From 8079eaee2a797becafe468de58beddfd0cf03793 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Fri, 27 Oct 2023 08:38:11 +0200 Subject: 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. --- do-at-point.el | 27 +++++++++++++++------------ 1 file 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. -- cgit v1.0