diff options
Diffstat (limited to 'lisp/hi-lock.el')
-rw-r--r-- | lisp/hi-lock.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 0fe651ace34..536a1af8462 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -136,9 +136,9 @@ patterns." (put 'hi-lock-file-patterns-policy 'risky-local-variable t) (defcustom hi-lock-auto-select-face nil - "Non-nil means highlighting commands do not prompt for the face to use. -Instead, each hi-lock command will cycle through the faces in -`hi-lock-face-defaults'." + "When nil, highlighting commands prompt for the face to use. +When non-nil, highlighting command determine the faces to use +by cycling through the faces in `hi-lock-face-defaults'." :type 'boolean :version "24.4") @@ -484,9 +484,17 @@ the major mode specifies support for Font Lock." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight" 'regexp-history-last)) + (read-regexp "Regexp to highlight" + (if (use-region-p) + (prog1 + (buffer-substring (region-beginning) + (region-end)) + (deactivate-mark)) + 'regexp-history-last))) (hi-lock-read-face-name) current-prefix-arg)) + (when (stringp face) + (setq face (intern face))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) (hi-lock-set-pattern @@ -814,6 +822,7 @@ SPACES-REGEXP is a regexp to substitute spaces in font-lock search." (font-lock-add-keywords nil hi-lock-file-patterns t) (font-lock-flush))) +;;;###autoload (defun hi-lock-find-patterns () "Add patterns from the current buffer to the list of hi-lock patterns." (interactive) |