aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-06-12 12:20:17 +0000
committerRichard M. Stallman2002-06-12 12:20:17 +0000
commit246a06d33929467fcd972cf5690652e69f6f7136 (patch)
treee0b85b87ff159f7d277aba51c6bcc56758425d7e
parentfc896a928cac48ab605eb17dc32267450a85c0d4 (diff)
downloademacs-246a06d33929467fcd972cf5690652e69f6f7136.tar.gz
emacs-246a06d33929467fcd972cf5690652e69f6f7136.zip
(Info-select-node): Turn header line on or off here.
(Info-setup-header-line): Function deleted. (Info-mode): Make Info-header-line local. (Info-fontify-node): Ignore Info-use-header-line. Unconditionally compute what the header line should be, and store it on the `header-line' property of the node's first char. Bind [header-line down-mouse-1]. Use `keymap' property, not `local-map'. Bind [mouse-2] for mouse clicks on the node line in the text.
-rw-r--r--lisp/info.el90
1 files changed, 39 insertions, 51 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 9ab060e7dbd..19bb7d0cf31 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -999,7 +999,14 @@ Bind this in case the user sets it to nil."
999 (if Info-enable-active-nodes (eval active-expression)) 999 (if Info-enable-active-nodes (eval active-expression))
1000 (Info-fontify-node) 1000 (Info-fontify-node)
1001 (if Info-use-header-line 1001 (if Info-use-header-line
1002 (Info-setup-header-line) 1002 (progn
1003 (setq Info-header-line
1004 (get-text-property (point-min) 'header-line))
1005 (setq header-line-format 'Info-header-line)
1006;;; It is useful to be able to copy the links line out of the buffer
1007;;; with M-w.
1008;;; (narrow-to-region (1+ header-end) (point-max))
1009 )
1003 (setq Info-header-line nil) 1010 (setq Info-header-line nil)
1004 (setq header-line-format nil)) ; so the header line isn't displayed 1011 (setq header-line-format nil)) ; so the header line isn't displayed
1005 (run-hooks 'Info-selection-hook))))) 1012 (run-hooks 'Info-selection-hook)))))
@@ -1016,29 +1023,6 @@ Bind this in case the user sets it to nil."
1016 ") " 1023 ") "
1017 (or Info-current-node "")))))) 1024 (or Info-current-node ""))))))
1018 1025
1019;; Skip the node header and make it into a header-line. This function
1020;; should be called when the node is already narrowed.
1021(defun Info-setup-header-line ()
1022 (goto-char (point-min))
1023 (let* ((case-fold-search t)
1024 (header-end (save-excursion (forward-line 1) (1- (point))))
1025 ;; If we find neither Next: nor Prev: link, show the entire
1026 ;; node header. Otherwise, don't show the File: and Node:
1027 ;; parts, to avoid wasting precious space on information that
1028 ;; is available in the mode line.
1029 (header-beg (if (re-search-forward
1030 "\\(next\\|prev[ious]*\\): "
1031 header-end t)
1032 (match-beginning 1)
1033 (point))))
1034 (set (make-local-variable 'Info-header-line)
1035 (buffer-substring header-beg header-end))
1036 (setq header-line-format 'Info-header-line)
1037;;; It is useful to be able to copy the links line out of the buffer
1038;;; with M-w.
1039;;; (narrow-to-region (1+ header-end) (point-max))
1040 ))
1041
1042;; Go to an info node specified with a filename-and-nodename string 1026;; Go to an info node specified with a filename-and-nodename string
1043;; of the sort that is found in pointers in nodes. 1027;; of the sort that is found in pointers in nodes.
1044 1028
@@ -2345,6 +2329,7 @@ Advanced commands:
2345 (setq Info-tag-table-buffer nil) 2329 (setq Info-tag-table-buffer nil)
2346 (make-local-variable 'Info-history) 2330 (make-local-variable 'Info-history)
2347 (make-local-variable 'Info-index-alternatives) 2331 (make-local-variable 'Info-index-alternatives)
2332 (make-local-variable 'Info-header-line)
2348 (set (make-local-variable 'tool-bar-map) info-tool-bar-map) 2333 (set (make-local-variable 'tool-bar-map) info-tool-bar-map)
2349 ;; This is for the sake of the invisible text we use handling titles. 2334 ;; This is for the sake of the invisible text we use handling titles.
2350 (make-local-variable 'line-move-ignore-invisible) 2335 (make-local-variable 'line-move-ignore-invisible)
@@ -2599,15 +2584,8 @@ the variable `Info-file-list-for-emacs'."
2599 ;; Only fontify the node if it hasn't already been done. [We pass in 2584 ;; Only fontify the node if it hasn't already been done. [We pass in
2600 ;; LIMIT arg to `next-property-change' because it seems to search past 2585 ;; LIMIT arg to `next-property-change' because it seems to search past
2601 ;; (point-max).] 2586 ;; (point-max).]
2602 (unless (and (< (next-property-change (point-min) nil (point-max)) 2587 (unless (< (next-property-change (point-min) nil (point-max))
2603 (point-max)) 2588 (point-max))
2604 ;; But do put the text properties if the local-map property
2605 ;; is inconsistent with Info-use-header-line's value.
2606 (eq
2607 (= (next-single-property-change
2608 (point-min) 'local-map nil (point-max))
2609 (point-max))
2610 (null Info-use-header-line)))
2611 (save-excursion 2589 (save-excursion
2612 (let ((buffer-read-only nil) 2590 (let ((buffer-read-only nil)
2613 (case-fold-search t)) 2591 (case-fold-search t))
@@ -2628,24 +2606,34 @@ the variable `Info-file-list-for-emacs'."
2628 'help-echo 2606 'help-echo
2629 (concat "Go to node " 2607 (concat "Go to node "
2630 (buffer-substring nbeg nend))) 2608 (buffer-substring nbeg nend)))
2631 ;; Don't bind mouse events on the header line if we 2609 ;; Always set up the text property keymap.
2632 ;; aren't going to display the header line. 2610 ;; It will be used either in the buffer
2633 (when Info-use-header-line 2611 ;; or copied in the header line.
2634 (let ((fun (cdr (assoc tag '(("Prev" . Info-prev) 2612 (let ((fun (cdr (assoc tag '(("Prev" . Info-prev)
2635 ("Next" . Info-next) 2613 ("Next" . Info-next)
2636 ("Up" . Info-up)))))) 2614 ("Up" . Info-up))))))
2637 (when fun 2615 (when fun
2638 (let ((keymap (make-sparse-keymap))) 2616 (let ((keymap (make-sparse-keymap)))
2639 (define-key keymap [header-line mouse-1] fun) 2617 (define-key keymap [header-line mouse-1] fun)
2640 (define-key keymap [header-line mouse-2] fun) 2618 (define-key keymap [header-line mouse-2] fun)
2641 (put-text-property tbeg nend 'local-map keymap))))) 2619 (define-key keymap [header-line down-mouse-1] 'ignore)
2642 (if (not Info-use-header-line) 2620 (define-key keymap [mouse-2] fun)
2643 ;; In case they switched Info-use-header-line off 2621 (put-text-property tbeg nend 'keymap keymap))))
2644 ;; in the middle of an Info session, some text 2622 )))
2645 ;; properties may have been left lying around from 2623 (goto-char (point-min))
2646 ;; past visits of this node. Remove them. 2624 (let* ((header-end (save-excursion (end-of-line) (point)))
2647 (remove-text-properties tbeg nend '(local-map nil))) 2625 ;; If we find neither Next: nor Prev: link, show the entire
2648 )))) 2626 ;; node header. Otherwise, don't show the File: and Node:
2627 ;; parts, to avoid wasting precious space on information that
2628 ;; is available in the mode line.
2629 (header-beg (if (re-search-forward
2630 "\\(next\\|prev[ious]*\\): "
2631 header-end t)
2632 (match-beginning 1)
2633 (point))))
2634 (put-text-property (point-min) (1+ (point-min))
2635 'header-line
2636 (buffer-substring header-beg header-end))))
2649 (goto-char (point-min)) 2637 (goto-char (point-min))
2650 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" 2638 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
2651 nil t) 2639 nil t)