help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: speedbar: speedbar-up-directory


From: martin rudalics
Subject: Re: speedbar: speedbar-up-directory
Date: Thu, 13 Jul 2006 11:13:30 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> Hi,
>
> I did not use speedbar for a long time, but the preceeding post
> reminded me of that handy feature. For some things it can be really
> helpfull, but I find its behaviour kind of weird. Every time I do a
> speedbar-up-directory speedbar jumps to the next directory but jumps
> back at the same speed.  Same thing when I click on the directory name.
>  No way to reach another directory that way. Only thing I can do is a
> C-x d to change the directory.
> Any pointers to that?
>
> harry
>
> PS: I use emacs-snapshot (that ist 22) from debian unstable

I think there's a couple of bugs in speedbar.el and dframe.el.  I posted
the attached fix at <emacs-devel@gnu.org> please try whether it works.
*** dframe.el   Tue Apr 11 16:23:48 2006
--- dframe.el   Thu Jul 13 09:56:02 2006
***************
*** 164,172 ****
  ;;; Variables
  ;;
  (defgroup dframe nil
!   "Faces used in dframe."
    :prefix "dframe-"
!   :group 'dframe)

  (defvar dframe-have-timer-flag
    (and (or (fboundp 'run-with-idle-timer)
--- 164,174 ----
  ;;; Variables
  ;;
  (defgroup dframe nil
!   "Dedicated frames management."
    :prefix "dframe-"
!   :group 'frames
!   :group 'speedbar
!   :version "22.1")

  (defvar dframe-have-timer-flag
    (and (or (fboundp 'run-with-idle-timer)
***************
*** 187,193 ****
  Updates occur to allow dframe to display directory information
  relevant to the buffer you are currently editing."
    :group 'dframe
!   :type 'integer)

  (defcustom dframe-activity-change-focus-flag nil
    "*Non-nil means the selected frame will change based on activity.
--- 189,199 ----
  Updates occur to allow dframe to display directory information
  relevant to the buffer you are currently editing."
    :group 'dframe
!   :type 'integer
!   :set (lambda (sym val)
!        (set-default sym val)
!          (when (and val (fboundp 'dframe-set-timer-internal)
!            (dframe-set-timer-internal val t)))))

  (defcustom dframe-activity-change-focus-flag nil
    "*Non-nil means the selected frame will change based on activity.

*** speedbar.el Tue Jun  6 19:20:26 2006
--- speedbar.el Thu Jul 13 10:16:46 2006
***************
*** 320,336 ****
    :group 'speedbar
    :type 'boolean)

! ;;; EVENTUALLY REMOVE THESE

! ;; When I moved to a repeating timer, I had the horrible missfortune
! ;; of loosing the ability for adaptive speed choice.  This update
! ;; speed currently causes long delays when it should have been turned off.
! (defvar speedbar-update-speed dframe-update-speed
!   "*Obsoleted variable.  Use `dframe-update-speed'.")
! 
! (defvar speedbar-navigating-speed dframe-update-speed
!   "*Obsoleted variable.  Use `dframe-update-speed'.")
! ;;; END REMOVE THESE

  (defcustom speedbar-frame-parameters '((minibuffer . nil)
                                       (width . 20)
--- 320,340 ----
    :group 'speedbar
    :type 'boolean)

! (defcustom speedbar-update-speed dframe-update-speed
!   "*Idle time in seconds needed before speedbar will update itself.
! Updates occur to allow speedbar to display directory information
! relevant to the buffer you are currently editing."
!   :group 'speedbar
!   :type 'integer
!   :set (lambda (sym val)
!        (set-default sym val)
!          (when (and val (fboundp 'speedbar-set-timer)
!                   (boundp 'speedbar-buffer) speedbar-buffer)
!          (with-current-buffer speedbar-buffer
!            (speedbar-set-timer val)))))

! (defvar speedbar-navigating-speed speedbar-update-speed
!   "*Obsoleted variable.  Use `speedbar-update-speed' instead.")

  (defcustom speedbar-frame-parameters '((minibuffer . nil)
                                       (width . 20)
***************
*** 915,921 ****
                     (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))]
      )
    "Additional menu items while in file-mode.")
!  
  (defvar speedbar-easymenu-definition-trailer
    (append
     (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
--- 919,925 ----
                     (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))]
      )
    "Additional menu items while in file-mode.")
! 
  (defvar speedbar-easymenu-definition-trailer
    (append
     (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
***************
*** 1008,1014 ****
        (speedbar-set-timer nil)
      (speedbar-reconfigure-keymaps)
      (speedbar-update-contents)
!     (speedbar-set-timer dframe-update-speed)
      )
    ;; Frame modifications
    (set (make-local-variable 'dframe-delete-frame-function)
--- 1012,1018 ----
        (speedbar-set-timer nil)
      (speedbar-reconfigure-keymaps)
      (speedbar-update-contents)
!     (speedbar-set-timer speedbar-update-speed)
      )
    ;; Frame modifications
    (set (make-local-variable 'dframe-delete-frame-function)
***************
*** 1158,1164 ****
  ;; Backwards compatibility
  (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer)
  (defalias 'speedbar-maybee-jump-to-attached-frame 
'dframe-maybee-jump-to-attached-frame)
!  
  (defun speedbar-set-mode-line-format ()
    "Set the format of the mode line based on the current speedbar environment.
  This gives visual indications of what is up.  It EXPECTS the speedbar
--- 1162,1168 ----
  ;; Backwards compatibility
  (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer)
  (defalias 'speedbar-maybee-jump-to-attached-frame 
'dframe-maybee-jump-to-attached-frame)
! 
  (defun speedbar-set-mode-line-format ()
    "Set the format of the mode line based on the current speedbar environment.
  This gives visual indications of what is up.  It EXPECTS the speedbar
***************
*** 1422,1428 ****
      (speedbar-update-contents)
      (speedbar-stealthy-updates)
      ;; Reset the timer in case it got really hosed for some reason...
!     (speedbar-set-timer dframe-update-speed)
      (if (<= 1 speedbar-verbosity-level)
        (speedbar-message "Refreshing speedbar...done"))))

--- 1426,1432 ----
      (speedbar-update-contents)
      (speedbar-stealthy-updates)
      ;; Reset the timer in case it got really hosed for some reason...
!     (speedbar-set-timer speedbar-update-speed)
      (if (<= 1 speedbar-verbosity-level)
        (speedbar-message "Refreshing speedbar...done"))))

***************
*** 1674,1680 ****
    (interactive)
    (setq speedbar-update-flag t)
    (speedbar-set-mode-line-format)
!   (speedbar-set-timer dframe-update-speed))

  (defun speedbar-disable-update ()
    "Disable automatic updating and stop consuming resources."
--- 1678,1684 ----
    (interactive)
    (setq speedbar-update-flag t)
    (speedbar-set-mode-line-format)
!   (speedbar-set-timer speedbar-update-speed))

  (defun speedbar-disable-update ()
    "Disable automatic updating and stop consuming resources."
***************
*** 2055,2061 ****
                            (if tag-button-function 'speedbar-highlight-face 
nil)
                            tag-button-function tag-button-data))
      ))
!   
  (defun speedbar-change-expand-button-char (char)
    "Change the expansion button character to CHAR for the current line."
    (save-excursion
--- 2059,2065 ----
                            (if tag-button-function 'speedbar-highlight-face 
nil)
                            tag-button-function tag-button-data))
      ))
! 
  (defun speedbar-change-expand-button-char (char)
    "Change the expansion button character to CHAR for the current line."
    (save-excursion
***************
*** 2454,2460 ****
    (speedbar-insert-generic-list indent lst
                                'speedbar-tag-expand
                                'speedbar-tag-find))
!                               
  (defun speedbar-insert-etags-list (indent lst)
    "At level INDENT, insert the etags generated LST."
    (speedbar-insert-generic-list indent lst
--- 2458,2464 ----
    (speedbar-insert-generic-list indent lst
                                'speedbar-tag-expand
                                'speedbar-tag-find))
! 
  (defun speedbar-insert-etags-list (indent lst)
    "At level INDENT, insert the etags generated LST."
    (speedbar-insert-generic-list indent lst
***************
*** 2721,2727 ****
    "Go to the line where FILE is."

    (set-buffer speedbar-buffer)
!   
    (goto-char (point-min))
    (let ((m nil))
      (while (and (setq m (re-search-forward
--- 2725,2731 ----
    "Go to the line where FILE is."

    (set-buffer speedbar-buffer)
! 
    (goto-char (point-min))
    (let ((m nil))
      (while (and (setq m (re-search-forward
***************
*** 3212,3218 ****
      (widen)
      (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory)))
        (if rf (funcall rf depth) default-directory))))
!       
  (defun speedbar-files-line-directory (&optional depth)
    "Retrieve the directoryname associated with the current line.
  This may require traversing backwards from DEPTH and combining the default
--- 3216,3222 ----
      (widen)
      (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory)))
        (if rf (funcall rf depth) default-directory))))
! 
  (defun speedbar-files-line-directory (&optional depth)
    "Retrieve the directoryname associated with the current line.
  This may require traversing backwards from DEPTH and combining the default
***************
*** 3297,3308 ****
          (forward-char -2)
          (speedbar-do-function-pointer))
        (error (speedbar-position-cursor-on-line)))))
!   
  (defun speedbar-flush-expand-line ()
    "Expand the line under the cursor and flush any cached information."
    (interactive)
    (speedbar-expand-line 1))
!   
  (defun speedbar-contract-line ()
    "Contract the line under the cursor."
    (interactive)
--- 3301,3312 ----
          (forward-char -2)
          (speedbar-do-function-pointer))
        (error (speedbar-position-cursor-on-line)))))
! 
  (defun speedbar-flush-expand-line ()
    "Expand the line under the cursor and flush any cached information."
    (interactive)
    (speedbar-expand-line 1))
! 
  (defun speedbar-contract-line ()
    "Contract the line under the cursor."
    (interactive)
***************
*** 3370,3376 ****
      ;; Reset the timer with a new timeout when cliking a file
      ;; in case the user was navigating directories, we can cancel
      ;; that other timer.
!     (speedbar-set-timer dframe-update-speed))
    (dframe-maybee-jump-to-attached-frame))

  (defun speedbar-dir-follow (text token indent)
--- 3374,3380 ----
      ;; Reset the timer with a new timeout when cliking a file
      ;; in case the user was navigating directories, we can cancel
      ;; that other timer.
!     (speedbar-set-timer speedbar-update-speed))
    (dframe-maybee-jump-to-attached-frame))

  (defun speedbar-dir-follow (text token indent)
***************
*** 3387,3393 ****
    ;; in case.
    (let ((speedbar-smart-directory-expand-flag nil))
      (speedbar-update-contents))
!   (speedbar-set-timer speedbar-navigating-speed)
    (setq speedbar-last-selected-file nil)
    (speedbar-stealthy-updates))

--- 3391,3397 ----
    ;; in case.
    (let ((speedbar-smart-directory-expand-flag nil))
      (speedbar-update-contents))
!   (speedbar-set-timer speedbar-update-speed)
    (setq speedbar-last-selected-file nil)
    (speedbar-stealthy-updates))

***************
*** 3452,3458 ****
    ;; update contents will change directory without
    ;; having to touch the attached frame.
    (speedbar-update-contents)
!   (speedbar-set-timer speedbar-navigating-speed))

  (defun speedbar-tag-file (text token indent)
    "The cursor is on a selected line.  Expand the tags in the specified file.
--- 3456,3462 ----
    ;; update contents will change directory without
    ;; having to touch the attached frame.
    (speedbar-update-contents)
!   (speedbar-set-timer speedbar-update-speed))

  (defun speedbar-tag-file (text token indent)
    "The cursor is on a selected line.  Expand the tags in the specified file.
***************
*** 3491,3497 ****
      ;; Reset the timer with a new timeout when cliking a file
      ;; in case the user was navigating directories, we can cancel
      ;; that other timer.
!     (speedbar-set-timer dframe-update-speed)
      (goto-char token)
      (run-hooks 'speedbar-visiting-tag-hook)
      (dframe-maybee-jump-to-attached-frame)
--- 3495,3501 ----
      ;; Reset the timer with a new timeout when cliking a file
      ;; in case the user was navigating directories, we can cancel
      ;; that other timer.
!     (speedbar-set-timer speedbar-update-speed)
      (goto-char token)
      (run-hooks 'speedbar-visiting-tag-hook)
      (dframe-maybee-jump-to-attached-frame)
***************
*** 3551,3561 ****
  interested in."

    (save-selected-window
!   
      (select-window (get-buffer-window speedbar-buffer t))
!     
      (set-buffer speedbar-buffer)
!     
      (if (<= (count-lines (point-min) (point-max))
            (1- (window-height (selected-window))))
        ;; whole buffer fits
--- 3555,3565 ----
  interested in."

    (save-selected-window
! 
      (select-window (get-buffer-window speedbar-buffer t))
! 
      (set-buffer speedbar-buffer)
! 
      (if (<= (count-lines (point-min) (point-max))
            (1- (window-height (selected-window))))
        ;; whole buffer fits


reply via email to

[Prev in Thread] Current Thread [Next in Thread]