Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
bb35f42f
Commit
bb35f42f
authored
Aug 23, 2013
by
Glenn Morris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/files.el (create-file-buffer): Rework previous change.
parent
cb8d2612
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
lisp/ChangeLog
lisp/ChangeLog
+2
-2
lisp/files.el
lisp/files.el
+7
-8
No files found.
lisp/ChangeLog
View file @
bb35f42f
...
...
@@ -2,8 +2,8 @@
* files.el (interpreter-mode-alist): Use tcl-mode for expect scripts.
* files.el (create-file-buffer):
Handle the vital case of a file
whose basename is all spaces
. (Bug#15162)
* files.el (create-file-buffer):
If the result would begin with
spaces, prepend a "|" instead of removing them
. (Bug#15162)
2013-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
...
...
lisp/files.el
View file @
bb35f42f
...
...
@@ -1603,17 +1603,16 @@ killed."
"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.
Spaces at the start of FILENAME (sans directory) are removed."
;; ^ Because buffers whose name begins with a space are treated as
;; internal Emacs buffers.
Emacs treats buffers whose names begin with a space as internal buffers.
To avoid confusion when visiting a file whose name begins with a space,
this function prepends a \"|\" to the final result if necessary."
(
let
((
lastname
(
file-name-nondirectory
filename
)))
(
if
(
string=
lastname
""
)
(
setq
lastname
filename
))
(
save-match-data
(
if
(
string-match
"\\` +\\(.*\\)"
lastname
)
(
if
(
zerop
(
length
(
setq
lastname
(
match-string
1
lastname
))))
(
setq
lastname
"SPC"
))))
; bug#15162
(
generate-new-buffer
lastname
)))
(
generate-new-buffer
(
if
(
string-match-p
"\\` "
lastname
)
(
concat
"|"
lastname
)
lastname
))))
(
defun
generate-new-buffer
(
name
)
"Create and return a buffer with a name based on NAME.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment