* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
@ 2014-05-14 7:14 Sergio Pokrovskij
2014-05-14 15:10 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Sergio Pokrovskij @ 2014-05-14 7:14 UTC (permalink / raw)
To: 17489
Given a .dir-locals.el file of the form:
--8<---------------cut here---------------start------------->8---
% ls -al /tmp/tst/
total 16
drwxrwxr-x 2 sergio sergio 4096 мая 14 12:01 .
drwxrwxrwt 17 root root 4096 мая 14 14:06 ..
-rw-rw-r-- 1 sergio sergio 44 мая 14 12:01 .dir-locals.el
-rw-rw-r-- 1 sergio sergio 4 мая 14 11:58 t.t
%
% cat /tmp/tst/.dir-locals.el
((nil . ((mode . c) (fill-column . 80))))
%
--8<---------------cut here---------------end--------------->8---
it works okay for the local files which are read with a path in the
command-line or with a find-file:
--8<---------------cut here---------------start------------->8---
% emacs -nw -Q /tmp/tst/t.t
--8<---------------cut here---------------end--------------->8---
The file is open in c-mode, the *Messages* contains:
--8<---------------cut here---------------start------------->8---
("emacs" "/tmp/tst/t.t")
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading cc-langs...done
--8<---------------cut here---------------end--------------->8---
Yet it prevents the dired buffer for /tmp/tst/ to be displayed; a
"Wrong type argument: stringp, nil" message is issued.
This seems to occur for any major mode; I tried it for psgml-mode,
text-mode, c-mode.
It can be reproduced form batch or interactively. The batch version:
--8<---------------cut here---------------start------------->8---
% cat /tmp/tst/.dir-locals.el
((nil . ((mode . c) (fill-column . 80))))
%
% cat /tmp/ff.el
(find-file "/tmp/tst" t)
%
% emacs -Q -batch -l /tmp/ff.el
Loading cc-langs...
Wrong type argument: stringp, nil
%
--8<---------------cut here---------------end--------------->8---
Same for the interactive version:
--8<---------------cut here---------------start------------->8---
% emacs -nw -Q /tmp/tst/
--8<---------------cut here---------------end--------------->8---
*Messages* contains:
--8<---------------cut here---------------start------------->8---
("emacs" "/tmp/tst/")
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading cc-langs...done
dired-sort-R-check: Wrong type argument: stringp, nil
--8<---------------cut here---------------end--------------->8---
==================================
In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
of 2013-07-27 on roseapple, modified by Debian
System Description: Ubuntu 13.10
Configured using:
`configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LC_MONETARY: ru_RU.UTF-8
value of $LC_NUMERIC: ru_RU.UTF-8
value of $LC_TIME: ru_RU.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
ESC [ > 0 ; 1 1 5 ; 0 c ESC x r e p o r t - e m a c
s - b u g RET
Recent messages:
("emacs" "/tmp/tst/")
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading cc-langs...done
dired-sort-R-check: Wrong type argument: stringp, nil
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message cl-macs gv format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cc-langs cl cl-lib cc-mode cc-fonts
easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs dired time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
--
Sergio
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 7:14 bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired Sergio Pokrovskij
@ 2014-05-14 15:10 ` Eli Zaretskii
2014-05-14 16:56 ` Stefan Monnier
2014-05-14 17:24 ` Sergio Pokrovskij
0 siblings, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2014-05-14 15:10 UTC (permalink / raw)
To: Sergio Pokrovskij; +Cc: 17489
> From: Sergio Pokrovskij <sergio.pokrovskij@gmail.com>
> Date: Wed, 14 May 2014 14:14:48 +0700
>
> Given a .dir-locals.el file of the form:
>
> --8<---------------cut here---------------start------------->8---
> % ls -al /tmp/tst/
> total 16
> drwxrwxr-x 2 sergio sergio 4096 мая 14 12:01 .
> drwxrwxrwt 17 root root 4096 мая 14 14:06 ..
> -rw-rw-r-- 1 sergio sergio 44 мая 14 12:01 .dir-locals.el
> -rw-rw-r-- 1 sergio sergio 4 мая 14 11:58 t.t
> %
> % cat /tmp/tst/.dir-locals.el
> ((nil . ((mode . c) (fill-column . 80))))
>
> %
> --8<---------------cut here---------------end--------------->8---
>
> it works okay for the local files which are read with a path in the
> command-line or with a find-file:
>
> --8<---------------cut here---------------start------------->8---
> % emacs -nw -Q /tmp/tst/t.t
> --8<---------------cut here---------------end--------------->8---
>
> The file is open in c-mode, the *Messages* contains:
>
> --8<---------------cut here---------------start------------->8---
> ("emacs" "/tmp/tst/t.t")
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Loading cc-langs...done
> --8<---------------cut here---------------end--------------->8---
>
> Yet it prevents the dired buffer for /tmp/tst/ to be displayed; a
> "Wrong type argument: stringp, nil" message is issued.
>
> This seems to occur for any major mode; I tried it for psgml-mode,
> text-mode, c-mode.
It's not clear what did you expect instead. Did you expect that
unconditionally turning on some mode in a Dired buffer be ignored,
just because it's a Dired buffer? Or did you expect that your
.dir-locals.el settings be in effect only for files, not for
directories? Or did you expect that cc-mode somehow gracefully does
nothing when the buffer text is not a C-like program source? Or
something else?
IOW, why isn't that .dir-locals.el setting of yours not a cockpit
error?
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 15:10 ` Eli Zaretskii
@ 2014-05-14 16:56 ` Stefan Monnier
2014-05-14 17:24 ` Sergio Pokrovskij
1 sibling, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2014-05-14 16:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Sergio Pokrovskij, 17489
> Or did you expect that cc-mode somehow gracefully does
> nothing when the buffer text is not a C-like program source?
That's a reasonable expectation (just as we've seen for for todo-mode).
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 15:10 ` Eli Zaretskii
2014-05-14 16:56 ` Stefan Monnier
@ 2014-05-14 17:24 ` Sergio Pokrovskij
2014-05-14 17:31 ` Glenn Morris
2014-05-14 18:17 ` Eli Zaretskii
1 sibling, 2 replies; 15+ messages in thread
From: Sergio Pokrovskij @ 2014-05-14 17:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 17489
>>>>> "Eli" == Eli Zaretskii wrote:
[...]
Eli> It's not clear what did you expect instead. Did you expect
Eli> that unconditionally turning on some mode in a Dired buffer
Eli> be ignored, just because it's a Dired buffer?
Kind of. It is not quite a "local file". Cf:
,----
| Sometimes, you may wish to define the same set of local variables
| to all the files in a certain directory ...
`---- (info "(emacs)Directory Variables")
Eli> Or did you expect that your .dir-locals.el settings be in
Eli> effect only for files, not for directories?
This too, normally "local variables" are not attributable to
directories, are they?
Eli> Or did you expect that cc-mode somehow gracefully does
Eli> nothing when the buffer text is not a C-like program
Eli> source?
It seems that it's a dired's problem rather than cc-mode's.
Eli> Or something else?
My expectation was that I could specify a local-variable setting
common to all the files from the directory in question. And
actually it does work. The only problem is that it breaks the
dired buffer.
Eli> IOW, why isn't that .dir-locals.el setting of yours not a
Eli> cockpit error?
Because there is no appropriate means to impose a reasonable
condition. Just the "nil" or a major mode name. It may happen
that I do not know the a-priori mode; actually it is mode that I
would like to set.
After all, I've found a workaround; but I believe the feature
would be more useful if it could be restricted to '-' files only
(i.e. only to those which normally can contain
"Local variables:"):
,----
| Whenever Emacs visits any file IN THAT DIRECTORY or any of its
| subdirectories, it will apply the directory-local variables
| specified in `.dir-locals.el', AS THOUGH THEY HAD BEEN DEFINED AS
| FILE-LOCAL VARIABLES for that file ...
`----
--
Sergio
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 17:24 ` Sergio Pokrovskij
@ 2014-05-14 17:31 ` Glenn Morris
2014-05-14 17:38 ` Glenn Morris
2022-02-22 14:29 ` Lars Ingebrigtsen
2014-05-14 18:17 ` Eli Zaretskii
1 sibling, 2 replies; 15+ messages in thread
From: Glenn Morris @ 2014-05-14 17:31 UTC (permalink / raw)
To: Sergio Pokrovskij; +Cc: 17489
It's useful for dir-locals to apply to some buffers not visiting files.
It's not just dired, it's some VC buffers as well, etc, IIRC.
I believe this issue reduces to a duplicate of
http://debbugs.gnu.org/13685
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 17:31 ` Glenn Morris
@ 2014-05-14 17:38 ` Glenn Morris
2014-05-14 18:20 ` Eli Zaretskii
2022-02-22 14:29 ` Lars Ingebrigtsen
1 sibling, 1 reply; 15+ messages in thread
From: Glenn Morris @ 2014-05-14 17:38 UTC (permalink / raw)
To: Sergio Pokrovskij; +Cc: 17489
Glenn Morris wrote:
> It's useful for dir-locals to apply to some buffers not visiting files.
> It's not just dired, it's some VC buffers as well, etc, IIRC.
>
> I believe this issue reduces to a duplicate of
>
> http://debbugs.gnu.org/13685
Although we could probably treat this specific example specially, and
just say that it never (?) makes sense for a dir-local `mode' to apply to
non-file buffers.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 17:38 ` Glenn Morris
@ 2014-05-14 18:20 ` Eli Zaretskii
2014-05-14 18:29 ` Glenn Morris
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2014-05-14 18:20 UTC (permalink / raw)
To: Glenn Morris; +Cc: sergio.pokrovskij, 17489
> From: Glenn Morris <rgm@gnu.org>
> Date: Wed, 14 May 2014 13:38:20 -0400
> Cc: 17489@debbugs.gnu.org
>
> Although we could probably treat this specific example specially, and
> just say that it never (?) makes sense for a dir-local `mode' to apply to
> non-file buffers.
Arguably, it makes no sense to apply the same fixed mode to all the
files in a directory, either.
From my POV, the .dire-locals.el facility has some serious
limitations, and this one is one of them. Kludging over it will never
cut it, we will promptly need to apply more kludges on top of that.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 18:20 ` Eli Zaretskii
@ 2014-05-14 18:29 ` Glenn Morris
2014-05-14 18:40 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Glenn Morris @ 2014-05-14 18:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: sergio.pokrovskij, 17489
Eli Zaretskii wrote:
>> From: Glenn Morris <rgm@gnu.org>
>> Date: Wed, 14 May 2014 13:38:20 -0400
>> Cc: 17489@debbugs.gnu.org
>>
>> Although we could probably treat this specific example specially, and
>> just say that it never (?) makes sense for a dir-local `mode' to apply to
>> non-file buffers.
>
> Arguably, it makes no sense to apply the same fixed mode to all the
> files in a directory, either.
I'm sure it makes sense to the OP.
Dired buffers have buffer-file-name = nil so IMO can quite reasonably be
viewed as not visiting files.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 18:29 ` Glenn Morris
@ 2014-05-14 18:40 ` Eli Zaretskii
2014-05-14 19:01 ` Glenn Morris
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2014-05-14 18:40 UTC (permalink / raw)
To: Glenn Morris; +Cc: sergio.pokrovskij, 17489
> From: Glenn Morris <rgm@gnu.org>
> Cc: sergio.pokrovskij@gmail.com, 17489@debbugs.gnu.org
> Date: Wed, 14 May 2014 14:29:25 -0400
>
> I'm sure it makes sense to the OP.
Sure. And I'm sure some other user will argue that it makes sense to
apply _her_ favorite major mode to any and all buffers.
> Dired buffers have buffer-file-name = nil so IMO can quite reasonably be
> viewed as not visiting files.
But major modes are not only for buffers visiting files.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 18:40 ` Eli Zaretskii
@ 2014-05-14 19:01 ` Glenn Morris
2014-05-14 19:38 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Glenn Morris @ 2014-05-14 19:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: sergio.pokrovskij, 17489
Eli Zaretskii wrote:
> Sure. And I'm sure some other user will argue that it makes sense to
> apply _her_ favorite major mode to any and all buffers.
Well, it really doesn't make sense AFAICS, but ok then, you don't want
the special-case solution of simply ignoring a `mode' dir-locals in
non-file buffers. So then we are back to http://debbugs.gnu.org/13685,
which would let people choose.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 19:01 ` Glenn Morris
@ 2014-05-14 19:38 ` Eli Zaretskii
2014-05-14 19:40 ` Glenn Morris
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2014-05-14 19:38 UTC (permalink / raw)
To: Glenn Morris; +Cc: sergio.pokrovskij, 17489
> From: Glenn Morris <rgm@gnu.org>
> Cc: sergio.pokrovskij@gmail.com, 17489@debbugs.gnu.org
> Date: Wed, 14 May 2014 15:01:21 -0400
>
> Well, it really doesn't make sense AFAICS, but ok then, you don't want
> the special-case solution of simply ignoring a `mode' dir-locals in
> non-file buffers.
It's not that I don't want that. I actually am quite indifferent to
this, because I think dir-locals, in its current design, is too
restrictive, and therefore I'm simply not interested.
I just think that adding these implied conditions is a slippery slope,
because different people want to do different things with dir-locals.
> So then we are back to http://debbugs.gnu.org/13685, which would let
> people choose.
That looks better, since it at least makes the user's desire
explicit. Why not implement it?
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 17:31 ` Glenn Morris
2014-05-14 17:38 ` Glenn Morris
@ 2022-02-22 14:29 ` Lars Ingebrigtsen
1 sibling, 0 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-22 14:29 UTC (permalink / raw)
To: Glenn Morris; +Cc: Sergio Pokrovskij, 17489
Glenn Morris <rgm@gnu.org> writes:
> It's useful for dir-locals to apply to some buffers not visiting files.
> It's not just dired, it's some VC buffers as well, etc, IIRC.
>
> I believe this issue reduces to a duplicate of
>
> http://debbugs.gnu.org/13685
So I've now merged them. (I think it would make sense to implement
something like what Glenn suggested there.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 17:24 ` Sergio Pokrovskij
2014-05-14 17:31 ` Glenn Morris
@ 2014-05-14 18:17 ` Eli Zaretskii
2014-05-15 0:39 ` Sergio Pokrovskij
1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2014-05-14 18:17 UTC (permalink / raw)
To: Sergio Pokrovskij; +Cc: 17489
> From: Sergio Pokrovskij <sergio.pokrovskij@gmail.com>
> Cc: 17489@debbugs.gnu.org
> Date: Thu, 15 May 2014 00:24:47 +0700
>
> Eli> IOW, why isn't that .dir-locals.el setting of yours not a
> Eli> cockpit error?
>
> Because there is no appropriate means to impose a reasonable
> condition. Just the "nil" or a major mode name. It may happen
> that I do not know the a-priori mode; actually it is mode that I
> would like to set.
Why would someone want to apply a fixed major mode to all the files in
a directory?
> ,----
> | Whenever Emacs visits any file IN THAT DIRECTORY or any of its
> | subdirectories, it will apply the directory-local variables
> | specified in `.dir-locals.el', AS THOUGH THEY HAD BEEN DEFINED AS
> | FILE-LOCAL VARIABLES for that file ...
> `----
Are you saying that "." is not a file?
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired
2014-05-14 18:17 ` Eli Zaretskii
@ 2014-05-15 0:39 ` Sergio Pokrovskij
0 siblings, 0 replies; 15+ messages in thread
From: Sergio Pokrovskij @ 2014-05-15 0:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 17489
>>>>> "Eli" == Eli Zaretskii wrote:
>> From: Sergio Pokrovskij <sergio.pokrovskij@gmail.com>
...
>> ,----
>> | Whenever Emacs visits any file IN THAT DIRECTORY or any of its
>> | subdirectories, it will apply the directory-local variables
>> | specified in `.dir-locals.el', AS THOUGH THEY HAD BEEN DEFINED AS
>> | FILE-LOCAL VARIABLES for that file ...
>> `----
Eli> Are you saying that "." is not a file?
I applied dired to "tmp/tst", not to "tmp/tst/."
I expect that when I open a file linked from an encompassing
directory to "/tmp/tst/foo", the "/tmp/tst/.dir-locals.el" does
not affect the buffer.
--
Sergio
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-02-22 14:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 7:14 bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired Sergio Pokrovskij
2014-05-14 15:10 ` Eli Zaretskii
2014-05-14 16:56 ` Stefan Monnier
2014-05-14 17:24 ` Sergio Pokrovskij
2014-05-14 17:31 ` Glenn Morris
2014-05-14 17:38 ` Glenn Morris
2014-05-14 18:20 ` Eli Zaretskii
2014-05-14 18:29 ` Glenn Morris
2014-05-14 18:40 ` Eli Zaretskii
2014-05-14 19:01 ` Glenn Morris
2014-05-14 19:38 ` Eli Zaretskii
2014-05-14 19:40 ` Glenn Morris
2022-02-22 14:29 ` Lars Ingebrigtsen
2014-05-14 18:17 ` Eli Zaretskii
2014-05-15 0:39 ` Sergio Pokrovskij
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.