Commit 661e8cd1 authored by Michaël Cadilhac's avatar Michaël Cadilhac
Browse files

(create-file-buffer): If the filename sans directory starts with spaces,

remove them.
parent b42ff099
2007-08-31 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
* files.el (create-file-buffer): If the filename sans directory starts
with spaces, remove them.
2007-08-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* term/x-win.el (x-gtk-stock-map): Add etc/images to keys.
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment