From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.devel Subject: BUG: which-func-mode Date: Tue, 04 Mar 2003 19:36:41 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: main.gmane.org 1046825069 9328 80.91.224.249 (5 Mar 2003 00:44:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 5 Mar 2003 00:44:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Mar 05 01:44:27 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18qN1H-0002QK-00 for ; Wed, 05 Mar 2003 01:44:27 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18qNKs-0007Vy-00 for ; Wed, 05 Mar 2003 02:04:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18qN1S-0004VD-03 for emacs-devel@quimby.gnus.org; Tue, 04 Mar 2003 19:44:38 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18qN0y-00042L-00 for emacs-devel@gnu.org; Tue, 04 Mar 2003 19:44:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18qN0h-0003T0-00 for emacs-devel@gnu.org; Tue, 04 Mar 2003 19:43:52 -0500 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18qMwh-0000xR-00 for emacs-devel@gnu.org; Tue, 04 Mar 2003 19:39:43 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18qMw9-00029a-00 for ; Wed, 05 Mar 2003 01:39:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18qMw4-000295-00 for ; Wed, 05 Mar 2003 01:39:04 +0100 Original-Lines: 66 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: KNode/0.7.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12099 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12099 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