Questions tagged [byte-compilation]

is for the Emacs Lisp compiler in Emacs that compiles lisp code to byte-code for faster execution compared to uncompiled lisp code. Byte-compiled code is read by the byte-code interpreter.

Useful link:

105 questions
34
votes
5 answers

Can I avoid outdated byte-compiled elisp files?

Occasionally, when I start Emacs, I get a message like. Source file `/home/USER/.emacs.d/elpa/....el' newer than byte-compiled file Also, I sometimes edit a package I'm developing and forget to recompile it. When I try to load the new file, it…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
18
votes
1 answer

Dealing with "Warning: assignment to free variable" when certain libraries can be missing by design

Byte compilation of my mode: (defun dict-setup-expansions () "Add `dict-mode' specific expansions." (set (make-local-variable 'er/try-expand-list) (list #'dict-mark-article))) gives warning: Warning: assignment to free variable…
18
votes
1 answer

suppress warning: assignment to free variable (and others)

How can I suppress the "assignment to free variable" warning when byte compiling an emacs lisp file? I'm actually mostly interested in suppressing it for a specific buffer when using flycheck, but I understand this is just passing off to the byte…
fommil
  • 1,750
  • 11
  • 24
16
votes
3 answers

Defun inside let with lexical binding gives byte-compile warning "the function is not known to be defined"

I want to get the effect of a static variable by using defun inside of let with lexical binding to create a closure. However, when byte-compiling the file, I get a warning. Am I doing something wrong, or if not, is there a way to suppress this…
14
votes
1 answer

Macro with defcustom leads to "Symbol's value as variable is void" error when byte-compiled

In two of my packages I have a macro where the body depends on a variable defined in a defcustom form. When installing the packages from Melpa, the byte-compilation ends with: Error: Symbol's value as variable is void: my-defcustom-variable Then,…
syl20bnr
  • 2,095
  • 11
  • 21
14
votes
2 answers

Can a function or macro specify byte-compiler warnings?

I'm writing a function which, in principle, takes an arbitrary number of arguments. In practice, however, it should only ever be passed an even number of arguments, and will produce undesirable results otherwise. Here's a dummy example for…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
13
votes
2 answers

Are macros expanded when the file is compiled?

I have a macro that needs to be expanded at every single instance of its use compile-time. Is there a way I can specify this to be so without going through the codebase and carefully wrapping each call with eval-when-compile?
Sean Allred
  • 6,861
  • 16
  • 85
12
votes
2 answers

byte compiled version of elisp files

I have both .el and the byte compiled version (.elc) of an elisp file. Accidentally I delete the .el file. Can I retrieve the .el file from its .elc version? Is an .elc file without its .el file functional?
Name
  • 7,689
  • 4
  • 38
  • 84
12
votes
2 answers

`Warning (bytecomp)` is a bit vague - can I get any more information?

When I start emacs, I get a couple of byte compilation warnings in a window that pops up: Warning (bytecomp): `interactive-p' is an obsolete function (as of 23.2); use `called-interactively-p' instead. [7 times] Warning (bytecomp): Use…
Tom Seddon
  • 275
  • 1
  • 6
10
votes
2 answers

How do I run multiple versions of Emacs with the same .emacs.d

I alternatively run 24.5 and 25.0.50. Unfortunately, packages installed and compiled from 25.0.50 don't work with Emacs 24.5 (cl-struct-define is a common culprit). One trivial solution is to not byte-compile anything. That makes things pretty slow,…
Clément
  • 3,924
  • 1
  • 22
  • 37
8
votes
1 answer

eval-when-compile: defsubst vs defmacro vs define-inline

I defined some simple functions in init.el, for example my-cache-file: (defconst my-cache-directory (expand-file-name ".cache" user-emacs-directory)) ; ~/.emacs/.cache (defun my-cache-file (x) (expand-file-name x my-cache-directory)) ;…
ivan
  • 1,928
  • 10
  • 20
8
votes
1 answer

Why is Emacs asking me to save changed buffers, when I install a package?

Every time when I change something in a buffer, and then I decided to install a package from packages.el, Emacs is repeatingly asking me if I want to save the other buffers, because it's changed. I fail to understand the relation between this buffer…
ReneFroger
  • 3,855
  • 22
  • 63
7
votes
2 answers

Performance differences in comparing symbols and strings

In sx.el, we have a case where we need to verify if we've passed GET or POST as an argument. Currently we have the argument passing as a string and are using (string= "GET" url-method) to compare it to "GET". Is there any elisp/byte-compilation…
Jonathan Leech-Pepin
  • 4,307
  • 1
  • 19
  • 32
7
votes
3 answers

Byte-compilation of a multi-file package: "the function is not known to be defined"

Imagine that I have the following files in my (ridiculous) package: File test1.el: ;;; test1.el --- ;;; Code: (defvar test-var1) (defun test-fun1 (test) nil) (require 'test2 "./test2.el) (provide 'test1) ;;;…
T. Verron
  • 4,233
  • 1
  • 22
  • 55
6
votes
1 answer

package.el: How can I avoid byte-compilation

How can I tell package.el to not byte-compile? It is generally OK to byte-compile installed packages but it makes difficult to test a new Emacs with byte compiler improvements (such as Emacs 26 from 25) if you share .emacs/elpa/ with old Emacsen.
Yasushi Shoji
  • 2,151
  • 15
  • 35
1
2 3 4 5 6 7