comparison lisp/hi-lock.el @ 30590:63a24eff41fe

(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).
author Eli Zaretskii <eliz@gnu.org>
date Fri, 04 Aug 2000 11:39:24 +0000
parents b823f1c83a00
children ca514eff4924
comparison
equal deleted inserted replaced
30589:f4e7aabae4c0 30590:63a24eff41fe
344 (defun hi-lock-unface-buffer (regexp) 344 (defun hi-lock-unface-buffer (regexp)
345 "Remove highlighting of matches to REGEXP set by hi-lock. 345 "Remove highlighting of matches to REGEXP set by hi-lock.
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
371 (error "No highlighting to remove")) 380 (error "No highlighting to remove"))
372 (list 381 (list