branch: master commit a71b76e3852bbba90630c6005a70abe9a31bf7e6 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Intercept quit signals * hydra.el (hydra--format): Make keys wider. (hydra--make-defun): Catch quit. (hydra-pink-fallback): Catch quit. * hydra-test.el: Update tests. --- hydra-test.el | 30 +++++++++++++++--------------- hydra.el | 8 ++++---- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/hydra-test.el b/hydra-test.el index 31519dc..7b3d24b 100644 --- a/hydra-test.el +++ b/hydra-test.el @@ -49,9 +49,9 @@ Call the head: `first-error'." (hydra-disable) (catch (quote hydra-disable) (condition-case err (prog1 t (call-interactively (function first-error))) - (error (message "%S" err) - (unless hydra-lv (sit-for 0.8)) - nil)) + ((quit error) (message "%S" err) + (unless hydra-lv (sit-for 0.8)) + nil)) (when hydra-is-helpful (hydra-error/hint)) (setq hydra-last (hydra-set-transient-map @@ -96,9 +96,9 @@ Call the head: `next-error'." (hydra-disable) (catch (quote hydra-disable) (condition-case err (prog1 t (call-interactively (function next-error))) - (error (message "%S" err) - (unless hydra-lv (sit-for 0.8)) - nil)) + ((quit error) (message "%S" err) + (unless hydra-lv (sit-for 0.8)) + nil)) (when hydra-is-helpful (hydra-error/hint)) (setq hydra-last (hydra-set-transient-map @@ -143,9 +143,9 @@ Call the head: `previous-error'." (hydra-disable) (catch (quote hydra-disable) (condition-case err (prog1 t (call-interactively (function previous-error))) - (error (message "%S" err) - (unless hydra-lv (sit-for 0.8)) - nil)) + ((quit error) (message "%S" err) + (unless hydra-lv (sit-for 0.8)) + nil)) (when hydra-is-helpful (hydra-error/hint)) (setq hydra-last (hydra-set-transient-map @@ -392,9 +392,9 @@ Call the head: `next-line'." (hydra-disable) (catch (quote hydra-disable) (condition-case err (prog1 t (call-interactively (function next-line))) - (error (message "%S" err) - (unless hydra-lv (sit-for 0.8)) - nil)) + ((quit error) (message "%S" err) + (unless hydra-lv (sit-for 0.8)) + nil)) (when hydra-is-helpful (hydra-vi/hint)) (setq hydra-last (hydra-set-transient-map @@ -450,9 +450,9 @@ Call the head: `previous-line'." (hydra-disable) (catch (quote hydra-disable) (condition-case err (prog1 t (call-interactively (function previous-line))) - (error (message "%S" err) - (unless hydra-lv (sit-for 0.8)) - nil)) + ((quit error) (message "%S" err) + (unless hydra-lv (sit-for 0.8)) + nil)) (when hydra-is-helpful (hydra-vi/hint)) (setq hydra-last (hydra-set-transient-map diff --git a/hydra.el b/hydra.el index 1b23eaf..578d879 100644 --- a/hydra.el +++ b/hydra.el @@ -345,7 +345,7 @@ The expressions can be auto-expanded according to NAME." varlist) (while (setq start (string-match - "\\(?:%\\( ?-?[0-9]*\\)`\\([a-z-A-Z/0-9]+\\)\\)\\|\\(?:_\\([a-z-A-Z]+\\)_\\)" + "\\(?:%\\( ?-?[0-9]*\\)`\\([a-z-A-Z/0-9]+\\)\\)\\|\\(?:_\\([a-z-~A-Z]+\\)_\\)" docstring start)) (if (eq ?_ (aref (match-string 0 docstring) 0)) (let* ((key (match-string 3 docstring)) @@ -353,7 +353,7 @@ The expressions can be auto-expanded according to NAME." (if head (progn (push (propertize key 'face (hydra--face head body)) varlist) - (setq docstring (replace-match "%s" nil nil docstring))) + (setq docstring (replace-match "% 3s" nil nil docstring))) (error "Unrecognized key: _%s_" key))) (push (hydra--unalias-var (match-string 2 docstring) prefix) varlist) (setq docstring (replace-match (concat "%" (match-string 1 docstring) "S") nil nil docstring 0)))) @@ -407,7 +407,7 @@ BODY-COLOR, BODY-PRE, BODY-POST, and OTHER-POST are used as well." `(condition-case err (prog1 t (call-interactively #',cmd)) - (error + ((quit error) (message "%S" err) (unless hydra-lv (sit-for 0.8)) @@ -433,7 +433,7 @@ BODY-COLOR, BODY-PRE, BODY-POST, and OTHER-POST are used as well." (if (commandp kb) (condition-case err (call-interactively kb) - (error + ((quit error) (message "%S" err) (unless hydra-lv (sit-for 0.8))))