all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Le Wang <lewang@yahoo.com>
Subject: BUG: which-func-mode
Date: Tue, 04 Mar 2003 19:36:41 -0500	[thread overview]
Message-ID: <b43gv7$80s$1@main.gmane.org> (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

             reply	other threads:[~2003-03-05  0:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-05  0:36 Le Wang [this message]
2003-03-10 18:28 ` BUG: which-func-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='b43gv7$80s$1@main.gmane.org' \
    --to=lewang@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.