aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/uniquify.el21
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
107The value can be set to a customized function with two mandatory
108arguments BASE and EXTRA-STRINGS where BASE is a string and
109EXTRA-STRINGS is a list of strings. For example the current
110implementation 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
107The \"mumble\" part may be stripped as well, depending on the 115The \"mumble\" part may be stripped as well, depending on the
108setting of `uniquify-strip-common-suffix'. For more options that 116setting of `uniquify-strip-common-suffix'. For more options that
109you can set, browse the `uniquify' custom group." 117you 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