summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMichaël Cadilhac <michael.cadilhac@lrde.org>2007-08-31 13:30:02 +0000
committerMichaël Cadilhac <michael.cadilhac@lrde.org>2007-08-31 13:30:02 +0000
commit661e8cd19ba9e136fbe61f0b728c05e9226da9ea (patch)
tree0b4d9a63ed9e62fae35219a56e194e4f39e5be8f /lisp
parentb42ff09954b7c53cdca01b72d08dedf2da9f1afe (diff)
downloademacs-661e8cd19ba9e136fbe61f0b728c05e9226da9ea.tar.gz
(create-file-buffer): If the filename sans directory starts with spaces,
remove them.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el7
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 59cedc9e160..6a3447dc01e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+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.
diff --git a/lisp/files.el b/lisp/files.el
index 6f4c9cd6f4c..3eba2d43111 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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.