all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.