Subject: 27.0.50; custom-theme-directory variable is set to nil before init.el loads causing load-theme to fail

From: Wojciech Kozlowski <[email-masked]>
Date: Sun, 01 Sep 2019 18:40:53 +0200

--text follows this line--

I'm using Emacs on the master branch so hopefully this is the right
place to report bugs.

My init.el fails on the call to load-path leaving the following
backtrace (from the point load-theme is called):

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-directory-p(nil)
  custom-theme--load-path()
  load-theme(havoc-dark t)

Digging deeper, this is caused by the fact that the variable `custom-
theme-directory' has been reset to nil.

This bug is reproducible without any code from my init.el file.

To reproduce

1. launch Emacs with `emacs -Q`
2. M-x describe-variable
3. Enter `custom-theme-directory`
4. Help screen will show that the value of the variable is nil and that
originally it was equal to "~/.emacs.d"

The last point suggests that this variable got changed somewhere.

My current workaround is to manually set this variable in my init.el
file before the call to load-theme.

Happy to help with further debugging! I could also try to provide a fix
if others are too busy, but would require some steering as to where to
look to implement the fix. Also, I would only be able to handle this
after 11 September.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.10)
 of 2019-09-01 built on thor
Repository revision: a7d47e64aaf438feaa8cbe4d40acb7bae0eab059
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12005000
System Description: Fedora 30 (Thirty)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Type C-x 1 to delete the help window, C-M-v to scroll help.
Making completion list...

Configured using:
 'configure --with-modules --prefix=/home/wojtek/.local'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT
ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS JSON PDUMPER
LCMS2
GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-
config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra pp cl-print
cus-dep autoload lisp-mnt cus-theme cus-edit cus-start cus-load wid-
edit
thingatpt help-fns radix-tree help-mode easymenu cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset
image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-
mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-
readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 71397 9620)
 (symbols 48 7838 1)
 (strings 32 22570 1951)
 (string-bytes 1 654162)
 (vectors 16 12567)
 (vector-slots 8 153644 9374)
 (floats 8 40 119)
 (intervals 56 246 0)
 (buffers 992 13))