diff options
| author | Nick Roberts | 2005-10-17 21:10:48 +0000 |
|---|---|---|
| committer | Nick Roberts | 2005-10-17 21:10:48 +0000 |
| commit | 28126f297cf6a939bd25cf8407362857edaca267 (patch) | |
| tree | f80cbb11987366ead198af1968f9289e7a810b09 | |
| parent | 695bdd01076af84f6caa38feddf5309162c925ca (diff) | |
| download | emacs-28126f297cf6a939bd25cf8407362857edaca267.tar.gz emacs-28126f297cf6a939bd25cf8407362857edaca267.zip | |
(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.
| -rw-r--r-- | lisp/speedbar.el | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index bb813808ed9..e09c0d734cc 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -1106,7 +1106,8 @@ frame and window to be the currently active frame and window." | |||
| 1106 | (or (not dframe-xemacsp) | 1106 | (or (not dframe-xemacsp) |
| 1107 | (with-no-warnings | 1107 | (with-no-warnings |
| 1108 | (specifier-instance has-modeline-p))) | 1108 | (specifier-instance has-modeline-p))) |
| 1109 | speedbar-buffer) (save-excursion | 1109 | speedbar-buffer) |
| 1110 | (save-excursion | ||
| 1110 | (set-buffer speedbar-buffer) | 1111 | (set-buffer speedbar-buffer) |
| 1111 | (let* ((w (or (speedbar-frame-width) 20)) | 1112 | (let* ((w (or (speedbar-frame-width) 20)) |
| 1112 | (p1 "<<") | 1113 | (p1 "<<") |
| @@ -1677,9 +1678,8 @@ specialized speedbar displays." | |||
| 1677 | (speedbar-make-button start (point) face mouse function token)) | 1678 | (speedbar-make-button start (point) face mouse function token)) |
| 1678 | (let ((start (point))) | 1679 | (let ((start (point))) |
| 1679 | (insert "\n") | 1680 | (insert "\n") |
| 1680 | (put-text-property start (point) 'face nil) | 1681 | (add-text-properties |
| 1681 | (put-text-property start (point) 'invisible nil) | 1682 | start (point) '(face nil invisible nil mouse-face nil)))) |
| 1682 | (put-text-property start (point) 'mouse-face nil))) | ||
| 1683 | 1683 | ||
| 1684 | (defun speedbar-insert-separator (text) | 1684 | (defun speedbar-insert-separator (text) |
| 1685 | "Insert a separation label of TEXT. | 1685 | "Insert a separation label of TEXT. |
| @@ -1698,13 +1698,11 @@ Separators are not active, have no labels, depth, or actions." | |||
| 1698 | "Create a button from START to END, with FACE as the display face. | 1698 | "Create a button from START to END, with FACE as the display face. |
| 1699 | MOUSE is the mouse face. When this button is clicked on FUNCTION | 1699 | MOUSE is the mouse face. When this button is clicked on FUNCTION |
| 1700 | will be run with the TOKEN parameter (any Lisp object)" | 1700 | will be run with the TOKEN parameter (any Lisp object)" |
| 1701 | (put-text-property start end 'face face) | 1701 | (add-text-properties |
| 1702 | (put-text-property start end 'mouse-face mouse) | 1702 | start end `(face ,face mouse-face ,mouse invisible nil |
| 1703 | speedbar-text ,(buffer-substring-no-properties start end))) | ||
| 1703 | (if speedbar-use-tool-tips-flag | 1704 | (if speedbar-use-tool-tips-flag |
| 1704 | (put-text-property start end 'help-echo #'dframe-help-echo)) | 1705 | (put-text-property start end 'help-echo #'dframe-help-echo)) |
| 1705 | (put-text-property start end 'invisible nil) | ||
| 1706 | (put-text-property start end 'speedbar-text | ||
| 1707 | (buffer-substring-no-properties start end)) | ||
| 1708 | (if function (put-text-property start end 'speedbar-function function)) | 1706 | (if function (put-text-property start end 'speedbar-function function)) |
| 1709 | (if token (put-text-property start end 'speedbar-token token)) | 1707 | (if token (put-text-property start end 'speedbar-token token)) |
| 1710 | ;; So far the only text we have is less that 3 chars. | 1708 | ;; So far the only text we have is less that 3 chars. |
| @@ -2455,10 +2453,9 @@ name will have the function FIND-FUN and not token." | |||
| 2455 | (set-buffer speedbar-buffer) | 2453 | (set-buffer speedbar-buffer) |
| 2456 | (speedbar-with-writable | 2454 | (speedbar-with-writable |
| 2457 | (erase-buffer) | 2455 | (erase-buffer) |
| 2458 | (while funclst | 2456 | (dolist (func funclst) |
| 2459 | (setq default-directory cbd) | 2457 | (setq default-directory cbd) |
| 2460 | (funcall (car funclst) cbd 0) | 2458 | (funcall func cbd 0)) |
| 2461 | (setq funclst (cdr funclst))) | ||
| 2462 | (speedbar-reconfigure-keymaps) | 2459 | (speedbar-reconfigure-keymaps) |
| 2463 | (goto-char (point-min))) | 2460 | (goto-char (point-min))) |
| 2464 | )))) | 2461 | )))) |
| @@ -2535,10 +2532,9 @@ name will have the function FIND-FUN and not token." | |||
| 2535 | speedbar-shown-directories)) | 2532 | speedbar-shown-directories)) |
| 2536 | (insert (cdr cache))) | 2533 | (insert (cdr cache))) |
| 2537 | (t | 2534 | (t |
| 2538 | (while funclst | 2535 | (dolist (func funclst) |
| 2539 | (setq default-directory cbd) | 2536 | (setq default-directory cbd) |
| 2540 | (funcall (car funclst) cbd 0) | 2537 | (funcall func cbd 0))))) |
| 2541 | (setq funclst (cdr funclst)))))) | ||
| 2542 | (goto-char (point-min))))) | 2538 | (goto-char (point-min))))) |
| 2543 | (speedbar-reconfigure-keymaps)) | 2539 | (speedbar-reconfigure-keymaps)) |
| 2544 | 2540 | ||
| @@ -2561,11 +2557,10 @@ This should only be used by modes classified as special." | |||
| 2561 | speedbar-shown-directories nil)) | 2557 | speedbar-shown-directories nil)) |
| 2562 | ;; Now fill in the buffer with our newly found specialized list. | 2558 | ;; Now fill in the buffer with our newly found specialized list. |
| 2563 | (speedbar-with-writable | 2559 | (speedbar-with-writable |
| 2564 | (while funclst | 2560 | (dolist (func funclst) |
| 2565 | ;; We do not erase the buffer because these functions may | 2561 | ;; We do not erase the buffer because these functions may |
| 2566 | ;; decide NOT to update themselves. | 2562 | ;; decide NOT to update themselves. |
| 2567 | (funcall (car funclst) specialbuff) | 2563 | (funcall func specialbuff))) |
| 2568 | (setq funclst (cdr funclst)))) | ||
| 2569 | 2564 | ||
| 2570 | (goto-char (point-min)))) | 2565 | (goto-char (point-min)))) |
| 2571 | (speedbar-reconfigure-keymaps)) | 2566 | (speedbar-reconfigure-keymaps)) |
| @@ -3822,6 +3817,7 @@ regular expression EXPR." | |||
| 3822 | ["Contract File Tags" speedbar-contract-line | 3817 | ["Contract File Tags" speedbar-contract-line |
| 3823 | (save-excursion (beginning-of-line) | 3818 | (save-excursion (beginning-of-line) |
| 3824 | (looking-at "[0-9]+: *.-. "))] | 3819 | (looking-at "[0-9]+: *.-. "))] |
| 3820 | "----" | ||
| 3825 | ["Kill Buffer" speedbar-buffer-kill-buffer | 3821 | ["Kill Buffer" speedbar-buffer-kill-buffer |
| 3826 | (save-excursion (beginning-of-line) | 3822 | (save-excursion (beginning-of-line) |
| 3827 | (looking-at "[0-9]+: *.[-+?]. "))] | 3823 | (looking-at "[0-9]+: *.[-+?]. "))] |