diff options
| author | Daniel Pfeiffer | 2004-08-11 20:00:11 +0000 |
|---|---|---|
| committer | Daniel Pfeiffer | 2004-08-11 20:00:11 +0000 |
| commit | 048526bd2d7c479248ae5b23225fddee312a0eba (patch) | |
| tree | 26bf6d76e8ab204c7c8809a337d42c99061acdcc | |
| parent | 2a15eb73df90655c012a78713ae9b33278c3206e (diff) | |
| download | emacs-048526bd2d7c479248ae5b23225fddee312a0eba.tar.gz emacs-048526bd2d7c479248ae5b23225fddee312a0eba.zip | |
(speedbar-scan-subdirs): New option.
(speedbar-file-lists): Don't ignore file-name case on Unix and use dolist.
(speedbar-insert-files-at-point): Take an extra argument and use it to optionally find out if a subdir is empty. Also unreadable files don't get expand buttons.
(speedbar-directory-plus): New image (bitmap already existed unused).
(speedbar-expand-image-button-alist): Use it.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/speedbar.el | 85 |
2 files changed, 60 insertions, 36 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12c2b4d8a60..2ebc52c42ef 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2004-08-11 Daniel Pfeiffer <occitan@esperanto.org> | ||
| 2 | |||
| 3 | * speedbar.el (speedbar-scan-subdirs): New option. | ||
| 4 | (speedbar-file-lists): Don't ignore file-name case on Unix and use | ||
| 5 | dolist. | ||
| 6 | (speedbar-insert-files-at-point): Take an extra argument and use | ||
| 7 | it to optionally find out if a subdir is empty. Also unreadable | ||
| 8 | files don't get expand buttons. | ||
| 9 | (speedbar-directory-plus): New image (bitmap already existed unused). | ||
| 10 | (speedbar-expand-image-button-alist): Use it. | ||
| 11 | |||
| 1 | 2004-08-11 Martin Stjernholm <bug-cc-mode@gnu.org> | 12 | 2004-08-11 Martin Stjernholm <bug-cc-mode@gnu.org> |
| 2 | 13 | ||
| 3 | CC Mode update to 5.30.9: | 14 | CC Mode update to 5.30.9: |
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index f8e9386585d..0556af489ef 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -689,8 +689,16 @@ file." | |||
| 689 | :type '(repeat (regexp :tag "Extension Regexp")) | 689 | :type '(repeat (regexp :tag "Extension Regexp")) |
| 690 | :set (lambda (sym val) | 690 | :set (lambda (sym val) |
| 691 | (setq speedbar-supported-extension-expressions val | 691 | (setq speedbar-supported-extension-expressions val |
| 692 | speedbar-file-regexp (speedbar-extension-list-to-regex val))) | 692 | speedbar-file-regexp (speedbar-extension-list-to-regex val)))) |
| 693 | ) | 693 | |
| 694 | (defcustom speedbar-scan-subdirs nil | ||
| 695 | "*Non-nil means speedbar will check if subdirs are empty. | ||
| 696 | That way you don't have to click on them to find out. But this | ||
| 697 | incurs extra I/O, hence it slows down directory display | ||
| 698 | proportionally to the number of subdirs." | ||
| 699 | :group 'speedbar | ||
| 700 | :type 'boolean | ||
| 701 | :version 21.4) | ||
| 694 | 702 | ||
| 695 | (defvar speedbar-file-regexp | 703 | (defvar speedbar-file-regexp |
| 696 | (speedbar-extension-list-to-regex speedbar-supported-extension-expressions) | 704 | (speedbar-extension-list-to-regex speedbar-supported-extension-expressions) |
| @@ -2185,21 +2193,17 @@ the file-system." | |||
| 2185 | ;; find the directory, either in the cache, or build it. | 2193 | ;; find the directory, either in the cache, or build it. |
| 2186 | (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) | 2194 | (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) |
| 2187 | (let ((default-directory directory) | 2195 | (let ((default-directory directory) |
| 2188 | (dir (directory-files directory nil)) | 2196 | (case-fold-search read-file-name-completion-ignore-case) |
| 2189 | (dirs nil) | 2197 | dirs files) |
| 2190 | (files nil)) | 2198 | (dolist (file (directory-files directory nil)) |
| 2191 | (while dir | 2199 | (or (string-match speedbar-file-unshown-regexp file) |
| 2192 | (if (not | 2200 | (string-match speedbar-directory-unshown-regexp file) |
| 2193 | (or (string-match speedbar-file-unshown-regexp (car dir)) | 2201 | (if (file-directory-p file) |
| 2194 | (string-match speedbar-directory-unshown-regexp (car dir)))) | 2202 | (setq dirs (cons file dirs)) |
| 2195 | (if (file-directory-p (car dir)) | 2203 | (setq files (cons file files))))) |
| 2196 | (setq dirs (cons (car dir) dirs)) | 2204 | (let ((nl `(,(nreverse dirs) ,(nreverse files)))) |
| 2197 | (setq files (cons (car dir) files)))) | ||
| 2198 | (setq dir (cdr dir))) | ||
| 2199 | (let ((nl (cons (nreverse dirs) (list (nreverse files))))) | ||
| 2200 | (aput 'speedbar-directory-contents-alist directory nl) | 2205 | (aput 'speedbar-directory-contents-alist directory nl) |
| 2201 | nl)) | 2206 | nl)))) |
| 2202 | )) | ||
| 2203 | 2207 | ||
| 2204 | (defun speedbar-directory-buttons (directory index) | 2208 | (defun speedbar-directory-buttons (directory index) |
| 2205 | "Insert a single button group at point for DIRECTORY. | 2209 | "Insert a single button group at point for DIRECTORY. |
| @@ -2343,34 +2347,40 @@ position to insert a new item, and that the new item will end with a CR." | |||
| 2343 | 2347 | ||
| 2344 | ;;; Build button lists | 2348 | ;;; Build button lists |
| 2345 | ;; | 2349 | ;; |
| 2346 | (defun speedbar-insert-files-at-point (files level) | 2350 | (defun speedbar-insert-files-at-point (files level directory) |
| 2347 | "Insert list of FILES starting at point, and indenting all files to LEVEL. | 2351 | "Insert list of FILES starting at point, and indenting all files to LEVEL. |
| 2348 | Tag expandable items with a +, otherwise a ?. Don't highlight ? as we | 2352 | Tag expandable items with a +, otherwise a ?. Don't highlight ? as we |
| 2349 | don't know how to manage them. The input parameter FILES is a cons | 2353 | don't know how to manage them. The input parameter FILES is a cons |
| 2350 | cell of the form ( 'DIRLIST . 'FILELIST )." | 2354 | cell of the form ( 'DIRLIST . 'FILELIST )." |
| 2351 | ;; Start inserting all the directories | 2355 | ;; Start inserting all the directories |
| 2352 | (let ((dirs (car files))) | 2356 | (dolist (dir (car files)) |
| 2353 | (while dirs | 2357 | (if (if speedbar-scan-subdirs |
| 2354 | (speedbar-make-tag-line 'angle ?+ 'speedbar-dired (car dirs) | 2358 | (condition-case nil |
| 2355 | (car dirs) 'speedbar-dir-follow nil | 2359 | (let ((l (speedbar-file-lists (concat directory dir)))) |
| 2356 | 'speedbar-directory-face level) | 2360 | (or (car l) (cadr l))) |
| 2357 | (setq dirs (cdr dirs)))) | 2361 | (file-error)) |
| 2358 | (let ((lst (car (cdr files))) | 2362 | (file-readable-p (concat directory dir))) |
| 2359 | (case-fold-search t)) | 2363 | (speedbar-make-tag-line 'angle ?+ 'speedbar-dired dir |
| 2360 | (while lst | 2364 | dir 'speedbar-dir-follow nil |
| 2361 | (let* ((known (string-match speedbar-file-regexp (car lst))) | 2365 | 'speedbar-directory-face level) |
| 2366 | (speedbar-make-tag-line 'angle ? nil dir | ||
| 2367 | dir 'speedbar-dir-follow nil | ||
| 2368 | 'speedbar-directory-face level))) | ||
| 2369 | (let ((case-fold-search read-file-name-completion-ignore-case)) | ||
| 2370 | (dolist (file (cadr files)) | ||
| 2371 | (let* ((known (and (file-readable-p (concat directory file)) | ||
| 2372 | (string-match speedbar-file-regexp file))) | ||
| 2362 | (expchar (if known ?+ ??)) | 2373 | (expchar (if known ?+ ??)) |
| 2363 | (fn (if known 'speedbar-tag-file nil))) | 2374 | (fn (if known 'speedbar-tag-file nil))) |
| 2364 | (if (or speedbar-show-unknown-files (/= expchar ??)) | 2375 | (if (or speedbar-show-unknown-files (/= expchar ??)) |
| 2365 | (speedbar-make-tag-line 'bracket expchar fn (car lst) | 2376 | (speedbar-make-tag-line 'bracket expchar fn file |
| 2366 | (car lst) 'speedbar-find-file nil | 2377 | file 'speedbar-find-file nil |
| 2367 | 'speedbar-file-face level))) | 2378 | 'speedbar-file-face level)))))) |
| 2368 | (setq lst (cdr lst))))) | ||
| 2369 | 2379 | ||
| 2370 | (defun speedbar-default-directory-list (directory index) | 2380 | (defun speedbar-default-directory-list (directory index) |
| 2371 | "Insert files for DIRECTORY with level INDEX at point." | 2381 | "Insert files for DIRECTORY with level INDEX at point." |
| 2372 | (speedbar-insert-files-at-point | 2382 | (speedbar-insert-files-at-point |
| 2373 | (speedbar-file-lists directory) index) | 2383 | (speedbar-file-lists directory) index directory) |
| 2374 | (speedbar-reset-scanners) | 2384 | (speedbar-reset-scanners) |
| 2375 | (if (= index 0) | 2385 | (if (= index 0) |
| 2376 | ;; If the shown files variable has extra directories, then | 2386 | ;; If the shown files variable has extra directories, then |
| @@ -2918,7 +2928,7 @@ updated." | |||
| 2918 | (newcf (if newcfd newcfd)) | 2928 | (newcf (if newcfd newcfd)) |
| 2919 | (lastb (current-buffer)) | 2929 | (lastb (current-buffer)) |
| 2920 | (sucf-recursive (boundp 'sucf-recursive)) | 2930 | (sucf-recursive (boundp 'sucf-recursive)) |
| 2921 | (case-fold-search t)) | 2931 | (case-fold-search read-file-name-completion-ignore-case)) |
| 2922 | (if (and newcf | 2932 | (if (and newcf |
| 2923 | ;; check here, that way we won't refresh to newcf until | 2933 | ;; check here, that way we won't refresh to newcf until |
| 2924 | ;; its been written, thus saving ourselves some time | 2934 | ;; its been written, thus saving ourselves some time |
| @@ -4235,9 +4245,7 @@ IMAGESPEC is the image data, and DOCSTRING is documentation for the image." | |||
| 4235 | (speedbar-convert-emacs21-imagespec-to-xemacs (quote ,imagespec))) | 4245 | (speedbar-convert-emacs21-imagespec-to-xemacs (quote ,imagespec))) |
| 4236 | 'buffer) | 4246 | 'buffer) |
| 4237 | (error nil)) | 4247 | (error nil)) |
| 4238 | ,docstring)) | 4248 | ,docstring))))) |
| 4239 | |||
| 4240 | ))) | ||
| 4241 | 4249 | ||
| 4242 | (defimage-speedbar speedbar-directory-plus | 4250 | (defimage-speedbar speedbar-directory-plus |
| 4243 | ((:type xpm :file "sb-dir-plus.xpm" :ascent center)) | 4251 | ((:type xpm :file "sb-dir-plus.xpm" :ascent center)) |
| @@ -4247,6 +4255,10 @@ IMAGESPEC is the image data, and DOCSTRING is documentation for the image." | |||
| 4247 | ((:type xpm :file "sb-dir-minus.xpm" :ascent center)) | 4255 | ((:type xpm :file "sb-dir-minus.xpm" :ascent center)) |
| 4248 | "Image used for open directories with stuff in them.") | 4256 | "Image used for open directories with stuff in them.") |
| 4249 | 4257 | ||
| 4258 | (defimage-speedbar speedbar-directory | ||
| 4259 | ((:type xpm :file "sb-dir.xpm" :ascent center)) | ||
| 4260 | "Image used for empty or unreadable directories.") | ||
| 4261 | |||
| 4250 | (defimage-speedbar speedbar-page-plus | 4262 | (defimage-speedbar speedbar-page-plus |
| 4251 | ((:type xpm :file "sb-pg-plus.xpm" :ascent center)) | 4263 | ((:type xpm :file "sb-pg-plus.xpm" :ascent center)) |
| 4252 | "Image used for closed files with stuff in them.") | 4264 | "Image used for closed files with stuff in them.") |
| @@ -4290,6 +4302,7 @@ IMAGESPEC is the image data, and DOCSTRING is documentation for the image." | |||
| 4290 | (defvar speedbar-expand-image-button-alist | 4302 | (defvar speedbar-expand-image-button-alist |
| 4291 | '(("<+>" . speedbar-directory-plus) | 4303 | '(("<+>" . speedbar-directory-plus) |
| 4292 | ("<->" . speedbar-directory-minus) | 4304 | ("<->" . speedbar-directory-minus) |
| 4305 | ("< >" . speedbar-directory) | ||
| 4293 | ("[+]" . speedbar-page-plus) | 4306 | ("[+]" . speedbar-page-plus) |
| 4294 | ("[-]" . speedbar-page-minus) | 4307 | ("[-]" . speedbar-page-minus) |
| 4295 | ("[?]" . speedbar-page) | 4308 | ("[?]" . speedbar-page) |