diff -c "c:/emacs-21.3.50/lisp/info.el" "c:/drews-lisp-20/info-w-quotes-third.el" *** c:/emacs-21.3.50/lisp/info.el Mon Jul 26 09:42:06 2004 --- c:/drews-lisp-20/info-w-quotes-third.el Thu Oct 7 00:10:04 2004 *************** *** 65,70 **** --- 65,87 ---- 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 ; For `...' + '((t (:inherit font-lock-constant-face))) + "Face used for quoted names (`...') in `info'." + :group 'info) + + (defface info-string ; For "..." + '((t (:inherit font-lock-string-face))) + "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) *************** *** 3416,3421 **** --- 3433,3442 ---- (skip-chars-backward " \t,") (put-text-property (point) header-end 'invisible t))))) + ;; Fontify `...' and "..." + (goto-char (point-min)) + (when Info-fontify-quotations-flag (info-fontify-quotations)) + ;; Fontify titles (goto-char (point-min)) (when not-fontified-p *************** *** 3669,3676 **** '(font-lock-face info-xref mouse-face highlight help-echo "mouse-2: go to this URL")))) - (set-buffer-modified-p nil)))) ;; When an Info buffer is killed, make sure the associated tags buffer --- 3690,3719 ---- '(font-lock-face info-xref mouse-face highlight help-echo "mouse-2: go to this URL")))) (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)) + 'font-lock-face 'info-quoted-name) + (put-text-property (match-beginning 0) (match-end 0) + 'font-lock-face 'info-string)))) ;; When an Info buffer is killed, make sure the associated tags buffer Diff finished. Thu Oct 07 00:12:15 2004