From 661e8cd19ba9e136fbe61f0b728c05e9226da9ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C3=ABl=20Cadilhac?= Date: Fri, 31 Aug 2007 13:30:02 +0000 Subject: [PATCH] (create-file-buffer): If the filename sans directory starts with spaces, remove them. --- lisp/ChangeLog | 5 +++++ lisp/files.el | 7 +++++-- 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 + + * 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. -- 2.39.5