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

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

bug#12213: 24.1; Cannot customize help-argument-name face


From: Raffaele Ricciardi
Subject: bug#12213: 24.1; Cannot customize help-argument-name face
Date: Fri, 17 Aug 2012 09:09:55 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0

On 08/17/2012 08:15 AM, Glenn Morris wrote:
> Raffaele Ricciardi wrote:
>
>> - emacs -Q
>> - M-x customize-face RET help-argument-name RET
>> - set face foreground (i.e. "yellow")
>> - click on "Set for this session"
>> - M-x describe-face RET help-argument-name RET
>> - all the fields in the face specification are "unspecified"
> [...]
>> In GNU Emacs 24.1.1 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
>>   of 2012-06-12 on debian
>
> Thanks for the report, but I cannot reproduce this on x86_64.
> I tried on RHEL6 and Debian testing, GTK and Lucid toolkits, and it
> works fine for me.

I have isolated a contributory cause: the bug shows up only when I use a bitmap
font.  With a TrueType font, everything works. At first.

No matter the kind of font used, my Emacs behaves weirdly in regard to the
`help-argument-name' face. `describe-face' correctly describes the face, but
if I use it in `font-lock-add-keywords', then the `default' face gets used
instead.  This is strange because Help mode does use the face as expected.

How to reproduce:

 - emacs -Q

 - evaluate:

(defun rr-Info-mode-highlight-argument-names ()
  "Highlight argument names the way 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:]]+\\_>"
                             . help-argument-name))))

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

 - C-h S define-minor-mode RET

Place the cursor over an uppercase argument name, and:

M-x describe-face RET

Emacs says the `default' face is being used.  Now, replace the
`help-argument-name' face with 'font-lock-comment-face' in the hook above and
retry.  The highlighting now works.

Moreover, if I "recreate" the face as a copy of the `default' face - e.g. by using `copy-face' - beforehand, then customizations become persistent with a bitmap font as well, but `font-lock-add-keywords' keeps using the `default' face instead.

Hope this helps.

Incidentally, I think that the default `help-argument-name' face or any other face looking the same as the 'default' face is an undesirable feature. Every face should look different from `default', to let users know they can customize them. I understand that choosing a color for every face may be a lot of work, but then having a default foreground color that is different from `default' when
defining a new face in the Emacs standard libraries would be enough.  If you
want to keep the default foreground color, then I suggest that you use other
attributes like Underline, Weight, etc.

> (There seems to be an implicit "click on Show All
> Attributes" in the recipe.)

Indeed there is.  Sorry for the oversight.

Cheers.





reply via email to

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