From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: problem with uniquify.el and kill-buffer-hook Date: Fri, 13 Dec 2002 10:48:57 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200212131548.gBDFmva14269@rum.cs.yale.edu> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1039795312 10906 80.91.224.249 (13 Dec 2002 16:01:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 13 Dec 2002 16:01:52 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18MsG5-0002pY-00 for ; Fri, 13 Dec 2002 17:01:49 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18MsSA-0006Vb-00 for ; Fri, 13 Dec 2002 17:14:18 +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 18Ms7p-0004Ed-08 for emacs-devel@quimby.gnus.org; Fri, 13 Dec 2002 10:53:17 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18Ms58-000316-00 for emacs-devel@gnu.org; Fri, 13 Dec 2002 10:50:30 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18Ms4m-0002do-00 for emacs-devel@gnu.org; Fri, 13 Dec 2002 10:50:09 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18Ms4L-0002ac-00 for emacs-devel@gnu.org; Fri, 13 Dec 2002 10:49:41 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id gBDFmva14269; Fri, 13 Dec 2002 10:48:57 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Miles Bader 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:10117 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10117 > Recently I've noticed that the `uniquify' package has stopped working > correctly, in particular, the feature controlled by the > `uniquify-after-kill-buffer-p' variable doesn't work; here's the doc: > > uniquify-after-kill-buffer-p's value is t > > If non-nil, rerationalize buffer names after a buffer has been killed. > This can be dangerous if Emacs Lisp code is keeping track of buffers > by their names (rather than keeping pointers to the buffers > themselves). > > I looked at the code a bit, and I think I found the problem: > > This feature works by adding an appropriate local hook to > `kill-buffer-hook' in all the affected buffers. > > However, this is done _before_ the buffer's mode is set (in the new > buffer that caused uniqify to be triggered); since most mode functions > call `kill-all-local-variables', this trashes the `kill-buffer-hook'. Duh! > Also, any ideas why this just stopped working recently? I didn't see > any _obvious_ things in the ChangeLogs, but maybe I just missed it. It's due to: 2002-09-27 Stefan Monnier * uniquify.el (uniquify-rationalize-file-buffer-names): Add to kill-buffer-hook for buffers with conflict. (rename-buffer): Check kill-buffer-hook to see if there was a conflict. (uniquify-delay-rationalize-file-buffer-names): Remove useless check. (kill-buffer-hook): Don't change globally. I guess it should just be reverted. Please do it (unless you can come up with a fix, of course). I don't have easy access to the CVS right now. This patch did not fix any real bug anyway. > Another thing (whew!), is that uniquify.el uses `defadvice' (on > `rename-buffer', and `create-file-buffer') and I wonder if it should be > changed to just have those functions invoke it directly. That's a long standing issue indeed. Stefan