diff options
author | Nick Roberts <nickrob@snap.net.nz> | 2006-02-17 00:26:14 +0000 |
---|---|---|
committer | Nick Roberts <nickrob@snap.net.nz> | 2006-02-17 00:26:14 +0000 |
commit | 160b7d8b868f1c36a819d545ca1a64ecd44e6616 (patch) | |
tree | ce2d7bb5bece168308141e37049ec0970a13554e /lisp/speedbar.el | |
parent | b32d1b9b0198a6e74906eb520e8d65ec836e2fec (diff) | |
download | emacs-160b7d8b868f1c36a819d545ca1a64ecd44e6616.tar.gz |
(speedbar-frame-width): Make an inline function
instead of a macro. Use frame-width.
(speedbar-try-completion, speedbar-update-contents)
(speedbar-timer-fn): Use consp.
(speedbar-update-localized-contents): Try to preserve point.
Diffstat (limited to 'lisp/speedbar.el')
-rw-r--r-- | lisp/speedbar.el | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index c3f949ead37..4e639c586f2 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -1019,10 +1019,10 @@ selected. If the speedbar frame is active, then select the attached frame." (lambda () (let ((speedbar-update-flag t)) (speedbar-timer-fn))))) -(defmacro speedbar-frame-width () +(defsubst speedbar-frame-width () "Return the width of the speedbar frame in characters. nil if it doesn't exist." - '(window-width (get-buffer-window speedbar-buffer))) + (frame-width speedbar-frame)) (defun speedbar-mode () "Major mode for managing a display of directories and tags. @@ -2123,7 +2123,7 @@ Groups may optionally contain a position." "A wrapper for `try-completion'. Passes STRING and ALIST to `try-completion' if ALIST passes some tests." - (if (and (listp alist) (not (null alist)) + (if (and (consp alist) (listp (car alist)) (stringp (car (car alist)))) (try-completion string alist) nil)) @@ -2423,8 +2423,7 @@ name will have the function FIND-FUN and not token." ;; Choose the correct method of doodling. (if (and speedbar-mode-specific-contents-flag - (listp speedbar-special-mode-expansion-list) - speedbar-special-mode-expansion-list + (consp speedbar-special-mode-expansion-list) (local-variable-p 'speedbar-special-mode-expansion-list (current-buffer))) @@ -2463,12 +2462,14 @@ name will have the function FIND-FUN and not token." ) (set-buffer speedbar-buffer) (speedbar-with-writable - (erase-buffer) - (dolist (func funclst) - (setq default-directory cbd) - (funcall func cbd 0)) - (speedbar-reconfigure-keymaps) - (goto-char (point-min))) + (let* ((window (get-buffer-window speedbar-buffer 0)) + (p (window-point window))) + (erase-buffer) + (dolist (func funclst) + (setq default-directory cbd) + (funcall func cbd 0)) + (speedbar-reconfigure-keymaps) + (set-window-point window p))) )))) (defun speedbar-update-directory-contents () @@ -2572,7 +2573,6 @@ This should only be used by modes classified as special." ;; We do not erase the buffer because these functions may ;; decide NOT to update themselves. (funcall func specialbuff))) - (goto-char (point-min)))) (speedbar-reconfigure-keymaps)) @@ -2614,8 +2614,7 @@ Also resets scanner functions." (speedbar-maybe-add-localized-support (current-buffer)) ;; Update for special mode all the time! (if (and speedbar-mode-specific-contents-flag - (listp speedbar-special-mode-expansion-list) - speedbar-special-mode-expansion-list + (consp speedbar-special-mode-expansion-list) (local-variable-p 'speedbar-special-mode-expansion-list (current-buffer))) |