summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisuwesh <visuweshm@gmail.com>2023-10-27 08:38:11 +0200
committerPhilip Kaludercic <philipk@posteo.net>2023-10-27 08:38:11 +0200
commit8079eaee2a797becafe468de58beddfd0cf03793 (patch)
tree41cf6eacfcd3db1904792fa7da0939382cb94bce
parentb607434773c4b30007dbfab978385dabe745937e (diff)
Catch 'quit' during 'read-multiple-choice'
C-g when in read-multiple-choice call doesn't disable do-at-point--mode. A condition-case catching quit solves the issue.
-rw-r--r--do-at-point.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/do-at-point.el b/do-at-point.el
index 3600bd4..8f529ec 100644
--- a/do-at-point.el
+++ b/do-at-point.el
@@ -237,22 +237,25 @@ action is selected."
(choice (cond
(quick (car options))
((assq last-command-event options))
- ((read-multiple-choice
- (format "Action on %s" thing)
- (mapcar
- (pcase-lambda (`(,key ,short ,_func ,long))
- (list key short long))
- options)))))
+ ((condition-case nil
+ (read-multiple-choice
+ (format "Action on %s" thing)
+ (mapcar
+ (pcase-lambda (`(,key ,short ,_func ,long))
+ (list key short long))
+ options))
+ (quit nil)))))
(func (cadr (alist-get (car choice) options)))
(bound (cons (overlay-start do-at-point--overlay)
(overlay-end do-at-point--overlay))))
(do-at-point--mode -1)
- (message nil) ;clear mini buffer
- (pcase (car (func-arity func))
- (0 (funcall func))
- (1 (funcall func (buffer-substring (car bound) (cdr bound))))
- (2 (funcall func (car bound) (cdr bound)))
- (_ (error "Unsupported signature: %S" func)))))
+ (when func
+ (message nil) ;clear mini buffer
+ (pcase (car (func-arity func))
+ (0 (funcall func))
+ (1 (funcall func (buffer-substring (car bound) (cdr bound))))
+ (2 (funcall func (car bound) (cdr bound)))
+ (_ (error "Unsupported signature: %S" func))))))
;; We add an alias for to avoid confusing `substitute-key-definition'
;; later on.