* Printing coloured strings in help-buffer
@ 2024-04-13 22:20 Heime
2024-04-13 23:21 ` Heime
0 siblings, 1 reply; 3+ messages in thread
From: Heime @ 2024-04-13 22:20 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
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" )))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Printing coloured strings in help-buffer
2024-04-13 22:20 Printing coloured strings in help-buffer Heime
@ 2024-04-13 23:21 ` Heime
2024-04-14 6:55 ` Bruno Barbier
0 siblings, 1 reply; 3+ messages in thread
From: Heime @ 2024-04-13 23:21 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
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))) )
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Printing coloured strings in help-buffer
2024-04-13 23:21 ` Heime
@ 2024-04-14 6:55 ` Bruno Barbier
0 siblings, 0 replies; 3+ messages in thread
From: Bruno Barbier @ 2024-04-14 6:55 UTC (permalink / raw)
To: Heime, Heime; +Cc: Heime via Users list for the GNU Emacs text editor
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-14 6:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-13 22:20 Printing coloured strings in help-buffer Heime
2024-04-13 23:21 ` Heime
2024-04-14 6:55 ` Bruno Barbier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).