aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-08-15 05:37:45 +0300
committerEli Zaretskii2018-08-15 05:37:45 +0300
commitbcdb2d9733118a6529a66e12c3f2dc7662370c15 (patch)
treebc1c7fbaa0a2416122de31bf0787e6022bbef6e8
parentcc5a23d40bfa7a832f7a6fb7a016557ac1416559 (diff)
downloademacs-bcdb2d9733118a6529a66e12c3f2dc7662370c15.tar.gz
emacs-bcdb2d9733118a6529a66e12c3f2dc7662370c15.zip
Improve documentation of last change
* lisp/hi-lock.el (hi-lock-set-pattern, hi-lock-face-buffer): Improve the doc strings. (Bug#32365) * etc/NEWS: * doc/emacs/display.texi (Highlight Interactively): Clarify wording.
-rw-r--r--doc/emacs/display.texi7
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/hi-lock.el7
3 files changed, 11 insertions, 6 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index fe4936d85a1..d9a08b974f6 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -974,9 +974,10 @@ the buffer is loaded. For example, to highlight all occurrences of
974the word ``whim'' using the default face (a yellow background), type 974the word ``whim'' using the default face (a yellow background), type
975@kbd{M-s h r whim @key{RET} @key{RET}}. Any face can be used for 975@kbd{M-s h r whim @key{RET} @key{RET}}. Any face can be used for
976highlighting, Hi Lock provides several of its own and these are 976highlighting, Hi Lock provides several of its own and these are
977pre-loaded into a list of default values. While being prompted 977pre-loaded into a list of default values. While being prompted for a
978for a face use @kbd{M-n} and @kbd{M-p} to cycle through them. A prefix 978face use @kbd{M-n} and @kbd{M-p} to cycle through them. A prefix
979argument limits the highlighting to the corresponding subexpression. 979numeric argument limits the highlighting to the corresponding
980subexpression.
980 981
981@vindex hi-lock-auto-select-face 982@vindex hi-lock-auto-select-face
982Setting the option @code{hi-lock-auto-select-face} to a non-@code{nil} 983Setting the option @code{hi-lock-auto-select-face} to a non-@code{nil}
diff --git a/etc/NEWS b/etc/NEWS
index 5146e756d00..6f23f7ee427 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -720,7 +720,8 @@ UUID at point.
720 720
721+++ 721+++
722*** 'highlight-regexp' can now highlight subexpressions. 722*** 'highlight-regexp' can now highlight subexpressions.
723The command accepts a prefix argument to choose the subexpression. 723The now command accepts a prefix numeric argument to choose the
724subexpression.
724 725
725 726
726* New Modes and Packages in Emacs 27.1 727* New Modes and Packages in Emacs 27.1
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 23820cda587..08b58117dd0 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -433,7 +433,8 @@ highlighting will not update as you type."
433 "Set face of each match of REGEXP to FACE. 433 "Set face of each match of REGEXP to FACE.
434Interactively, prompt for REGEXP using `read-regexp', then FACE. 434Interactively, prompt for REGEXP using `read-regexp', then FACE.
435Use the global history list for FACE. Limit face setting to the 435Use the global history list for FACE. Limit face setting to the
436corresponding SUBEXP of REGEXP. 436corresponding SUBEXP (interactively, the prefix argument) of REGEXP.
437If SUBEXP is omitted or nil, the entire REGEXP is highlighted.
437 438
438Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, 439Use Font lock mode, if enabled, to highlight REGEXP. Otherwise,
439use overlays for highlighting. If overlays are used, the 440use overlays for highlighting. If overlays are used, the
@@ -689,7 +690,9 @@ with completion and history."
689 (intern face))) 690 (intern face)))
690 691
691(defun hi-lock-set-pattern (regexp face &optional subexp) 692(defun hi-lock-set-pattern (regexp face &optional subexp)
692 "Highlight SUBEXP of REGEXP with face FACE." 693 "Highlight SUBEXP of REGEXP with face FACE.
694If omitted or nil, SUBEXP defaults to zero, i.e. the entire
695REGEXP is highlighted."
693 ;; Hashcons the regexp, so it can be passed to remove-overlays later. 696 ;; Hashcons the regexp, so it can be passed to remove-overlays later.
694 (setq regexp (hi-lock--hashcons regexp)) 697 (setq regexp (hi-lock--hashcons regexp))
695 (setq subexp (or subexp 0)) 698 (setq subexp (or subexp 0))