GNU bug report logs -
#17489
24.3; Major mode spec in .dir-locals.el breaks dired
Previous Next
To reply to this bug, email your comments to 17489 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 07:29:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sergio Pokrovskij <sergio.pokrovskij <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 14 May 2014 07:29:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 15:11:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> From: Sergio Pokrovskij <sergio.pokrovskij <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 16:58:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 17:26:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 17489 <at> debbugs.gnu.org (full text, mbox):
>>>>> "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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 17:32:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 17489 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 17:39:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 17489 <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 18:18:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> From: Sergio Pokrovskij <sergio.pokrovskij <at> gmail.com>
> Cc: 17489 <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 18:21:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Wed, 14 May 2014 13:38:20 -0400
> Cc: 17489 <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 18:30:03 GMT)
Full text and
rfc822 format available.
Message #29 received at 17489 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
>> From: Glenn Morris <rgm <at> gnu.org>
>> Date: Wed, 14 May 2014 13:38:20 -0400
>> Cc: 17489 <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 18:50:04 GMT)
Full text and
rfc822 format available.
Message #32 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: sergio.pokrovskij <at> gmail.com, 17489 <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 19:02:04 GMT)
Full text and
rfc822 format available.
Message #35 received at 17489 <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 19:39:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 17489 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: sergio.pokrovskij <at> gmail.com, 17489 <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Wed, 14 May 2014 19:41:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 17489 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
>> 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?
Lack of round tuits.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Thu, 15 May 2014 00:40:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 17489 <at> debbugs.gnu.org (full text, mbox):
>>>>> "Eli" == Eli Zaretskii wrote:
>> From: Sergio Pokrovskij <sergio.pokrovskij <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17489
; Package
emacs
.
(Tue, 22 Feb 2022 14:30:03 GMT)
Full text and
rfc822 format available.
Message #47 received at 17489 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> 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
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 3 years and 111 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.