all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* byte-compile-file: emacs vs the command line.
@ 2013-12-28 22:41 R. Clayton
  2013-12-29 15:59 ` R. Clayton
  0 siblings, 1 reply; 9+ messages in thread
From: R. Clayton @ 2013-12-28 22:41 UTC (permalink / raw)
  To: help-gnu-emacs

I'm running this

  $ emacs -version
  GNU Emacs 23.4.1
  Copyright (C) 2012 Free Software Foundation, Inc.
  GNU Emacs comes with ABSOLUTELY NO WARRANTY.
  You may redistribute copies of Emacs
  under the terms of the GNU General Public License.
  For more information about these matters, see the file named COPYING.

  $ 

on this

  $ uname -a
  Linux UlanBator 3.10-2-686-pae #1 SMP Debian 3.10.5-1 (2013-08-07) i686 GNU/Linux

  $ 

a debian testing system updated weekly.  When I byte-compile a file using
byte-compile-file within emacs, I get this

  Compiling file /home/rclayton/.emacs.d/rmail-init.el at Sat Dec 28 17:24:55 2013
  Entering directory `/home/rclayton/.emacs.d/'
  rmail-init.el:56:21:Warning: reference to free variable `mail-mode-map'
  rmail-init.el:61:21:Warning: reference to free variable `rmail-mode-map'
  rmail-init.el:63:15:Warning: assignment to free variable
      `rmail-confirm-expunge'

but when I try it from the command-line I get this:

  $ make
  emacs --batch --eval '(byte-compile-file "~/.emacs.d/rmail-init.el" nil)'
  Loading 00debian-vars...
  Loading /etc/emacs/site-start.d/20apel.el (source)...
  Loading /etc/emacs/site-start.d/50asymptote.el (source)...
  Loading /etc/emacs/site-start.d/50auto-complete-el.el (source)...
  Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
  Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
  Loading debian-ispell...
  Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
  Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
  Loading /etc/emacs/site-start.d/50flim.el (source)...
  Loading /etc/emacs/site-start.d/50haskell-mode.el (source)...
  Loading /usr/share/emacs23/site-lisp/haskell-mode/haskell-mode-autoloads.el (source)...
  Loading /etc/emacs/site-start.d/50haxe.el (source)...
  Loading /etc/emacs/site-start.d/50lua-mode.el (source)...
  Loading /etc/emacs/site-start.d/50mgp.el (source)...
  Loading /etc/emacs/site-start.d/50noweb.el (source)...
  Loading /etc/emacs/site-start.d/50scsh.el (source)...
  Loading /etc/emacs/site-start.d/50vm.el (source)...
  Loading /etc/emacs23/site-start.d/50vm-init.el (source)...
  Loading /etc/emacs/site-start.d/50w3m-el.el (source)...
  Loading /etc/emacs/site-start.d/50w3m-el-snapshot.el (source)...
  Loading /etc/emacs/site-start.d/51semi.el (source)...
  Loading /etc/emacs/site-start.d/65wl.el (source)...

  In toplevel form:
  rmail-init.el:5:4:Error: Cannot open load file: general-utils

  $ ls -l rm*
  -rw------- 1 rclayton rclayton 2548 Dec 28 17:19 rmail-init.el

  $ 

In both cases rmail-init.elc didn't exist before compiling.  Why is the
command-line compile failing, and how can I fix it?

-- 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-28 22:41 byte-compile-file: emacs vs the command line R. Clayton
@ 2013-12-29 15:59 ` R. Clayton
  2013-12-29 16:26   ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: R. Clayton @ 2013-12-29 15:59 UTC (permalink / raw)
  To: help-gnu-emacs

