* Fontification in ' *' buffers.
@ 2007-08-23 17:16 Michaël Cadilhac
2007-08-26 19:26 ` Michaël Cadilhac
0 siblings, 1 reply; 8+ messages in thread
From: Michaël Cadilhac @ 2007-08-23 17:16 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1933 bytes --]
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?
Index: font-core.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/font-core.el,v
retrieving revision 1.46
diff -c -r1.46 font-core.el
*** font-core.el 26 Jul 2007 05:26:24 -0000 1.46
--- font-core.el 23 Aug 2007 17:13:45 -0000
***************
*** 144,151 ****
`font-lock-function'. "
nil nil nil
;; Don't turn on Font Lock mode if we don't have a display (we're running a
! ;; batch job) or if the buffer is invisible (the name starts with a space).
! (when (or noninteractive (eq (aref (buffer-name) 0) ?\s))
(setq font-lock-mode nil))
(funcall font-lock-function font-lock-mode)
;; Arrange to unfontify this buffer if we change major mode later.
--- 144,153 ----
`font-lock-function'. "
nil nil nil
;; Don't turn on Font Lock mode if we don't have a display (we're running a
! ;; batch job) or if the buffer is invisible (the name starts with a space)
! ;; and not a file.
! (when (or noninteractive (and (eq (aref (buffer-name) 0) ?\s)
! (not buffer-file-name)))
(setq font-lock-mode nil))
(funcall font-lock-function font-lock-mode)
;; Arrange to unfontify this buffer if we change major mode later.
--
| Michaël `Micha' Cadilhac | Un certain Blaise Pascal |
| http://michael.cadilhac.name | etc... etc... |
| JID/MSN: | -- Prévert (Les paris stupides) |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fontification in ' *' buffers.
2007-08-23 17:16 Fontification in ' *' buffers Michaël Cadilhac
@ 2007-08-26 19:26 ` Michaël Cadilhac
2007-08-27 4:27 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Michaël Cadilhac @ 2007-08-26 19:26 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 763 bytes --]
michael@cadilhac.name (Michaël Cadilhac) 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?
--
| Michaël `Micha' Cadilhac | Le copillage-collage |
| http://michael.cadilhac.name | tue le programmeur. |
| JID/MSN: | -- Dictons LRDE |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fontification in ' *' buffers.
2007-08-26 19:26 ` Michaël Cadilhac
@ 2007-08-27 4:27 ` Stefan Monnier
2007-08-27 7:25 ` Michaël Cadilhac
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2007-08-27 4:27 UTC (permalink / raw)
To: Michaël Cadilhac; +Cc: emacs-devel
>> 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.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fontification in ' *' buffers.
2007-08-27 4:27 ` Stefan Monnier
@ 2007-08-27 7:25 ` Michaël Cadilhac
2007-08-27 14:17 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Michaël Cadilhac @ 2007-08-27 7:25 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1208 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> 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.
Beside, the minibuffer has a buffer-undo-list, nop? (Well, it could be
a benefit, in fact, because the M-x could be a font-lock property and be
disabled by g-f-l-m, as it was asked IIRC).
--
| Michaël `Micha' Cadilhac | Le second degré, |
| http://michael.cadilhac.name | c'est un peu |
| JID/MSN: | le verlan sémantique. |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fontification in ' *' buffers.
2007-08-27 7:25 ` Michaël Cadilhac
@ 2007-08-27 14:17 ` Stefan Monnier
2007-08-27 14:46 ` Michaël Cadilhac
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2007-08-27 14:17 UTC (permalink / raw)
To: Michaël Cadilhac; +Cc: emacs-devel
>>>> 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.
But maybe you're right. It was just an idea.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fontification in ' *' buffers.
2007-08-27 14:17 ` Stefan Monnier
@ 2007-08-27 14:46 ` Michaël Cadilhac
2007-08-27 20:13 ` Stefan Monnier
2007-08-31 13:33 ` Michaël Cadilhac
0 siblings, 2 replies; 8+ messages in thread
From: Michaël Cadilhac @ 2007-08-27 14:46 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 1288 bytes --]
Stefan Monnier <monnier@IRO.UMontreal.CA> 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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: files.patch --]
[-- Type: text/x-patch, Size: 1355 bytes --]
*** 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.
[-- Attachment #1.1.3: Type: text/plain, Size: 327 bytes --]
--
| Michaël `Micha' Cadilhac | One user is enough. |
| http://michael.cadilhac.name | People suck. |
| JID/MSN: | |
`---- michael.cadilhac@gmail.com | -- Tuomo Valkonen - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-31 13:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23 17:16 Fontification in ' *' buffers Michaël Cadilhac
2007-08-26 19:26 ` Michaël Cadilhac
2007-08-27 4:27 ` Stefan Monnier
2007-08-27 7:25 ` Michaël Cadilhac
2007-08-27 14:17 ` Stefan Monnier
2007-08-27 14:46 ` Michaël Cadilhac
2007-08-27 20:13 ` Stefan Monnier
2007-08-31 13:33 ` Michaël Cadilhac
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.