diff options
| author | Eli Zaretskii | 2000-08-04 11:39:24 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-08-04 11:39:24 +0000 |
| commit | cf667bc526eaf89c638956a65287133853904c02 (patch) | |
| tree | 9ef3f3b1020e609960b65df811809229ab4c6bdc | |
| parent | 74f0e5522d29151372430ee31159919b082de11c (diff) | |
| download | emacs-cf667bc526eaf89c638956a65287133853904c02.tar.gz emacs-cf667bc526eaf89c638956a65287133853904c02.zip | |
(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).
| -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. | |||
| 346 | 346 | ||
| 347 | Interactively, prompt for REGEXP. Buffer-local history of inserted | 347 | Interactively, prompt for REGEXP. Buffer-local history of inserted |
| 348 | regexp's maintained. Will accept only regexps inserted by hi-lock | 348 | regexp's maintained. Will accept only regexps inserted by hi-lock |
| 349 | interactive functions. (See `hi-lock-interactive-patterns') | 349 | interactive functions. \(See `hi-lock-interactive-patterns'.\) |
| 350 | \\<minibuffer-local-must-match-map>Use \\[minibuffer-complete] to complete a partially typed regexp. | 350 | \\<minibuffer-local-must-match-map>Use \\[minibuffer-complete] to complete a partially typed regexp. |
| 351 | (See info node `Minibuffer History'.)" | 351 | \(See info node `Minibuffer History'.\)" |
| 352 | (interactive | 352 | (interactive |
| 353 | (if (vectorp (this-command-keys)) | 353 | (if (vectorp (this-command-keys)) |
| 354 | (x-popup-menu | 354 | (catch 'snafu |
| 355 | t | 355 | (or |
| 356 | (cons | 356 | (x-popup-menu |
| 357 | `keymap | 357 | t |
| 358 | (cons "Select Pattern to Unhighlight" | 358 | (cons |
| 359 | (mapcar (lambda (pattern) | 359 | `keymap |
| 360 | (list (car pattern) | 360 | (cons "Select Pattern to Unhighlight" |
| 361 | (format | 361 | (mapcar (lambda (pattern) |
| 362 | "%s (%s)" (car pattern) | 362 | (list (car pattern) |
| 363 | (symbol-name | 363 | (format |
| 364 | (car (cdr (car (cdr (car (cdr pattern)))))))) | 364 | "%s (%s)" (car pattern) |
| 365 | (cons nil nil) | 365 | (symbol-name |
| 366 | (car pattern))) | 366 | (car |
| 367 | hi-lock-interactive-patterns)))) | 367 | (cdr (car (cdr (car (cdr pattern)))))))) |
| 368 | (cons nil nil) | ||
| 369 | (car pattern))) | ||
| 370 | hi-lock-interactive-patterns)))) | ||
| 371 | ;; If the user clicks outside the menu, meaning that they | ||
| 372 | ;; change their mind, x-popup-menu returns nil, and | ||
| 373 | ;; interactive signals a wrong number of arguments error. | ||
| 374 | ;; To prevent that, we return an empty string, which will | ||
| 375 | ;; effectively disable the rest of the function. | ||
| 376 | (throw 'snafu '("")))) | ||
| 368 | (let ((history-list (mapcar (lambda (p) (car p)) | 377 | (let ((history-list (mapcar (lambda (p) (car p)) |
| 369 | hi-lock-interactive-patterns))) | 378 | hi-lock-interactive-patterns))) |
| 370 | (unless hi-lock-interactive-patterns | 379 | (unless hi-lock-interactive-patterns |