[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer who
From: |
Stefan Monnier |
Subject: |
bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD |
Date: |
Sun, 09 Jul 2023 22:04:54 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>> This inspired me to do something not exactly this but which also gets
>>> rid of the new argument to create-file-buffer. How about this:
>>
>> Now you're talking! :-)
>> LGTM! Thank you very much,
>
> Great! Here's that as a complete patch again.
Eli, OK to install on `master`?
Stefan
PS: Nitpicks:
> + (let* ((lastname (if (directory-name-p filename)
> + (file-name-nondirectory (directory-file-name
> filename))
> + (file-name-nondirectory filename)))
Aka
(let* ((lastname (file-name-nondirectory
(if (directory-name-p filename)
(directory-file-name filename)
filename)))
or even just
(let* ((lastname (file-name-nondirectory
(directory-file-name filename)))
> + (lastname (if (and (directory-name-p filename)
> uniquify-trailing-separator-p)
> + (cond ((eq uniquify-buffer-name-style 'forward)
> + (file-name-as-directory lastname))
> + ((eq uniquify-buffer-name-style 'reverse)
> + (concat (or uniquify-separator "\\") lastname))
> + (t lastname))
> + lastname))
Here you can merge the `if` into the `cond` and I'd test
`uniquify-trailing-separator-p` first (cheaper and nil by default)
and since we know (directory-name-p filename), I'd be tempted to replace
(file-name-as-directory lastname) with just `filename`. Also I'd argue
that when `uniquify-trailing-separator-p` and (directory-name-p
filename) are both true we never want to use just `lastname` so the
default should be to return `filename`:
(lastname (cond
((not (and uniquify-trailing-separator-p
(directory-name-p filename)))
lastname)
((eq uniquify-buffer-name-style 'reverse)
(concat (or uniquify-separator "\\") lastname))
(t filename)))
so for `post-forward` (my personal favorite) /foo/bar/mumble/name/ would
turn into name/|bar/mumble.
WDYT?
Stefan
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, sbaugh, 2023/07/03
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Stefan Monnier, 2023/07/08
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, sbaugh, 2023/07/09
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Eli Zaretskii, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Spencer Baugh, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Eli Zaretskii, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Stefan Monnier, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Eli Zaretskii, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Stefan Monnier, 2023/07/10
- bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD, Eli Zaretskii, 2023/07/10