diff options
author | Eli Zaretskii <eliz@gnu.org> | 2000-08-04 11:39:24 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2000-08-04 11:39:24 +0000 |
commit | cf667bc526eaf89c638956a65287133853904c02 (patch) | |
tree | 9ef3f3b1020e609960b65df811809229ab4c6bdc /lisp/hi-lock.el | |
parent | 74f0e5522d29151372430ee31159919b082de11c (diff) | |
download | emacs-cf667bc526eaf89c638956a65287133853904c02.tar.gz |
(hi-lock-unface-buffer): If a menu of regexps is
popped up, but the user clicks outside the menu, return an empty
regexp (that causes unhighlight-regexp to have no effect).
Diffstat (limited to 'lisp/hi-lock.el')
-rw-r--r-- | lisp/hi-lock.el | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index f5606d7e445..f2a77b620c7 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -346,25 +346,34 @@ list maintained for regexps, global history maintained for faces. Interactively, prompt for REGEXP. Buffer-local history of inserted regexp's maintained. Will accept only regexps inserted by hi-lock -interactive functions. (See `hi-lock-interactive-patterns') +interactive functions. \(See `hi-lock-interactive-patterns'.\) \\<minibuffer-local-must-match-map>Use \\[minibuffer-complete] to complete a partially typed regexp. -(See info node `Minibuffer History'.)" +\(See info node `Minibuffer History'.\)" (interactive (if (vectorp (this-command-keys)) - (x-popup-menu - t - (cons - `keymap - (cons "Select Pattern to Unhighlight" - (mapcar (lambda (pattern) - (list (car pattern) - (format - "%s (%s)" (car pattern) - (symbol-name - (car (cdr (car (cdr (car (cdr pattern)))))))) - (cons nil nil) - (car pattern))) - hi-lock-interactive-patterns)))) + (catch 'snafu + (or + (x-popup-menu + t + (cons + `keymap + (cons "Select Pattern to Unhighlight" + (mapcar (lambda (pattern) + (list (car pattern) + (format + "%s (%s)" (car pattern) + (symbol-name + (car + (cdr (car (cdr (car (cdr pattern)))))))) + (cons nil nil) + (car pattern))) + hi-lock-interactive-patterns)))) + ;; If the user clicks outside the menu, meaning that they + ;; change their mind, x-popup-menu returns nil, and + ;; interactive signals a wrong number of arguments error. + ;; To prevent that, we return an empty string, which will + ;; effectively disable the rest of the function. + (throw 'snafu '("")))) (let ((history-list (mapcar (lambda (p) (car p)) hi-lock-interactive-patterns))) (unless hi-lock-interactive-patterns |