# HG changeset patch # User Nick Roberts # Date 1129583448 0 # Node ID ce5979f4b405e1a78047dc7b9c987f1b17745b83 # Parent 9698655085d399084e5e72895c1ac1f56772844d (speedbar-set-mode-line-format): Indent properly. (speedbar-insert-button, speedbar-make-button): Use add-text-properties. (speedbar-update-localized-contents) (speedbar-update-directory-contents) (speedbar-update-special-contents): Use dolist. (speedbar-buffer-easymenu-definition): Add a menu separator. diff -r 9698655085d3 -r ce5979f4b405 lisp/speedbar.el --- a/lisp/speedbar.el Mon Oct 17 21:09:38 2005 +0000 +++ b/lisp/speedbar.el Mon Oct 17 21:10:48 2005 +0000 @@ -1106,7 +1106,8 @@ (or (not dframe-xemacsp) (with-no-warnings (specifier-instance has-modeline-p))) - speedbar-buffer) (save-excursion + speedbar-buffer) + (save-excursion (set-buffer speedbar-buffer) (let* ((w (or (speedbar-frame-width) 20)) (p1 "<<") @@ -1677,9 +1678,8 @@ (speedbar-make-button start (point) face mouse function token)) (let ((start (point))) (insert "\n") - (put-text-property start (point) 'face nil) - (put-text-property start (point) 'invisible nil) - (put-text-property start (point) 'mouse-face nil))) + (add-text-properties + start (point) '(face nil invisible nil mouse-face nil)))) (defun speedbar-insert-separator (text) "Insert a separation label of TEXT. @@ -1698,13 +1698,11 @@ "Create a button from START to END, with FACE as the display face. MOUSE is the mouse face. When this button is clicked on FUNCTION will be run with the TOKEN parameter (any Lisp object)" - (put-text-property start end 'face face) - (put-text-property start end 'mouse-face mouse) + (add-text-properties + start end `(face ,face mouse-face ,mouse invisible nil + speedbar-text ,(buffer-substring-no-properties start end))) (if speedbar-use-tool-tips-flag (put-text-property start end 'help-echo #'dframe-help-echo)) - (put-text-property start end 'invisible nil) - (put-text-property start end 'speedbar-text - (buffer-substring-no-properties start end)) (if function (put-text-property start end 'speedbar-function function)) (if token (put-text-property start end 'speedbar-token token)) ;; So far the only text we have is less that 3 chars. @@ -2455,10 +2453,9 @@ (set-buffer speedbar-buffer) (speedbar-with-writable (erase-buffer) - (while funclst + (dolist (func funclst) (setq default-directory cbd) - (funcall (car funclst) cbd 0) - (setq funclst (cdr funclst))) + (funcall func cbd 0)) (speedbar-reconfigure-keymaps) (goto-char (point-min))) )))) @@ -2535,10 +2532,9 @@ speedbar-shown-directories)) (insert (cdr cache))) (t - (while funclst - (setq default-directory cbd) - (funcall (car funclst) cbd 0) - (setq funclst (cdr funclst)))))) + (dolist (func funclst) + (setq default-directory cbd) + (funcall func cbd 0))))) (goto-char (point-min))))) (speedbar-reconfigure-keymaps)) @@ -2561,11 +2557,10 @@ speedbar-shown-directories nil)) ;; Now fill in the buffer with our newly found specialized list. (speedbar-with-writable - (while funclst - ;; We do not erase the buffer because these functions may - ;; decide NOT to update themselves. - (funcall (car funclst) specialbuff) - (setq funclst (cdr funclst)))) + (dolist (func funclst) + ;; 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)) @@ -3822,6 +3817,7 @@ ["Contract File Tags" speedbar-contract-line (save-excursion (beginning-of-line) (looking-at "[0-9]+: *.-. "))] + "----" ["Kill Buffer" speedbar-buffer-kill-buffer (save-excursion (beginning-of-line) (looking-at "[0-9]+: *.[-+?]. "))]