changeset 48833:df00563bf991

(uniquify-rationalize-file-buffer-names, rename-buffer) (uniquify-delay-rationalize-file-buffer-names, kill-buffer-hook): Undo 2002/09/27 change, because kill-buffer-hook is not permanent-local.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 13 Dec 2002 19:52:35 +0000
parents 351ae4e51f08
children ffa5e816fcad
files lisp/uniquify.el
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/uniquify.el	Fri Dec 13 04:45:43 2002 +0000
+++ b/lisp/uniquify.el	Fri Dec 13 19:52:35 2002 +0000
@@ -209,13 +209,6 @@
 				 rawname bfn uniquify-min-dir-content)))
 	    (push (vector rawname bfn buffer proposed) fix-list)
 	  (push bufname uniquify-non-file-buffer-names))))
-    ;; Set up uniquify to re-rationalize after killing/renaming
-    ;; if there is a conflict.
-    (when (and uniquify-after-kill-buffer-p newbuffile (cdr fix-list))
-      (dolist (fix fix-list)
-	(with-current-buffer (uniquify-ref-buffer fix)
-	  (add-hook 'kill-buffer-hook
-		    'uniquify-delay-rationalize-file-buffer-names nil t))))
     ;; selects buffers whose names may need changing, and others that
     ;; may conflict, then bring conflicting names together
     (uniquify-rationalize-a-list fix-list uniquify-min-dir-content)))
@@ -368,8 +361,7 @@
 	   ;; UNIQUE argument
 	   (ad-get-arg 1))
       (progn
-	(if (memq 'uniquify-delay-rationalize-file-buffer-names
-		  kill-buffer-hook)
+	(if uniquify-after-kill-buffer-p
 	    ;; call with no argument; rationalize vs. old name as well as new
 	    (uniquify-rationalize-file-buffer-names)
 	  ;; call with argument: rationalize vs. new name only
@@ -397,7 +389,9 @@
   "Add `delayed-uniquify-rationalize-file-buffer-names' to `post-command-hook'.
 For use on, eg, `kill-buffer-hook', to rationalize *after* buffer deletion."
   (if (and uniquify-buffer-name-style
-	   uniquify-after-kill-buffer-p)
+	   uniquify-after-kill-buffer-p
+	   ;; Rationalizing is costly, so don't do it for temp buffers.
+	   (uniquify-buffer-file-name (current-buffer)))
       (add-hook 'post-command-hook
 		'uniquify-delayed-rationalize-file-buffer-names)))
 
@@ -408,4 +402,6 @@
   (remove-hook 'post-command-hook
 	       'uniquify-delayed-rationalize-file-buffer-names))
 
+(add-hook 'kill-buffer-hook 'uniquify-delay-rationalize-file-buffer-names)
+
 ;;; uniquify.el ends here