help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Special hilighting for comments


From: Heime
Subject: Re: Special hilighting for comments
Date: Sat, 10 Dec 2022 11:26:58 +0000

------- Original Message -------
On Saturday, December 10th, 2022 at 11:15 AM, Eli Zaretskii <eliz@gnu.org> 
wrote:


> > Date: Sat, 10 Dec 2022 10:53:42 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> > 
> > > > Emacs is missing out on a beneficial capability beyond just highlight 
> > > > symbols in other programming language modes.
> > > 
> > > I don't think that's true: have you tried using the capabilities in
> > > hi-lock.el, as I suggested up-thread? That package can let you
> > > highlight anything.
> > 
> > What do I need to do?
> 
> 
> Type "M-s h l" (or "M-x highlight-lines-matching-regexp RET").

How can I do it with elisp code.  Highlighting lines starting with
";; [".

Thus in elisp-mode, how to achieve the following

;; [Highlighted line]
;; Some comment 
;; Other comment

Have started with the following, whilst you suggest 
"highlight-lines-matching-regexp".

(defun hl-regexp ()
  (interactive)
  (highlight-regexp ";; [.*" some-face))

(defun hl-elisp ()
  (add-to-list 'auto-mode-alist '("\\.el\\'" . hi-lock-mode))
  (add-hook 'hi-lock-mode-hook 'hlregexp))







reply via email to

[Prev in Thread] Current Thread [Next in Thread]