diff options
| author | Stefan Monnier | 1999-10-13 14:48:57 +0000 |
|---|---|---|
| committer | Stefan Monnier | 1999-10-13 14:48:57 +0000 |
| commit | 4fceda3c2f20650ecd87d879449a27a1540e37cf (patch) | |
| tree | 7ad5aea0ad7b1fa5631a45c809287527d4745c2c | |
| parent | b005abd5c098532dd0b09654ac77a990bfe51510 (diff) | |
| download | emacs-4fceda3c2f20650ecd87d879449a27a1540e37cf.tar.gz emacs-4fceda3c2f20650ecd87d879449a27a1540e37cf.zip | |
(Info-on-current-buffer): new entry point.
(Info-find-node): split into two for Info-on-current-buffer to
hook into it.
(Info-current-file, Info-set-mode-line, Info-up):
Info-current-file can now be t.
(Info-clone-buffer-hook): new function for `clone-buffer'.
(Info-goto-node, Info-menu, Info-mode-map, Info-mode): make
`clone-buffer' available in various ways to the user.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/info.el | 56 |
2 files changed, 57 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0f91cb3779..9573fb88510 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 1999-10-13 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * info.el (Info-on-current-buffer): new entry point. | ||
| 4 | (Info-find-node): split into two for Info-on-current-buffer to | ||
| 5 | hook into it. | ||
| 6 | (Info-current-file, Info-set-mode-line, Info-up): | ||
| 7 | Info-current-file can now be t. | ||
| 8 | (Info-clone-buffer-hook): new function for `clone-buffer'. | ||
| 9 | (Info-goto-node, Info-menu, Info-mode-map, Info-mode): make | ||
| 10 | `clone-buffer' available in various ways to the user. | ||
| 11 | |||
| 1 | 1999-10-12 Stefan Monnier <monnier@cs.yale.edu> | 12 | 1999-10-12 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 13 | ||
| 3 | * simple.el (shell-command, shell-command-on-region): use make-temp-file. | 14 | * simple.el (shell-command, shell-command-on-region): use make-temp-file. |
diff --git a/lisp/info.el b/lisp/info.el index f8273d09f2d..0d381ab6976 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -102,7 +102,8 @@ These directories are not searched for merging the `dir' file." | |||
| 102 | (defvar Info-current-file nil | 102 | (defvar Info-current-file nil |
| 103 | "Info file that Info is now looking at, or nil. | 103 | "Info file that Info is now looking at, or nil. |
| 104 | This is the name that was specified in Info, not the actual file name. | 104 | This is the name that was specified in Info, not the actual file name. |
| 105 | It doesn't contain directory names or file name extensions added by Info.") | 105 | It doesn't contain directory names or file name extensions added by Info. |
| 106 | Can also be t when using `Info-on-current-buffer'.") | ||
| 106 | 107 | ||
| 107 | (defvar Info-current-subfile nil | 108 | (defvar Info-current-subfile nil |
| 108 | "Info subfile that is actually in the *info* buffer now, | 109 | "Info subfile that is actually in the *info* buffer now, |
| @@ -365,7 +366,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." | |||
| 365 | (info-initialize) | 366 | (info-initialize) |
| 366 | ;; Convert filename to lower case if not found as specified. | 367 | ;; Convert filename to lower case if not found as specified. |
| 367 | ;; Expand it. | 368 | ;; Expand it. |
| 368 | (if filename | 369 | (if (stringp filename) |
| 369 | (let (temp temp-downcase found) | 370 | (let (temp temp-downcase found) |
| 370 | (setq filename (substitute-in-file-name filename)) | 371 | (setq filename (substitute-in-file-name filename)) |
| 371 | (if (string= (downcase filename) "dir") | 372 | (if (string= (downcase filename) "dir") |
| @@ -410,6 +411,22 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." | |||
| 410 | Info-history))) | 411 | Info-history))) |
| 411 | ;; Go into info buffer. | 412 | ;; Go into info buffer. |
| 412 | (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) | 413 | (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) |
| 414 | (Info-find-node-2 filename nodename no-going-back)) | ||
| 415 | |||
| 416 | (defun Info-on-current-buffer (&optional nodename) | ||
| 417 | "Use the `Info-mode' to browse the current info buffer. | ||
| 418 | If a prefix arg is provided, it queries for the NODENAME which | ||
| 419 | else defaults to `Top'." | ||
| 420 | (interactive | ||
| 421 | (list (if current-prefix-arg | ||
| 422 | (completing-read "Node name: " (Info-build-node-completions) | ||
| 423 | nil t "Top") | ||
| 424 | "Top"))) | ||
| 425 | (Info-mode) | ||
| 426 | (set (make-local-variable 'Info-current-file) t) | ||
| 427 | (Info-find-node-2 nil nodename)) | ||
| 428 | |||
| 429 | (defun Info-find-node-2 (filename nodename &optional no-going-back) | ||
| 413 | (buffer-disable-undo (current-buffer)) | 430 | (buffer-disable-undo (current-buffer)) |
| 414 | (or (eq major-mode 'Info-mode) | 431 | (or (eq major-mode 'Info-mode) |
| 415 | (Info-mode)) | 432 | (Info-mode)) |
| @@ -868,7 +885,9 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." | |||
| 868 | (concat | 885 | (concat |
| 869 | " Info: (" | 886 | " Info: (" |
| 870 | (if Info-current-file | 887 | (if Info-current-file |
| 871 | (file-name-nondirectory Info-current-file) | 888 | (file-name-nondirectory (if (stringp Info-current-file) |
| 889 | Info-current-file | ||
| 890 | (or buffer-file-name ""))) | ||
| 872 | "") | 891 | "") |
| 873 | ")" | 892 | ")" |
| 874 | (or Info-current-node "")))) | 893 | (or Info-current-node "")))) |
| @@ -876,10 +895,15 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." | |||
| 876 | ;; Go to an info node specified with a filename-and-nodename string | 895 | ;; Go to an info node specified with a filename-and-nodename string |
| 877 | ;; of the sort that is found in pointers in nodes. | 896 | ;; of the sort that is found in pointers in nodes. |
| 878 | 897 | ||
| 879 | (defun Info-goto-node (nodename) | 898 | (defun Info-goto-node (nodename &optional fork) |
| 880 | "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME." | 899 | "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME. |
| 881 | (interactive (list (Info-read-node-name "Goto node: "))) | 900 | If FORK is non-nil, show the node in a new info buffer. |
| 901 | If FORK is a string, it is the name to use for the new buffer." | ||
| 902 | (interactive (list (Info-read-node-name "Goto node: ") current-prefix-arg)) | ||
| 882 | (info-initialize) | 903 | (info-initialize) |
| 904 | (if fork | ||
| 905 | (set-buffer | ||
| 906 | (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) | ||
| 883 | (let (filename) | 907 | (let (filename) |
| 884 | (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" | 908 | (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" |
| 885 | nodename) | 909 | nodename) |
| @@ -1092,7 +1116,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." | |||
| 1092 | If SAME-FILE is non-nil, do not move to a different Info file." | 1116 | If SAME-FILE is non-nil, do not move to a different Info file." |
| 1093 | (interactive) | 1117 | (interactive) |
| 1094 | (let ((node (Info-extract-pointer "up"))) | 1118 | (let ((node (Info-extract-pointer "up"))) |
| 1095 | (and same-file | 1119 | (and (or same-file (not (stringp Info-current-file))) |
| 1096 | (string-match "^(" node) | 1120 | (string-match "^(" node) |
| 1097 | (error "Up node is in another Info file")) | 1121 | (error "Up node is in another Info file")) |
| 1098 | (Info-goto-node node)) | 1122 | (Info-goto-node node)) |
| @@ -1276,7 +1300,7 @@ NAME may be an abbreviation of the reference name." | |||
| 1276 | nil t)))))) | 1300 | nil t)))))) |
| 1277 | 1301 | ||
| 1278 | 1302 | ||
| 1279 | (defun Info-menu (menu-item) | 1303 | (defun Info-menu (menu-item &optional fork) |
| 1280 | "Go to node for menu item named (or abbreviated) NAME. | 1304 | "Go to node for menu item named (or abbreviated) NAME. |
| 1281 | Completion is allowed, and the menu item point is on is the default." | 1305 | Completion is allowed, and the menu item point is on is the default." |
| 1282 | (interactive | 1306 | (interactive |
| @@ -1316,10 +1340,10 @@ Completion is allowed, and the menu item point is on is the default." | |||
| 1316 | (setq item default) | 1340 | (setq item default) |
| 1317 | ;; ask again | 1341 | ;; ask again |
| 1318 | (setq item nil)))) | 1342 | (setq item nil)))) |
| 1319 | (list item)))) | 1343 | (list item current-prefix-arg)))) |
| 1320 | ;; there is a problem here in that if several menu items have the same | 1344 | ;; there is a problem here in that if several menu items have the same |
| 1321 | ;; name you can only go to the node of the first with this command. | 1345 | ;; name you can only go to the node of the first with this command. |
| 1322 | (Info-goto-node (Info-extract-menu-item menu-item))) | 1346 | (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item))) |
| 1323 | 1347 | ||
| 1324 | (defun Info-extract-menu-item (menu-item) | 1348 | (defun Info-extract-menu-item (menu-item) |
| 1325 | (setq menu-item (regexp-quote menu-item)) | 1349 | (setq menu-item (regexp-quote menu-item)) |
| @@ -1862,6 +1886,7 @@ If no reference to follow, moves to the next node, or up if none." | |||
| 1862 | (define-key Info-mode-map "s" 'Info-search) | 1886 | (define-key Info-mode-map "s" 'Info-search) |
| 1863 | ;; For consistency with Rmail. | 1887 | ;; For consistency with Rmail. |
| 1864 | (define-key Info-mode-map "\M-s" 'Info-search) | 1888 | (define-key Info-mode-map "\M-s" 'Info-search) |
| 1889 | (define-key Info-mode-map "\M-n" 'clone-buffer) | ||
| 1865 | (define-key Info-mode-map "t" 'Info-top-node) | 1890 | (define-key Info-mode-map "t" 'Info-top-node) |
| 1866 | (define-key Info-mode-map "u" 'Info-up) | 1891 | (define-key Info-mode-map "u" 'Info-up) |
| 1867 | (define-key Info-mode-map "," 'Info-index-next) | 1892 | (define-key Info-mode-map "," 'Info-index-next) |
| @@ -2037,9 +2062,20 @@ Advanced commands: | |||
| 2037 | ;; This is for the sake of the invisible text we use handling titles. | 2062 | ;; This is for the sake of the invisible text we use handling titles. |
| 2038 | (make-local-variable 'line-move-ignore-invisible) | 2063 | (make-local-variable 'line-move-ignore-invisible) |
| 2039 | (setq line-move-ignore-invisible t) | 2064 | (setq line-move-ignore-invisible t) |
| 2065 | (add-hook (make-local-hook 'clone-buffer-hook) 'Info-clone-buffer-hook nil t) | ||
| 2040 | (Info-set-mode-line) | 2066 | (Info-set-mode-line) |
| 2041 | (run-hooks 'Info-mode-hook)) | 2067 | (run-hooks 'Info-mode-hook)) |
| 2042 | 2068 | ||
| 2069 | (defun Info-clone-buffer-hook () | ||
| 2070 | (when (bufferp Info-tag-table-buffer) | ||
| 2071 | (setq Info-tag-table-buffer | ||
| 2072 | (with-current-buffer Info-tag-table-buffer (clone-buffer))) | ||
| 2073 | (let ((m Info-tag-table-marker)) | ||
| 2074 | (when (and (markerp m) (marker-position m)) | ||
| 2075 | (setq Info-tag-table-marker | ||
| 2076 | (with-current-buffer Info-tag-table-buffer | ||
| 2077 | (copy-marker (marker-position m)))))))) | ||
| 2078 | |||
| 2043 | (defvar Info-edit-map nil | 2079 | (defvar Info-edit-map nil |
| 2044 | "Local keymap used within `e' command of Info.") | 2080 | "Local keymap used within `e' command of Info.") |
| 2045 | (if Info-edit-map | 2081 | (if Info-edit-map |