2580 |
(put-text-property (match-beginning 1) (match-end 1) |
(put-text-property (match-beginning 1) (match-end 1) |
2581 |
'font-lock-face 'info-menu-header))))) |
'font-lock-face 'info-menu-header))))) |
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 |
|
|
2611 |
(defun Info-fontify-node () |
(defun Info-fontify-node () |
2612 |
;; Only fontify the node if it hasn't already been done. [We pass in |
;; Only fontify the node if it hasn't already been done. [We pass in |
2613 |
;; LIMIT arg to `next-property-change' because it seems to search past |
;; LIMIT arg to `next-property-change' because it seems to search past |
2635 |
(concat "Go to node " |
(concat "Go to node " |
2636 |
(buffer-substring nbeg nend))) |
(buffer-substring nbeg nend))) |
2637 |
;; Always set up the text property keymap. |
;; Always set up the text property keymap. |
2638 |
;; It will be used either in the buffer |
;; It will either be used in the buffer |
2639 |
;; or copied in the header line. |
;; or copied in the header line. |
2640 |
(let ((fun (cdr (assoc tag '(("Prev" . Info-prev) |
(cond ((equal tag "Prev") |
2641 |
("Next" . Info-next) |
(put-text-property tbeg nend 'keymap |
2642 |
("Up" . Info-up)))))) |
Info-prev-link-keymap)) |
2643 |
(when fun |
((equal tag "Next") |
2644 |
(let ((keymap (make-sparse-keymap))) |
(put-text-property tbeg nend 'keymap |
2645 |
(define-key keymap [header-line mouse-1] fun) |
Info-next-link-keymap)) |
2646 |
(define-key keymap [header-line mouse-2] fun) |
((equal tag "Up") |
2647 |
(define-key keymap [header-line down-mouse-1] 'ignore) |
(put-text-property tbeg nend 'keymap |
2648 |
(define-key keymap [mouse-2] fun) |
Info-up-link-keymap)))))) |
|
(put-text-property tbeg nend 'keymap keymap)))) |
|
|
))) |
|
2649 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2650 |
(let* ((header-end (save-excursion (end-of-line) (point))) |
(let ((header-end (save-excursion (end-of-line) (point))) |
2651 |
;; If we find neither Next: nor Prev: link, show the entire |
header) |
2652 |
;; node header. Otherwise, don't show the File: and Node: |
;; If we find neither Next: nor Prev: link, show the entire |
2653 |
;; parts, to avoid wasting precious space on information that |
;; node header. Otherwise, don't show the File: and Node: |
2654 |
;; is available in the mode line. |
;; parts, to avoid wasting precious space on information that |
2655 |
(header-beg (if (re-search-forward |
;; is available in the mode line. |
2656 |
"\\(next\\|prev[ious]*\\): " |
(if (re-search-forward |
2657 |
header-end t) |
"\\(next\\|up\\|prev[ious]*\\): " |
2658 |
(match-beginning 1) |
header-end t) |
2659 |
(point)))) |
(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 |
|
|
2668 |
(put-text-property (point-min) (1+ (point-min)) |
(put-text-property (point-min) (1+ (point-min)) |
2669 |
'header-line |
'header-line header) |
2670 |
(buffer-substring header-beg header-end)))) |
;; 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)))) |
2676 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2677 |
(while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" |
(while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" |
2678 |
nil t) |
nil t) |