diff options
| author | Juanma Barranquero | 2008-02-14 14:32:44 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2008-02-14 14:32:44 +0000 |
| commit | 20c4d633d37bfe4f7ad1295d9dc09e78b4936bb9 (patch) | |
| tree | 8408d43492bf4c0db25ca9c75305d34301ee0521 | |
| parent | b270d6afc02794c82ea320be8d49acd02d8462d2 (diff) | |
| download | emacs-20c4d633d37bfe4f7ad1295d9dc09e78b4936bb9.tar.gz emacs-20c4d633d37bfe4f7ad1295d9dc09e78b4936bb9.zip | |
(uniquify-buffer-base-name): New function.
Suggested by Stefan Monnier <monnier@iro.umontreal.ca>.
| -rw-r--r-- | lisp/uniquify.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/uniquify.el b/lisp/uniquify.el index da549301580..802f18c3753 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | ;;; Commentary: | 28 | ;;; Commentary: |
| 29 | 29 | ||
| 30 | ;; Emacs's standard method for making buffer names unique adds <2>, <3>, | 30 | ;; Emacs's standard method for making buffer names unique adds <2>, <3>, |
| 31 | ;; etc.. to the end of (all but one of) the buffers. This file replaces | 31 | ;; etc. to the end of (all but one of) the buffers. This file replaces |
| 32 | ;; that behavior, for buffers visiting files and dired buffers, with a | 32 | ;; that behavior, for buffers visiting files and dired buffers, with a |
| 33 | ;; uniquification that adds parts of the file name until the buffer names | 33 | ;; uniquification that adds parts of the file name until the buffer names |
| 34 | ;; are unique. For instance, buffers visiting /u/mernst/tmp/Makefile and | 34 | ;; are unique. For instance, buffers visiting /u/mernst/tmp/Makefile and |
| @@ -191,6 +191,13 @@ It actually holds the list of `uniquify-item's corresponding to the conflict.") | |||
| 191 | (make-variable-buffer-local 'uniquify-managed) | 191 | (make-variable-buffer-local 'uniquify-managed) |
| 192 | (put 'uniquify-managed 'permanent-local t) | 192 | (put 'uniquify-managed 'permanent-local t) |
| 193 | 193 | ||
| 194 | ;; Used in desktop.el to save the non-uniquified buffer name | ||
| 195 | (defun uniquify-buffer-base-name () | ||
| 196 | "Return the base name of the current buffer. | ||
| 197 | Return nil if the buffer is not managed by uniquify." | ||
| 198 | (and uniquify-managed | ||
| 199 | (uniquify-item-base (car uniquify-managed)))) | ||
| 200 | |||
| 194 | ;;; Main entry point. | 201 | ;;; Main entry point. |
| 195 | 202 | ||
| 196 | (defun uniquify-rationalize-file-buffer-names (base dirname newbuf) | 203 | (defun uniquify-rationalize-file-buffer-names (base dirname newbuf) |
| @@ -491,7 +498,7 @@ For use on `kill-buffer-hook'." | |||
| 491 | (dolist (buf buffers) | 498 | (dolist (buf buffers) |
| 492 | (set-buffer (car buf)) | 499 | (set-buffer (car buf)) |
| 493 | (rename-buffer (cdr buf) t)))) | 500 | (rename-buffer (cdr buf) t)))) |
| 494 | ;; continue standard uploading | 501 | ;; continue standard unloading |
| 495 | nil) | 502 | nil) |
| 496 | 503 | ||
| 497 | (provide 'uniquify) | 504 | (provide 'uniquify) |