Why is the command-line compile failing, and how can I fix it?

  require uses load, and running in batch doesn't load init files.  This means
  load-path doesn't contain everything it should to load local files.  The fix
  is to fix load-path:

    $ cat rm.el
    (require 'general-utils)

    $ emacs --batch --exec '(byte-compile-file "rm.el")'
    Loading 00debian-vars...
    Loading /etc/emacs/site-start.d/20apel.el (source)...
    Loading /etc/emacs/site-start.d/50asymptote.el (source)...
    Loading /etc/emacs/site-start.d/50auto-complete-el.el (source)...
    Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
    Loading debian-ispell...
    Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
    Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
    Loading /etc/emacs/site-start.d/50flim.el (source)...
    Loading /etc/emacs/site-start.d/50haskell-mode.el (source)...
    Loading /usr/share/emacs23/site-lisp/haskell-mode/haskell-mode-autoloads.el (source)...
    Loading /etc/emacs/site-start.d/50haxe.el (source)...
    Loading /etc/emacs/site-start.d/50lua-mode.el (source)...
    Loading /etc/emacs/site-start.d/50mgp.el (source)...
    Loading /etc/emacs/site-start.d/50noweb.el (source)...
    Loading /etc/emacs/site-start.d/50scsh.el (source)...
    Loading /etc/emacs/site-start.d/50vm.el (source)...
    Loading /etc/emacs23/site-start.d/50vm-init.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el-snapshot.el (source)...
    Loading /etc/emacs/site-start.d/51semi.el (source)...
    Loading /etc/emacs/site-start.d/65wl.el (source)...

    In toplevel form:
    rm.el:1:1:Error: Cannot open load file: general-utils

    $ ls -l rm.elc
    ls: cannot access rm.elc: No such file or directory

    $ emacs --batch --exec '(progn (push "~/lib/emacs/lisp" load-path) (byte-compile-file "rm.el"))'
    Loading 00debian-vars...
    Loading /etc/emacs/site-start.d/20apel.el (source)...
    Loading /etc/emacs/site-start.d/50asymptote.el (source)...
    Loading /etc/emacs/site-start.d/50auto-complete-el.el (source)...
    Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
    Loading debian-ispell...
    Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
    Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
    Loading /etc/emacs/site-start.d/50flim.el (source)...
    Loading /etc/emacs/site-start.d/50haskell-mode.el (source)...
    Loading /usr/share/emacs23/site-lisp/haskell-mode/haskell-mode-autoloads.el (source)...
    Loading /etc/emacs/site-start.d/50haxe.el (source)...
    Loading /etc/emacs/site-start.d/50lua-mode.el (source)...
    Loading /etc/emacs/site-start.d/50mgp.el (source)...
    Loading /etc/emacs/site-start.d/50noweb.el (source)...
    Loading /etc/emacs/site-start.d/50scsh.el (source)...
    Loading /etc/emacs/site-start.d/50vm.el (source)...
    Loading /etc/emacs23/site-start.d/50vm-init.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el-snapshot.el (source)...
    Loading /etc/emacs/site-start.d/51semi.el (source)...
    Loading /etc/emacs/site-start.d/65wl.el (source)...
    Wrote /home/rclayton/.emacs.d/rm.elc

    $ ls -l rm.elc
    -rw------- 1 rclayton rclayton 526 Dec 29 10:51 rm.elc

    $ 

  There are probably other ways to fix load-path - loading the init files, for
  example.

-- 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-29 15:59 ` R. Clayton
@ 2013-12-29 16:26   ` Eli Zaretskii
  2013-12-30  5:19     ` R. Clayton
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2013-12-29 16:26 UTC (permalink / raw)
  To: help-gnu-emacs

> From: rclayton@monmouth.edu (R. Clayton)
> Date: Sun, 29 Dec 2013 10:59:55 -0500
> 
> Why is the command-line compile failing, and how can I fix it?
> 
>   require uses load, and running in batch doesn't load init files.  This means
>   load-path doesn't contain everything it should to load local files.  The fix
>   is to fix load-path:
> 
>     $ cat rm.el
>     (require 'general-utils)
> 
>     $ emacs --batch --exec '(byte-compile-file "rm.el")'

Like this:

  $ EMACSLOADPATH=/what:/ever:/you:/need emacs -batch -f batch-byte-compile rm.el



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-29 16:26   ` Eli Zaretskii
@ 2013-12-30  5:19     ` R. Clayton
  2013-12-30  7:20       ` Thierry Volpiatto
  2013-12-30 10:34       ` Peter Dyballa
  0 siblings, 2 replies; 9+ messages in thread
From: R. Clayton @ 2013-12-30  5:19 UTC (permalink / raw)
  To: help-gnu-emacs

Like this: $ EMACSLOADPATH=/what:[...]

  That too, but my reading of the emacs manual, coupled with a few tests,
  suggests that the EMACSLOADPATH contents becomes the load-path, which means
  I'd have to dig around to make sure everything needed is in the environment
  variable. 

    $ emacs --batch --exec '(byte-compile-file "rm.el")'
    Loading 00debian-vars...
    Loading /etc/emacs/site-start.d/20apel.el (source)...
    Loading /etc/emacs/site-start.d/50asymptote.el (source)...
    Loading /etc/emacs/site-start.d/50auto-complete-el.el (source)...
    Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
    Loading debian-ispell...
    Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
    Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
    Loading /etc/emacs/site-start.d/50flim.el (source)...
    Loading /etc/emacs/site-start.d/50haskell-mode.el (source)...
    Loading /usr/share/emacs23/site-lisp/haskell-mode/haskell-mode-autoloads.el (source)...
    Loading /etc/emacs/site-start.d/50haxe.el (source)...
    Loading /etc/emacs/site-start.d/50lua-mode.el (source)...
    Loading /etc/emacs/site-start.d/50mgp.el (source)...
    Loading /etc/emacs/site-start.d/50noweb.el (source)...
    Loading /etc/emacs/site-start.d/50scsh.el (source)...
    Loading /etc/emacs/site-start.d/50vm.el (source)...
    Loading /etc/emacs23/site-start.d/50vm-init.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el.el (source)...
    Loading /etc/emacs/site-start.d/50w3m-el-snapshot.el (source)...
    Loading /etc/emacs/site-start.d/51semi.el (source)...
    Loading /etc/emacs/site-start.d/65wl.el (source)...

    In toplevel form:
    rm.el:1:1:Error: Cannot open load file: general-utils

    $ EMACSLOADPATH=~/lib/emacs/lisp emacs --batch --exec '(byte-compile-file "rm.el")'
    Warning: Could not find simple.el nor simple.elc
    Cannot open load file: bytecomp

    $ EMACSLOADPATH=~/lib/emacs/lisp emacs --batch --exec '(message "%S" load-path)'
    Warning: Could not find simple.el nor simple.elc
    ("/home/rclayton/lib/emacs/lisp")

    $ 

  Plus, I'll be that once EMACSLOADPATH is set up for this system here (e.g.,
  debian testing), it still needs fiddling to get it set up for that system
  there (e.g., freebsd 9.2).

-- 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-30  5:19     ` R. Clayton
@ 2013-12-30  7:20       ` Thierry Volpiatto
  2013-12-30 10:34       ` Peter Dyballa
  1 sibling, 0 replies; 9+ messages in thread
From: Thierry Volpiatto @ 2013-12-30  7:20 UTC (permalink / raw)
  To: help-gnu-emacs

rclayton@monmouth.edu (R. Clayton) writes:

>     $ EMACSLOADPATH=~/lib/emacs/lisp emacs --batch --exec '(message "%S" load-path)'
>     Warning: Could not find simple.el nor simple.elc
>     ("/home/rclayton/lib/emacs/lisp")
>

EMACSLOADPATH=$EMACSLOADPATH:~/lib/emacs/lisp emacs --batch --exec '(message "%S" load-path)'

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-30  5:19     ` R. Clayton
  2013-12-30  7:20       ` Thierry Volpiatto
@ 2013-12-30 10:34       ` Peter Dyballa
  2013-12-30 16:23         ` R. Clayton
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2013-12-30 10:34 UTC (permalink / raw)
  To: R. Clayton; +Cc: help-gnu-emacs


Am 30.12.2013 um 06:19 schrieb R. Clayton:

> EMACSLOADPATH=~/lib/emacs/lisp

THis shortens your EMACSLOADPATH to exactly the one element you specify. The environment variable EMACSLOADPATH overrides any internally used setting of load-path coming from compilation time. So at least you should try

	EMACSLOADPATH=${EMACSLOADPATH}:~/lib/emacs/lisp ...

This way you are adding another element to what you already have set.


What you did not try yet is:

	EMACSLOADPATH="" emacs --batch ...

This makes the environment variable EMACSLOADPATH empty so that GNU Emacs can use its compile time default. Maybe this internal setting is enough and you don't need to set EMACSLOADPATH externally… (And if you are building GNU Emacs yourself you can configure it with --enable-locallisppath=<whichever extra paths you need> so that it will find all Emacs Lisp repositories ion your system.)

--
Greetings

  Pete

To be is to do.
			– I. Kant
To do is to be.
			– A. Sartre
Yabba-Dabba-Doo!
			– F. Flintstone




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-30 10:34       ` Peter Dyballa
@ 2013-12-30 16:23         ` R. Clayton
  2013-12-30 19:27           ` Peter Dyballa
  0 siblings, 1 reply; 9+ messages in thread
From: R. Clayton @ 2013-12-30 16:23 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

Thank you for your reply to my message.

> So at least you should try
>	EMACSLOADPATH=${EMACSLOADPATH}:~/lib/emacs/lisp ...

True, but for me EMACSLOADPATH is undefined ("which is usually the case"
according to section 15.9 of the elisp manual)

  $ env | grep EM

  $ 

When EMACSLOADPATH is undefined, the two ways of setting it are (more or less)
equivalent (I write "more or less" because I don't know how emacs treats null
directories in the load path).

> What you did not try yet is:
> 
> 	EMACSLOADPATH="" emacs --batch ...
> 
> This makes the environment variable EMACSLOADPATH empty so that GNU Emacs can
> use its compile time default.  Maybe this internal setting is enough and you
> don't need to set EMACSLOADPATH externally…

I don't see how this helps.  Running batch emacs essentially uses compile-time
defaults, which I've already established can't find the file being required.

> And if you are building GNU Emacs yourself you can configure it with
> --enable-locallisppath=<whichever extra paths you need> so that it will find
> all Emacs Lisp repositories ion your system. 

True, but compared to calling an extra elisp function, building emacs with
special purpose defaults seems way over the top to me, and not something I want
to do every time I have a new directory of elisp code to search for.

> To be is to do.
> 			– I. Kant
> To do is to be.
> 			– A. Sartre
> Yabba-Dabba-Doo!
> 			– F. Flintstone

Shoo be do be do        F. Sinatra



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-30 16:23         ` R. Clayton
@ 2013-12-30 19:27           ` Peter Dyballa
  2014-01-01  2:52             ` R. Clayton
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2013-12-30 19:27 UTC (permalink / raw)
  To: R. Clayton; +Cc: help-gnu-emacs


Am 30.12.2013 um 17:23 schrieb R. Clayton:

> Running batch emacs essentially uses compile-time
> defaults, which I've already established can't find the file being required.
> 
>> And if you are building GNU Emacs yourself you can configure it with
>> --enable-locallisppath=<whichever extra paths you need> so that it will find
>> all Emacs Lisp repositories ion your system. 
> 
> True, but compared to calling an extra elisp function, building emacs with
> special purpose defaults seems way over the top to me, and not something I want
> to do every time I have a new directory of elisp code to search for.

OK! Then just try to add all missing extra paths to directories with local Emacs Lisp additions to load-path in the system-wide init file, site-start.el. I think in batch mode this file is loaded because 'emacs --help' tells that --batch works like -q or --no-init-file.

When you launch GNU Emacs with -Q you can check the compile-time value of load-path. I think in any of these directories you can create the site-run-file. Then determine the missing paths – if you haven't done yet – and move from your personal init file the lines which extend load-path to the site-run-file!

--
Greetings

  Pete

When confronted with actual numbers, a mathematician is at a loss.
				– Steffen Hokland




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: byte-compile-file: emacs vs the command line.
  2013-12-30 19:27           ` Peter Dyballa
@ 2014-01-01  2:52             ` R. Clayton
  0 siblings, 0 replies; 9+ messages in thread
From: R. Clayton @ 2014-01-01  2:52 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

  Then just try to add all missing extra paths to directories with local Emacs
  Lisp additions to load-path in the system-wide init file, site-start.el. I
  think in batch mode this file is loaded because 'emacs --help' tells that
  --batch works like -q or --no-init-file.

  When you launch GNU Emacs with -Q you can check the compile-time value of
  load-path. I think in any of these directories you can create the
  site-run-file. Then determine the missing paths - if you haven't done yet -
  and move from your personal init file the lines which extend load-path to the
  site-run-file!

Ah, I see.  Thanks for your comments.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-01  2:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-28 22:41 byte-compile-file: emacs vs the command line R. Clayton
2013-12-29 15:59 ` R. Clayton
2013-12-29 16:26   ` Eli Zaretskii
2013-12-30  5:19     ` R. Clayton
2013-12-30  7:20       ` Thierry Volpiatto
2013-12-30 10:34       ` Peter Dyballa
2013-12-30 16:23         ` R. Clayton
2013-12-30 19:27           ` Peter Dyballa
2014-01-01  2:52             ` R. Clayton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.