diff options
| -rw-r--r-- | lisp/uniquify.el | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/uniquify.el b/lisp/uniquify.el index 70e8ecee745..1df84ccc35e 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el | |||
| @@ -104,6 +104,14 @@ would have the following buffer names in the various styles: | |||
| 104 | post-forward-angle-brackets name<bar/mumble> name<quux/mumble> | 104 | post-forward-angle-brackets name<bar/mumble> name<quux/mumble> |
| 105 | nil name name<2> | 105 | nil name name<2> |
| 106 | 106 | ||
| 107 | The value can be set to a customized function with two mandatory | ||
| 108 | arguments BASE and EXTRA-STRINGS where BASE is a string and | ||
| 109 | EXTRA-STRINGS is a list of strings. For example the current | ||
| 110 | implementation for post-forward-angle-brackets could be: | ||
| 111 | |||
| 112 | (defun my-post-forward-angle-brackets (base extra-string) | ||
| 113 | (concat base \"<\" (mapconcat 'identity extra-string \"/\") \">\")) | ||
| 114 | |||
| 107 | The \"mumble\" part may be stripped as well, depending on the | 115 | The \"mumble\" part may be stripped as well, depending on the |
| 108 | setting of `uniquify-strip-common-suffix'. For more options that | 116 | setting of `uniquify-strip-common-suffix'. For more options that |
| 109 | you can set, browse the `uniquify' custom group." | 117 | you can set, browse the `uniquify' custom group." |
| @@ -111,6 +119,7 @@ you can set, browse the `uniquify' custom group." | |||
| 111 | (const reverse) | 119 | (const reverse) |
| 112 | (const post-forward) | 120 | (const post-forward) |
| 113 | (const post-forward-angle-brackets) | 121 | (const post-forward-angle-brackets) |
| 122 | (function :tag "Other") | ||
| 114 | (const :tag "numeric suffixes" nil)) | 123 | (const :tag "numeric suffixes" nil)) |
| 115 | :version "24.4" | 124 | :version "24.4" |
| 116 | :require 'uniquify) | 125 | :require 'uniquify) |
| @@ -364,20 +373,22 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." | |||
| 364 | (cond | 373 | (cond |
| 365 | ((null extra-string) base) | 374 | ((null extra-string) base) |
| 366 | ((string-equal base "") ;Happens for dired buffers on the root directory. | 375 | ((string-equal base "") ;Happens for dired buffers on the root directory. |
| 367 | (mapconcat 'identity extra-string "/")) | 376 | (mapconcat #'identity extra-string "/")) |
| 368 | ((eq uniquify-buffer-name-style 'reverse) | 377 | ((eq uniquify-buffer-name-style 'reverse) |
| 369 | (mapconcat 'identity | 378 | (mapconcat #'identity |
| 370 | (cons base (nreverse extra-string)) | 379 | (cons base (nreverse extra-string)) |
| 371 | (or uniquify-separator "\\"))) | 380 | (or uniquify-separator "\\"))) |
| 372 | ((eq uniquify-buffer-name-style 'forward) | 381 | ((eq uniquify-buffer-name-style 'forward) |
| 373 | (mapconcat 'identity (nconc extra-string (list base)) | 382 | (mapconcat #'identity (nconc extra-string (list base)) |
| 374 | "/")) | 383 | "/")) |
| 375 | ((eq uniquify-buffer-name-style 'post-forward) | 384 | ((eq uniquify-buffer-name-style 'post-forward) |
| 376 | (concat base (or uniquify-separator "|") | 385 | (concat base (or uniquify-separator "|") |
| 377 | (mapconcat 'identity extra-string "/"))) | 386 | (mapconcat #'identity extra-string "/"))) |
| 378 | ((eq uniquify-buffer-name-style 'post-forward-angle-brackets) | 387 | ((eq uniquify-buffer-name-style 'post-forward-angle-brackets) |
| 379 | (concat base "<" (mapconcat 'identity extra-string "/") | 388 | (concat base "<" (mapconcat #'identity extra-string "/") |
| 380 | ">")) | 389 | ">")) |
| 390 | ((functionp uniquify-buffer-name-style) | ||
| 391 | (funcall uniquify-buffer-name-style base extra-string)) | ||
| 381 | (t (error "Bad value for uniquify-buffer-name-style: %s" | 392 | (t (error "Bad value for uniquify-buffer-name-style: %s" |
| 382 | uniquify-buffer-name-style))))) | 393 | uniquify-buffer-name-style))))) |
| 383 | 394 | ||