;;; Copyright (C) 1996, 97, 98 Free Software Foundation
;; Author: Eric M. Ludlam <zappo@gnu.org>
-;; Version: 0.7.1
+;; Version: 0.7.2
;; Keywords: file, tags, tools
-;; X-RCS: $Id: speedbar.el,v 1.5 1998/08/03 17:47:39 zappo Exp zappo $
+;; X-RCS: $Id: speedbar.el,v 1.6 1998/08/04 13:58:39 zappo Exp zappo $
;; This file is part of GNU Emacs.
(progn
(message "Updating speedbar to special mode: %s...done"
major-mode)
- (sit-for 1)
(message nil))))
;; Update all the contents if directories change!
(if (or (member (expand-file-name default-directory)
(progn
(message "Updating speedbar to: %s...done"
default-directory)
- (sit-for 1)
(message nil)))))
(select-frame af))
;; Now run stealthy updates of time-consuming items
(run-hooks 'speedbar-scanner-reset-hook)
)
+(defun speedbar-find-selected-file (file)
+ "Goto the line where FILE is."
+ (goto-char (point-min))
+ (let ((m nil))
+ (while (and (setq m (re-search-forward
+ (concat " \\(" (file-name-nondirectory file)
+ "\\)\\(" speedbar-indicator-regex "\\)?\n")
+ nil t))
+ (not (string= file
+ (concat
+ (speedbar-line-path
+ (save-excursion
+ (goto-char (match-beginning 0))
+ (beginning-of-line)
+ (save-match-data
+ (looking-at "[0-9]+:")
+ (string-to-number (match-string 0)))))
+ (match-string 1))))))
+ (if m
+ (progn
+ (goto-char (match-beginning 1))
+ (match-string 1)))))
+
(defun speedbar-clear-current-file ()
"Locate the file thought to be current, and remove its highlighting."
(save-excursion
(set-buffer speedbar-buffer)
(if speedbar-last-selected-file
(speedbar-with-writable
- (goto-char (point-min))
- (if (and
- speedbar-last-selected-file
- (re-search-forward
- (concat " \\(" (regexp-quote speedbar-last-selected-file)
- "\\)\\(" speedbar-indicator-regex "\\)?\n")
- nil t))
+ (if (speedbar-find-selected-file speedbar-last-selected-file)
(put-text-property (match-beginning 1)
(match-end 1)
'face
nil)))
(select-frame lastf)
rf)))
- (newcf (if newcfd (file-name-nondirectory newcfd)))
+ (newcf (if newcfd newcfd))
(lastb (current-buffer))
(sucf-recursive (boundp 'sucf-recursive))
(case-fold-search t))
;; now highlight the new one.
(set-buffer speedbar-buffer)
(speedbar-with-writable
- (goto-char (point-min))
- (if (re-search-forward
- (concat " \\(" (regexp-quote newcf) "\\)\\("
- speedbar-indicator-regex "\\)?$") nil t)
- ;; put the property on it
- (put-text-property (match-beginning 1)
- (match-end 1)
- 'face
- 'speedbar-selected-face)
+ (if (speedbar-find-selected-file newcf)
+ ;; put the property on it
+ (put-text-property (match-beginning 1)
+ (match-end 1)
+ 'face
+ 'speedbar-selected-face)
;; Oops, it's not in the list. Should it be?
(if (and (string-match speedbar-file-regexp newcf)
(string= (file-name-directory newcfd)
;; yes, it is (we will ignore unknowns for now...)
(progn
(speedbar-refresh)
- (if (re-search-forward
- (concat " \\(" (regexp-quote newcf) "\\)\n") nil t)
+ (if (speedbar-find-selected-file newcf)
;; put the property on it
(put-text-property (match-beginning 1)
(match-end 1)
(beginning-of-line)
;; If this fails, then it is a non-standard click, and as such,
;; perfectly allowed.
- (if (re-search-forward "[]>}] [a-zA-Z0-9]"
+ (if (re-search-forward "[]>?}] [^ ]"
(save-excursion (end-of-line) (point))
t)
(speedbar-do-function-pointer)
"Delete text from point to indentation level INDENT or greater.
Handles end-of-sublist smartly."
(speedbar-with-writable
- (save-excursion
- (end-of-line) (forward-char 1)
- (while (and (not (save-excursion
- (re-search-forward (format "^%d:" indent)
- nil t)))
- (>= indent 0))
- (setq indent (1- indent)))
- (delete-region (point) (if (>= indent 0)
- (match-beginning 0)
- (point-max))))))
+ (save-excursion
+ (end-of-line) (forward-char 1)
+ (let ((start (point)))
+ (while (and (looking-at "^\\([0-9]+\\):")
+ (> (string-to-int (match-string 1)) indent)
+ (not (eobp)))
+ (forward-line 1)
+ (beginning-of-line))
+ (delete-region start (point))))))
(defun speedbar-dired (text token indent)
"Speedbar click handler for directory expand button.
(end-of-line)
(if (re-search-backward exp nil t)
(setq start (point))
- (error "Center error"))
+ (setq start (point-min)))
(save-excursion ;Not sure about this part.
(end-of-line)
(setq p (point))
(beginning-of-line)
;; If this fails, then it is a non-standard click, and as such,
;; perfectly allowed.
- (if (re-search-forward "[]>}] [a-zA-Z0-9]"
+ (if (re-search-forward "[]>?}] [^ ]"
(save-excursion (end-of-line) (point))
t)
(let ((text (progn
(beginning-of-line)
;; If this fails, then it is a non-standard click, and as such,
;; perfectly allowed
- (if (re-search-forward "[]>}] [a-zA-Z0-9]"
+ (if (re-search-forward "[]>?}] [^ ]"
(save-excursion (end-of-line) (point))
t)
(let ((text (progn