[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Printing coloured strings in help-buffer
From: |
Bruno Barbier |
Subject: |
Re: Printing coloured strings in help-buffer |
Date: |
Sun, 14 Apr 2024 08:55:38 +0200 |
Heime <heimeborgia@protonmail.com> writes:
> Sent with Proton Mail secure email.
>
> On Sunday, April 14th, 2024 at 10:20 AM, Heime <heimeborgia@protonmail.com>
> wrote:
>
>> How can I print text with colour? Have made the following and want
>> vcname and vcfile to print in colour, in the help buffer.
>>
>>
>> (defun gali-intro (vcname vcfile)
>> "TODO"
>>
>> (princ
>> (concat
>> "`" vcname "' is a variable defined in` " vcfile "'.\n\n"
>> "Its description is shown below.\n\n")) )
>>
>> (defun gali-vconst ()
>> (with-help-window (help-buffer)
>> (gali-intro "gali-minicompl" "gali.el" )))
>
> Have made the following test but the colour is not being activated
>
> (defun sangali-defcon (vcname color)
> (insert (propertize vcname 'face '(:foreground color))) )
If Font Lock mode is enabled, you need to use 'font-lock-face, see:
(info "(elisp) Special Properties")
The following works for me, in the scratch buffer:
(with-current-buffer "*scratch*"
(insert (propertize "hello" 'font-lock-face '(:foreground "blue"))))
You can check what face is applied, calling `describe-char'.
Bruno