]> code.delx.au - gnu-emacs/commitdiff
(Info-fontify-node): For multiline refs,
authorThien-Thi Nguyen <ttn@gnuvola.org>
Mon, 18 Oct 2004 07:31:43 +0000 (07:31 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Mon, 18 Oct 2004 07:31:43 +0000 (07:31 +0000)
arrange to unfontify newline and surrounding whitespace.

lisp/ChangeLog
lisp/info.el

index a0ba6ba22ecc018ee2547802fd25eefc5e29ebe2..a3fb778928c59378fb639b7293df062338ba980c 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-18  Thien-Thi Nguyen  <ttn@gnu.org>
+
+       * info.el (Info-fontify-node): For multiline refs,
+       arrange to unfontify newline and surrounding whitespace.
+
 2004-10-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * vc-arch.el (vc-arch-workfile-version): Don't burp if the patch-log
index 386f5b612ec72e3cec1771bef41f4af9091426b0..17905c6d738cc4be2e461892d7d2fcd160899d59 100644 (file)
@@ -3445,7 +3445,8 @@ Preserve text properties."
            (fontify-visited-p ; visited nodes need to be re-fontified
             (and Info-fontify-visited-nodes
                  ;; Don't take time to refontify visited nodes in huge nodes
-                 (< (- (point-max) (point-min)) Info-fontify-maximum-menu-size))))
+                 (< (- (point-max) (point-min)) Info-fontify-maximum-menu-size)))
+           rbeg rend)
 
       ;; Fontify header line
       (goto-char (point-min))
@@ -3570,39 +3571,48 @@ Preserve text properties."
                              "mouse-2: go to this node")
                 'mouse-face 'highlight)))
             (when (or not-fontified-p fontify-visited-p)
-              (add-text-properties
-               (match-beginning 2) (match-end 2)
-               (list
-                'font-lock-face
-                ;; Display visited nodes in a different face
-                (if (and Info-fontify-visited-nodes
-                         (save-match-data
-                           (let* ((node (replace-regexp-in-string
-                                         "^[ \t]+" ""
-                                         (replace-regexp-in-string
-                                          "[ \t\n]+" " "
-                                          (or (match-string 5)
-                                              (and (not (equal (match-string 4) ""))
-                                                   (match-string 4))
-                                              (match-string 2)))))
-                                  (file (file-name-nondirectory
-                                         Info-current-file))
-                                  (hl Info-history-list)
-                                  res)
-                             (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
-                                 (setq file (file-name-nondirectory
-                                             (match-string 1 node))
-                                       node (if (equal (match-string 2 node) "")
-                                                "Top"
-                                              (match-string 2 node))))
-                             (while hl
-                               (if (and (string-equal node (nth 1 (car hl)))
-                                        (string-equal file
-                                                      (file-name-nondirectory
-                                                       (nth 0 (car hl)))))
-                                   (setq res (car hl) hl nil)
-                                 (setq hl (cdr hl))))
-                             res))) 'info-xref-visited 'info-xref))))
+              (setq rbeg (match-beginning 2)
+                    rend (match-end 2))
+              (put-text-property
+               rbeg rend
+               'font-lock-face
+               ;; Display visited nodes in a different face
+               (if (and Info-fontify-visited-nodes
+                        (save-match-data
+                          (let* ((node (replace-regexp-in-string
+                                        "^[ \t]+" ""
+                                        (replace-regexp-in-string
+                                         "[ \t\n]+" " "
+                                         (or (match-string 5)
+                                             (and (not (equal (match-string 4) ""))
+                                                  (match-string 4))
+                                             (match-string 2)))))
+                                 (file (file-name-nondirectory
+                                        Info-current-file))
+                                 (hl Info-history-list)
+                                 res)
+                            (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
+                                (setq file (file-name-nondirectory
+                                            (match-string 1 node))
+                                      node (if (equal (match-string 2 node) "")
+                                               "Top"
+                                             (match-string 2 node))))
+                            (while hl
+                              (if (and (string-equal node (nth 1 (car hl)))
+                                       (string-equal file
+                                                     (file-name-nondirectory
+                                                      (nth 0 (car hl)))))
+                                  (setq res (car hl) hl nil)
+                                (setq hl (cdr hl))))
+                            res))) 'info-xref-visited 'info-xref))
+              ;; For multiline ref, unfontify newline and surrounding whitespace
+              (save-excursion
+                (goto-char rbeg)
+                (save-match-data
+                  (while (re-search-forward "\\s-*\n\\s-*" rend t nil)
+                    (remove-text-properties (match-beginning 0)
+                                            (match-end 0)
+                                            '(font-lock-face t))))))
             (when not-fontified-p
               (when (memq Info-hide-note-references '(t hide))
                 (add-text-properties (match-beginning 3) (match-end 3)