Mercurial > emacs
changeset 83817:d2159c231849
(create-file-buffer): If the filename sans directory starts with spaces,
remove them.
author | Michaël Cadilhac <michael.cadilhac@lrde.org> |
---|---|
date | Fri, 31 Aug 2007 13:29:34 +0000 |
parents | 5c99c1cc7ce2 |
children | 2873d23e35c8 |
files | lisp/files.el |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Fri Aug 31 10:17:15 2007 +0000 +++ b/lisp/files.el Fri Aug 31 13:29:34 2007 +0000 @@ -1319,11 +1319,14 @@ (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.