diff options
| author | Jim Blandy | 1992-02-07 21:40:34 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-02-07 21:40:34 +0000 |
| commit | aea2a8dafe2bfeb03a7cb9096920265056f83a6e (patch) | |
| tree | df3aaf4cd6c3820f4e72819a6962378851940c7a | |
| parent | bc93c0971894741c726bd7921a9ad6c5441c4a3d (diff) | |
| download | emacs-aea2a8dafe2bfeb03a7cb9096920265056f83a6e.tar.gz emacs-aea2a8dafe2bfeb03a7cb9096920265056f83a6e.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/info.el | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/lisp/info.el b/lisp/info.el index d31e86839a8..020ec32395d 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -30,10 +30,16 @@ Each element of list is a list (FILENAME NODENAME BUFFERPOS).") | |||
| 30 | "Non-nil allows Info to execute Lisp code associated with nodes. | 30 | "Non-nil allows Info to execute Lisp code associated with nodes. |
| 31 | The Lisp code is executed when the node is selected.") | 31 | The Lisp code is executed when the node is selected.") |
| 32 | 32 | ||
| 33 | (defvar Info-directory-list t | 33 | (defvar Info-default-directory-list nil |
| 34 | "List of default directories to search for Info documentation files. | ||
| 35 | This value is used as the default for `Info-directory-list'. It is set | ||
| 36 | in paths.el.") | ||
| 37 | |||
| 38 | (defvar Info-directory-list nil | ||
| 34 | "List of directories to search for Info documentation files. | 39 | "List of directories to search for Info documentation files. |
| 35 | t means not yet initialized. In this case, Info uses the environment | 40 | nil means not yet initialized. In this case, Info uses the environment |
| 36 | variable INFODIR to initialize it.") | 41 | variable INFODIR to initialize it, or `Info-default-directory-list' |
| 42 | if there is no INFODIR variable in the environment.") | ||
| 37 | 43 | ||
| 38 | (defvar Info-current-file nil | 44 | (defvar Info-current-file nil |
| 39 | "Info file that Info is now looking at, or nil.") | 45 | "Info file that Info is now looking at, or nil.") |
| @@ -59,15 +65,19 @@ In interactive use, a prefix argument directs this command | |||
| 59 | to read a file name from the minibuffer." | 65 | to read a file name from the minibuffer." |
| 60 | (interactive (if current-prefix-arg | 66 | (interactive (if current-prefix-arg |
| 61 | (list (read-file-name "Info file name: " nil nil t)))) | 67 | (list (read-file-name "Info file name: " nil nil t)))) |
| 62 | (if (eq Info-directory-list t) | 68 | (or Info-directory-list |
| 63 | (let ((path (getenv "INFOPATH")) | 69 | (setq Info-directory-list |
| 64 | list) | 70 | (let ((path (getenv "INFOPATH"))) |
| 65 | (and path | 71 | (if path |
| 66 | (while (> (length path) 0) | 72 | (let ((list nil) |
| 67 | (let ((idx (or (string-match ":" path) (length path)))) | 73 | idx) |
| 68 | (setq list (cons (substring path 0 idx) list) | 74 | (while (> (length path) 0) |
| 69 | path (substring path (min (1+ idx) (length path))))))) | 75 | (setq idx (or (string-match ":" path) (length path)) |
| 70 | (setq Info-directory-list (nreverse list)))) | 76 | list (cons (substring path 0 idx) list) |
| 77 | path (substring path (min (1+ idx) | ||
| 78 | (length path))))) | ||
| 79 | (nreverse list)) | ||
| 80 | Info-default-directory-list)))) | ||
| 71 | (if file | 81 | (if file |
| 72 | (Info-goto-node (concat "(" file ")")) | 82 | (Info-goto-node (concat "(" file ")")) |
| 73 | (if (get-buffer "*info*") | 83 | (if (get-buffer "*info*") |
| @@ -299,6 +309,14 @@ to read a file name from the minibuffer." | |||
| 299 | (Info-find-node (if (equal filename "") nil filename) | 309 | (Info-find-node (if (equal filename "") nil filename) |
| 300 | (if (equal nodename "") "Top" nodename)))) | 310 | (if (equal nodename "") "Top" nodename)))) |
| 301 | 311 | ||
| 312 | (defun Info-restore-point (hl) | ||
| 313 | "If this node has been visited, restore the point value when we left." | ||
| 314 | (if hl | ||
| 315 | (if (and (equal (nth 0 (car hl)) Info-current-file) | ||
| 316 | (equal (nth 1 (car hl)) Info-current-node)) | ||
| 317 | (goto-char (nth 2 (car hl))) | ||
| 318 | (Info-restore-point (cdr hl))))) | ||
| 319 | |||
| 302 | (defvar Info-last-search nil | 320 | (defvar Info-last-search nil |
| 303 | "Default regexp for \\<info-mode-map>\\[Info-search] command to search for.") | 321 | "Default regexp for \\<info-mode-map>\\[Info-search] command to search for.") |
| 304 | 322 | ||
| @@ -407,7 +425,8 @@ to read a file name from the minibuffer." | |||
| 407 | (defun Info-up () | 425 | (defun Info-up () |
| 408 | "Go to the superior node of this node." | 426 | "Go to the superior node of this node." |
| 409 | (interactive) | 427 | (interactive) |
| 410 | (Info-goto-node (Info-extract-pointer "up"))) | 428 | (Info-goto-node (Info-extract-pointer "up")) |
| 429 | (Info-restore-point Info-history)) | ||
| 411 | 430 | ||
| 412 | (defun Info-last () | 431 | (defun Info-last () |
| 413 | "Go back to the last node visited." | 432 | "Go back to the last node visited." |
| @@ -536,9 +555,9 @@ Completion is allowed, and the menu item point is on is the default." | |||
| 536 | default) | 555 | default) |
| 537 | "Menu item: ") | 556 | "Menu item: ") |
| 538 | completions nil t))) | 557 | completions nil t))) |
| 539 | ;; we rely on the bug (which RMS won't change for his own reasons) | 558 | ;; we rely on the fact that completing-read accepts an input |
| 540 | ;; that ;; completing-read accepts an input of "" even when the | 559 | ;; of "" even when the require-match argument is true and "" |
| 541 | ;; require-match argument is true and "" is not a valid possibility | 560 | ;; is not a valid possibility |
| 542 | (if (string= item "") | 561 | (if (string= item "") |
| 543 | (if default | 562 | (if default |
| 544 | (setq item default) | 563 | (setq item default) |
| @@ -736,14 +755,14 @@ SIG optional fourth argument, controls action on no match | |||
| 736 | (t | 755 | (t |
| 737 | (error "No %s around position %d" errorstring pos)))))) | 756 | (error "No %s around position %d" errorstring pos)))))) |
| 738 | 757 | ||
| 739 | (defun Info-follow-nearest-node (event) | 758 | (defun Info-follow-nearest-node (click) |
| 740 | "\\<Info-mode-map>Follow a node reference near point. Like \\[Info-menu], \\Info-follow-reference], \\[Info-next], \\[Info-previous] or \\Info-up] command. | 759 | "\\<Info-mode-map>Follow a node reference near point. Like \\[Info-menu], \\Info-follow-reference], \\[Info-next], \\[Info-previous] or \\Info-up] command. |
| 741 | At end of the node's text, moves to the next node." | 760 | At end of the node's text, moves to the next node." |
| 742 | (interactive "@e") | 761 | (interactive "K") |
| 743 | (let* ((relative-coordinates (coordinates-in-window-p (car event) | 762 | (let* ((relative-coordinates (coordinates-in-window-p (mouse-coords click) |
| 744 | (selected-window))) | 763 | (selected-window))) |
| 745 | (rel-x (car relative-coordinates)) | 764 | (rel-x (car relative-coordinates)) |
| 746 | (rel-y (car (cdr relative-coordinates)))) | 765 | (rel-y (cdr relative-coordinates))) |
| 747 | (move-to-window-line rel-y) | 766 | (move-to-window-line rel-y) |
| 748 | (move-to-column rel-x)) | 767 | (move-to-column rel-x)) |
| 749 | (let (node) | 768 | (let (node) |
| @@ -802,20 +821,8 @@ At end of the node's text, moves to the next node." | |||
| 802 | (define-key Info-mode-map "q" 'Info-exit) | 821 | (define-key Info-mode-map "q" 'Info-exit) |
| 803 | (define-key Info-mode-map "s" 'Info-search) | 822 | (define-key Info-mode-map "s" 'Info-search) |
| 804 | (define-key Info-mode-map "u" 'Info-up) | 823 | (define-key Info-mode-map "u" 'Info-up) |
| 805 | (define-key Info-mode-map "\177" 'scroll-down)) | 824 | (define-key Info-mode-map "\177" 'scroll-down) |
| 806 | 825 | ) | |
| 807 | (defvar Info-mode-mouse-map nil | ||
| 808 | "Mouse map for use with Info mode.") | ||
| 809 | |||
| 810 | (if Info-mode-mouse-map | ||
| 811 | nil | ||
| 812 | (if (null (cdr global-mouse-map)) | ||
| 813 | nil | ||
| 814 | (setq Info-mode-mouse-map (make-sparse-keymap)) | ||
| 815 | (define-key Info-mode-mouse-map mouse-button-middle | ||
| 816 | 'Info-follow-nearest-node) | ||
| 817 | (define-key Info-mode-mouse-map mouse-button-left 'mouse-scroll-up-full) | ||
| 818 | (define-key Info-mode-mouse-map mouse-button-right 'mouse-scroll-down-full))) | ||
| 819 | 826 | ||
| 820 | ;; Info mode is suitable only for specially formatted data. | 827 | ;; Info mode is suitable only for specially formatted data. |
| 821 | (put 'info-mode 'mode-class 'special) | 828 | (put 'info-mode 'mode-class 'special) |
| @@ -835,6 +842,7 @@ Selecting other nodes: | |||
| 835 | \\[Info-up] Move \"up\" from this node. | 842 | \\[Info-up] Move \"up\" from this node. |
| 836 | \\[Info-menu] Pick menu item specified by name (or abbreviation). | 843 | \\[Info-menu] Pick menu item specified by name (or abbreviation). |
| 837 | Picking a menu item causes another node to be selected. | 844 | Picking a menu item causes another node to be selected. |
| 845 | \\[Info-directory] Go to the Info directory node. | ||
| 838 | \\[Info-follow-reference] Follow a cross reference. Reads name of reference. | 846 | \\[Info-follow-reference] Follow a cross reference. Reads name of reference. |
| 839 | \\[Info-last] Move to the last node you were at. | 847 | \\[Info-last] Move to the last node you were at. |
| 840 | 848 | ||
| @@ -842,11 +850,6 @@ Moving within a node: | |||
| 842 | \\[scroll-up] scroll forward a full screen. \\[scroll-down] scroll backward. | 850 | \\[scroll-up] scroll forward a full screen. \\[scroll-down] scroll backward. |
| 843 | \\[beginning-of-buffer] Go to beginning of node. | 851 | \\[beginning-of-buffer] Go to beginning of node. |
| 844 | 852 | ||
| 845 | Mouse commands: | ||
| 846 | Middle Button Go to node mentioned in the text near where you click. | ||
| 847 | Left Button Scroll forward a full screen. | ||
| 848 | Right Button Scroll backward. | ||
| 849 | |||
| 850 | Advanced commands: | 853 | Advanced commands: |
| 851 | \\[Info-exit] Quit Info: reselect previously selected buffer. | 854 | \\[Info-exit] Quit Info: reselect previously selected buffer. |
| 852 | \\[Info-edit] Edit contents of selected node. | 855 | \\[Info-edit] Edit contents of selected node. |
| @@ -864,7 +867,6 @@ Advanced commands: | |||
| 864 | (setq local-abbrev-table text-mode-abbrev-table) | 867 | (setq local-abbrev-table text-mode-abbrev-table) |
| 865 | (setq case-fold-search t) | 868 | (setq case-fold-search t) |
| 866 | (setq buffer-read-only t) | 869 | (setq buffer-read-only t) |
| 867 | (setq buffer-mouse-map Info-mode-mouse-map) | ||
| 868 | (make-local-variable 'Info-current-file) | 870 | (make-local-variable 'Info-current-file) |
| 869 | (make-local-variable 'Info-current-subfile) | 871 | (make-local-variable 'Info-current-subfile) |
| 870 | (make-local-variable 'Info-current-node) | 872 | (make-local-variable 'Info-current-node) |