-;;; hi-lock.el --- Minor mode for interactive automatic highlighting.
+;;; hi-lock.el --- minor mode for interactive automatic highlighting
;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
-;;; Commentary
+;;; Commentary:
;;
;; With the hi-lock commands text matching interactively entered
;; regexp's can be highlighted. For example, `M-x highlight-regexp
(unless hi-lock-mode (hi-lock-mode))
(or (facep face) (setq face 'rwl-yellow))
(hi-lock-set-pattern
- (list (concat "^.*" regexp ".*$") (list 0 (list 'quote face) t))))
+ ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ?
+ ;; or a trailing $ in REGEXP will be interpreted correctly.
+ (list (concat "^.*\\(?:" regexp "\\).*$") (list 0 (list 'quote face) t))))
;;;###autoload
\\<minibuffer-local-must-match-map>Use \\[minibuffer-complete] to complete a partially typed regexp.
\(See info node `Minibuffer History'.\)"
(interactive
- (if (vectorp (this-command-keys))
+ (if (and (display-popup-menus-p) (vectorp (this-command-keys)))
(catch 'snafu
(or
(x-popup-menu
(error "No highlighting to remove"))
(list
(completing-read "Regexp to unhighlight: "
- hi-lock-interactive-patterns t t
+ hi-lock-interactive-patterns nil t
(car (car hi-lock-interactive-patterns))
(cons 'history-list 1))))))
(let ((keyword (assoc regexp hi-lock-interactive-patterns)))