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

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

Re: define-minor-mode: what's the purpose of the BODY argument?


From: Raffaele Ricciardi
Subject: Re: define-minor-mode: what's the purpose of the BODY argument?
Date: Thu, 16 Aug 2012 22:32:50 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0


On 08/16/2012 06:23 PM, Raffaele Ricciardi wrote:
> Well, I discovered that the argument is indeed documented, only not as
> prominently as the others.  Therefore I missed it, also because
> arguments in
> Info mode are not highlighted the way I'm used to in Help mode.  I
> apologize for
> the inconvenience.

And to avoid cutting a sorry figure like this one in the future, I've written a snippet of code to highlight arguments in Info mode, too, and I'm attaching it.
Arguments are empirically identified as symbols of two or more uppercase
letters, digits or dashes, starting with a letter.

I would have preferred using the `help-argument-name' face, but on my
installation this face misbehaves (I've filed a bug report), so I'm using
`font-lock-comment-face'.


(defun rr-Info-mode-highlight-argument-names ()
  "Highlight argument names as they are highlighted in Help mode."
  ;; To avoid highlighting uppercase single letters in the text, highlight
  ;; only symbols more than one character long.
  (font-lock-add-keywords nil
                          '(("\\_<[A-Z][-A-Z[:digit:]]+\\_>"
                             . font-lock-comment-face))))

(add-hook 'Info-mode-hook #'rr-Info-mode-highlight-argument-names)


reply via email to

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