aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/speedbar.el81
1 files changed, 40 insertions, 41 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 4c563d87da8..3a233588ae8 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -220,9 +220,9 @@ frame."
220 :type 'boolean) 220 :type 'boolean)
221 221
222(defcustom speedbar-query-confirmation-method 'all 222(defcustom speedbar-query-confirmation-method 'all
223 "Query control for file operations. 223 "Control querying for file operations.
224The `all' flag means to always query before file operations. 224The value `all' means to always query before file operations.
225The `none-but-delete' flag means to not query before any file 225The value `none-but-delete' means to not query before any file
226operations, except before a file deletion." 226operations, except before a file deletion."
227 :group 'speedbar 227 :group 'speedbar
228 :type '(radio (const :tag "Always Query before some file operations." 228 :type '(radio (const :tag "Always Query before some file operations."
@@ -284,7 +284,7 @@ The default buffer is the buffer in the selected window in the attached frame."
284 :type 'hook) 284 :type 'hook)
285 285
286(defcustom speedbar-show-unknown-files nil 286(defcustom speedbar-show-unknown-files nil
287 "Non-nil show files we can't expand with a ? in the expand button. 287 "Non-nil means show files we can't expand with a ? in the expand button.
288A nil value means don't show the file in the list." 288A nil value means don't show the file in the list."
289 :group 'speedbar 289 :group 'speedbar
290 :type 'boolean) 290 :type 'boolean)
@@ -309,7 +309,8 @@ attached to and added to this list before the new frame is initialized."
309 :version "30.1") 309 :version "30.1")
310 310
311(defcustom speedbar-use-imenu-flag t 311(defcustom speedbar-use-imenu-flag t
312 "Non-nil means use imenu for file parsing, nil to use etags. 312 "Whether to use imenu or etags for file parsing.
313Non-nil means use imenu for file parsing, nil means use etags.
313Etags support is not as robust as imenu support." ; See Bug#51102 314Etags support is not as robust as imenu support." ; See Bug#51102
314 :tag "Use Imenu for tags" 315 :tag "Use Imenu for tags"
315 :group 'speedbar 316 :group 'speedbar
@@ -335,12 +336,12 @@ display is used instead."
335 :type 'boolean) 336 :type 'boolean)
336 337
337(defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag) 338(defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag)
338 "Non-nil means to display info about the line under the mouse." 339 "Non-nil means to display info about the line under the mouse pointer."
339 :group 'speedbar 340 :group 'speedbar
340 :type 'boolean) 341 :type 'boolean)
341 342
342(defcustom speedbar-default-position 'left-right 343(defcustom speedbar-default-position 'left-right
343 "Default position of the speedbar frame. 344 "Default position of the speedbar frame relative to the attached frame.
344Possible values are `left', `right' or `left-right'. 345Possible values are `left', `right' or `left-right'.
345If value is `left-right', the most suitable location is 346If value is `left-right', the most suitable location is
346determined automatically." 347determined automatically."
@@ -350,8 +351,8 @@ determined automatically."
350 (const :tag "Right" right))) 351 (const :tag "Right" right)))
351 352
352(defcustom speedbar-sort-tags nil 353(defcustom speedbar-sort-tags nil
353 "If non-nil, sort tags in the speedbar display. *Obsolete*. 354 "If non-nil, sort tags in the speedbar display.
354Use `speedbar-tag-hierarchy-method' instead." 355This option is obsolete; use `speedbar-tag-hierarchy-method' instead."
355 :group 'speedbar 356 :group 'speedbar
356 :type 'boolean) 357 :type 'boolean)
357 358
@@ -405,7 +406,7 @@ items is reached."
405 :type 'integer) 406 :type 'integer)
406 407
407(defcustom speedbar-directory-button-trim-method 'span 408(defcustom speedbar-directory-button-trim-method 'span
408 "Indicates how the directory button will be displayed. 409 "Control how the directory button in speedbar will be displayed.
409Possible values are: 410Possible values are:
410 `span' - span large directories over multiple lines. 411 `span' - span large directories over multiple lines.
411 `trim' - trim large directories to only show the last few. 412 `trim' - trim large directories to only show the last few.
@@ -419,7 +420,7 @@ Possible values are:
419 420
420(defcustom speedbar-smart-directory-expand-flag t 421(defcustom speedbar-smart-directory-expand-flag t
421 "Non-nil means speedbar should use smart expansion. 422 "Non-nil means speedbar should use smart expansion.
422Smart expansion only affects when speedbar wants to display a 423Smart expansion is only in effect when speedbar wants to display a
423directory for a file in the attached frame. When smart expansion is 424directory for a file in the attached frame. When smart expansion is
424enabled, new directories which are children of a displayed directory 425enabled, new directories which are children of a displayed directory
425are expanded in the current framework. If nil, then the current 426are expanded in the current framework. If nil, then the current
@@ -433,7 +434,7 @@ hierarchy would be replaced with the new directory."
433 :type 'integer) 434 :type 'integer)
434 435
435(defcustom speedbar-hide-button-brackets-flag nil 436(defcustom speedbar-hide-button-brackets-flag nil
436 "Non-nil means speedbar will hide the brackets around the + or -." 437 "If non-nil, speedbar will hide the brackets around the + or -."
437 :group 'speedbar 438 :group 'speedbar
438 :type 'boolean) 439 :type 'boolean)
439 440
@@ -474,14 +475,14 @@ hierarchy would be replaced with the new directory."
474 "String separating file text from indicator characters.") 475 "String separating file text from indicator characters.")
475 476
476(defcustom speedbar-vc-do-check t 477(defcustom speedbar-vc-do-check t
477 "Non-nil check all files in speedbar to see if they have been checked out. 478 "If non-nil, check all files in speedbar to see if they have been checked out.
478Any file checked out is marked with `speedbar-vc-indicator'." 479Any file checked out is marked with `speedbar-vc-indicator'."
479 :group 'speedbar-vc 480 :group 'speedbar-vc
480 :type 'boolean) 481 :type 'boolean)
481 482
482(defvar speedbar-vc-indicator "*" 483(defvar speedbar-vc-indicator "*"
483 "Text used to mark files which are currently checked out. 484 "Text used to mark files which are currently checked out.
484Other version control systems can be added by examining the function 485Other version control systems can be added by examining the functions
485`speedbar-vc-directory-enable-hook' and `speedbar-vc-in-control-hook'.") 486`speedbar-vc-directory-enable-hook' and `speedbar-vc-in-control-hook'.")
486 487
487(defcustom speedbar-vc-directory-enable-hook nil 488(defcustom speedbar-vc-directory-enable-hook nil
@@ -502,7 +503,7 @@ current file, and the FILENAME of the file being checked."
502 "Local variable maintaining the current version control check position.") 503 "Local variable maintaining the current version control check position.")
503 504
504(defcustom speedbar-obj-do-check t 505(defcustom speedbar-obj-do-check t
505 "Non-nil check all files in speedbar to see if they have an object file. 506 "If non-nil, check all files in speedbar to see if they have an object file.
506Any file checked out is marked with `speedbar-obj-indicator', and the 507Any file checked out is marked with `speedbar-obj-indicator', and the
507marking is based on `speedbar-obj-alist'." 508marking is based on `speedbar-obj-alist'."
508 :group 'speedbar-vc 509 :group 'speedbar-vc
@@ -561,7 +562,7 @@ state data."
561 (repeat :tag "List of modes" (symbol :tag "Major mode")))) 562 (repeat :tag "List of modes" (symbol :tag "Major mode"))))
562 563
563(defun speedbar-extension-list-to-regex (extlist) 564(defun speedbar-extension-list-to-regex (extlist)
564 "Takes EXTLIST, a list of extensions and transforms it into regexp. 565 "Take EXTLIST, a list of extensions and transform it into regexp.
565All the preceding `.' are stripped for an optimized expression starting 566All the preceding `.' are stripped for an optimized expression starting
566with `.' followed by extensions, followed by full-filenames." 567with `.' followed by extensions, followed by full-filenames."
567 (let ((regex1 nil) (regex2 nil)) 568 (let ((regex1 nil) (regex2 nil))
@@ -894,10 +895,10 @@ directories.")
894(defalias 'speedbar 'speedbar-frame-mode) 895(defalias 'speedbar 'speedbar-frame-mode)
895;;;###autoload 896;;;###autoload
896(defun speedbar-frame-mode (&optional arg) 897(defun speedbar-frame-mode (&optional arg)
897 "Enable or disable speedbar. Positive ARG means turn on, negative turn off. 898 "Enable or disable speedbar.
898A nil ARG means toggle. Once the speedbar frame is activated, a buffer in 899Positive ARG means turn on, negative turn off. A nil ARG means toggle.
899`speedbar-mode' will be displayed. Currently, only one speedbar is 900Once the speedbar frame is activated, a buffer in `speedbar-mode' will
900supported at a time. 901be displayed. Currently, only one speedbar is supported at a time.
901`speedbar-before-popup-hook' is called before popping up the speedbar frame. 902`speedbar-before-popup-hook' is called before popping up the speedbar frame.
902`speedbar-before-delete-hook' is called before the frame is deleted." 903`speedbar-before-delete-hook' is called before the frame is deleted."
903 (interactive "P") 904 (interactive "P")
@@ -956,7 +957,7 @@ supported at a time.
956 (dframe-current-frame 'speedbar-frame 'speedbar-mode)) 957 (dframe-current-frame 'speedbar-frame 'speedbar-mode))
957 958
958(defun speedbar-handle-delete-frame (e) 959(defun speedbar-handle-delete-frame (e)
959 "Handle a delete frame event E. 960 "Handle a delete-frame event E.
960If the deleted frame is the frame speedbar is attached to, 961If the deleted frame is the frame speedbar is attached to,
961we need to delete speedbar also." 962we need to delete speedbar also."
962 (when (and speedbar-frame 963 (when (and speedbar-frame
@@ -1177,7 +1178,7 @@ and the existence of packages."
1177 (error (dframe-message nil))))))) 1178 (error (dframe-message nil)))))))
1178 1179
1179(defun speedbar-show-info-under-mouse () 1180(defun speedbar-show-info-under-mouse ()
1180 "Call the info function for the line under the mouse." 1181 "Call the info function for the line under the mouse pointer."
1181 (let ((pos (mouse-position))) ; we ignore event until I use it later. 1182 (let ((pos (mouse-position))) ; we ignore event until I use it later.
1182 (if (equal (car pos) speedbar-frame) 1183 (if (equal (car pos) speedbar-frame)
1183 (save-excursion 1184 (save-excursion
@@ -1360,7 +1361,7 @@ File style information is displayed with `speedbar-item-info'."
1360 (point) (line-end-position))))) 1361 (point) (line-end-position)))))
1361 1362
1362(defun speedbar-item-info () 1363(defun speedbar-item-info ()
1363 "Display info in the minibuffer about the button the mouse is over. 1364 "Display info in the minibuffer about the button the mouse pointer is over.
1364This function can be replaced in `speedbar-mode-functions-list' as 1365This function can be replaced in `speedbar-mode-functions-list' as
1365`speedbar-item-info'." 1366`speedbar-item-info'."
1366 (interactive) 1367 (interactive)
@@ -1479,7 +1480,7 @@ Files can be copied to new names or places."
1479 )))))) 1480 ))))))
1480 1481
1481(defun speedbar-item-rename () 1482(defun speedbar-item-rename ()
1482 "Rename the item under the cursor or mouse. 1483 "Rename the item under the cursor or the mouse pointer.
1483Files can be renamed to new names or moved to new directories." 1484Files can be renamed to new names or moved to new directories."
1484 (interactive) 1485 (interactive)
1485 (let ((f (speedbar-line-file))) 1486 (let ((f (speedbar-line-file)))
@@ -1524,7 +1525,8 @@ Files can be renamed to new names or moved to new directories."
1524 (error "Not a file")))) 1525 (error "Not a file"))))
1525 1526
1526(defun speedbar-item-delete () 1527(defun speedbar-item-delete ()
1527 "Delete the item under the cursor. Files are removed from disk." 1528 "Delete the item under the cursor.
1529Files are removed from disk."
1528 (interactive) 1530 (interactive)
1529 (let ((f (speedbar-line-file))) 1531 (let ((f (speedbar-line-file)))
1530 (if (not f) (error "Not a file")) 1532 (if (not f) (error "Not a file"))
@@ -1679,7 +1681,7 @@ This is based on `speedbar-initial-expansion-list-name' referencing
1679 speedbar-initial-expansion-mode-alist))))) 1681 speedbar-initial-expansion-mode-alist)))))
1680 1682
1681(defun speedbar-initial-keymap () 1683(defun speedbar-initial-keymap ()
1682 "Return the current default menu data. 1684 "Return the current default keymap data.
1683This is based on `speedbar-initial-expansion-list-name' referencing 1685This is based on `speedbar-initial-expansion-list-name' referencing
1684`speedbar-initial-expansion-mode-alist'." 1686`speedbar-initial-expansion-mode-alist'."
1685 (symbol-value 1687 (symbol-value
@@ -1956,7 +1958,7 @@ position to insert a new item, and that the new item will end with a CR."
1956;;; Build button lists 1958;;; Build button lists
1957;; 1959;;
1958(defun speedbar-insert-files-at-point (files level) 1960(defun speedbar-insert-files-at-point (files level)
1959 "Insert list of FILES starting at point, and indenting all files to LEVEL. 1961 "Insert list of FILES starting at point, and indent all files to LEVEL.
1960Tag expandable items with a +, otherwise a ?. Don't highlight ? as we 1962Tag expandable items with a +, otherwise a ?. Don't highlight ? as we
1961don't know how to manage them. The input parameter FILES is a cons 1963don't know how to manage them. The input parameter FILES is a cons
1962cell of the form (DIRLIST . FILELIST)." 1964cell of the form (DIRLIST . FILELIST)."
@@ -2028,7 +2030,7 @@ Groups may optionally contain a position."
2028 ))) 2030 )))
2029 2031
2030(defun speedbar-generic-list-positioned-group-p (sublst) 2032(defun speedbar-generic-list-positioned-group-p (sublst)
2031 "Non-nil if SUBLST is a group with a position." 2033 "Return non-nil if SUBLST is a group with a position."
2032 (and (stringp (car-safe sublst)) 2034 (and (stringp (car-safe sublst))
2033 (number-or-marker-p (car-safe (cdr-safe sublst))) 2035 (number-or-marker-p (car-safe (cdr-safe sublst)))
2034 (listp (cdr-safe (cdr-safe sublst))) 2036 (listp (cdr-safe (cdr-safe sublst)))
@@ -2039,7 +2041,7 @@ Groups may optionally contain a position."
2039 )))) 2041 ))))
2040 2042
2041(defun speedbar-generic-list-tag-p (sublst) 2043(defun speedbar-generic-list-tag-p (sublst)
2042 "Non-nil if SUBLST is a tag." 2044 "Return non-nil if SUBLST is a tag."
2043 (and (stringp (car-safe sublst)) 2045 (and (stringp (car-safe sublst))
2044 (or (and (number-or-marker-p (cdr-safe sublst)) 2046 (or (and (number-or-marker-p (cdr-safe sublst))
2045 (not (cdr-safe (cdr-safe sublst)))) 2047 (not (cdr-safe (cdr-safe sublst))))
@@ -2744,7 +2746,7 @@ indicator, then do not add a space."
2744 )))) 2746 ))))
2745 2747
2746(defun speedbar-check-read-only () 2748(defun speedbar-check-read-only ()
2747 "Scan all the files in a directory, and for each see if it is read only." 2749 "Scan all the files in a directory, and for each see if it is read-only."
2748 ;; Check for to-do to be reset. If reset but no RCS is available 2750 ;; Check for to-do to be reset. If reset but no RCS is available
2749 ;; then set to nil (do nothing) otherwise, start at the beginning 2751 ;; then set to nil (do nothing) otherwise, start at the beginning
2750 (save-excursion 2752 (save-excursion
@@ -3296,7 +3298,7 @@ INDENT is the current indentation level and is unused."
3296 (speedbar-set-timer dframe-update-speed)) 3298 (speedbar-set-timer dframe-update-speed))
3297 3299
3298(defun speedbar-tag-file (text token indent) 3300(defun speedbar-tag-file (text token indent)
3299 "The cursor is on a selected line. Expand the tags in the specified file. 3301 "Expand tags in file given by TOKEN when button TEXT was clicked.
3300The parameter TEXT and TOKEN are required, where TEXT is the button 3302The parameter TEXT and TOKEN are required, where TEXT is the button
3301clicked, and TOKEN is the file to expand. INDENT is the current 3303clicked, and TOKEN is the file to expand. INDENT is the current
3302indentation level." 3304indentation level."
@@ -3338,7 +3340,8 @@ INDENT is the current indentation level."
3338 )) 3340 ))
3339 3341
3340(defun speedbar-tag-expand (text token indent) 3342(defun speedbar-tag-expand (text token indent)
3341 "Expand a tag sublist. Imenu will return sub-lists of specialized tag types. 3343 "Expand a tag sublist TOKEN for button TEXT and indentation level INDENT.
3344Imenu will return sub-lists of specialized tag types.
3342Etags does not support this feature. TEXT will be the button string. 3345Etags does not support this feature. TEXT will be the button string.
3343TOKEN will be the list, and INDENT is the current indentation level." 3346TOKEN will be the list, and INDENT is the current indentation level."
3344 (cond ((string-search "+" text) ;we have to expand this file 3347 (cond ((string-search "+" text) ;we have to expand this file
@@ -3365,7 +3368,7 @@ the attached frame (the frame that speedbar was started from)."
3365 :type '(choice integer (other :tag "attached" attached))) 3368 :type '(choice integer (other :tag "attached" attached)))
3366 3369
3367(defun speedbar-find-file-in-frame (file) 3370(defun speedbar-find-file-in-frame (file)
3368 "This will load FILE into the speedbar attached frame. 3371 "Load FILE into the frame attached to speedbar.
3369If the file is being displayed in a different frame already, then raise that 3372If the file is being displayed in a different frame already, then raise that
3370frame instead." 3373frame instead."
3371 (let* ((buff (find-file-noselect file)) 3374 (let* ((buff (find-file-noselect file))
@@ -3388,18 +3391,13 @@ frame instead."
3388 "Recenter a speedbar buffer so the current indentation level is all visible. 3391 "Recenter a speedbar buffer so the current indentation level is all visible.
3389This assumes that the cursor is on a file, or tag of a file which the user is 3392This assumes that the cursor is on a file, or tag of a file which the user is
3390interested in." 3393interested in."
3391
3392 (save-selected-window 3394 (save-selected-window
3393
3394 (select-window (get-buffer-window speedbar-buffer t)) 3395 (select-window (get-buffer-window speedbar-buffer t))
3395
3396 (set-buffer speedbar-buffer) 3396 (set-buffer speedbar-buffer)
3397
3398 (if (<= (count-lines (point-min) (point-max)) 3397 (if (<= (count-lines (point-min) (point-max))
3399 (1- (window-height))) 3398 (1- (window-height)))
3400 ;; whole buffer fits 3399 ;; whole buffer fits
3401 (let ((cp (point))) 3400 (let ((cp (point)))
3402
3403 (goto-char (point-min)) 3401 (goto-char (point-min))
3404 (recenter 0) 3402 (recenter 0)
3405 (goto-char cp)) 3403 (goto-char cp))
@@ -3659,7 +3657,8 @@ regular expression EXPR."
3659 ))) 3657 )))
3660 3658
3661(defun speedbar-parse-tex-string () 3659(defun speedbar-parse-tex-string ()
3662 "Parse a Tex string. Only find data which is relevant." 3660 "Parse a Tex string.
3661Only finds data which is relevant."
3663 (save-excursion 3662 (save-excursion
3664 (let ((bound (line-end-position))) 3663 (let ((bound (line-end-position)))
3665 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t) 3664 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t)
@@ -3803,8 +3802,8 @@ Optional argument DEPTH specifies the current depth of the back search."
3803 (buffer-file-name buffer)))))))) 3802 (buffer-file-name buffer))))))))
3804 3803
3805(defun speedbar-buffer-click (text token _indent) 3804(defun speedbar-buffer-click (text token _indent)
3806 "When the users clicks on a buffer-button in speedbar. 3805 "Select frame when the users clicks on a buffer-button in speedbar.
3807TEXT is the buffer's name, TOKEN and INDENT are unused." 3806TEXT is the buffer's name, INDENT is unused."
3808 (if dframe-power-click 3807 (if dframe-power-click
3809 (let ((pop-up-frames t)) (select-window (display-buffer text))) 3808 (let ((pop-up-frames t)) (select-window (display-buffer text)))
3810 (dframe-select-attached-frame speedbar-frame) 3809 (dframe-select-attached-frame speedbar-frame)