Commit 61611d54 authored by Glenn Morris's avatar Glenn Morris

* files.el (create-file-buffer): Handle a file whose basename is all spaces.

Fixes: debbugs:15162
parent e3a66363
2013-08-23 Glenn Morris <>
* files.el (create-file-buffer): Handle the vital case of a file
whose basename is all spaces. (Bug#15162)
2013-08-23 Stefan Monnier <>
* textmodes/fill.el (fill-match-adaptive-prefix): Don't throw away
......@@ -1604,12 +1604,16 @@ killed."
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))
(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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment