(Info-fontify-node): Remove any local-map text properties left
authorEli Zaretskii <eliz@gnu.org>
Fri, 21 Dec 2001 19:31:06 +0000 (19:31 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 21 Dec 2001 19:31:06 +0000 (19:31 +0000)
over from past visits to this node.

lisp/ChangeLog
lisp/info.el

index 5c1c86d..0c93b1c 100644 (file)
@@ -3,7 +3,8 @@
        * info.el (Info-select-node): If Info-use-header-line is nil, set
        header-line-format to nil.
        (Info-fontify-node): Don't put a keymap text property on the
-       heading if we are not going to display the header line.
+       heading if we are not going to display the header line.  Remove
+       any such text properties left over from past visits to this node.
 
        * ls-lisp.el (insert-directory): Insert the amount of free disk
        space, like files.el's insert-directory does.
index cc90027..f1a4621 100644 (file)
@@ -2578,8 +2578,15 @@ the variable `Info-file-list-for-emacs'."
   ;; Only fontify the node if it hasn't already been done.  [We pass in
   ;; LIMIT arg to `next-property-change' because it seems to search past
   ;; (point-max).]
-  (unless (< (next-property-change (point-min) nil (point-max))
-            (point-max))
+  (unless (and (< (next-property-change (point-min) nil (point-max))
+                 (point-max))
+              ;; But do put the text properties if the local-map property
+              ;; is inconsistent with Info-use-header-line's value.
+              (eq
+               (= (next-single-property-change
+                   (point-min) 'local-map nil (point-max))
+                  (point-max))
+               (null Info-use-header-line)))
     (save-excursion
       (let ((buffer-read-only nil)
            (case-fold-search t))
@@ -2610,8 +2617,14 @@ the variable `Info-file-list-for-emacs'."
                      (let ((keymap (make-sparse-keymap)))
                        (define-key keymap [header-line down-mouse-1] fun)
                        (define-key keymap [header-line down-mouse-2] fun)
-                       (put-text-property tbeg nend 'local-map keymap))))
-                 )))))
+                       (put-text-property tbeg nend 'local-map keymap)))))
+               (if (not Info-use-header-line)
+                   ;; In case they switched Info-use-header-line off
+                   ;; in the middle of an Info session, some text
+                   ;; properties may have been left lying around from
+                   ;; past visits of this node.  Remove them.
+                   (remove-text-properties tbeg nend '(local-map nil)))
+                 ))))
        (goto-char (point-min))
        (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
                                  nil t)