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

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