+2007-08-31 Micha\e,Ak\e(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\e,Ad\e(Brv <jan.h.d@swipnet.se>
* term/x-win.el (x-gtk-stock-map): Add etc/images to keys.
(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.