From 0cdffd7dd407452c8d60931736a5be52cf9ed7b6 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 21 May 2013 20:13:56 -0700 Subject: [PATCH] Small speedbar-related clean-up * lisp/dframe.el (x-sensitive-text-pointer-shape, x-pointer-shape): Remove unnecessary declarations. (dframe-message): Doc fix. * lisp/info.el (dframe-select-attached-frame, dframe-current-frame): Declare. * lisp/speedbar.el (speedbar-message): Make it an obsolete alias. Update all callers. (speedbar-with-attached-buffer) (speedbar-maybee-jump-to-attached-frame): Make these aliases obsolete. (speedbar-with-writable): Use backquote. * lisp/emacs-lisp/eieio-opt.el (eieio-describe-class-sb): * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-handle-click): Use dframe-with-attached-buffer, dframe-maybee-jump-to-attached-frame rather than speedbar- aliases. * lisp/mail/rmail.el: Load dframe rather than speedbar when compiling. (speedbar-make-specialized-keymap, speedbar-insert-button) (dframe-select-attached-frame, dframe-maybee-jump-to-attached-frame) (speedbar-do-function-pointer): Declare. (rmail-speedbar-button, rmail-speedbar-find-file) (rmail-speedbar-move-message): Use dframe-with-attached-buffer rather than speedbar- alias. * lisp/progmodes/gud.el: Load dframe rather than speedbar when compiling. (dframe-message, speedbar-make-specialized-keymap) (speedbar-add-expansion-list, speedbar-mode-functions-list) (speedbar-make-tag-line, speedbar-remove-localized-speedbar-support) (speedbar-insert-button, dframe-select-attached-frame) (dframe-maybee-jump-to-attached-frame) (speedbar-change-initial-expansion-list) (speedbar-previously-used-expansion-list-name): Declare. (gud-speedbar-item-info, gud-gdb-goto-stackframe): Use dframe-message, dframe-with-attached-buffer rather than speedbar- aliases. (gud-sentinel): Silence compiler. * lisp/progmodes/vhdl-mode.el (speedbar-refresh) (speedbar-do-function-pointer, speedbar-add-supported-extension) (speedbar-add-mode-functions-list, speedbar-make-specialized-keymap) (speedbar-change-initial-expansion-list, speedbar-add-expansion-list) (speedbar-extension-list-to-regex, speedbar-directory-buttons) (speedbar-file-lists, speedbar-make-tag-line) (speedbar-line-directory, speedbar-goto-this-file) (speedbar-center-buffer-smartly, speedbar-change-expand-button-char) (speedbar-delete-subblock, speedbar-position-cursor-on-line) (speedbar-make-button, speedbar-reset-scanners) (speedbar-files-item-info, speedbar-line-text) (speedbar-find-file-in-frame, speedbar-set-timer) (dframe-maybee-jump-to-attached-frame, speedbar-line-file): Declare. (speedbar-with-writable): Do not (re)define it. (vhdl-speedbar-find-file): Use dframe-maybee-jump-to-attached-frame rather than speedbar- alias. * lisp/cedet/ede/speedbar.el (ede-file-find, ede-tag-find): * lisp/cedet/semantic/sb.el (semantic-sb-token-jump): Use dframe-maybee-jump-to-attached-frame rather than speedbar- alias. * lisp/mh-e/mh-speed.el (mh-speed-view): Use dframe-with-attached-buffer rather than speedbar- alias. --- lisp/ChangeLog | 54 ++++++++++++++++++++++ lisp/cedet/ChangeLog | 6 +++ lisp/cedet/ede/speedbar.el | 4 +- lisp/cedet/semantic/sb.el | 2 +- lisp/dframe.el | 5 +- lisp/emacs-lisp/eieio-opt.el | 4 +- lisp/emacs-lisp/eieio-speedbar.el | 4 +- lisp/info.el | 6 ++- lisp/mail/rmail.el | 25 ++++++---- lisp/mh-e/ChangeLog | 5 ++ lisp/mh-e/mh-speed.el | 2 +- lisp/progmodes/gud.el | 35 ++++++++++---- lisp/progmodes/vhdl-mode.el | 58 ++++++++++++++++++++--- lisp/speedbar.el | 77 +++++++++++++++---------------- 14 files changed, 212 insertions(+), 75 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5a74fa4a21f..c97eb3b2cb7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,57 @@ +2013-05-22 Glenn Morris + + * dframe.el (x-sensitive-text-pointer-shape, x-pointer-shape): + Remove unnecessary declarations. + (dframe-message): Doc fix. + + * info.el (dframe-select-attached-frame, dframe-current-frame): + Declare. + + * speedbar.el (speedbar-message): Make it an obsolete alias. + Update all callers. + (speedbar-with-attached-buffer) + (speedbar-maybee-jump-to-attached-frame): Make these aliases obsolete. + (speedbar-with-writable): Use backquote. + * emacs-lisp/eieio-opt.el (eieio-describe-class-sb): + * emacs-lisp/eieio-speedbar.el (eieio-speedbar-handle-click): + Use dframe-with-attached-buffer, dframe-maybee-jump-to-attached-frame + rather than speedbar- aliases. + * mail/rmail.el: Load dframe rather than speedbar when compiling. + (speedbar-make-specialized-keymap, speedbar-insert-button) + (dframe-select-attached-frame, dframe-maybee-jump-to-attached-frame) + (speedbar-do-function-pointer): Declare. + (rmail-speedbar-button, rmail-speedbar-find-file) + (rmail-speedbar-move-message): + Use dframe-with-attached-buffer rather than speedbar- alias. + * progmodes/gud.el: Load dframe rather than speedbar when compiling. + (dframe-message, speedbar-make-specialized-keymap) + (speedbar-add-expansion-list, speedbar-mode-functions-list) + (speedbar-make-tag-line, speedbar-remove-localized-speedbar-support) + (speedbar-insert-button, dframe-select-attached-frame) + (dframe-maybee-jump-to-attached-frame) + (speedbar-change-initial-expansion-list) + (speedbar-previously-used-expansion-list-name): Declare. + (gud-speedbar-item-info, gud-gdb-goto-stackframe): + Use dframe-message, dframe-with-attached-buffer rather than + speedbar- aliases. + (gud-sentinel): Silence compiler. + * progmodes/vhdl-mode.el (speedbar-refresh) + (speedbar-do-function-pointer, speedbar-add-supported-extension) + (speedbar-add-mode-functions-list, speedbar-make-specialized-keymap) + (speedbar-change-initial-expansion-list, speedbar-add-expansion-list) + (speedbar-extension-list-to-regex, speedbar-directory-buttons) + (speedbar-file-lists, speedbar-make-tag-line) + (speedbar-line-directory, speedbar-goto-this-file) + (speedbar-center-buffer-smartly, speedbar-change-expand-button-char) + (speedbar-delete-subblock, speedbar-position-cursor-on-line) + (speedbar-make-button, speedbar-reset-scanners) + (speedbar-files-item-info, speedbar-line-text) + (speedbar-find-file-in-frame, speedbar-set-timer) + (dframe-maybee-jump-to-attached-frame, speedbar-line-file): Declare. + (speedbar-with-writable): Do not (re)define it. + (vhdl-speedbar-find-file): Use dframe-maybee-jump-to-attached-frame + rather than speedbar- alias. + 2013-05-21 Leo Liu * progmodes/octave.el (octave-mode-menu): Update and re-organize diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 0474559fe9e..486f1abfeda 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,9 @@ +2013-05-22 Glenn Morris + + * ede/speedbar.el (ede-file-find, ede-tag-find): + * semantic/sb.el (semantic-sb-token-jump): + Use dframe-maybee-jump-to-attached-frame rather than speedbar- alias. + 2013-05-15 Glenn Morris * semantic/symref/list.el (semantic-symref-auto-expand-results) diff --git a/lisp/cedet/ede/speedbar.el b/lisp/cedet/ede/speedbar.el index d963a56697a..0f3c96b1a7d 100644 --- a/lisp/cedet/ede/speedbar.el +++ b/lisp/cedet/ede/speedbar.el @@ -257,7 +257,7 @@ It has depth DEPTH." INDENT is the current indentation level." (speedbar-find-file-in-frame (expand-file-name token (speedbar-line-directory indent))) - (speedbar-maybee-jump-to-attached-frame)) + (dframe-maybee-jump-to-attached-frame)) (defun ede-create-tag-buttons (filename indent) "Create the tag buttons associated with FILENAME at INDENT." @@ -304,7 +304,7 @@ INDENT is the current indentation level." (goto-char token) (run-hooks 'speedbar-visiting-tag-hook) ;;(recenter) - (speedbar-maybee-jump-to-attached-frame) + (dframe-maybee-jump-to-attached-frame) )) ;;; EDE and the speedbar FILE display diff --git a/lisp/cedet/semantic/sb.el b/lisp/cedet/semantic/sb.el index f56c2b388d6..accee18f257 100644 --- a/lisp/cedet/semantic/sb.el +++ b/lisp/cedet/semantic/sb.el @@ -323,7 +323,7 @@ TEXT TOKEN and INDENT are the details." ;; that other timer. ;; (speedbar-set-timer dframe-update-speed) ;;(recenter) - (speedbar-maybee-jump-to-attached-frame) + (dframe-maybee-jump-to-attached-frame) (run-hooks 'speedbar-visiting-tag-hook))) (defun semantic-sb-expand-group (text token indent) diff --git a/lisp/dframe.el b/lisp/dframe.el index 7f3a586ada3..21b508512d3 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -243,9 +243,6 @@ Local to those buffers, as a function called that created it.") "Return non-nil if FRAME is currently available." (and frame (frame-live-p frame) (frame-visible-p frame))) -(defvar x-sensitive-text-pointer-shape) -(defvar x-pointer-shape) - (defun dframe-frame-mode (arg frame-var cache-var buffer-var frame-name local-mode-fn &optional @@ -681,7 +678,7 @@ Optionally select that frame if necessary." "Non-nil means that `dframe-message' should just return a string.") (defun dframe-message (fmt &rest args) - "Like message, but for use in a dedicated frame. + "Like `message', but for use in a dedicated frame. Argument FMT is the format string, and ARGS are the arguments for message." (save-selected-window (if dframe-suppress-message-flag diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 29ad980991b..27f97b31ebe 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -795,9 +795,9 @@ Argument INDENT is the depth of indentation." (defun eieio-describe-class-sb (text token indent) "Describe the class TEXT in TOKEN. INDENT is the current indentation level." - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (eieio-describe-class token)) - (speedbar-maybee-jump-to-attached-frame)) + (dframe-maybee-jump-to-attached-frame)) (provide 'eieio-opt) diff --git a/lisp/emacs-lisp/eieio-speedbar.el b/lisp/emacs-lisp/eieio-speedbar.el index c230226eae4..e964263754f 100644 --- a/lisp/emacs-lisp/eieio-speedbar.el +++ b/lisp/emacs-lisp/eieio-speedbar.el @@ -230,9 +230,9 @@ object edit buffer doing an in-place edit. If your object represents some other item, override this method and take the appropriate action." (require 'eieio-custom) - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (eieio-customize-object object)) - (speedbar-maybee-jump-to-attached-frame)) + (dframe-maybee-jump-to-attached-frame)) ;;; Class definitions diff --git a/lisp/info.el b/lisp/info.el index f67dc9ab987..b4673731383 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4985,7 +4985,7 @@ first line or header line, and for breadcrumb links.") ;;; Speedbar support: ;; These functions permit speedbar to display the "tags" in the ;; current Info node. -(eval-when-compile (require 'speedbar)) +(eval-when-compile (require 'speedbar)) ; for speedbar-with-writable (declare-function speedbar-add-expansion-list "speedbar" (new-list)) (declare-function speedbar-center-buffer-smartly "speedbar" ()) @@ -5047,6 +5047,10 @@ This will add a speedbar major display mode." (speedbar-change-initial-expansion-list "Info") ) +;; speedbar loads dframe at runtime. +(declare-function dframe-select-attached-frame "dframe" (&optional frame)) +(declare-function dframe-current-frame "dframe" (frame-var desired-major-mode)) + (defun Info-speedbar-hierarchy-buttons (_directory depth &optional node) "Display an Info directory hierarchy in speedbar. DIRECTORY is the current directory in the attached frame. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index af7ad220595..e29becedb6e 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4310,8 +4310,6 @@ This has an effect only if a summary buffer exists." (restore-buffer-modified-p nil))))))) ;;; Speedbar support for RMAIL files. -(eval-when-compile (require 'speedbar)) - (defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$" "Regexp matching Rmail folder names to be displayed in Speedbar. Enabling this permits Speedbar to display your folders for easy @@ -4326,12 +4324,12 @@ browsing, and moving of messages." (defvar rmail-speedbar-key-map nil "Keymap used when in rmail display mode.") +(declare-function speedbar-make-specialized-keymap "speedbar" ()) + (defun rmail-install-speedbar-variables () "Install those variables used by speedbar to enhance rmail." - (if rmail-speedbar-key-map - nil + (unless rmail-speedbar-key-map (setq rmail-speedbar-key-map (speedbar-make-specialized-keymap)) - (define-key rmail-speedbar-key-map "e" 'speedbar-edit-line) (define-key rmail-speedbar-key-map "r" 'speedbar-edit-line) (define-key rmail-speedbar-key-map "\C-m" 'speedbar-edit-line) @@ -4346,6 +4344,9 @@ browsing, and moving of messages." (looking-at " "))]) "Additional menu-items to add to speedbar frame.") +(declare-function speedbar-insert-button "speedbar" + (text face mouse function &optional token prevline)) + ;; Make sure our special speedbar major mode is loaded (if (featurep 'speedbar) (rmail-install-speedbar-variables) @@ -4387,19 +4388,27 @@ current message into that RMAIL folder." (speedbar-insert-button file 'speedbar-file-face 'highlight 'rmail-speedbar-find-file nil t))))))) +(eval-when-compile (require 'dframe)) +;; Part of the macro expansion of dframe-with-attached-buffer. +;; At runtime, will be pulled in as a require of speedbar. +(declare-function dframe-select-attached-frame "dframe" (&optional frame)) +(declare-function dframe-maybee-jump-to-attached-frame "dframe" ()) + (defun rmail-speedbar-button (text token indent) "Execute an rmail command specified by TEXT. The command used is TOKEN. INDENT is not used." - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (funcall token t))) (defun rmail-speedbar-find-file (text token indent) "Load in the rmail file TEXT. TOKEN and INDENT are not used." - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (message "Loading in RMAIL file %s..." text) (rmail text))) +(declare-function speedbar-do-function-pointer "speedbar" ()) + (defun rmail-speedbar-move-message-to-folder-on-line () "If the current line is a folder, move current message to it." (interactive) @@ -4413,7 +4422,7 @@ TOKEN and INDENT are not used." (defun rmail-speedbar-move-message (text token indent) "From button TEXT, copy current message to the rmail file specified by TOKEN. TEXT and INDENT are not used." - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (message "Moving message to %s" token) ;; expand-file-name is needed due to the unhelpful way in which ;; rmail-output expands non-absolute filenames against rmail-default-file. diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index d85ae04a16c..3db1780af63 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog @@ -1,3 +1,8 @@ +2013-05-22 Glenn Morris + + * mh-speed.el (mh-speed-view): + Use dframe-with-attached-buffer rather than speedbar- alias. + 2013-05-21 Glenn Morris * mh-comp.el (mh-regexp-in-field-p): Fix previous change. diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index eb36ffed64b..bae019f8926 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -175,7 +175,7 @@ The optional arguments from speedbar are IGNORED." (mh-read-range "Scan" folder t nil nil mh-interpret-number-as-range-flag)))) (when (stringp folder) - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (mh-visit-folder folder range) (delete-other-windows))))) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 9ee4aae1da6..212d3894091 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -413,7 +413,7 @@ we're in the GUD buffer)." ;; ====================================================================== ;; speedbar support functions and variables. -(eval-when-compile (require 'speedbar)) ;For speedbar-with-attached-buffer. +(eval-when-compile (require 'dframe)) ; for dframe-with-attached-buffer (defvar gud-last-speedbar-stackframe nil "Description of the currently displayed GUD stack. @@ -422,19 +422,24 @@ The value t means that there is no stack, and we are in display-file mode.") (defvar gud-speedbar-key-map nil "Keymap used when in the buffers display mode.") +;; At runtime, will be pulled in as a require of speedbar. +(declare-function dframe-message "dframe" (fmt &rest args)) + (defun gud-speedbar-item-info () "Display the data type of the watch expression element." (let ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))) (if (nth 7 var) - (speedbar-message "%s: %s" (nth 7 var) (nth 3 var)) - (speedbar-message "%s" (nth 3 var))))) + (dframe-message "%s: %s" (nth 7 var) (nth 3 var)) + (dframe-message "%s" (nth 3 var))))) + +(declare-function speedbar-make-specialized-keymap "speedbar" ()) +(declare-function speedbar-add-expansion-list "speedbar" (new-list)) +(defvar speedbar-mode-functions-list) (defun gud-install-speedbar-variables () "Install those variables used by speedbar to enhance gud/gdb." - (if gud-speedbar-key-map - nil + (unless gud-speedbar-key-map (setq gud-speedbar-key-map (speedbar-make-specialized-keymap)) - (define-key gud-speedbar-key-map "j" 'speedbar-edit-line) (define-key gud-speedbar-key-map "e" 'speedbar-edit-line) (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line) @@ -483,6 +488,13 @@ The value t means that there is no stack, and we are in display-file mode.") DIRECTORY and ZERO are not used, but are required by the caller." (gud-speedbar-buttons gud-comint-buffer)) +(declare-function speedbar-make-tag-line "speedbar" + (type char func data tag tfunc tdata tface depth)) +(declare-function speedbar-remove-localized-speedbar-support "speedbar" + (buffer)) +(declare-function speedbar-insert-button "speedbar" + (text face mouse function &optional token prevline)) + (defun gud-speedbar-buttons (buffer) "Create a speedbar display based on the current state of GUD. If the GUD BUFFER is not running a supported debugger, then turn @@ -881,9 +893,14 @@ It is passed through `gud-gdb-marker-filter' before we look at it." ;; gdb speedbar functions +;; Part of the macro expansion of dframe-with-attached-buffer. +;; At runtime, will be pulled in as a require of speedbar. +(declare-function dframe-select-attached-frame "dframe" (&optional frame)) +(declare-function dframe-maybee-jump-to-attached-frame "dframe" ()) + (defun gud-gdb-goto-stackframe (_text token _indent) "Goto the stackframe described by TEXT, TOKEN, and INDENT." - (speedbar-with-attached-buffer + (dframe-with-attached-buffer (gud-basic-call (concat "server frame " (nth 1 token))) (sit-for 1))) @@ -2633,6 +2650,8 @@ It is saved for when this flag is not set.") (add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position) (declare-function gdb-reset "gdb-mi" ()) +(declare-function speedbar-change-initial-expansion-list "speedbar" (new)) +(defvar speedbar-previously-used-expansion-list-name) (defun gud-sentinel (proc msg) (cond ((null (buffer-name (process-buffer proc))) @@ -2640,7 +2659,7 @@ It is saved for when this flag is not set.") ;; Stop displaying an arrow in a source file. (setq gud-overlay-arrow-position nil) (set-process-buffer proc nil) - (if (and (boundp 'speedbar-frame) + (if (and (boundp 'speedbar-initial-expansion-list-name) (string-equal speedbar-initial-expansion-list-name "GUD")) (speedbar-change-initial-expansion-list speedbar-previously-used-expansion-list-name)) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 4c3ae340ab8..0050a94513a 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -2135,7 +2135,7 @@ your style, only those that are different from the default.") (eval-when-compile (require 'font-lock) (require 'ps-print) - (require 'speedbar))) + (require 'speedbar))) ; for speedbar-with-writable ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -2553,6 +2553,9 @@ conversion." (setcdr list1 (cddr list1)))) (cdr list)) +(declare-function speedbar-refresh "speedbar" (&optional arg)) +(declare-function speedbar-do-function-pointer "speedbar" ()) + (defun vhdl-speedbar-refresh (&optional key) "Refresh directory or project with name KEY." (when (and (boundp 'speedbar-frame) @@ -14515,6 +14518,13 @@ if required." (defvar vhdl-speedbar-menu-items nil "Additional menu-items to add to speedbar frame.") +(declare-function speedbar-add-supported-extension "speedbar" (extension)) +(declare-function speedbar-add-mode-functions-list "speedbar" (new-list)) +(declare-function speedbar-make-specialized-keymap "speedbar" ()) +(declare-function speedbar-change-initial-expansion-list "speedbar" + (new-default)) +(declare-function speedbar-add-expansion-list "speedbar" (new-list)) + (defun vhdl-speedbar-initialize () "Initialize speedbar." ;; general settings @@ -14644,11 +14654,15 @@ if required." "Name of last selected project.") ;; macros must be defined in the file they are used (copied from `speedbar.el') -(defmacro speedbar-with-writable (&rest forms) - "Allow the buffer to be writable and evaluate FORMS." - (list 'let '((inhibit-read-only t)) - (cons 'progn forms))) -(put 'speedbar-with-writable 'lisp-indent-function 0) +;;; (defmacro speedbar-with-writable (&rest forms) +;;; "Allow the buffer to be writable and evaluate FORMS." +;;; (list 'let '((inhibit-read-only t)) +;;; (cons 'progn forms))) +;;; (put 'speedbar-with-writable 'lisp-indent-function 0) + +(declare-function speedbar-extension-list-to-regex "speedbar" (extlist)) +(declare-function speedbar-directory-buttons "speedbar" (directory _index)) +(declare-function speedbar-file-lists "speedbar" (directory)) (defun vhdl-speedbar-display-directory (directory depth &optional rescan) "Display directory and hierarchy information in speedbar." @@ -14684,6 +14698,9 @@ if required." (error (vhdl-warning-when-idle "ERROR: Invalid hierarchy information, unable to display correctly")))) (setq speedbar-full-text-cache nil)) ; prevent caching +(declare-function speedbar-make-tag-line "speedbar" + (type char func data tag tfunc tdata tface depth)) + (defun vhdl-speedbar-insert-projects () "Insert all projects in speedbar." (vhdl-speedbar-make-title-line "Projects:") @@ -14787,6 +14804,8 @@ otherwise use cached data." depth) (setq pack-alist (cdr pack-alist)))))) +(declare-function speedbar-line-directory "speedbar" (&optional depth)) + (defun vhdl-speedbar-rescan-hierarchy () "Rescan hierarchy for the directory or project under the cursor." (interactive) @@ -14808,6 +14827,8 @@ otherwise use cached data." (abbreviate-file-name (match-string 1 path))))) (vhdl-speedbar-refresh key))) +(declare-function speedbar-goto-this-file "speedbar" (file)) + (defun vhdl-speedbar-expand-dirs (directory) "Expand subdirectories in DIRECTORY according to `speedbar-shown-directories'." @@ -14857,6 +14878,8 @@ otherwise use cached data." (setq unit-alist (cdr unit-alist)))))) (vhdl-speedbar-update-current-unit nil t)) +(declare-function speedbar-center-buffer-smartly "speedbar" ()) + (defun vhdl-speedbar-contract-level () "Contract current level in current directory/project." (interactive) @@ -14912,6 +14935,9 @@ otherwise use cached data." (when (memq 'display vhdl-speedbar-save-cache) (add-to-list 'vhdl-updated-project-list key)))) +(declare-function speedbar-change-expand-button-char "speedbar" (char)) +(declare-function speedbar-delete-subblock "speedbar" (indent)) + (defun vhdl-speedbar-expand-project (text token indent) "Expand/contract the project under the cursor." (cond @@ -15240,6 +15266,8 @@ otherwise use cached data." (setq vhdl-speedbar-last-selected-project vhdl-project))) t) +(declare-function speedbar-position-cursor-on-line "speedbar" ()) + (defun vhdl-speedbar-update-current-unit (&optional no-position always) "Highlight all design units that are contained in the current file. NO-POSITION non-nil means do not re-position cursor." @@ -15329,6 +15357,9 @@ NO-POSITION non-nil means do not re-position cursor." (setq unit-list (cdr unit-list))) pos) +(declare-function speedbar-make-button "speedbar" + (start end face mouse function &optional token)) + (defun vhdl-speedbar-make-inst-line (inst-name inst-file-marker ent-name ent-file-marker arch-name arch-file-marker @@ -15515,6 +15546,8 @@ NO-POSITION non-nil means do not re-position cursor." 'speedbar-directory-face level) (setq dirs (cdr dirs))))) +(declare-function speedbar-reset-scanners "speedbar" ()) + (defun vhdl-speedbar-dired (text token indent) "Speedbar click handler for directory expand button in hierarchy mode." (cond ((string-match "+" text) ; we have to expand this dir @@ -15554,6 +15587,8 @@ NO-POSITION non-nil means do not re-position cursor." (when (equal (selected-frame) speedbar-frame) (speedbar-center-buffer-smartly))) +(declare-function speedbar-files-item-info "speedbar" ()) + (defun vhdl-speedbar-item-info () "Derive and display information about this line item." (save-excursion @@ -15602,6 +15637,8 @@ NO-POSITION non-nil means do not re-position cursor." (vhdl-default-directory))))) (t (message ""))))) +(declare-function speedbar-line-text "speedbar" (&optional p)) + (defun vhdl-speedbar-line-text () "Calls `speedbar-line-text' and removes text properties." (let ((string (speedbar-line-text))) @@ -15696,6 +15733,11 @@ NO-POSITION non-nil means do not re-position cursor." (goto-char dest) nil))) +(declare-function speedbar-find-file-in-frame "speedbar" (file)) +(declare-function speedbar-set-timer "speedbar" (timeout)) +;; speedbar loads dframe at runtime. +(declare-function dframe-maybee-jump-to-attached-frame "dframe" ()) + (defun vhdl-speedbar-find-file (text token indent) "When user clicks on TEXT, load file with name and position in TOKEN. Jump to the design unit if `vhdl-speedbar-jump-to-unit' is t or if the file @@ -15709,7 +15751,7 @@ is already shown in a buffer." (recenter)) (vhdl-speedbar-update-current-unit t t) (speedbar-set-timer dframe-update-speed) - (speedbar-maybee-jump-to-attached-frame)))) + (dframe-maybee-jump-to-attached-frame)))) (defun vhdl-speedbar-port-copy () "Copy the port of the entity/component or subprogram under the cursor." @@ -15769,6 +15811,8 @@ is already shown in a buffer." (setcar (cddr (cddr ent-entry)) arch-key) ; (nth 4 ent-entry) (speedbar-refresh)))) +(declare-function speedbar-line-file "speedbar" (&optional p)) + (defun vhdl-speedbar-make-design () "Make (compile) design unit or directory/project under the cursor." (interactive) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 70bf5f41518..9daa77b740f 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -73,7 +73,7 @@ this version is not backward compatible to 0.14 or earlier.") ;; `speedbar-insert-generic-list'. If you use ;; `speedbar-insert-generic-list', also read the doc for ;; `speedbar-tag-hierarchy-method' in case you wish to override it. -;; The macro `speedbar-with-attached-buffer' brings you back to the +;; The macro `dframe-with-attached-buffer' brings you back to the ;; buffer speedbar is displaying for. ;; ;; For those functions that make buttons, the "function" should be a @@ -1137,10 +1137,7 @@ in the selected file. dframe-mouse-position-function #'speedbar-position-cursor-on-line)) speedbar-buffer) -(defmacro speedbar-message (fmt &rest args) - "Like `message', but for use in the speedbar frame. -Argument FMT is the format string, and ARGS are the arguments for message." - `(dframe-message ,fmt ,@args)) +(define-obsolete-function-alias 'speedbar-message 'dframe-message "24.4") (defsubst speedbar-y-or-n-p (prompt &optional deleting) "Like `y-or-n-p', but for use in the speedbar frame. @@ -1157,8 +1154,10 @@ return true without a query." (dframe-select-attached-frame (speedbar-current-frame))) ;; Backwards compatibility -(defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer) -(defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame) +(define-obsolete-function-alias 'speedbar-with-attached-buffer + 'dframe-with-attached-buffer "24.4") ; macro +(define-obsolete-function-alias 'speedbar-maybee-jump-to-attached-frame + 'dframe-maybee-jump-to-attached-frame "24.4") (defun speedbar-set-mode-line-format () "Set the format of the mode line based on the current speedbar environment. @@ -1285,7 +1284,7 @@ and the existence of packages." (if (eq major-mode 'speedbar-mode) ;; XEmacs may let us get in here in other mode buffers. (speedbar-item-info))) - (error (speedbar-message nil))))))) + (error (dframe-message nil))))))) (defun speedbar-show-info-under-mouse () "Call the info function for the line under the mouse." @@ -1417,13 +1416,13 @@ Argument ARG represents to force a refresh past any caches that may exist." (delq (assoc d speedbar-directory-contents-alist) speedbar-directory-contents-alist))) (if (<= 1 speedbar-verbosity-level) - (speedbar-message "Refreshing speedbar...")) + (dframe-message "Refreshing speedbar...")) (speedbar-update-contents) (speedbar-stealthy-updates) ;; Reset the timer in case it got really hosed for some reason... (speedbar-set-timer dframe-update-speed) (if (<= 1 speedbar-verbosity-level) - (speedbar-message "Refreshing speedbar...done")))) + (dframe-message "Refreshing speedbar...done")))) (defun speedbar-item-load () "Load the item under the cursor or mouse if it is a Lisp file." @@ -1467,7 +1466,7 @@ File style information is displayed with `speedbar-item-info'." ;; Skip items in "folder" type text characters. (if (looking-at "\\s-*[[<({].[]>)}] ") (goto-char (match-end 0))) ;; Get the text - (speedbar-message "Text: %s" (buffer-substring-no-properties + (dframe-message "Text: %s" (buffer-substring-no-properties (point) (line-end-position))))) (defun speedbar-item-info () @@ -1485,7 +1484,7 @@ Return nil if not applicable. If FILENAME, then use that instead of reading it from the speedbar buffer." (let* ((item (or filename (speedbar-line-file))) (attr (if item (file-attributes item) nil))) - (if (and item attr) (speedbar-message "%s %-6d %s" (nth 8 attr) + (if (and item attr) (dframe-message "%s %-6d %s" (nth 8 attr) (nth 7 attr) item) nil))) @@ -1506,14 +1505,14 @@ Return nil if not applicable." (when (and (semantic-tag-overlay attr) (semantic-tag-buffer attr)) (set-buffer (semantic-tag-buffer attr))) - (speedbar-message + (dframe-message (funcall semantic-sb-info-format-tag-function attr) ))) (looking-at "\\([0-9]+\\):") (setq item (file-name-nondirectory (speedbar-line-directory))) - (speedbar-message "Tag: %s in %s" tag item))) + (dframe-message "Tag: %s in %s" tag item))) (if (re-search-forward "{[+-]} \\([^\n]+\\)$" (line-end-position) t) - (speedbar-message "Group of tags \"%s\"" (match-string 1)) + (dframe-message "Group of tags \"%s\"" (match-string 1)) (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t) (let* ((detailtext (match-string 1)) (detail (or (speedbar-line-token) detailtext)) @@ -1532,18 +1531,18 @@ Return nil if not applicable." (if (featurep 'semantic) (with-no-warnings (if (semantic-tag-p detail) - (speedbar-message + (dframe-message (funcall semantic-sb-info-format-tag-function detail parent)) (if parent - (speedbar-message "Detail: %s of tag %s" detail + (dframe-message "Detail: %s of tag %s" detail (if (semantic-tag-p parent) (semantic-format-tag-name parent nil t) parent)) - (speedbar-message "Detail: %s" detail)))) + (dframe-message "Detail: %s" detail)))) ;; Not using `semantic': (if parent - (speedbar-message "Detail: %s of tag %s" detail parent) - (speedbar-message "Detail: %s" detail)))) + (dframe-message "Detail: %s of tag %s" detail parent) + (dframe-message "Detail: %s" detail)))) nil))))) (defun speedbar-files-item-info () @@ -1641,7 +1640,7 @@ Files can be renamed to new names or moved to new directories." (if (file-directory-p f) (delete-directory f t t) (delete-file f t)) - (speedbar-message "Okie dokie.") + (dframe-message "Okie dokie.") (let ((p (point))) (speedbar-refresh) (goto-char p)) @@ -1706,9 +1705,9 @@ variable `speedbar-obj-alist'." (defmacro speedbar-with-writable (&rest forms) "Allow the buffer to be writable and evaluate FORMS." - (list 'let '((inhibit-read-only t)) - (cons 'progn forms))) -(put 'speedbar-with-writable 'lisp-indent-function 0) + (declare (indent 0)) + `(let ((inhibit-read-only t)) + ,@forms)) (defun speedbar-insert-button (text face mouse function &optional token prevline) @@ -2437,7 +2436,7 @@ name will have the function FIND-FUN and not token." (car (car lst)) ;button name nil nil 'speedbar-tag-face (1+ level))) - (t (speedbar-message "speedbar-insert-generic-list: malformed list!") + (t (dframe-message "speedbar-insert-generic-list: malformed list!") )) (setq lst (cdr lst))))) @@ -2492,14 +2491,14 @@ name will have the function FIND-FUN and not token." (expand-file-name default-directory)))) nil (if (<= 1 speedbar-verbosity-level) - (speedbar-message "Updating speedbar to: %s..." + (dframe-message "Updating speedbar to: %s..." default-directory)) (speedbar-update-directory-contents) (if (<= 1 speedbar-verbosity-level) (progn - (speedbar-message "Updating speedbar to: %s...done" + (dframe-message "Updating speedbar to: %s...done" default-directory) - (speedbar-message nil)))) + (dframe-message nil)))) ;; Else, we can do a short cut. No text cache. (let ((cbd (expand-file-name default-directory))) (set-buffer speedbar-buffer) @@ -2662,16 +2661,16 @@ Also resets scanner functions." ;;(eq (get major-mode 'mode-class 'special))) (progn (if (<= 2 speedbar-verbosity-level) - (speedbar-message + (dframe-message "Updating speedbar to special mode: %s..." major-mode)) (speedbar-update-special-contents) (if (<= 2 speedbar-verbosity-level) (progn - (speedbar-message + (dframe-message "Updating speedbar to special mode: %s...done" major-mode) - (speedbar-message nil)))) + (dframe-message nil)))) ;; Update all the contents if directories change! (unless (and (or (member major-mode speedbar-ignored-modes) @@ -2704,7 +2703,7 @@ interrupted by the user." (while (and l (funcall (car l))) ;;(sit-for 0) (setq l (cdr l)))) - ;;(speedbar-message "Exit with %S" (car l)) + ;;(dframe-message "Exit with %S" (car l)) )))) (defun speedbar-reset-scanners () @@ -2944,7 +2943,7 @@ the file being checked." (point)))) (fulln (concat f fn))) (if (<= 2 speedbar-verbosity-level) - (speedbar-message "Speedbar vc check...%s" fulln)) + (dframe-message "Speedbar vc check...%s" fulln)) (and (file-writable-p fulln) (speedbar-this-file-in-vc f fn)))) @@ -3016,7 +3015,7 @@ the file being checked." (point)))) (fulln (concat f fn))) (if (<= 2 speedbar-verbosity-level) - (speedbar-message "Speedbar obj check...%s" fulln)) + (dframe-message "Speedbar obj check...%s" fulln)) (let ((oa speedbar-obj-alist)) (while (and oa (not (string-match (car (car oa)) fulln))) (setq oa (cdr oa))) @@ -3076,7 +3075,7 @@ a function if appropriate." (buffer-substring-no-properties (match-beginning 0) (match-end 0)) "0"))))) - ;;(speedbar-message "%S:%S:%S:%s" fn tok txt dent) + ;;(dframe-message "%S:%S:%S:%s" fn tok txt dent) (and fn (funcall fn txt tok dent))) (speedbar-position-cursor-on-line)) @@ -3697,14 +3696,14 @@ Each symbol will be associated with its line position in FILE." (if (get-buffer "*etags tmp*") (kill-buffer "*etags tmp*")) ;kill to clean it up (if (<= 1 speedbar-verbosity-level) - (speedbar-message "Fetching etags...")) + (dframe-message "Fetching etags...")) (set-buffer (get-buffer-create "*etags tmp*")) (apply 'call-process speedbar-fetch-etags-command nil (current-buffer) nil (append speedbar-fetch-etags-arguments (list file))) (goto-char (point-min)) (if (<= 1 speedbar-verbosity-level) - (speedbar-message "Fetching etags...")) + (dframe-message "Fetching etags...")) (let ((expr (let ((exprlst speedbar-fetch-etags-parse-list) (ans nil)) @@ -3721,7 +3720,7 @@ Each symbol will be associated with its line position in FILE." (setq tnl (speedbar-extract-one-symbol expr))) (if tnl (setq newlist (cons tnl newlist))) (forward-line 1))) - (speedbar-message + (dframe-message "Sorry, no support for a file of that extension")))) ) (if speedbar-sort-tags @@ -3908,7 +3907,7 @@ Argument BUFFER is the buffer being tested." (let* ((item (speedbar-line-text)) (buffer (if item (get-buffer item) nil))) (and buffer - (speedbar-message "%s%s %S %d %s" + (dframe-message "%s%s %S %d %s" (if (buffer-modified-p buffer) "* " "") item (with-current-buffer buffer major-mode) -- 2.39.2