Subject: Re: bug#19151: 24.4; Batch mode doesn't call package-initialize, can't find packages

From: Eli Zaretskii <[email-masked]>
Date: Sun, 23 Nov 2014 18:29:46 +0200

> Date: Sat, 22 Nov 2014 17:24:25 -0500
> From: Gary Oberbrunner <[email-masked]>
> 
> In batch mode, emacs doesn't load installed packages, although the doc implies
> that it should. If you want to eval forms that require packages, you have to
> call (package-initialize) explicitly.
> 
> For instance, from a shell:
> 
> % emacs -batch -eval '(progn (message "%s" package-directory-list))'
> Symbol's value as variable is void: package-directory-list
> % emacs -batch -eval '(progn (package-initialize) (message "%s"
> package-directory-list))'
> (c:/emacs/emacs/share/emacs/24.4/site-lisp/elpa
> c:/emacs/emacs/share/emacs/site-lisp/elpa)
> 
> Or, since I have the 'dash' package installed in my ~/.emacs.d/elpa:
> 
> % emacs -batch -eval "(progn (require 'dash))"
> Cannot open load file: no such file or directory, dash
> % emacs -batch -eval "(progn (package-initialize) (require 'dash))"
> %
> 
> The documentation at
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html
> is not totally clear on this, but it implies that packages should be loaded.

I think this is a documentation bug.  package-initialize is not
invoked under -q (which I Think makes sense), and -batch implies -q.