emacs-devel
[Top][All Lists]
Advanced

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

BUG: which-func-mode


From: Le Wang
Subject: BUG: which-func-mode
Date: Tue, 04 Mar 2003 19:36:41 -0500
User-agent: KNode/0.7.1

Hi,

I just spend a few hours debugging a situation where something was modifying 
my buffer-list behind my back, whenever I had multiple windows in the same 
frame.

It turned out that `which-func-mode' was using `walk-windows' to update the 
mode-lines in all windows.  It selects each window and forces a mode-line 
update in it.  But by selecting the window, it silently disrupts the 
`buffer-list'.  This is the bug.

If I've failed to make the problem clear for everyone, please let me know and 
I'll provide a step by step test case.  But I think this one should be fairly 
obvious.

This is the patch I've come up with, again, please provide corrections where 
required:

*** /usr/local/share/emacs/21.3.50/lisp/which-func.el   Tue Feb  4 19:31:41 2003
--- /tmp/buffer-content-5706yVU Tue Mar  4 19:31:46 2003
***************
*** 158,176 ****
  
  (defun which-func-update-1 (window)
    "Update the Which-Function mode display for window WINDOW."
!   (save-selected-window
!     (select-window window)
!     ;; Update the string containing the current function.
!     (when which-func-mode
!       (condition-case info
!         (progn
!           (setq which-func-current (or (which-function) which-func-unknown))
!           (unless (string= which-func-current which-func-previous)
!             (force-mode-line-update)
!             (setq which-func-previous which-func-current)))
!       (error
!        (which-func-mode -1)
!        (error "Error in which-func-update: %s" info))))))
  
  ;;;###autoload
  (defalias 'which-func-mode 'which-function-mode)
--- 158,175 ----
  
  (defun which-func-update-1 (window)
    "Update the Which-Function mode display for window WINDOW."
!   (set-buffer (window-buffer window))
!   ;; Update the string containing the current function.
!   (when which-func-mode
!     (condition-case info
!       (progn
!         (setq which-func-current (or (which-function) which-func-unknown))
!         (unless (string= which-func-current which-func-previous)
!           (force-mode-line-update)
!           (setq which-func-previous which-func-current)))
!       (error
!        (which-func-mode -1)
!        (error "Error in which-func-update: %s" info)))))
  
  ;;;###autoload
  (defalias 'which-func-mode 'which-function-mode)

Diff finished at Tue Mar  4 19:31:46


--
Le





reply via email to

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