From: "Drew Adams" <drew.adams@oracle.com>
Cc: lennart.borgman.073@student.lu.se,
Luc Teirlinck <teirllm@dms.auburn.edu>,
monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: RE: info faces for strings and quotations
Date: Wed, 6 Oct 2004 00:40:07 -0700 [thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBIEBMCIAA.drew.adams@oracle.com> (raw)
In-Reply-To: <buo7jq4eah8.fsf@mctpc71.ucom.lsi.nec.co.jp>
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
Here's the patch to info.el that highlights `...' and "...".
Sending it as an attachment because my mailer apparently wraps the lines
otherwise.
- Drew
-----Original Message-----
From: Miles Bader [mailto:miles@lsi.nec.co.jp]
"Drew Adams" <drew.adams@oracle.com> writes:
> BTW, have you -- have others -- _tried_ the code?
Could you send it as a single patch file? That's a good idea any time
you submit code for consideration (easier to test, and often less
ambiguous).
Thanks,
-Miles
[-- Attachment #2: diff-info-highlight-quotations.txt --]
[-- Type: text/plain, Size: 4007 bytes --]
diff -c "c:/emacs-21.3.50/lisp/info.el" "c:/drews-lisp-20/info-w-quotes.el"
*** c:/emacs-21.3.50/lisp/info.el Mon Jul 26 09:42:06 2004
--- c:/drews-lisp-20/info-w-quotes.el Tue Oct 5 21:45:12 2004
***************
*** 65,70 ****
--- 65,91 ----
The Lisp code is executed when the node is selected.")
(put 'Info-enable-active-nodes 'risky-local-variable t)
+ (defcustom Info-fontify-quotations-flag t
+ "*Non-nil means `info' fontifies text between quotes.
+ This applies to double-quote strings (\"...\") and text between
+ single-quotes (`...')."
+ :type 'boolean
+ :group 'info)
+
+ (defface info-quoted-name
+ '((((class color) (background light)) :foreground "red3")
+ (((class color) (background dark)) :foreground "white")
+ (t :weight bold :slant italic))
+ "Face used for quoted names (`...') in `info'."
+ :group 'info)
+
+ (defface info-string
+ '((((class color) (background light)) :foreground "green4")
+ (((class color) (background dark)) :foreground "yellow")
+ (t :slant italic))
+ "Face used for strings (\"...\") in `info'."
+ :group 'info)
+
(defface info-node
'((((class color) (background light)) :foreground "brown" :weight bold :slant italic)
(((class color) (background dark)) :foreground "white" :weight bold :slant italic)
***************
*** 3669,3676 ****
'(font-lock-face info-xref
mouse-face highlight
help-echo "mouse-2: go to this URL"))))
!
(set-buffer-modified-p nil))))
\f
;; When an Info buffer is killed, make sure the associated tags buffer
--- 3690,3736 ----
'(font-lock-face info-xref
mouse-face highlight
help-echo "mouse-2: go to this URL"))))
! (goto-char (point-min))
! (when Info-fontify-quotations-flag (info-fontify-quotations))
(set-buffer-modified-p nil))))
+
+
+ ;; The regexp has these parts: double-quoted string or single-quoted stuff.
+ ;;
+ ;; String has, inside "...", zero or more of these characters:
+ ;; - any character except \ and "
+ ;; - \ followed by any character
+ ;;
+ ;; Single-quoted stuff has, inside `...', one or more of these characters:
+ ;; - any character except \ and '
+ ;; - \ followed by any character
+ ;;
+ (if (< emacs-major-version 21)
+ (defun info-fontify-quotations ()
+ "Fontify double-quote strings (\"...\") and text between single-quotes (`...')
+ For single-quotes, use face `info-quoted-name'.
+ For double-quotes, use face `info-string'."
+ (while (re-search-forward
+ "\"\\([^\\\"]\\|\\\\\\(.\\|[\n]\\)\\)*\"\\|`\\([^'\\]\\|\\\\\\(.\\|[\n]\\)\\)+'"
+ nil t)
+ (if (eq ?` (aref (match-string 0) 0))
+ (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
+ 'face info-quoted-name)
+ (put-text-property (match-beginning 0) (match-end 0)
+ 'face info-string))))
+ (defun info-fontify-quotations ()
+ "Fontify double-quote strings (\"...\") and text between single-quotes (`...')
+ For single-quotes, use face `info-quoted-name'.
+ For double-quotes, use face `info-string'."
+ (while
+ (re-search-forward
+ "\"\\(?:[^\\\"]\\|\\\\\\(?:.\\|[\n]\\)\\)*\"\\|`\\(?:[^'\\]\\|\\\\\\(?:.\\|[\n]\\)\\)+'"
+ nil t)
+ (if (eq ?` (aref (match-string 0) 0))
+ (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
+ 'face 'info-quoted-name)
+ (put-text-property (match-beginning 0) (match-end 0)
+ 'face 'info-string)))))
\f
;; When an Info buffer is killed, make sure the associated tags buffer
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-10-06 7:40 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-03 7:05 info faces for strings and quotations Drew Adams
2004-10-05 7:15 ` Drew Adams
2004-10-05 7:30 ` Miles Bader
2004-10-06 8:34 ` Matt Hodges
2004-10-05 8:58 ` Drew Adams
2004-10-05 11:43 ` Stefan
2004-10-05 11:56 ` Stefan
2004-10-05 16:11 ` Drew Adams
2004-10-06 2:25 ` Luc Teirlinck
2004-10-06 4:19 ` Drew Adams
2004-10-06 4:28 ` Miles Bader
2004-10-06 7:40 ` Drew Adams [this message]
2004-10-06 21:32 ` Drew Adams
2004-10-06 4:53 ` Stefan Monnier
2004-10-06 7:07 ` Drew Adams
2004-10-06 17:07 ` Robert J. Chassell
2004-10-06 21:36 ` Drew Adams
2004-10-07 5:53 ` Juri Linkov
2004-10-07 6:53 ` Drew Adams
2004-10-07 14:58 ` Stefan Monnier
2004-10-07 15:13 ` David Kastrup
2004-10-07 17:01 ` Stefan Monnier
2004-10-08 5:13 ` Drew Adams
2004-10-07 15:13 ` Kim F. Storm
2004-10-07 16:35 ` David Kastrup
2004-10-08 0:33 ` Luc Teirlinck
2004-10-08 16:04 ` Richard Stallman
2004-10-08 16:51 ` Luc Teirlinck
2004-10-09 15:45 ` Richard Stallman
2004-10-08 20:00 ` Robert J. Chassell
2004-10-07 5:57 ` Juri Linkov
2004-10-07 15:22 ` w3 mode Camm Maguire
2004-10-07 17:03 ` Stefan Monnier
2004-10-07 17:25 ` Camm Maguire
2004-10-07 17:37 ` Mark Plaksin
2004-10-07 17:45 ` Kevin Rodgers
2004-10-08 16:05 ` Richard Stallman
2004-10-08 17:44 ` David Kastrup
2004-10-07 15:28 ` unexec development Camm Maguire
2004-10-15 14:10 ` Camm Maguire
2004-10-15 14:35 ` Jan D.
2004-10-15 21:11 ` Camm Maguire
2004-10-16 13:52 ` Richard Stallman
2004-10-06 8:44 ` info faces for strings and quotations Oliver Scholz
2004-10-07 5:55 ` Juri Linkov
2004-10-07 7:13 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2004-10-05 16:15 LENNART BORGMAN
2004-10-05 16:28 ` Drew Adams
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=FDELKNEBLPKKDCEBEJCBIEBMCIAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman.073@student.lu.se \
--cc=monnier@iro.umontreal.ca \
--cc=teirllm@dms.auburn.edu \
/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.