[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
info faces for strings and quotations
From: |
Drew Adams |
Subject: |
info faces for strings and quotations |
Date: |
Sun, 3 Oct 2004 00:05:48 -0700 |
I find Info to be a lot more readable with strings ("blah blah toto titi")
and quoted names (`my-foobar-function') highlighted in different faces from
the rest of the text.
What about adding something simple like this to the end of
Info-fontify-node - just before (set-buffer-modified-p nil):
(goto-char (point-min))
(while (re-search-forward "`\\([^']+\\)'" nil t)
(put-text-property (match-beginning 1) (match-end 1)
'face info-quoted-name-face))
(goto-char (point-min))
(while (re-search-forward "\"\\([^\"]+\\)\"" nil t)
(put-text-property (match-beginning 1) (match-end 1)
'face info-string-face))
Granted, there are a few Info nodes that get thrown off by this simple
matching because of unbalanced double or single quotes. This happens when a
node discusses characters like \", \`, and \' or uses this, where the two
are nested: `""'.
Probably most of these problems could be eliminated by smartening up the
regexps. Most of the "rogue" occurrences of these characters are preceded by
backslashes: \".
Even with these simple regexps, however, 99% of the pages look better, and
the text is much more readable, IMO. In particular, it is very helpful that
quoted names stand out; the double-quoted strings are less important.
To see this at its _worst_, these are the nodes of the Emacs manual that
throw off the regexps to some extent:
- Glossary
- Key (Character) Index
- Minor Modes
- Init Syntax
- Printing and MS-DOS
- Cursor Position Information (at the bottom)
- TeX Editing Commands
- Options Controlling Comments
- Etags Regexps
- Acknowledgements
- info faces for strings and quotations,
Drew Adams <=