[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113982: * files.el (create-file-buffer): Handle a f
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] trunk r113982: * files.el (create-file-buffer): Handle a file whose basename is all spaces. |
Date: |
Fri, 23 Aug 2013 17:08:23 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113982
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15162
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2013-08-23 13:08:19 -0400
message:
* files.el (create-file-buffer): Handle a file whose basename is all spaces.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/files.el files.el-20091113204419-o5vbwnq5f7feedwu-265
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-08-23 15:31:45 +0000
+++ b/lisp/ChangeLog 2013-08-23 17:08:19 +0000
@@ -1,3 +1,8 @@
+2013-08-23 Glenn Morris <address@hidden>
+
+ * files.el (create-file-buffer): Handle the vital case of a file
+ whose basename is all spaces. (Bug#15162)
+
2013-08-23 Stefan Monnier <address@hidden>
* textmodes/fill.el (fill-match-adaptive-prefix): Don't throw away
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2013-08-06 16:33:14 +0000
+++ b/lisp/files.el 2013-08-23 17:08:19 +0000
@@ -1604,12 +1604,16 @@
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.
Spaces at the start of FILENAME (sans directory) are removed."
+ ;; ^ Because buffers whose name begins with a space are treated as
+ ;; internal Emacs buffers.
(let ((lastname (file-name-nondirectory filename)))
(if (string= lastname "")
(setq lastname filename))
(save-match-data
- (string-match "^ *\\(.*\\)" lastname)
- (generate-new-buffer (match-string 1 lastname)))))
+ (if (string-match "\\` +\\(.*\\)" lastname)
+ (if (zerop (length (setq lastname (match-string 1 lastname))))
+ (setq lastname "SPC")))) ; bug#15162
+ (generate-new-buffer lastname)))
(defun generate-new-buffer (name)
"Create and return a buffer with a name based on NAME.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113982: * files.el (create-file-buffer): Handle a file whose basename is all spaces.,
Glenn Morris <=