diff options
| author | Eric M. Ludlam | 1998-08-08 21:20:51 +0000 |
|---|---|---|
| committer | Eric M. Ludlam | 1998-08-08 21:20:51 +0000 |
| commit | fd7bd989f8ea8e28fe5f1d5ec6ff2d72d6496a80 (patch) | |
| tree | 59d59fa4d2637e154a57f6baf01899895e20da17 | |
| parent | da427818a9e5d8d285a474e931aa0b24056d2c94 (diff) | |
| download | emacs-fd7bd989f8ea8e28fe5f1d5ec6ff2d72d6496a80.tar.gz emacs-fd7bd989f8ea8e28fe5f1d5ec6ff2d72d6496a80.zip | |
(speedbar-edit-line, speedbar-buffer-kill-buffer,
speedbar-buffer-revert-buffer): Updated buffer finding regex to
handle the [?] tag.
(speedbar-find-selected-file): New function.
(speedbar-clear-current-file): Uses `speedbar-find-selected-file'
(speedbar-update-current-file): Uses `speedbar-find-selected-file',
and now `speedbar-last-selected-file' is defined as the path name
to the file, not just the file itself.
(speedbar-center-buffer-smartly): Fixed center error to handle
the whole buffer.
(speedbar-delete-subblock): Rewrote to be more robust, less clever.
(speedbar-timer-fn): Removed short display time for messages.
| -rw-r--r-- | lisp/speedbar.el | 84 |
1 files changed, 47 insertions, 37 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index d2d2865bde9..5d1e3d32bd5 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | ;;; Copyright (C) 1996, 97, 98 Free Software Foundation | 3 | ;;; Copyright (C) 1996, 97, 98 Free Software Foundation |
| 4 | 4 | ||
| 5 | ;; Author: Eric M. Ludlam <zappo@gnu.org> | 5 | ;; Author: Eric M. Ludlam <zappo@gnu.org> |
| 6 | ;; Version: 0.7.1 | 6 | ;; Version: 0.7.2 |
| 7 | ;; Keywords: file, tags, tools | 7 | ;; Keywords: file, tags, tools |
| 8 | ;; X-RCS: $Id: speedbar.el,v 1.5 1998/08/03 17:47:39 zappo Exp zappo $ | 8 | ;; X-RCS: $Id: speedbar.el,v 1.6 1998/08/04 13:58:39 zappo Exp zappo $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -2551,7 +2551,6 @@ This should only be used by modes classified as special." | |||
| 2551 | (progn | 2551 | (progn |
| 2552 | (message "Updating speedbar to special mode: %s...done" | 2552 | (message "Updating speedbar to special mode: %s...done" |
| 2553 | major-mode) | 2553 | major-mode) |
| 2554 | (sit-for 1) | ||
| 2555 | (message nil)))) | 2554 | (message nil)))) |
| 2556 | ;; Update all the contents if directories change! | 2555 | ;; Update all the contents if directories change! |
| 2557 | (if (or (member (expand-file-name default-directory) | 2556 | (if (or (member (expand-file-name default-directory) |
| @@ -2572,7 +2571,6 @@ This should only be used by modes classified as special." | |||
| 2572 | (progn | 2571 | (progn |
| 2573 | (message "Updating speedbar to: %s...done" | 2572 | (message "Updating speedbar to: %s...done" |
| 2574 | default-directory) | 2573 | default-directory) |
| 2575 | (sit-for 1) | ||
| 2576 | (message nil))))) | 2574 | (message nil))))) |
| 2577 | (select-frame af)) | 2575 | (select-frame af)) |
| 2578 | ;; Now run stealthy updates of time-consuming items | 2576 | ;; Now run stealthy updates of time-consuming items |
| @@ -2609,19 +2607,36 @@ If new functions are added, their state needs to be updated here." | |||
| 2609 | (run-hooks 'speedbar-scanner-reset-hook) | 2607 | (run-hooks 'speedbar-scanner-reset-hook) |
| 2610 | ) | 2608 | ) |
| 2611 | 2609 | ||
| 2610 | (defun speedbar-find-selected-file (file) | ||
| 2611 | "Goto the line where FILE is." | ||
| 2612 | (goto-char (point-min)) | ||
| 2613 | (let ((m nil)) | ||
| 2614 | (while (and (setq m (re-search-forward | ||
| 2615 | (concat " \\(" (file-name-nondirectory file) | ||
| 2616 | "\\)\\(" speedbar-indicator-regex "\\)?\n") | ||
| 2617 | nil t)) | ||
| 2618 | (not (string= file | ||
| 2619 | (concat | ||
| 2620 | (speedbar-line-path | ||
| 2621 | (save-excursion | ||
| 2622 | (goto-char (match-beginning 0)) | ||
| 2623 | (beginning-of-line) | ||
| 2624 | (save-match-data | ||
| 2625 | (looking-at "[0-9]+:") | ||
| 2626 | (string-to-number (match-string 0))))) | ||
| 2627 | (match-string 1)))))) | ||
| 2628 | (if m | ||
| 2629 | (progn | ||
| 2630 | (goto-char (match-beginning 1)) | ||
| 2631 | (match-string 1))))) | ||
| 2632 | |||
| 2612 | (defun speedbar-clear-current-file () | 2633 | (defun speedbar-clear-current-file () |
| 2613 | "Locate the file thought to be current, and remove its highlighting." | 2634 | "Locate the file thought to be current, and remove its highlighting." |
| 2614 | (save-excursion | 2635 | (save-excursion |
| 2615 | (set-buffer speedbar-buffer) | 2636 | (set-buffer speedbar-buffer) |
| 2616 | (if speedbar-last-selected-file | 2637 | (if speedbar-last-selected-file |
| 2617 | (speedbar-with-writable | 2638 | (speedbar-with-writable |
| 2618 | (goto-char (point-min)) | 2639 | (if (speedbar-find-selected-file speedbar-last-selected-file) |
| 2619 | (if (and | ||
| 2620 | speedbar-last-selected-file | ||
| 2621 | (re-search-forward | ||
| 2622 | (concat " \\(" (regexp-quote speedbar-last-selected-file) | ||
| 2623 | "\\)\\(" speedbar-indicator-regex "\\)?\n") | ||
| 2624 | nil t)) | ||
| 2625 | (put-text-property (match-beginning 1) | 2640 | (put-text-property (match-beginning 1) |
| 2626 | (match-end 1) | 2641 | (match-end 1) |
| 2627 | 'face | 2642 | 'face |
| @@ -2640,7 +2655,7 @@ updated." | |||
| 2640 | nil))) | 2655 | nil))) |
| 2641 | (select-frame lastf) | 2656 | (select-frame lastf) |
| 2642 | rf))) | 2657 | rf))) |
| 2643 | (newcf (if newcfd (file-name-nondirectory newcfd))) | 2658 | (newcf (if newcfd newcfd)) |
| 2644 | (lastb (current-buffer)) | 2659 | (lastb (current-buffer)) |
| 2645 | (sucf-recursive (boundp 'sucf-recursive)) | 2660 | (sucf-recursive (boundp 'sucf-recursive)) |
| 2646 | (case-fold-search t)) | 2661 | (case-fold-search t)) |
| @@ -2659,15 +2674,12 @@ updated." | |||
| 2659 | ;; now highlight the new one. | 2674 | ;; now highlight the new one. |
| 2660 | (set-buffer speedbar-buffer) | 2675 | (set-buffer speedbar-buffer) |
| 2661 | (speedbar-with-writable | 2676 | (speedbar-with-writable |
| 2662 | (goto-char (point-min)) | 2677 | (if (speedbar-find-selected-file newcf) |
| 2663 | (if (re-search-forward | 2678 | ;; put the property on it |
| 2664 | (concat " \\(" (regexp-quote newcf) "\\)\\(" | 2679 | (put-text-property (match-beginning 1) |
| 2665 | speedbar-indicator-regex "\\)?$") nil t) | 2680 | (match-end 1) |
| 2666 | ;; put the property on it | 2681 | 'face |
| 2667 | (put-text-property (match-beginning 1) | 2682 | 'speedbar-selected-face) |
| 2668 | (match-end 1) | ||
| 2669 | 'face | ||
| 2670 | 'speedbar-selected-face) | ||
| 2671 | ;; Oops, it's not in the list. Should it be? | 2683 | ;; Oops, it's not in the list. Should it be? |
| 2672 | (if (and (string-match speedbar-file-regexp newcf) | 2684 | (if (and (string-match speedbar-file-regexp newcf) |
| 2673 | (string= (file-name-directory newcfd) | 2685 | (string= (file-name-directory newcfd) |
| @@ -2675,8 +2687,7 @@ updated." | |||
| 2675 | ;; yes, it is (we will ignore unknowns for now...) | 2687 | ;; yes, it is (we will ignore unknowns for now...) |
| 2676 | (progn | 2688 | (progn |
| 2677 | (speedbar-refresh) | 2689 | (speedbar-refresh) |
| 2678 | (if (re-search-forward | 2690 | (if (speedbar-find-selected-file newcf) |
| 2679 | (concat " \\(" (regexp-quote newcf) "\\)\n") nil t) | ||
| 2680 | ;; put the property on it | 2691 | ;; put the property on it |
| 2681 | (put-text-property (match-beginning 1) | 2692 | (put-text-property (match-beginning 1) |
| 2682 | (match-end 1) | 2693 | (match-end 1) |
| @@ -3089,7 +3100,7 @@ directory with these items." | |||
| 3089 | (beginning-of-line) | 3100 | (beginning-of-line) |
| 3090 | ;; If this fails, then it is a non-standard click, and as such, | 3101 | ;; If this fails, then it is a non-standard click, and as such, |
| 3091 | ;; perfectly allowed. | 3102 | ;; perfectly allowed. |
| 3092 | (if (re-search-forward "[]>}] [a-zA-Z0-9]" | 3103 | (if (re-search-forward "[]>?}] [^ ]" |
| 3093 | (save-excursion (end-of-line) (point)) | 3104 | (save-excursion (end-of-line) (point)) |
| 3094 | t) | 3105 | t) |
| 3095 | (speedbar-do-function-pointer) | 3106 | (speedbar-do-function-pointer) |
| @@ -3168,16 +3179,15 @@ subdirectory chosen will be at INDENT level." | |||
| 3168 | "Delete text from point to indentation level INDENT or greater. | 3179 | "Delete text from point to indentation level INDENT or greater. |
| 3169 | Handles end-of-sublist smartly." | 3180 | Handles end-of-sublist smartly." |
| 3170 | (speedbar-with-writable | 3181 | (speedbar-with-writable |
| 3171 | (save-excursion | 3182 | (save-excursion |
| 3172 | (end-of-line) (forward-char 1) | 3183 | (end-of-line) (forward-char 1) |
| 3173 | (while (and (not (save-excursion | 3184 | (let ((start (point))) |
| 3174 | (re-search-forward (format "^%d:" indent) | 3185 | (while (and (looking-at "^\\([0-9]+\\):") |
| 3175 | nil t))) | 3186 | (> (string-to-int (match-string 1)) indent) |
| 3176 | (>= indent 0)) | 3187 | (not (eobp))) |
| 3177 | (setq indent (1- indent))) | 3188 | (forward-line 1) |
| 3178 | (delete-region (point) (if (>= indent 0) | 3189 | (beginning-of-line)) |
| 3179 | (match-beginning 0) | 3190 | (delete-region start (point)))))) |
| 3180 | (point-max)))))) | ||
| 3181 | 3191 | ||
| 3182 | (defun speedbar-dired (text token indent) | 3192 | (defun speedbar-dired (text token indent) |
| 3183 | "Speedbar click handler for directory expand button. | 3193 | "Speedbar click handler for directory expand button. |
| @@ -3337,7 +3347,7 @@ interested in." | |||
| 3337 | (end-of-line) | 3347 | (end-of-line) |
| 3338 | (if (re-search-backward exp nil t) | 3348 | (if (re-search-backward exp nil t) |
| 3339 | (setq start (point)) | 3349 | (setq start (point)) |
| 3340 | (error "Center error")) | 3350 | (setq start (point-min))) |
| 3341 | (save-excursion ;Not sure about this part. | 3351 | (save-excursion ;Not sure about this part. |
| 3342 | (end-of-line) | 3352 | (end-of-line) |
| 3343 | (setq p (point)) | 3353 | (setq p (point)) |
| @@ -3665,7 +3675,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused." | |||
| 3665 | (beginning-of-line) | 3675 | (beginning-of-line) |
| 3666 | ;; If this fails, then it is a non-standard click, and as such, | 3676 | ;; If this fails, then it is a non-standard click, and as such, |
| 3667 | ;; perfectly allowed. | 3677 | ;; perfectly allowed. |
| 3668 | (if (re-search-forward "[]>}] [a-zA-Z0-9]" | 3678 | (if (re-search-forward "[]>?}] [^ ]" |
| 3669 | (save-excursion (end-of-line) (point)) | 3679 | (save-excursion (end-of-line) (point)) |
| 3670 | t) | 3680 | t) |
| 3671 | (let ((text (progn | 3681 | (let ((text (progn |
| @@ -3685,7 +3695,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused." | |||
| 3685 | (beginning-of-line) | 3695 | (beginning-of-line) |
| 3686 | ;; If this fails, then it is a non-standard click, and as such, | 3696 | ;; If this fails, then it is a non-standard click, and as such, |
| 3687 | ;; perfectly allowed | 3697 | ;; perfectly allowed |
| 3688 | (if (re-search-forward "[]>}] [a-zA-Z0-9]" | 3698 | (if (re-search-forward "[]>?}] [^ ]" |
| 3689 | (save-excursion (end-of-line) (point)) | 3699 | (save-excursion (end-of-line) (point)) |
| 3690 | t) | 3700 | t) |
| 3691 | (let ((text (progn | 3701 | (let ((text (progn |