From: Michaƫl Cadilhac Date: Fri, 31 Aug 2007 13:30:02 +0000 (+0000) Subject: (create-file-buffer): If the filename sans directory starts with spaces, X-Git-Tag: emacs-pretest-23.0.90~11167 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=661e8cd19ba9e136fbe61f0b728c05e9226da9ea;p=emacs.git (create-file-buffer): If the filename sans directory starts with spaces, remove them. --- 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 + + * files.el (create-file-buffer): If the filename sans directory starts + with spaces, remove them. + 2007-08-31 Jan Dj,Ad(Brv * 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.