unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Uniquify change [PATCH]
       [not found] <20200912115007.tze35edwcdo5vdoc.ref@Ergus>
@ 2020-09-12 11:50 ` Ergus
  2020-09-13 19:02   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Ergus @ 2020-09-12 11:50 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 128 bytes --]

Hi:

I want to add this patch to master. Could you give it a look and suggest
where in NEWS I should mention this?

Best, Ergus

[-- Attachment #2: uniquify.patch --]
[-- Type: text/plain, Size: 1446 bytes --]

diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index 70e8ecee74..8439d9d874 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -104,6 +104,13 @@ uniquify-buffer-name-style
   post-forward-angle-brackets   name<bar/mumble>   name<quux/mumble>
   nil                           name               name<2>
 
+The value can be set to a customized function with two mandatory
+arguments.  For example the current implementation for
+post-forward-angle-brackets could be:
+
+(defun my-post-forward-angle-brackets (base extra-string)
+  (concat base \"<\" (mapconcat 'identity extra-string \"/\") \">\"))
+
 The \"mumble\" part may be stripped as well, depending on the
 setting of `uniquify-strip-common-suffix'.  For more options that
 you can set, browse the `uniquify' custom group."
@@ -111,6 +118,7 @@ uniquify-buffer-name-style
 		(const reverse)
 		(const post-forward)
 		(const post-forward-angle-brackets)
+                (function :tag "Other")
 		(const :tag "numeric suffixes" nil))
   :version "24.4"
   :require 'uniquify)
@@ -378,6 +386,8 @@ uniquify-get-proposed-name
      ((eq uniquify-buffer-name-style 'post-forward-angle-brackets)
       (concat base "<" (mapconcat 'identity extra-string "/")
 	      ">"))
+     ((functionp uniquify-buffer-name-style)
+      (funcall uniquify-buffer-name-style base extra-string))
      (t (error "Bad value for uniquify-buffer-name-style: %s"
 	       uniquify-buffer-name-style)))))
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Uniquify change [PATCH]
  2020-09-12 11:50 ` Uniquify change [PATCH] Ergus
@ 2020-09-13 19:02   ` Stefan Monnier
  2020-09-15 11:34     ` Ergus
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2020-09-13 19:02 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

> I want to add this patch to master. Could you give it a look and suggest
> where in NEWS I should mention this?

Looks very good to me.  See below for the nitpicks,

> diff --git a/lisp/uniquify.el b/lisp/uniquify.el
> index 70e8ecee74..8439d9d874 100644
> --- a/lisp/uniquify.el
> +++ b/lisp/uniquify.el
> @@ -104,6 +104,13 @@ uniquify-buffer-name-style
>    post-forward-angle-brackets   name<bar/mumble>   name<quux/mumble>
>    nil                           name               name<2>
>  
> +The value can be set to a customized function with two mandatory
> +arguments.  For example the current implementation for
> +post-forward-angle-brackets could be:

You should describe those arguments rather than only tell the number of
args and show an example.  E.g.

    The value can be set to a customized function which will be called
    two arguments BASE and EXTRA-STRINGS where BASE is a string and
    EXTRA-STRINGS is a list of strings.  For example the current
    implementation for post-forward-angle-brackets could be:

> +(defun my-post-forward-angle-brackets (base extra-string)
> +  (concat base \"<\" (mapconcat 'identity extra-string \"/\") \">\"))

I'd use #' rather than ' to quote `identity`.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Uniquify change [PATCH]
  2020-09-13 19:02   ` Stefan Monnier
@ 2020-09-15 11:34     ` Ergus
  0 siblings, 0 replies; 3+ messages in thread
From: Ergus @ 2020-09-15 11:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Sun, Sep 13, 2020 at 03:02:44PM -0400, Stefan Monnier wrote:
>> I want to add this patch to master. Could you give it a look and suggest
>> where in NEWS I should mention this?
>
>Looks very good to me.  See below for the nitpicks,
>
>> diff --git a/lisp/uniquify.el b/lisp/uniquify.el
>> index 70e8ecee74..8439d9d874 100644
>> --- a/lisp/uniquify.el
>> +++ b/lisp/uniquify.el
>> @@ -104,6 +104,13 @@ uniquify-buffer-name-style
>>    post-forward-angle-brackets   name<bar/mumble>   name<quux/mumble>
>>    nil                           name               name<2>
>>
>> +The value can be set to a customized function with two mandatory
>> +arguments.  For example the current implementation for
>> +post-forward-angle-brackets could be:
>
>You should describe those arguments rather than only tell the number of
>args and show an example.  E.g.
>
>    The value can be set to a customized function which will be called
>    two arguments BASE and EXTRA-STRINGS where BASE is a string and
>    EXTRA-STRINGS is a list of strings.  For example the current
>    implementation for post-forward-angle-brackets could be:
>
>> +(defun my-post-forward-angle-brackets (base extra-string)
>> +  (concat base \"<\" (mapconcat 'identity extra-string \"/\") \">\"))
>
>I'd use #' rather than ' to quote `identity`.
>
>
>        Stefan
>
>
There is a new branch feature/uniquify-as-function.  I added some
documentation too. If it is fine confirm to merge into master.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-15 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200912115007.tze35edwcdo5vdoc.ref@Ergus>
2020-09-12 11:50 ` Uniquify change [PATCH] Ergus
2020-09-13 19:02   ` Stefan Monnier
2020-09-15 11:34     ` Ergus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).