diff options
| author | Stefan Monnier | 2002-12-13 19:52:35 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-12-13 19:52:35 +0000 |
| commit | 8b374c3fd77fb0c798ba434a04be7abc646985bc (patch) | |
| tree | e1e526a1befe2def3f335e341800de4b48af82f0 | |
| parent | 58566dff596304043559d71348c93e46ba18b7a2 (diff) | |
| download | emacs-8b374c3fd77fb0c798ba434a04be7abc646985bc.tar.gz emacs-8b374c3fd77fb0c798ba434a04be7abc646985bc.zip | |
(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.
| -rw-r--r-- | lisp/uniquify.el | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lisp/uniquify.el b/lisp/uniquify.el index 25f931868e9..28f231a1e42 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el | |||
| @@ -209,13 +209,6 @@ Arguments NEWBUFFILE and NEWBUF cause only a subset of buffers to be renamed." | |||
| 209 | rawname bfn uniquify-min-dir-content))) | 209 | rawname bfn uniquify-min-dir-content))) |
| 210 | (push (vector rawname bfn buffer proposed) fix-list) | 210 | (push (vector rawname bfn buffer proposed) fix-list) |
| 211 | (push bufname uniquify-non-file-buffer-names)))) | 211 | (push bufname uniquify-non-file-buffer-names)))) |
| 212 | ;; Set up uniquify to re-rationalize after killing/renaming | ||
| 213 | ;; if there is a conflict. | ||
| 214 | (when (and uniquify-after-kill-buffer-p newbuffile (cdr fix-list)) | ||
| 215 | (dolist (fix fix-list) | ||
| 216 | (with-current-buffer (uniquify-ref-buffer fix) | ||
| 217 | (add-hook 'kill-buffer-hook | ||
| 218 | 'uniquify-delay-rationalize-file-buffer-names nil t)))) | ||
| 219 | ;; selects buffers whose names may need changing, and others that | 212 | ;; selects buffers whose names may need changing, and others that |
| 220 | ;; may conflict, then bring conflicting names together | 213 | ;; may conflict, then bring conflicting names together |
| 221 | (uniquify-rationalize-a-list fix-list uniquify-min-dir-content))) | 214 | (uniquify-rationalize-a-list fix-list uniquify-min-dir-content))) |
| @@ -368,8 +361,7 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." | |||
| 368 | ;; UNIQUE argument | 361 | ;; UNIQUE argument |
| 369 | (ad-get-arg 1)) | 362 | (ad-get-arg 1)) |
| 370 | (progn | 363 | (progn |
| 371 | (if (memq 'uniquify-delay-rationalize-file-buffer-names | 364 | (if uniquify-after-kill-buffer-p |
| 372 | kill-buffer-hook) | ||
| 373 | ;; call with no argument; rationalize vs. old name as well as new | 365 | ;; call with no argument; rationalize vs. old name as well as new |
| 374 | (uniquify-rationalize-file-buffer-names) | 366 | (uniquify-rationalize-file-buffer-names) |
| 375 | ;; call with argument: rationalize vs. new name only | 367 | ;; call with argument: rationalize vs. new name only |
| @@ -397,7 +389,9 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." | |||
| 397 | "Add `delayed-uniquify-rationalize-file-buffer-names' to `post-command-hook'. | 389 | "Add `delayed-uniquify-rationalize-file-buffer-names' to `post-command-hook'. |
| 398 | For use on, eg, `kill-buffer-hook', to rationalize *after* buffer deletion." | 390 | For use on, eg, `kill-buffer-hook', to rationalize *after* buffer deletion." |
| 399 | (if (and uniquify-buffer-name-style | 391 | (if (and uniquify-buffer-name-style |
| 400 | uniquify-after-kill-buffer-p) | 392 | uniquify-after-kill-buffer-p |
| 393 | ;; Rationalizing is costly, so don't do it for temp buffers. | ||
| 394 | (uniquify-buffer-file-name (current-buffer))) | ||
| 401 | (add-hook 'post-command-hook | 395 | (add-hook 'post-command-hook |
| 402 | 'uniquify-delayed-rationalize-file-buffer-names))) | 396 | 'uniquify-delayed-rationalize-file-buffer-names))) |
| 403 | 397 | ||
| @@ -408,4 +402,6 @@ See also `delay-rationalize-file-buffer-names' for hook setter." | |||
| 408 | (remove-hook 'post-command-hook | 402 | (remove-hook 'post-command-hook |
| 409 | 'uniquify-delayed-rationalize-file-buffer-names)) | 403 | 'uniquify-delayed-rationalize-file-buffer-names)) |
| 410 | 404 | ||
| 405 | (add-hook 'kill-buffer-hook 'uniquify-delay-rationalize-file-buffer-names) | ||
| 406 | |||
| 411 | ;;; uniquify.el ends here | 407 | ;;; uniquify.el ends here |