all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: michael@cadilhac.name (Michaël Cadilhac)
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: Fontification in ' *' buffers.
Date: Mon, 27 Aug 2007 16:46:25 +0200	[thread overview]
Message-ID: <87odgtavcu.fsf@cadilhac.name> (raw)
In-Reply-To: <jwvbqctt66j.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 27 Aug 2007 10:17:25 -0400")


[-- 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

  reply	other threads:[~2007-08-27 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-08-27 20:13           ` Stefan Monnier
2007-08-31 13:33           ` Michaël Cadilhac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87odgtavcu.fsf@cadilhac.name \
    --to=michael@cadilhac.name \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.