mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
(create-file-buffer): If the filename sans directory starts with spaces,
remove them.
This commit is contained in:
parent
b42ff09954
commit
661e8cd19b
2 changed files with 10 additions and 2 deletions
|
|
@ -1319,11 +1319,14 @@ killed."
|
|||
(defun create-file-buffer (filename)
|
||||
"Create a suitably named buffer for visiting FILENAME, and return it.
|
||||
FILENAME (sans directory) is used unchanged if that name is free;
|
||||
otherwise a string <2> or <3> or ... is appended to get an unused name."
|
||||
otherwise a string <2> or <3> or ... is appended to get an unused name.
|
||||
Spaces at the start of FILENAME (sans directory) are removed."
|
||||
(let ((lastname (file-name-nondirectory filename)))
|
||||
(if (string= lastname "")
|
||||
(setq lastname filename))
|
||||
(generate-new-buffer lastname)))
|
||||
(save-match-data
|
||||
(string-match "^ *\\(.*\\)" lastname)
|
||||
(generate-new-buffer (match-string 1 lastname)))))
|
||||
|
||||
(defun generate-new-buffer (name)
|
||||
"Create and return a buffer with a name based on NAME.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue