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

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

Re: How to add syntax-highlighting to a Help buffer?


From: Emanuel Berg
Subject: Re: How to add syntax-highlighting to a Help buffer?
Date: Fri, 03 Jul 2015 22:09:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Raffaele Ricciardi <rfflrccrd@gmail.com> writes:

> I would like to add some syntax-highlighting to Help
> buffers. I have tried to do that for example with
> the Help buffer displayed by C-h f read-string RET,
> by following the usual way:

You mean, you want *more* than what's already there
for buttons etc.?

Check out this file - it isn't help, but the one of
the buffer menus, but you might find the mechanics
interesting for your purposes:

    http://user.it.uu.se/~embe8573/conf/emacs-init/buffer-menu.el

Here are the actual regexps to "help" you to a quick
start:

(defvar buffer-menu-buffer-font-lock-keywords
  '(
    ("\\(KILL\\|my-kill\\) "              .  font-lock-builtin-face)
    ("\\*\\(Errors\\|Backtrace\\)\\*"     .  font-lock-warning-face)
    ("\\*\\(Group\\|Server\\)\\*"         .  font-lock-comment-face)
    ("\\*\\(Help\\|Completions\\|Messages\\|info\\|Apropos\\)\\*"
                                          .  font-lock-constant-face)
    ("\\*\\(ielm\\|Article\\)\\*"         . 
'font-lock-regexp-grouping-backslash)
    (".* \\(.*\\.txt\\) "                 (1 font-lock-negation-char-face))
    ("[[:space:]]+\\([[:digit:]]+\\) "    (1 font-lock-comment-delimiter-face))
    ("<.*\\(>\\|\\.\\.\\.\\)"             . 
'font-lock-regexp-grouping-construct)
    ("Makefile"                           .  font-lock-comment-face)
    ("\\(\\*Man\\) \\(.*\\)\\(\\*\\)"
     (1  font-lock-type-face)
     (2 'font-lock-regexp-grouping-construct)
     (3  font-lock-type-face) )
    (".* \\(.*\\.\\(el\\|cc?\\|cpp\\)\\) "(1 font-lock-string-face))
    ("\\*w3m\\*"                          .  font-lock-function-name-face)
    (".* \\(.*\\.html?\\) "               (1 font-lock-doc-face))
    (".* \\(.*\\.\\(hh?\\|tex\\)\\) "     (1 font-lock-variable-name-face))
    (".* \\(\\.[[:alnum:]_.-]*\\) "       (1 font-lock-builtin-face))
))

Be sure to post your results somewhere - here, the
repos (ELPA, MELPA, etc.), the EmacsWiki, #emacs, ...

And come back with more questions if you'd like.

Good luck! 

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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