From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: How to add syntax-highlighting to a Help buffer?
Date: Sat, 04 Jul 2015 17:09:03 +0200 [thread overview]
Message-ID: <878uaw3qpc.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: 87si94x1vk.fsf@web.de
Michael Heerdegen <michael_heerdegen@web.de> writes:
> help-mode doesn't use font-lock. It directly attaches
> face text properties to the buffer text.
> If font-lock-mode fontifies such a buffer (it
> doesn't as long as font-lock-keywords is nil even
> when it is active), all face text properties get
> ignored by the display engine.
Yes, however that doesn't mean we can't use it the
same way we are used to. See the below solution.
One question is, why doesn't help-mode do this the
customary way?
> Note that there is a font-lock-face text property
> existing as well.
Yes - see line 17 in the source below, in the original
file. It is set to nil.
Here is is a dump that shows this works:
http://user.it.uu.se/~embe8573/dumps/color-help.png
Here is the source that does it:
http://user.it.uu.se/~embe8573/conf/emacs-init/help-font-lock.el
Here is the source that does it, only yanked:
(defvar help-font-lock-keywords
'(
("interactive" . 'font-lock-regexp-grouping-backslash)
("autoloaded" . font-lock-function-name-face)
("compiled" . font-lock-doc-face)
("Lisp" . font-lock-variable-name-face)
("function" . font-lock-builtin-face)
))
(defun help-custom-font-lock ()
(interactive)
(let ((font-lock-unfontify-region-function
(lambda (start end)
(remove-text-properties (point-min) (point-max)
'(font-lock-face nil)))))
(font-lock-unfontify-buffer)
(set (make-local-variable 'font-lock-defaults)
'(help-font-lock-keywords t))
(font-lock-fontify-buffer)))
(add-hook 'help-mode-hook 'help-custom-font-lock)
--
underground experts united
http://user.it.uu.se/~embe8573
next prev parent reply other threads:[~2015-07-04 15:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-03 7:59 How to add syntax-highlighting to a Help buffer? Raffaele Ricciardi
2015-07-03 9:20 ` Vaidheeswaran C
2015-07-03 20:09 ` Emanuel Berg
2015-07-03 23:22 ` Michael Heerdegen
2015-07-04 15:09 ` Emanuel Berg [this message]
2015-07-04 15:25 ` Michael Heerdegen
2015-07-04 23:24 ` Emanuel Berg
2015-07-04 16:30 ` tomas
2015-07-04 23:25 ` Emanuel Berg
[not found] ` <mailman.6316.1436023528.904.help-gnu-emacs@gnu.org>
2015-07-04 17:29 ` Raffaele Ricciardi
2015-07-04 17:43 ` Michael Heerdegen
2015-07-04 23:31 ` Emanuel Berg
[not found] ` <mailman.6317.1436027452.904.help-gnu-emacs@gnu.org>
2015-07-04 17:54 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878uaw3qpc.fsf@nl106-137-147.student.uu.se \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.