mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-28 07:45:00 +00:00
Make prettier unique file names in eww
(eww-make-unique-file-name): Make unique file names by making
files like foo(2).jpg instead of foo(1)(2).jpg.
Backport:
(cherry picked from commit edfdd0a6cb
)
This commit is contained in:
parent
90f82ffa5d
commit
a7143faf48
@ -1438,13 +1438,14 @@ Differences in #targets are ignored."
|
||||
(setq file "!"))
|
||||
((string-match "\\`[.]" file)
|
||||
(setq file (concat "!" file))))
|
||||
(let ((count 1))
|
||||
(let ((count 1)
|
||||
(stem file)
|
||||
(suffix ""))
|
||||
(when (string-match "\\`\\(.*\\)\\([.][^.]+\\)" file)
|
||||
(setq stem (match-string 1)
|
||||
suffix (match-string 2)))
|
||||
(while (file-exists-p (expand-file-name file directory))
|
||||
(setq file
|
||||
(if (string-match "\\`\\(.*\\)\\([.][^.]+\\)" file)
|
||||
(format "%s(%d)%s" (match-string 1 file)
|
||||
count (match-string 2 file))
|
||||
(format "%s(%d)" file count)))
|
||||
(setq file (format "%s(%d)%s" stem count suffix))
|
||||
(setq count (1+ count)))
|
||||
(expand-file-name file directory)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user