unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: info faces for strings and quotations
Date: Wed, 6 Oct 2004 14:32:58 -0700	[thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBMECBCIAA.drew.adams@oracle.com> (raw)
In-Reply-To: <FDELKNEBLPKKDCEBEJCBIEBMCIAA.drew.adams@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Here's an updated patch, which replaces the previous one.

It does everything the previous version did, but also correctly treats some
of the common pbs I saw yesterday, such as `\' and `C-\'. In fact, it just
allows _any_ character (except ') inside `...'.

Sorry about sending two patches. I don't expect to change this again.

  - Drew



From: Drew Adams [mailto:drew.adams@oracle.com]
Here's the patch to info.el that highlights `...' and "...".

[-- Attachment #2: diff-info-highlight-quotations-second.txt --]
[-- Type: text/plain, Size: 3237 bytes --]

cd c:/drews-lisp-20/
diff -c "c:/emacs-21.3.50/lisp/info.el" "c:/drews-lisp-20/info-w-quotes-second.el"
*** c:/emacs-21.3.50/lisp/info.el	Mon Jul 26 09:42:06 2004
--- c:/drews-lisp-20/info-w-quotes-second.el	Wed Oct  6 13:51:18 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,3721 ----
                                 '(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 `...': any character except '
+ ;;
+ (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]\\)\\)*\"\\|`[^']+'"
+          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

Diff finished at Wed Oct 06 13:51:40

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2004-10-06 21:32 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
2004-10-06 21:32               ` Drew Adams [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FDELKNEBLPKKDCEBEJCBMECBCIAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).