[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fontification in ' *' buffers.
From: |
Michaël Cadilhac |
Subject: |
Re: Fontification in ' *' buffers. |
Date: |
Mon, 27 Aug 2007 16:46:25 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>>>>> I may more or less understand why buffers which names start with a space
>>>>> are not fontified, but I happen to have downloaded files misnamed with
>>>>> one of those leading spaces, and was surprised that the fontification
>>>>> wasn't made.
>>>>>
>>>>> This is a minor issue, but shouldn't we check if we're in a file before?
>>>
>>>> This is a nobody-has-a-strong-opinion-on-this kind of concern?
>>>
>>> I think so, yes. Maybe it should check buffer-undo-list rather than
>>> buffer-file-name, tho.
>
>> Why? I think space-led buffers are only created with C-x C-f, it'd be
>> kind of pervert for a person to just create such a buffer.
>
> space-led buffers are expected to be temporary/internal buffers: when
> created they have buffer-undo-list set to t and they do not show up
> in C-x b's completion.
Well, this is a very minor issue. Buffers like that are just supposed
to not be created by the user. I was just surprised that there was no
way to toggle the font-locking in this misnamed file.
What I mean is that we should probably not start to have C-x b shows
space-led buffers that are files, but just fix this minor thing.
But maybe what we should do to end this thread is:
*** files.el 2007-08-27 16:44:01.000000000 +0200
--- files.el 2007-08-27 16:43:55.000000000 +0200
***************
*** 1268,1278 ****
(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."
(let ((lastname (file-name-nondirectory filename)))
(if (string= lastname "")
(setq lastname filename))
! (generate-new-buffer lastname)))
(defun generate-new-buffer (name)
"Create and return a buffer with a name based on NAME.
--- 1268,1281 ----
(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.
! Spaces at the start of FILENAME (sans directory) are removed."
(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)))))
(defun generate-new-buffer (name)
"Create and return a buffer with a name based on NAME.
--
| Michaël `Micha' Cadilhac | One user is enough. |
| http://michael.cadilhac.name | People suck. |
| JID/MSN: | |
`---- address@hidden | -- Tuomo Valkonen - --'
pgp8bevxuELjw.pgp
Description: PGP signature
- Fontification in ' *' buffers., Michaël Cadilhac, 2007/08/23
- Re: Fontification in ' *' buffers., Michaël Cadilhac, 2007/08/26
- Re: Fontification in ' *' buffers., Stefan Monnier, 2007/08/27
- Re: Fontification in ' *' buffers., Michaël Cadilhac, 2007/08/27
- Re: Fontification in ' *' buffers., Stefan Monnier, 2007/08/27
- Re: Fontification in ' *' buffers.,
Michaël Cadilhac <=
- Re: Fontification in ' *' buffers., Stefan Monnier, 2007/08/27
- Re: Fontification in ' *' buffers., Richard Stallman, 2007/08/27
- Re: Fontification in ' *' buffers., Michaël Cadilhac, 2007/08/31
- Re: Fontification in ' *' buffers., Richard Stallman, 2007/08/27
- Re: Fontification in ' *' buffers., Michaël Cadilhac, 2007/08/27