unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* New function: rcd-highlight-list
@ 2021-05-18 17:08 Jean Louis
  2021-05-18 17:27 ` tomas
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2021-05-18 17:08 UTC (permalink / raw)
  To: Help GNU Emacs


(defun rcd-highlight-list (list)
  "Uses LIST to highlight strings in buffer."
  (hi-lock-mode)
  (let* ((list (delete "" list))
	(highlights hi-lock-face-defaults))
    (while list
      (highlight-regexp (pop list) (pop highlights)))))

Just feed to this function a list of strings to highlight:

(rcd-highlight-list '("just" "to" "function" "list" "strings" "highlight"))

or use some highlighted tags in every text mode:

(rcd-highlight-list '("TODO" "DONE" "DELEGATED"))

or add it to some mode:

(add-hook 'mail-mode-hook
          (lambda ()
            (rcd-highlight-list '("TODO" "DONE" "DELEGATED" "To:" "Subject:"))))




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-19 10:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-18 17:08 New function: rcd-highlight-list Jean Louis
2021-05-18 17:27 ` tomas
2021-05-18 17:43   ` Jean Louis
2021-05-18 18:47     ` tomas
2021-05-18 20:13       ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-19  7:52         ` tomas
2021-05-19 10:15           ` Yuri Khan
2021-05-19 10:31             ` tomas
2021-05-19 10:27           ` Jean Louis
2021-05-18 20:14       ` Jean Louis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).