From: Eric M. Ludlam Date: Thu, 22 Jan 1998 23:50:25 +0000 (+0000) Subject: Added speedbar support function `Info-speedbar-buttons', X-Git-Tag: emacs-20.3~2319 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3cb6768fd7de118ae2f466384cc3a71dde99129a;p=emacs.git Added speedbar support function `Info-speedbar-buttons', `Info-speedbar-button', and `Info-speedbar-menu' --- 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 ?-)." (kill-buffer Info-tag-table-buffer))) (add-hook 'kill-buffer-hook 'Info-kill-buffer) - + +;;; Speedbar support: +;; These functions permit speedbar to display the "tags" in the +;; current info node. + +(eval-when-compile (require 'speedbspec)) + +(defvar Info-last-speedbar-node nil + "Last node viewed with speedbar in the form '(NODE FILE).") + +(defvar Info-speedbar-menu-items + '(["Browse Item On Line" speedbar-edit-line t]) + "Additional menu-items to add to speedbar frame.") + +(defun Info-speedbar-buttons (buffer) + "Create a speedbar display to help navigation in an Info file. +BUFFER is the buffer speedbar is requesting buttons for." + (goto-char (point-min)) + (if (and (looking-at "") + (save-excursion + (set-buffer buffer) + (and (equal (car Info-last-speedbar-node) Info-current-node) + (equal (cdr Info-last-speedbar-node) Info-current-file)))) + nil + (erase-buffer) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-directory) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-top-node) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-last) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-up) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-next) + (speedbar-insert-button "" 'info-xref 'highlight + 'Info-speedbar-button + 'Info-prev) + (let ((completions nil)) + (save-excursion + (set-buffer buffer) + (setq Info-last-speedbar-node + (cons Info-current-node Info-current-file)) + (goto-char (point-min)) + ;; Always skip the first one... + (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) + (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) + (setq completions (cons (buffer-substring (match-beginning 1) + (match-end 1)) + completions)))) + (setq completions (nreverse completions)) + (while completions + (speedbar-make-tag-line nil nil nil nil + (car completions) 'Info-speedbar-menu + nil 'info-node 0) + (setq completions (cdr completions)))))) + +(defun Info-speedbar-button (text token indent) + "Called when user clicks from speedbar. +TEXT, TOKEN, and INDENT are unused." + (speedbar-with-attached-buffer + (funcall token) + (setq Info-last-speedbar-node nil) + (speedbar-update-contents))) + +(defun Info-speedbar-menu (text token indent) + "Goto the menu node specified in TEXT. +TOKEN and INDENT are not used." + (speedbar-with-attached-buffer + (Info-menu text) + (setq Info-last-speedbar-node nil) + (speedbar-update-contents))) (provide 'info)