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.

Filter by
Sorted by
Tagged with
13
votes
1answer
3k views

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 ...
3
votes
0answers
228 views

Byte-compiling a file loads macros with `(eval-and-compile)` but not `(eval-when-compile)`

I created a buffer, test1.el: (eval-when-compile (defmacro dummy-macro (_) nil) (dummy-macro s)) Trying to compile this file, I get the following errors: In toplevel form: test1.el:3:16:Warning:...
6
votes
1answer
120 views

Can the byte-compiler warn me about unused variables?

I've just finished a pretty significant refactoring; byte-compiler warnings were a great way to quickly find errors, without even running tests. Still, there's one kind of code smell that the byte-...
2
votes
0answers
231 views

How much faster is C than compiled elisp? [closed]

I'd like to write some lightning-fast functions for analyzing LaTeX code. Because they could involve a lot of complicated processing of large documents, I don't know whether it's a good idea to write ...
0
votes
1answer
339 views

Fix for “Invalid function:” error when external function become a macro

For: (defun my-w3m-view-url () (interactive) (browse-url (w3m-anchor))) (eval-after-load 'w3m (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url)) when byte-compiled I get error on ...
3
votes
2answers
97 views

byte compile file-local variables

Is it possible to access a user-defined file-local variable during byte-compilation? As an example, I am trying to get this code to work: --- testfilelocals.el --- ;; -*- my-file-local: "foo" -*- (...
5
votes
2answers
2k views

Debugging “Warning: Reference to free variable”

I have something like below (from the answer) in my init file: (add-hook 'LaTeX-mode-hook 'my-latex-hook) (defun my-latex-hook () (require 'tex-site) (define-key LaTeX-mode-map "-" (lambda () (...
12
votes
2answers
131 views

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 ...
6
votes
2answers
95 views

Byte-compiling a file against a package that may or may not be here

I am trying to include support for smartparens in a major-mode package. I want that if a user is using smartparens, then he will get additional pair definitions, and if he isn't, he will not notice ...
2
votes
1answer
346 views

How to specify the directory for file-exists/delete-file/byte-compile-file?

I thought it would be great to save a Elisp file (in my init), and it compiles automatically a byte-compile Elisp-file. So I wrote a function for this. (defun remove-elc-and-compile-on-save () ...
10
votes
2answers
1k views

`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' ...
8
votes
1answer
620 views

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 ...
1
vote
2answers
197 views

Recompile a .gz file in emacs' progmodes directory

c-electric-lt-gt in cc-cmds.el.gz treats > as a closing paren only if it isn't immediately followed by another >. This behaviour is incorrect for C++11 and I tried to modify it by changing the ...
13
votes
2answers
308 views

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 ...
7
votes
2answers
752 views

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 ...
13
votes
1answer
360 views

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 ...
5
votes
1answer
419 views

What does a byte compiled Emacs file contains and how is it executed?

I didn't know byte compiled emacs files (.elc) were actually version-specific until Malabarba pointed that to me. So this made me ask what do those files actually contain and how does their ...
7
votes
3answers
634 views

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) ...
6
votes
1answer
405 views

Recursive load error in csharp mode on upgrading to 24.4

I'm on OSX 10.9.4 and I was previously running emacs 24.3 installed via brew. This morning I got around to asking brew to upgrade me to 24.4. Everything seemed to go smoothly, except csharp-mode no ...
4
votes
1answer
294 views

How can I get lint warnings when I've forgotten to require a package?

Flycheck has a brilliant ability to warn about when I'm using a function foo-bar but have forgotten to add (require 'foo) at the top of my file. However, it's inconsistent. It doesn't always warn for ...
15
votes
2answers
477 views

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 ...
4
votes
2answers
92 views

What compilers are used during installation of a package?

When I download and install auctex, I read that The simplest way of installing AUCTeX is by using the Emacs package manager integrated in Emacs 24 and greater (ELPA). Simply do M-x package-list-...
27
votes
4answers
4k views

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