comparison lisp/speedbar.el @ 105994:009383a57ce8

* x-dnd.el (x-dnd-maybe-call-test-function): * window.el (split-window-vertically): * whitespace.el (whitespace-help-on): * vc-rcs.el (vc-rcs-consult-headers): * userlock.el (ask-user-about-lock-help) (ask-user-about-supersession-help): * type-break.el (type-break-force-mode-line-update): * time-stamp.el (time-stamp-conv-warn): * terminal.el (te-set-output-log, te-more-break, te-filter) (te-sentinel,terminal-emulator): * term.el (make-term, term-exec, term-sentinel, term-read-input-ring) (term-write-input-ring, term-check-source, term-start-output-log): (term-display-buffer-line, term-dynamic-list-completions): (term-ansi-make-term, serial-term): * subr.el (selective-display): * strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer) (strokes-encode-buffer, strokes-xpm-for-compressed-string): * speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info) (speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support) (speedbar-remove-localized-speedbar-support) (speedbar-set-mode-line-format, speedbar-create-tag-hierarchy) (speedbar-update-special-contents, speedbar-buffer-buttons-engine) (speedbar-buffers-line-directory): * simple.el (shell-command-on-region, append-to-buffer) (prepend-to-buffer): * shadowfile.el (shadow-save-todo-file): * scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1) (scroll-bar-maybe-set-window-start): * sb-image.el (speedbar-image-dump): * saveplace.el (save-place-alist-to-file, save-places-to-alist) (load-save-place-alist-from-file): * ps-samp.el (ps-print-message-from-summary): * ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox) (ps-background-image, ps-begin-job, ps-do-despool): * ps-bdf.el (bdf-find-file, bdf-read-font-info): * printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting) (pr-ps-message-from-summary, pr-lpr-message-from-summary): (pr-call-process, pr-file-list, pr-interface-save): * novice.el (disabled-command-function) (enable-command, disable-command): * mouse.el (mouse-buffer-menu-alist): * mouse-copy.el (mouse-kill-preserving-secondary): * macros.el (kbd-macro-query): * ledit.el (ledit-go-to-lisp, ledit-go-to-liszt): * informat.el (batch-info-validate): * ido.el (ido-copy-current-word, ido-initiate-auto-merge): * hippie-exp.el (try-expand-dabbrev-visible): * help-mode.el (help-make-xrefs): * help-fns.el (describe-variable): * generic-x.el (bat-generic-mode-run-as-comint): * finder.el (finder-mouse-select): * find-dired.el (find-dired-sentinel): * filesets.el (filesets-file-close): * files.el (list-directory): * faces.el (list-faces-display, describe-face): * facemenu.el (list-colors-display): * ezimage.el (ezimage-image-association-dump, ezimage-image-dump): * epg.el (epg--process-filter, epg-cancel): * epa.el (epa--marked-keys, epa--select-keys, epa-display-info) (epa--read-signature-type): * emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B) (emerge-file-names): * ehelp.el (electric-helpify): * ediff.el (ediff-regions-wordwise, ediff-regions-linewise): * ediff-vers.el (rcs-ediff-view-revision): * ediff-util.el (ediff-setup): * ediff-mult.el (ediff-append-custom-diff): * ediff-diff.el (ediff-exec-process, ediff-process-sentinel) (ediff-wordify): * echistory.el (Electric-command-history-redo-expression): * dos-w32.el (find-file-not-found-set-buffer-file-coding-system): * disp-table.el (describe-display-table): * dired.el (dired-find-buffer-nocreate): * dired-aux.el (dired-rename-subdir, dired-dwim-target-directory): * dabbrev.el (dabbrev--same-major-mode-p): * chistory.el (list-command-history): * apropos.el (apropos-documentation): * allout.el (allout-obtain-passphrase): (allout-copy-exposed-to-buffer): (allout-verify-passphrase): Use with-current-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 13 Nov 2009 22:19:45 +0000
parents b78ceb253d15
children 88a813fffb40
comparison
equal deleted inserted replaced
105993:505670342624 105994:009383a57ce8
1171 (if (and (frame-live-p (speedbar-current-frame)) 1171 (if (and (frame-live-p (speedbar-current-frame))
1172 (or (not (featurep 'xemacs)) 1172 (or (not (featurep 'xemacs))
1173 (with-no-warnings 1173 (with-no-warnings
1174 (specifier-instance has-modeline-p))) 1174 (specifier-instance has-modeline-p)))
1175 speedbar-buffer) 1175 speedbar-buffer)
1176 (save-excursion 1176 (with-current-buffer speedbar-buffer
1177 (set-buffer speedbar-buffer)
1178 (let* ((w (or (speedbar-frame-width) 20)) 1177 (let* ((w (or (speedbar-frame-width) 20))
1179 (p1 "<<") 1178 (p1 "<<")
1180 (p5 ">>") 1179 (p5 ">>")
1181 (p3 (if speedbar-update-flag "#" "!")) 1180 (p3 (if speedbar-update-flag "#" "!"))
1182 (p35 (capitalize speedbar-initial-expansion-list-name)) 1181 (p35 (capitalize speedbar-initial-expansion-list-name))
1244 (if (local-variable-p 1243 (if (local-variable-p
1245 'speedbar-special-mode-key-map 1244 'speedbar-special-mode-key-map
1246 (current-buffer)) 1245 (current-buffer))
1247 speedbar-special-mode-key-map) 1246 speedbar-special-mode-key-map)
1248 (select-frame cf)))))) 1247 (select-frame cf))))))
1249 (save-excursion 1248 (with-current-buffer speedbar-buffer
1250 (set-buffer speedbar-buffer)
1251 (use-local-map (or localmap 1249 (use-local-map (or localmap
1252 (speedbar-initial-keymap) 1250 (speedbar-initial-keymap)
1253 ;; This creates a small keymap we can glom the 1251 ;; This creates a small keymap we can glom the
1254 ;; menu adjustments into. 1252 ;; menu adjustments into.
1255 (speedbar-make-specialized-keymap))) 1253 (speedbar-make-specialized-keymap)))
1857 "Add localized speedbar support to BUFFER's mode if it is available." 1855 "Add localized speedbar support to BUFFER's mode if it is available."
1858 (interactive "bBuffer: ") 1856 (interactive "bBuffer: ")
1859 (if (stringp buffer) (setq buffer (get-buffer buffer))) 1857 (if (stringp buffer) (setq buffer (get-buffer buffer)))
1860 (if (not (buffer-live-p buffer)) 1858 (if (not (buffer-live-p buffer))
1861 nil 1859 nil
1862 (save-excursion 1860 (with-current-buffer buffer
1863 (set-buffer buffer)
1864 (save-match-data 1861 (save-match-data
1865 (let ((ms (symbol-name major-mode)) v) 1862 (let ((ms (symbol-name major-mode)) v)
1866 (if (not (string-match "-mode$" ms)) 1863 (if (not (string-match "-mode$" ms))
1867 nil ;; do nothing to broken mode 1864 nil ;; do nothing to broken mode
1868 (setq ms (substring ms 0 (match-beginning 0))) 1865 (setq ms (substring ms 0 (match-beginning 0)))
1891 (symbol-value v))) 1888 (symbol-value v)))
1892 ))))))) 1889 )))))))
1893 1890
1894 (defun speedbar-remove-localized-speedbar-support (buffer) 1891 (defun speedbar-remove-localized-speedbar-support (buffer)
1895 "Remove any traces that BUFFER supports speedbar in a specialized way." 1892 "Remove any traces that BUFFER supports speedbar in a specialized way."
1896 (save-excursion 1893 (with-current-buffer buffer
1897 (set-buffer buffer)
1898 (kill-local-variable 'speedbar-special-mode-expansion-list) 1894 (kill-local-variable 'speedbar-special-mode-expansion-list)
1899 (kill-local-variable 'speedbar-special-mode-key-map) 1895 (kill-local-variable 'speedbar-special-mode-key-map)
1900 (kill-local-variable 'speedbar-easymenu-definition-special))) 1896 (kill-local-variable 'speedbar-easymenu-definition-special)))
1901 1897
1902 ;;; File button management 1898 ;;; File button management
2381 (let* ((f (save-excursion 2377 (let* ((f (save-excursion
2382 (forward-line -1) 2378 (forward-line -1)
2383 (or (speedbar-line-file) 2379 (or (speedbar-line-file)
2384 (speedbar-line-directory)))) 2380 (speedbar-line-directory))))
2385 (methods (if (get-file-buffer f) 2381 (methods (if (get-file-buffer f)
2386 (save-excursion (set-buffer (get-file-buffer f)) 2382 (with-current-buffer (get-file-buffer f)
2387 speedbar-tag-hierarchy-method) 2383 speedbar-tag-hierarchy-method)
2388 speedbar-tag-hierarchy-method)) 2384 speedbar-tag-hierarchy-method))
2389 (lst (if (fboundp 'copy-tree) 2385 (lst (if (fboundp 'copy-tree)
2390 (copy-tree lst) 2386 (copy-tree lst)
2391 lst))) 2387 lst)))
2392 (while methods 2388 (while methods
2610 (defun speedbar-update-special-contents () 2606 (defun speedbar-update-special-contents ()
2611 "Use the mode-specific variable to fill in the speedbar buffer. 2607 "Use the mode-specific variable to fill in the speedbar buffer.
2612 This should only be used by modes classified as special." 2608 This should only be used by modes classified as special."
2613 (let ((funclst speedbar-special-mode-expansion-list) 2609 (let ((funclst speedbar-special-mode-expansion-list)
2614 (specialbuff (current-buffer))) 2610 (specialbuff (current-buffer)))
2615 (save-excursion 2611 (setq speedbar-desired-buffer specialbuff)
2616 (setq speedbar-desired-buffer specialbuff) 2612 (with-current-buffer speedbar-buffer
2617 (set-buffer speedbar-buffer)
2618 ;; If we are leaving a directory, cache it. 2613 ;; If we are leaving a directory, cache it.
2619 (if (not speedbar-shown-directories) 2614 (if (not speedbar-shown-directories)
2620 ;; Do nothing 2615 ;; Do nothing
2621 nil 2616 nil
2622 ;; Clean up directory maintenance stuff 2617 ;; Clean up directory maintenance stuff
3885 nil 3880 nil
3886 (let* ((known (string-match speedbar-file-regexp 3881 (let* ((known (string-match speedbar-file-regexp
3887 (buffer-name (car bl)))) 3882 (buffer-name (car bl))))
3888 (expchar (if known ?+ ??)) 3883 (expchar (if known ?+ ??))
3889 (fn (if known 'speedbar-tag-file nil)) 3884 (fn (if known 'speedbar-tag-file nil))
3890 (fname (save-excursion (set-buffer (car bl)) 3885 (fname (with-current-buffer (car bl)
3891 (buffer-file-name)))) 3886 (buffer-file-name))))
3892 (speedbar-make-tag-line 'bracket expchar fn 3887 (speedbar-make-tag-line 'bracket expchar fn
3893 (if fname (file-name-nondirectory fname)) 3888 (if fname (file-name-nondirectory fname))
3894 (buffer-name (car bl)) 3889 (buffer-name (car bl))
3895 'speedbar-buffer-click temp 3890 'speedbar-buffer-click temp
3896 'speedbar-file-face 0) 3891 'speedbar-file-face 0)
3926 3921
3927 (defun speedbar-buffers-tail-notes (buffer) 3922 (defun speedbar-buffers-tail-notes (buffer)
3928 "Add a note to the end of the last tag line. 3923 "Add a note to the end of the last tag line.
3929 Argument BUFFER is the buffer being tested." 3924 Argument BUFFER is the buffer being tested."
3930 (let (mod ro) 3925 (let (mod ro)
3931 (save-excursion 3926 (with-current-buffer buffer
3932 (set-buffer buffer)
3933 (setq mod (buffer-modified-p) 3927 (setq mod (buffer-modified-p)
3934 ro buffer-read-only)) 3928 ro buffer-read-only))
3935 (if ro (speedbar-insert-button "%" nil nil nil nil t)))) 3929 (if ro (speedbar-insert-button "%" nil nil nil nil t))))
3936 3930
3937 (defun speedbar-buffers-item-info () 3931 (defun speedbar-buffers-item-info ()
3941 (buffer (if item (get-buffer item) nil))) 3935 (buffer (if item (get-buffer item) nil)))
3942 (and buffer 3936 (and buffer
3943 (speedbar-message "%s%s %S %d %s" 3937 (speedbar-message "%s%s %S %d %s"
3944 (if (buffer-modified-p buffer) "* " "") 3938 (if (buffer-modified-p buffer) "* " "")
3945 item 3939 item
3946 (save-excursion (set-buffer buffer) major-mode) 3940 (with-current-buffer buffer major-mode)
3947 (save-excursion (set-buffer buffer) 3941 (with-current-buffer buffer (buffer-size))
3948 (buffer-size))
3949 (or (buffer-file-name buffer) "<No file>")))))) 3942 (or (buffer-file-name buffer) "<No file>"))))))
3950 3943
3951 (defun speedbar-buffers-line-directory (&optional depth) 3944 (defun speedbar-buffers-line-directory (&optional depth)
3952 "Fetch the directory of the file (buffer) specified on the current line. 3945 "Fetch the directory of the file (buffer) specified on the current line.
3953 Optional argument DEPTH specifies the current depth of the back search." 3946 Optional argument DEPTH specifies the current depth of the back search."
3961 (buffer (if bn (get-buffer bn)))) 3954 (buffer (if bn (get-buffer bn))))
3962 (if buffer 3955 (if buffer
3963 (if (save-excursion 3956 (if (save-excursion
3964 (end-of-line) 3957 (end-of-line)
3965 (eq start (point))) 3958 (eq start (point)))
3966 (or (save-excursion (set-buffer buffer) 3959 (or (with-current-buffer buffer default-directory)
3967 default-directory)
3968 "") 3960 "")
3969 (buffer-file-name buffer)))))))) 3961 (buffer-file-name buffer))))))))
3970 3962
3971 (defun speedbar-buffer-click (text token indent) 3963 (defun speedbar-buffer-click (text token indent)
3972 "When the users clicks on a buffer-button in speedbar. 3964 "When the users clicks on a buffer-button in speedbar.