aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-06-12 15:50:25 +0000
committerRichard M. Stallman2002-06-12 15:50:25 +0000
commitefb21aabfa83f3be921da770c6c20952871e0229 (patch)
treeda5a35a56c25f16318a41306e93469a94b03897d
parente7b6ee945adc9879838f29e082e5ec15ec69a0d3 (diff)
downloademacs-efb21aabfa83f3be921da770c6c20952871e0229.tar.gz
emacs-efb21aabfa83f3be921da770c6c20952871e0229.zip
(Info-fontify-node): Compute header line specially
if node has no next, previous or up links. Hide the part of the first line that is used in the header. Use Info-next-link-keymap, etc. (Info-next-link-keymap, Info-prev-link-keymap) (Info-up-link-keymap): New variables.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/info.el87
2 files changed, 70 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4dfc1b2ab91..bd29cd50c29 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12002-06-12 Richard M. Stallman <rms@gnu.org> 12002-06-12 Richard M. Stallman <rms@gnu.org>
2 2
3 * info.el (Info-fontify-node): Compute header line specially
4 if node has no next, previous or up links.
5 Hide the part of the first line that is used in the header.
6 Use Info-next-link-keymap, etc.
7 (Info-next-link-keymap, Info-prev-link-keymap)
8 (Info-up-link-keymap): New variables.
9
3 * international/mule-diag.el (describe-char-after): Doc fix. 10 * international/mule-diag.el (describe-char-after): Doc fix.
4 11
5 * view.el (view-mode-enter): Clarify echo area message. 12 * view.el (view-mode-enter): Clarify echo area message.
diff --git a/lisp/info.el b/lisp/info.el
index 19bb7d0cf31..afc4433a253 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2580,6 +2580,34 @@ the variable `Info-file-list-for-emacs'."
2580 (put-text-property (match-beginning 1) (match-end 1) 2580 (put-text-property (match-beginning 1) (match-end 1)
2581 'font-lock-face 'info-menu-header))))) 2581 'font-lock-face 'info-menu-header)))))
2582 2582
2583(defvar Info-next-link-keymap
2584 (let ((keymap (make-sparse-keymap)))
2585 (define-key keymap [header-line mouse-1] 'Info-next)
2586 (define-key keymap [header-line mouse-2] 'Info-next)
2587 (define-key keymap [header-line down-mouse-1] 'ignore)
2588 (define-key keymap [mouse-2] 'Info-next)
2589 keymap)
2590 "Keymap to put on the Next link in the text or the header line.")
2591
2592(defvar Info-prev-link-keymap
2593 (let ((keymap (make-sparse-keymap)))
2594 (define-key keymap [header-line mouse-1] 'Info-prev)
2595 (define-key keymap [header-line mouse-2] 'Info-prev)
2596 (define-key keymap [header-line down-mouse-1] 'ignore)
2597 (define-key keymap [mouse-2] 'Info-prev)
2598 keymap)
2599 "Keymap to put on the Prev link in the text or the header line.")
2600
2601
2602(defvar Info-up-link-keymap
2603 (let ((keymap (make-sparse-keymap)))
2604 (define-key keymap [header-line mouse-1] 'Info-up)
2605 (define-key keymap [header-line mouse-2] 'Info-up)
2606 (define-key keymap [header-line down-mouse-1] 'ignore)
2607 (define-key keymap [mouse-2] 'Info-up)
2608 keymap)
2609 "Keymap to put on the Up link in the text or the header line.")
2610
2583(defun Info-fontify-node () 2611(defun Info-fontify-node ()
2584 ;; Only fontify the node if it hasn't already been done. [We pass in 2612 ;; Only fontify the node if it hasn't already been done. [We pass in
2585 ;; LIMIT arg to `next-property-change' because it seems to search past 2613 ;; LIMIT arg to `next-property-change' because it seems to search past
@@ -2607,33 +2635,44 @@ the variable `Info-file-list-for-emacs'."
2607 (concat "Go to node " 2635 (concat "Go to node "
2608 (buffer-substring nbeg nend))) 2636 (buffer-substring nbeg nend)))
2609 ;; Always set up the text property keymap. 2637 ;; Always set up the text property keymap.
2610 ;; It will be used either in the buffer 2638 ;; It will either be used in the buffer
2611 ;; or copied in the header line. 2639 ;; or copied in the header line.
2612 (let ((fun (cdr (assoc tag '(("Prev" . Info-prev) 2640 (cond ((equal tag "Prev")
2613 ("Next" . Info-next) 2641 (put-text-property tbeg nend 'keymap
2614 ("Up" . Info-up)))))) 2642 Info-prev-link-keymap))
2615 (when fun 2643 ((equal tag "Next")
2616 (let ((keymap (make-sparse-keymap))) 2644 (put-text-property tbeg nend 'keymap
2617 (define-key keymap [header-line mouse-1] fun) 2645 Info-next-link-keymap))
2618 (define-key keymap [header-line mouse-2] fun) 2646 ((equal tag "Up")
2619 (define-key keymap [header-line down-mouse-1] 'ignore) 2647 (put-text-property tbeg nend 'keymap
2620 (define-key keymap [mouse-2] fun) 2648 Info-up-link-keymap))))))
2621 (put-text-property tbeg nend 'keymap keymap))))
2622 )))
2623 (goto-char (point-min)) 2649 (goto-char (point-min))
2624 (let* ((header-end (save-excursion (end-of-line) (point))) 2650 (let ((header-end (save-excursion (end-of-line) (point)))
2625 ;; If we find neither Next: nor Prev: link, show the entire 2651 header)
2626 ;; node header. Otherwise, don't show the File: and Node: 2652 ;; If we find neither Next: nor Prev: link, show the entire
2627 ;; parts, to avoid wasting precious space on information that 2653 ;; node header. Otherwise, don't show the File: and Node:
2628 ;; is available in the mode line. 2654 ;; parts, to avoid wasting precious space on information that
2629 (header-beg (if (re-search-forward 2655 ;; is available in the mode line.
2630 "\\(next\\|prev[ious]*\\): " 2656 (if (re-search-forward
2631 header-end t) 2657 "\\(next\\|up\\|prev[ious]*\\): "
2632 (match-beginning 1) 2658 header-end t)
2633 (point)))) 2659 (progn
2660 (goto-char (match-beginning 1))
2661 (setq header (buffer-substring (point) header-end)))
2662 (if (re-search-forward "node:[ \t]*[^ \t]+[ \t]*" nil t)
2663 (setq header
2664 (concat "No next, prev or up links -- "
2665 (buffer-substring (point) header-end)))
2666 (setq header (buffer-substring (point) header-end))))
2667
2634 (put-text-property (point-min) (1+ (point-min)) 2668 (put-text-property (point-min) (1+ (point-min))
2635 'header-line 2669 'header-line header)
2636 (buffer-substring header-beg header-end)))) 2670 ;; Hide the part of the first line
2671 ;; that is in the header, if it is just part.
2672 (unless (bobp)
2673 ;; Hide the punctuation at the end, too.
2674 (skip-chars-backward " \t,")
2675 (put-text-property (point) header-end 'invisible t))))
2637 (goto-char (point-min)) 2676 (goto-char (point-min))
2638 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" 2677 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
2639 nil t) 2678 nil t)