aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEric M. Ludlam1998-01-22 23:50:25 +0000
committerEric M. Ludlam1998-01-22 23:50:25 +0000
commit3cb6768fd7de118ae2f466384cc3a71dde99129a (patch)
tree92f6d015538189be71972cb344158ad8286e214c /lisp
parent19a4cb2526882531f2e85aee530595be9fefe1af (diff)
downloademacs-3cb6768fd7de118ae2f466384cc3a71dde99129a.tar.gz
emacs-3cb6768fd7de118ae2f466384cc3a71dde99129a.zip
Added speedbar support function `Info-speedbar-buttons',
`Info-speedbar-button', and `Info-speedbar-menu'
Diffstat (limited to 'lisp')
-rw-r--r--lisp/info.el78
1 files changed, 77 insertions, 1 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 0d677bd0850..931e3c1bc0c 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2052,7 +2052,83 @@ The alist key is the character the title is underlined with (?*, ?= or ?-)."
2052 (kill-buffer Info-tag-table-buffer))) 2052 (kill-buffer Info-tag-table-buffer)))
2053 2053
2054(add-hook 'kill-buffer-hook 'Info-kill-buffer) 2054(add-hook 'kill-buffer-hook 'Info-kill-buffer)
2055 2055
2056;;; Speedbar support:
2057;; These functions permit speedbar to display the "tags" in the
2058;; current info node.
2059
2060(eval-when-compile (require 'speedbspec))
2061
2062(defvar Info-last-speedbar-node nil
2063 "Last node viewed with speedbar in the form '(NODE FILE).")
2064
2065(defvar Info-speedbar-menu-items
2066 '(["Browse Item On Line" speedbar-edit-line t])
2067 "Additional menu-items to add to speedbar frame.")
2068
2069(defun Info-speedbar-buttons (buffer)
2070 "Create a speedbar display to help navigation in an Info file.
2071BUFFER is the buffer speedbar is requesting buttons for."
2072 (goto-char (point-min))
2073 (if (and (looking-at "<Directory>")
2074 (save-excursion
2075 (set-buffer buffer)
2076 (and (equal (car Info-last-speedbar-node) Info-current-node)
2077 (equal (cdr Info-last-speedbar-node) Info-current-file))))
2078 nil
2079 (erase-buffer)
2080 (speedbar-insert-button "<Directory>" 'info-xref 'highlight
2081 'Info-speedbar-button
2082 'Info-directory)
2083 (speedbar-insert-button "<Top>" 'info-xref 'highlight
2084 'Info-speedbar-button
2085 'Info-top-node)
2086 (speedbar-insert-button "<Last>" 'info-xref 'highlight
2087 'Info-speedbar-button
2088 'Info-last)
2089 (speedbar-insert-button "<Up>" 'info-xref 'highlight
2090 'Info-speedbar-button
2091 'Info-up)
2092 (speedbar-insert-button "<Next>" 'info-xref 'highlight
2093 'Info-speedbar-button
2094 'Info-next)
2095 (speedbar-insert-button "<Prev>" 'info-xref 'highlight
2096 'Info-speedbar-button
2097 'Info-prev)
2098 (let ((completions nil))
2099 (save-excursion
2100 (set-buffer buffer)
2101 (setq Info-last-speedbar-node
2102 (cons Info-current-node Info-current-file))
2103 (goto-char (point-min))
2104 ;; Always skip the first one...
2105 (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t)
2106 (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t)
2107 (setq completions (cons (buffer-substring (match-beginning 1)
2108 (match-end 1))
2109 completions))))
2110 (setq completions (nreverse completions))
2111 (while completions
2112 (speedbar-make-tag-line nil nil nil nil
2113 (car completions) 'Info-speedbar-menu
2114 nil 'info-node 0)
2115 (setq completions (cdr completions))))))
2116
2117(defun Info-speedbar-button (text token indent)
2118 "Called when user clicks <Directory> from speedbar.
2119TEXT, TOKEN, and INDENT are unused."
2120 (speedbar-with-attached-buffer
2121 (funcall token)
2122 (setq Info-last-speedbar-node nil)
2123 (speedbar-update-contents)))
2124
2125(defun Info-speedbar-menu (text token indent)
2126 "Goto the menu node specified in TEXT.
2127TOKEN and INDENT are not used."
2128 (speedbar-with-attached-buffer
2129 (Info-menu text)
2130 (setq Info-last-speedbar-node nil)
2131 (speedbar-update-contents)))
2056 2132
2057(provide 'info) 2133(provide 'info)
2058 2134