diff options
| author | Juanma Barranquero | 2007-06-28 09:03:36 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2007-06-28 09:03:36 +0000 |
| commit | e5d2b9d41766cb2a7c9779da6751c3682594e715 (patch) | |
| tree | 9eddfadb0b27929c32fc742dfba9b3ba6d7de3c2 | |
| parent | 251db0f475e5a9af9861be3b983bafbdf9afd403 (diff) | |
| download | emacs-e5d2b9d41766cb2a7c9779da6751c3682594e715.tar.gz emacs-e5d2b9d41766cb2a7c9779da6751c3682594e715.zip | |
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
that deletes the current frame or causes an error if it is the only frame.
| -rw-r--r-- | lisp/speedbar.el | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 87176d0c1c8..4ecb0ec7dd3 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | "The current version of speedbar.") | 10 | "The current version of speedbar.") |
| 11 | (defvar speedbar-incompatible-version "0.14beta4" | 11 | (defvar speedbar-incompatible-version "0.14beta4" |
| 12 | "This version of speedbar is incompatible with this version. | 12 | "This version of speedbar is incompatible with this version. |
| 13 | Due to massive API changes (removing the use of the word PATH) | 13 | Due to massive API changes (removing the use of the word PATH) |
| 14 | this version is not backward compatible to 0.14 or earlier.") | 14 | this version is not backward compatible to 0.14 or earlier.") |
| 15 | 15 | ||
| 16 | ;; This file is part of GNU Emacs. | 16 | ;; This file is part of GNU Emacs. |
| @@ -915,7 +915,7 @@ This basically creates a sparse keymap, and makes its parent be | |||
| 915 | (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))] | 915 | (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))] |
| 916 | ) | 916 | ) |
| 917 | "Additional menu items while in file-mode.") | 917 | "Additional menu items while in file-mode.") |
| 918 | 918 | ||
| 919 | (defvar speedbar-easymenu-definition-trailer | 919 | (defvar speedbar-easymenu-definition-trailer |
| 920 | (append | 920 | (append |
| 921 | (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) | 921 | (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) |
| @@ -958,13 +958,13 @@ directories.") | |||
| 958 | (defalias 'speedbar-make-overlay | 958 | (defalias 'speedbar-make-overlay |
| 959 | (if (featurep 'xemacs) 'make-extent 'make-overlay)) | 959 | (if (featurep 'xemacs) 'make-extent 'make-overlay)) |
| 960 | 960 | ||
| 961 | (defalias 'speedbar-overlay-put | 961 | (defalias 'speedbar-overlay-put |
| 962 | (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) | 962 | (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) |
| 963 | 963 | ||
| 964 | (defalias 'speedbar-delete-overlay | 964 | (defalias 'speedbar-delete-overlay |
| 965 | (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) | 965 | (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) |
| 966 | 966 | ||
| 967 | (defalias 'speedbar-mode-line-update | 967 | (defalias 'speedbar-mode-line-update |
| 968 | (if (featurep 'xemacs) 'redraw-modeline 'force-mode-line-update)) | 968 | (if (featurep 'xemacs) 'redraw-modeline 'force-mode-line-update)) |
| 969 | 969 | ||
| 970 | ;;; Mode definitions/ user commands | 970 | ;;; Mode definitions/ user commands |
| @@ -1053,10 +1053,10 @@ supported at a time. | |||
| 1053 | "Handle a delete frame event E. | 1053 | "Handle a delete frame event E. |
| 1054 | If the deleted frame is the frame SPEEDBAR is attached to, | 1054 | If the deleted frame is the frame SPEEDBAR is attached to, |
| 1055 | we need to delete speedbar also." | 1055 | we need to delete speedbar also." |
| 1056 | (let ((frame-to-be-deleted (car (car (cdr e))))) | 1056 | (when (and speedbar-frame |
| 1057 | (if (eq frame-to-be-deleted dframe-attached-frame) | 1057 | (eq (car (car (cdr e))) ;; frame to be deleted |
| 1058 | (delete-frame speedbar-frame))) | 1058 | dframe-attached-frame)) |
| 1059 | ) | 1059 | (delete-frame speedbar-frame))) |
| 1060 | 1060 | ||
| 1061 | ;;;###autoload | 1061 | ;;;###autoload |
| 1062 | (defun speedbar-get-focus () | 1062 | (defun speedbar-get-focus () |
| @@ -1158,7 +1158,7 @@ return true without a query." | |||
| 1158 | ;; Backwards compatibility | 1158 | ;; Backwards compatibility |
| 1159 | (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer) | 1159 | (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer) |
| 1160 | (defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame) | 1160 | (defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame) |
| 1161 | 1161 | ||
| 1162 | (defun speedbar-set-mode-line-format () | 1162 | (defun speedbar-set-mode-line-format () |
| 1163 | "Set the format of the mode line based on the current speedbar environment. | 1163 | "Set the format of the mode line based on the current speedbar environment. |
| 1164 | This gives visual indications of what is up. It EXPECTS the speedbar | 1164 | This gives visual indications of what is up. It EXPECTS the speedbar |
| @@ -2055,7 +2055,7 @@ position to insert a new item, and that the new item will end with a CR." | |||
| 2055 | (if tag-button-function 'speedbar-highlight-face nil) | 2055 | (if tag-button-function 'speedbar-highlight-face nil) |
| 2056 | tag-button-function tag-button-data)) | 2056 | tag-button-function tag-button-data)) |
| 2057 | )) | 2057 | )) |
| 2058 | 2058 | ||
| 2059 | (defun speedbar-change-expand-button-char (char) | 2059 | (defun speedbar-change-expand-button-char (char) |
| 2060 | "Change the expansion button character to CHAR for the current line." | 2060 | "Change the expansion button character to CHAR for the current line." |
| 2061 | (save-excursion | 2061 | (save-excursion |
| @@ -2100,7 +2100,7 @@ cell of the form ( 'DIRLIST . 'FILELIST )." | |||
| 2100 | 2100 | ||
| 2101 | (defun speedbar-default-directory-list (directory index) | 2101 | (defun speedbar-default-directory-list (directory index) |
| 2102 | "Insert files for DIRECTORY with level INDEX at point." | 2102 | "Insert files for DIRECTORY with level INDEX at point." |
| 2103 | (speedbar-insert-files-at-point | 2103 | (speedbar-insert-files-at-point |
| 2104 | (speedbar-file-lists directory) index) | 2104 | (speedbar-file-lists directory) index) |
| 2105 | (speedbar-reset-scanners) | 2105 | (speedbar-reset-scanners) |
| 2106 | (if (= index 0) | 2106 | (if (= index 0) |
| @@ -2454,7 +2454,7 @@ name will have the function FIND-FUN and not token." | |||
| 2454 | (speedbar-insert-generic-list indent lst | 2454 | (speedbar-insert-generic-list indent lst |
| 2455 | 'speedbar-tag-expand | 2455 | 'speedbar-tag-expand |
| 2456 | 'speedbar-tag-find)) | 2456 | 'speedbar-tag-find)) |
| 2457 | 2457 | ||
| 2458 | (defun speedbar-insert-etags-list (indent lst) | 2458 | (defun speedbar-insert-etags-list (indent lst) |
| 2459 | "At level INDENT, insert the etags generated LST." | 2459 | "At level INDENT, insert the etags generated LST." |
| 2460 | (speedbar-insert-generic-list indent lst | 2460 | (speedbar-insert-generic-list indent lst |
| @@ -2729,7 +2729,7 @@ If new functions are added, their state needs to be updated here." | |||
| 2729 | "Go to the line where FILE is." | 2729 | "Go to the line where FILE is." |
| 2730 | 2730 | ||
| 2731 | (set-buffer speedbar-buffer) | 2731 | (set-buffer speedbar-buffer) |
| 2732 | 2732 | ||
| 2733 | (goto-char (point-min)) | 2733 | (goto-char (point-min)) |
| 2734 | (let ((m nil)) | 2734 | (let ((m nil)) |
| 2735 | (while (and (setq m (re-search-forward | 2735 | (while (and (setq m (re-search-forward |
| @@ -3220,7 +3220,7 @@ directory with these items. This function is replaceable in | |||
| 3220 | (widen) | 3220 | (widen) |
| 3221 | (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory))) | 3221 | (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory))) |
| 3222 | (if rf (funcall rf depth) default-directory)))) | 3222 | (if rf (funcall rf depth) default-directory)))) |
| 3223 | 3223 | ||
| 3224 | (defun speedbar-files-line-directory (&optional depth) | 3224 | (defun speedbar-files-line-directory (&optional depth) |
| 3225 | "Retrieve the directoryname associated with the current line. | 3225 | "Retrieve the directoryname associated with the current line. |
| 3226 | This may require traversing backwards from DEPTH and combining the default | 3226 | This may require traversing backwards from DEPTH and combining the default |
| @@ -3305,12 +3305,12 @@ With universal argument ARG, flush cached data." | |||
| 3305 | (forward-char -2) | 3305 | (forward-char -2) |
| 3306 | (speedbar-do-function-pointer)) | 3306 | (speedbar-do-function-pointer)) |
| 3307 | (error (speedbar-position-cursor-on-line))))) | 3307 | (error (speedbar-position-cursor-on-line))))) |
| 3308 | 3308 | ||
| 3309 | (defun speedbar-flush-expand-line () | 3309 | (defun speedbar-flush-expand-line () |
| 3310 | "Expand the line under the cursor and flush any cached information." | 3310 | "Expand the line under the cursor and flush any cached information." |
| 3311 | (interactive) | 3311 | (interactive) |
| 3312 | (speedbar-expand-line 1)) | 3312 | (speedbar-expand-line 1)) |
| 3313 | 3313 | ||
| 3314 | (defun speedbar-contract-line () | 3314 | (defun speedbar-contract-line () |
| 3315 | "Contract the line under the cursor." | 3315 | "Contract the line under the cursor." |
| 3316 | (interactive) | 3316 | (interactive) |
| @@ -3559,11 +3559,11 @@ This assumes that the cursor is on a file, or tag of a file which the user is | |||
| 3559 | interested in." | 3559 | interested in." |
| 3560 | 3560 | ||
| 3561 | (save-selected-window | 3561 | (save-selected-window |
| 3562 | 3562 | ||
| 3563 | (select-window (get-buffer-window speedbar-buffer t)) | 3563 | (select-window (get-buffer-window speedbar-buffer t)) |
| 3564 | 3564 | ||
| 3565 | (set-buffer speedbar-buffer) | 3565 | (set-buffer speedbar-buffer) |
| 3566 | 3566 | ||
| 3567 | (if (<= (count-lines (point-min) (point-max)) | 3567 | (if (<= (count-lines (point-min) (point-max)) |
| 3568 | (1- (window-height (selected-window)))) | 3568 | (1- (window-height (selected-window)))) |
| 3569 | ;; whole buffer fits | 3569 | ;; whole buffer fits |