Rudolf Adamkovič Personal site


Extend: Add support for string highlights

(keymap-global-set "M-s h s" #'my-hi-lock-string)
(defun my-hi-lock-string (string &optional face)
  "Set face of each occurrence of STRING to FACE."
  (interactive
   (list
    (read-string "String to highlight"
                 (if (use-region-p)
                     (prog1
                         (buffer-substring (region-beginning)
                                           (region-end))
                       (deactivate-mark))))
    (hi-lock-read-face-name)))
  (hi-lock-face-buffer (regexp-quote string) face))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.