GNU bug report logs - #13685
a way to say that dir-locals should only apply to buffers with files

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 11 Feb 2013 01:55:02 UTC

Severity: minor

Merged with 17489

Found in version 24.3

To reply to this bug, email your comments to 13685 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Message #1 received at quiet <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: quiet <at> debbugs.gnu.org
Subject: a way to say that dir-locals should only apply to buffers with files
Date: Sun, 10 Feb 2013 20:53:59 -0500
Package: emacs
Severity: wishlist
Version: 24.3

I think there should be some way in a dir-locals file to say
"these settings should only be applied to buffers with files".
Sometimes some options are not appropriate for file-less buffers.
Ref bug#11127.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13685; Package emacs. (Tue, 12 Feb 2013 02:34:01 GMT) Full text and rfc822 format available.

Message #4 received at 13685 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 13685 <at> debbugs.gnu.org
Subject: Re: a way to say that dir-locals should only apply to buffers with
	files
Date: Mon, 11 Feb 2013 21:32:49 -0500
Glenn Morris wrote:

> I think there should be some way in a dir-locals file to say
> "these settings should only be applied to buffers with files".
> Sometimes some options are not appropriate for file-less buffers.
> Ref bug#11127.

This seems easy to do, but I don't know what the best UI is.
An element in the dir-locals list:

  (fileonly . t)

or

  (apply-to . files)

The latter allows for

  (apply-to . nonfiles)

as well (though I can't think of a use for that).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13685; Package emacs. (Wed, 13 Feb 2013 03:26:02 GMT) Full text and rfc822 format available.

Message #7 received at 13685 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13685 <at> debbugs.gnu.org
Subject: Re: bug#13685: a way to say that dir-locals should only apply to
	buffers with files
Date: Tue, 12 Feb 2013 19:24:19 -0800
On Mon, Feb 11, 2013 at 6:32 PM, Glenn Morris <rgm <at> gnu.org> wrote:
> Glenn Morris wrote:
>
>> I think there should be some way in a dir-locals file to say
>> "these settings should only be applied to buffers with files".
>> Sometimes some options are not appropriate for file-less buffers.
>> Ref bug#11127.
>
> This seems easy to do, but I don't know what the best UI is.
> An element in the dir-locals list:
>
>   (fileonly . t)
>
> or
>
>   (apply-to . files)

Or more generally, the cdr could specify a predicate taking a single
argument (the buffer), e.g.
(apply-if . buffer-file-name)

> The latter allows for
>
>   (apply-to . nonfiles)
>
> as well (though I can't think of a use for that).

Likewise, (apply-if . (lambda (buffer) (not (buffer-file-name buffer))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13685; Package emacs. (Wed, 13 Feb 2013 08:37:01 GMT) Full text and rfc822 format available.

Message #10 received at 13685 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Josh <josh <at> foxtail.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 13685 <at> debbugs.gnu.org
Subject: Re: bug#13685: a way to say that dir-locals should only apply to
	buffers with files
Date: Wed, 13 Feb 2013 09:36:03 +0100
Josh <josh <at> foxtail.org> writes:

> Likewise, (apply-if . (lambda (buffer) (not (buffer-file-name buffer))))

Be careful about execution of arbitrary code.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13685; Package emacs. (Wed, 13 Feb 2013 17:20:03 GMT) Full text and rfc822 format available.

Message #13 received at 13685 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 13685 <at> debbugs.gnu.org
Subject: Re: bug#13685: a way to say that dir-locals should only apply to
	buffers with files
Date: Wed, 13 Feb 2013 09:18:05 -0800
On Wed, Feb 13, 2013 at 12:36 AM, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Josh <josh <at> foxtail.org> writes:
>
>> Likewise, (apply-if . (lambda (buffer) (not (buffer-file-name buffer))))
>
> Be careful about execution of arbitrary code.
>
> Andreas.

Indeed, such a feature should be governed by `enable-local-eval' and
`safe-local-eval-forms' or similar, with `buffer-file-name' being an
element of the latter by default.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13685; Package emacs. (Thu, 21 Feb 2013 16:19:01 GMT) Full text and rfc822 format available.

Message #16 received at 13685 <at> debbugs.gnu.org (full text, mbox):

From: Ted Zlatanov <tzz <at> lifelogs.com>
To: Josh <josh <at> foxtail.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 13685 <at> debbugs.gnu.org
Subject: Re: bug#13685: a way to say that dir-locals should only apply to
	buffers with files
Date: Thu, 21 Feb 2013 11:16:55 -0500
On Tue, 12 Feb 2013 19:24:19 -0800 Josh <josh <at> foxtail.org> wrote: 

J> Or more generally, the cdr could specify a predicate taking a single
J> argument (the buffer), e.g.
J> (apply-if . buffer-file-name)
...

J> Likewise, (apply-if . (lambda (buffer) (not (buffer-file-name buffer))))

I like the idea, but why not structure it like a cond statement since
that's what you're doing anyway?

Ted




Forcibly Merged 13685 17489. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 22 Feb 2022 14:30:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.