Subject: bug#17489: 24.3; Major mode spec in .dir-locals.el breaks dired

From: Eli Zaretskii <[email-masked]>
Date: Wed, 14 May 2014 18:10:04 +0300

> From: Sergio Pokrovskij <[email-masked]>
> 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?