unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* BUG: which-func-mode
@ 2003-03-05  0:36 Le Wang
  2003-03-10 18:28 ` Stefan Monnier
  0 siblings, 1 reply; 17+ messages in thread
From: Le Wang @ 2003-03-05  0:36 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2003-03-19  8:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-05  0:36 BUG: which-func-mode Le Wang
2003-03-10 18:28 ` Stefan Monnier
2003-03-11 18:36   ` Richard Stallman
2003-03-11 19:07     ` Stefan Monnier
2003-03-13  7:48       ` Richard Stallman
2003-03-14 23:46         ` Stefan Monnier
2003-03-16  7:47           ` Richard Stallman
2003-03-16  8:02             ` Stefan Monnier
2003-03-16 12:48               ` Robert J. Chassell
2003-03-16 22:37                 ` Stefan Monnier
2003-03-17 12:51                   ` Robert J. Chassell
2003-03-18 13:22                     ` Richard Stallman
2003-03-17  4:51               ` Richard Stallman
2003-03-17 15:30                 ` Stefan Monnier
2003-03-17 23:24                   ` Richard Stallman
2003-03-18  0:53                     ` Stefan Monnier
2003-03-19  8:49                       ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).