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)))) ;; 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))))) ;; When an Info buffer is killed, make sure the associated tags buffer