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
1 vote
1 answer
133 views

“assignment to free variable” warning after defvar

The compiler will issue a warning message Warning: assignment to free variable -/var if you evaluate the following forms: ;;; -*- lexical-binding: t; -*- (defvar -/var) (byte-compile (let (_) ...
shynur's user avatar
  • 4,638
1 vote
1 answer
54 views

Make the linter aware of autoloads for init files using package-quickstart

If I try to call an autoloaded function inside my init.el file, it will get executed normally. However, the byte compiler will give me warnings about undeclared functions. This applies for all user-...
cidra's user avatar
  • 135
0 votes
0 answers
38 views

When using `cl-labels` or `cl-flet` shouldn't the compiler catch signature msmatches

I was expecting a compilation error for the snippet below... unfortunately compilation goes through without any errors, but it errors during runtime. Run-time error is expected, so no surprise there. ...
user avatar
0 votes
1 answer
106 views

Squelching all byte and native compilation warnings from batch package installation

I have to copy my .emacs.d to different computers a lot, so I keep init.el etc in version control and pair it with a batch Elisp script that re-downloads all of my selected packages. I'd like this ...
zwol's user avatar
  • 272
0 votes
0 answers
20 views

How to avoid byte-compiler warnings when putting a defconst into a let?

I want to define a few constants in my emacs init file, based on running some code, like this: (let* ((var1 ...) (var2 ...) ... more code here... (defconst env-is-ok (or var1 var2)) (defconst ...
GaryO's user avatar
  • 496
0 votes
1 answer
77 views

Upgrade from 27.2 to 30.0, calling sequence change for "make-obsolete-variable"

I'm trying to upgrade from emacs-27.2 to emacs-30.0.50 under Ubuntu GNU/Linux. Now, when I use emacs-30.0.50, I get this error on startup: Wrong number of arguments: make-obsolete-variable, 2 I ...
HippoMan's user avatar
  • 594
3 votes
1 answer
45 views

Can you mark the end of 'compilation' in an eLisp source file?

In all of my source files, in whatever language, I use some trick or other to end compilation and then add a documentation trailer in perldoc format from which I can generate a man page. I always keep ...
Dale Amon's user avatar
-3 votes
1 answer
79 views

eval-when-compile in terms of minor-mode development

I'd like to know when a developer should use eval-when-compile despite the fact that at first glance everything works without eval-when-compile. When does not using eval-when-compile lead to ...
Dilna's user avatar
  • 1
0 votes
1 answer
43 views

Byte compile setup

What byte compile setup can I use when writing my init files? Have been doing M-x byte-compile-file directly. Would like to do a function that calls byte-compile-file on the current buffer.
Dilna's user avatar
  • 1
0 votes
1 answer
63 views

How to disassemble an lambda/anonymous function given its hex adress but not name?

Assume that we have: (defalias 'my-f (lambda () (message "a"))) (byte-compile 'my-f) => #f(compiled-function () #<bytecode 0x1dc01052127a>) (setq my-g (byte-compile (...
Daanturo's user avatar
  • 180
2 votes
1 answer
171 views

Which byte-compile-file is my Emacs using? Function signature in describe-function differs to that in bytecomp.el

After reviewing some functions in my own dot-emacs files, I've noticed that the function signature that describe-function shows for byte-compile-file differs to that for the function definition in the ...
Sean Champ's user avatar
3 votes
2 answers
3k views

Is there a way to determine if emacs uses the byte compiled or the natively compiled code of a function?

Say, there is some function and if I do a describe-function on it it says: x is an interactive compiled Lisp function in x.el Can I tell somehow if this loaded compiled code is byte compiled or ...
Tom's user avatar
  • 1,190
0 votes
1 answer
340 views

Errors with use-package after upgrading package

I load modus-themes (among other packages) in my Emacs configuration using: (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . &...
Mike Crowe's user avatar
1 vote
1 answer
91 views

How to revert org-ctrl-c-tab in Org?

I accidentaly pressed the keys C-c C-i which executed the command org-ctrl-c-tab. According to the self-documentation: org-ctrl-c-tab is an interactive and byte-compiled function defined in org.el.gz. ...
Pedro Delfino's user avatar
4 votes
1 answer
128 views

How do you find all macro calls in an elisp file?

I am trying to make sure a package that is installed from Melpa (org-ref) byte compiles correctly, and a typical issue is related to the use of macros. For example, if I use org-with-wide-buffer which ...
John Kitchin's user avatar
  • 11.6k
1 vote
1 answer
99 views

Why is byte compiler issuing a warning on one of these 2 de Morgan equivalent expressions?

Assuming that the symbol foo is not defined nor declared with a defvar or let form, the following code generates a byte-compiler warning in Emacs 26.3 and 27.2: (defun f-or () "Use or." (...
PRouleau's user avatar
  • 786
4 votes
1 answer
295 views

eval-when-compile and eval-and-compile identical definitions?

How can eval-when-compile and eval-and-compile have different behavior if their definitions are identical? From byte-run.el: (defmacro eval-when-compile (&rest body) ;; ... documentation string ...
ivan's user avatar
  • 1,938
3 votes
1 answer
153 views

Avoiding warnings of undefined functions while compiling

I have a lot of code in my init file like this: (when library-is-available ;; Code that use that uses functions from library ) However, I get warnings that the functions that I am using are not ...
Tohiko's user avatar
  • 1,609
0 votes
0 answers
70 views

How to properly advise macros used by functions if earlier byte-compilation is present?

I am trying to customize the looks of org-agenda and, in order to do so, I would like to advice the macro org-agenda--insert-overriding-header; this macro appears to be used in several functions. ...
Wilder's user avatar
  • 95
0 votes
0 answers
33 views

Is there a way to change the unibyte string bytecode output of `byte-compile` to hex?

Given a byte-compiled function: (byte-compile (defun factorial (integer) "Compute factorial of an integer." (if (= 1 integer) 1 (* integer (...
John DeBord's user avatar
0 votes
0 answers
48 views

Mutually recursive bytecode function throws an error when I try to eval

The following workflow contains the steps needed to reproduce the error: ;; Byte-compile the function. (byte-compile '(defun flatten (x) (cl-labels ((rec (x acc) ...
John DeBord's user avatar
0 votes
1 answer
101 views

Can you detect if a byte-compiled elisp file was not compiled by the current emacs?

Is there a way to tell if the current *.elc files were not compiled with the current Emacs? I am trying to detect an error where emacs is updated, but old .elc files are left in the user elpa ...
John Kitchin's user avatar
  • 11.6k
1 vote
2 answers
579 views

Byte compilation error with use-package

The beginning of my ~/.emacs.d/init.el file looks like this: ;; MELPA (require 'package) (setq package-enable-at-startup nil) (setq package-check-signature nil) (add-to-list 'package-archives '("...
space_voyager's user avatar
1 vote
2 answers
85 views

`rx` form, that is partially compiled, partially variable?

Is it possible to obtain an (rx ...) form, that is expanded at compile time for performance, but partially variable? rx-to-string may be slow For instance I want an expression that behaves ...
kdb's user avatar
  • 1,561
0 votes
1 answer
99 views

How to byte-compile a file in the background?

To cut time on untangling my org setup file, I now only compile on save. However it is somewhat annoying to have the compile buffer popup on every save. ;; Only untangle on a change/save (defun ...
SFbay007's user avatar
  • 564
4 votes
0 answers
173 views

Which Lisp objects are byte-compiled?

A compiled program and a source code can be interpreted differently at runtime. The issue is that some Lisp objects should not be modified because of the byte-compilation. Emacs Lisp manual: 2.7 ...
user avatar
3 votes
1 answer
537 views

*Compile-log* buffer warning

I am a newbie to Emacs Lisp. started Emacs and the *Compile-log* buffer shows the following logs which I don't have much clue of. I was trying to install Magit and Helm. should anything in this log ...
YiC's user avatar
  • 105
2 votes
1 answer
193 views

Which site-lisp file was loaded, default.el or default.elc?

I'm setting up some site-wide default configuration in the site-lisp directory, and trying to figure out whether emacs is loading the byte-compiled default.elc or default.el. I haven't applied any ...
ivan's user avatar
  • 1,938
1 vote
1 answer
86 views

Byte compilation still happening when `no-byte-compile` is t on adding advice

In org-mode, I have the following: #+BEGIN_SRC emacs-lisp :results scalar (setq no-byte-compile t) (defun f ()) (defun g ()) (add-function :before (symbol-function 'f) 'g) (symbol-function 'f) #+...
extremeaxe5's user avatar
0 votes
1 answer
36 views

Source file ‘c:/Users/.../AppData/Local/emacs-26.1-x86_64/share/emacs/26.1/lisp/progmodes/python.el’ newer than byte-compiled file

this message shows up on Emacs startup. what does it mean and how to get rid of it? Source file ‘c:/Users/jcao/AppData/Local/emacs-26.1-x86_64/share/emacs/26.1/lisp/progmodes/python.el’ newer than ...
YiC's user avatar
  • 105
2 votes
1 answer
478 views

Workaround for "Invalid search bound (wrong side of point)" in CC Mode

Emacs 24.x and 25.x have a bug in CC Mode which can result in some operations failing with the error Invalid search bound (wrong side of point) For example, I can reproduce it with the following ...
Gilles 'SO- stop being evil''s user avatar
0 votes
0 answers
456 views

How to manually byte-compile a package?

Looking at the package installed under elpa directory I see that it have been byte compiled and the structure is different from the source. Consider the following example https://github.com/hlissner/...
a--m's user avatar
  • 103
4 votes
3 answers
333 views

How do I get byte-compilation warnings about undefined variables?

The following code works fine with M-x eval-buffer, and byte-compiles without any warnings. (eval-when-compile (defconst demo-one 1)) (defvar demo-some-var `(foo bar ,demo-one)) However, if I ...
Wilfred Hughes's user avatar
4 votes
0 answers
1k views

byte-compile much slower in X (vs. -nw)

Setup Windows 10 host with X server (VcXsrv) Linux guest (Arch) in virtual machine (VMware) Benchmark (defmacro measure-time (&rest body) "Measure the time it takes to evaluate BODY." `(let ...
feklee's user avatar
  • 1,049
3 votes
2 answers
250 views

byte-compile and lexical-binding

Could someone in the know please help me understand what's going on here: ;; -*- lexical-binding: t; -*- (let* ((a 0)) (let* ((a 1)) (funcall (byte-compile (lambda () a))))) ;;=> 0 wat? Not ...
zeRusski's user avatar
  • 335
0 votes
1 answer
55 views

Byte-compilation and "uninterned" function names

Not quite a duplicate: this appears to be very similar to the situation described in an existing question. But my question is not "why does it happen", but rather "is there any way to keep using ...
user avatar
2 votes
0 answers
95 views

byte-compiling in presence of pcase patterns

TIL that trying to compile anything with pcase matching in it may lead to an explosion of code generated during expansion. Even the most innocent looking patterns may generate hundreds of branches and ...
zeRusski's user avatar
  • 335
2 votes
3 answers
728 views

error: Invalid byte opcode: op=183, ptr=2

I byte-compile my ~/.emacs.d/init.el. It was done by Emacs 26.1 from Cygwin and I got error when load emacs-nox 25.2 from Debian WSL: error: Invalid byte opcode: op=183, ptr=2 Were new opcodes ...
gavenkoa's user avatar
  • 3,362
4 votes
0 answers
66 views

A workflow for managing compiled elisp packages with different versions of emacs

I am using different versions of emacs, on different computers. On some of those (work computers) I don't really have a choice to update, whereas for my personal computers, I like to run the latest ...
T. Verron's user avatar
  • 4,263
3 votes
1 answer
103 views

How to get Emacs to know that a symbol has a function definition

While reading the source file prelude-ivy.el in the Prelude modules directory, I saw that there was a warning associated with "here" in the last line, specifically that prelude-required-packages was ...
pajato0's user avatar
  • 399
0 votes
1 answer
89 views

Byte complie predictive mode

I'm trying to byte compile predictive mode and I have an issue that I can't solve. If I clone it from the official repo, and make it, I get: In toplevel form: predictive-auto-overlay-auto-dict.el:35:...
Pouya's user avatar
  • 203
4 votes
1 answer
245 views

Make a variable visible to some functions only

Consider the following metacode: ;;; -*- lexical-binding: t -*- (defvar var1 ...) (defvar var2 ...) (defun main () "Main entry point" ...) (defun func1 ...) (defun func2 ...) ... (defun funcn ...)...
antonio's user avatar
  • 1,792
0 votes
2 answers
195 views

Generating a single byte-compiled file from more sources

I have a relatively large elisp file which starts becoming hard to maintain and I am going to split it into smaller files. However, for my use case, it would be still convenient to have a single byte-...
antonio's user avatar
  • 1,792
1 vote
1 answer
882 views

Can we force emacs to not load byte compiled files?

I would like Emacs to not use byte-compiled files because the stack-trace is really messy. So for my own elisp files, I can add ;; -*-no-byte-compile: t; -*- to disallow byte-compilation. But how ...
Nishant's user avatar
  • 239
0 votes
1 answer
90 views

eval-when-compile statements not running in files required by compiled file

I've got one file including (eval-when-compile (require 'cl)) Some other files require this file, and also need to have cl required when they are byte-compiled. This is not happening - this first ...
jcarpenter2's user avatar
3 votes
2 answers
207 views

Can one inhibit eval-when-compile?

There is an eval-when-compile macro but, AFAICT, no eval-when-not-compiling or load-time-only, that would be very convenient for me now. Do you know any generic workaround? Why do I need this: I ...
phs's user avatar
  • 1,105
5 votes
2 answers
741 views

Where are these variables defined? - bytecomp Warnings

Lately I'm getting warnings when compiling the .emacs Warning (bytecomp): reference to free variable ‘url-http-extra-headers’ Warning (bytecomp): reference to free variable ‘oauth--token-data’ ...
Dox's user avatar
  • 965
5 votes
1 answer
325 views

Why are custom themes not usually byte-compiled?

Three pieces of evidence suggest custom themes should not be byte-compiled: All built-in themes under etc/themes specify no-byte-compile: t. The function custom-available-themes considers only .el ...
Basil's user avatar
  • 12.2k
6 votes
1 answer
469 views

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 ...
Yasushi Shoji's user avatar
3 votes
2 answers
392 views

Disassembly of a bytecode *file*?

There is a disassembler for functions, but is there something that will disassemble a bytecode file? Thoughts on how to accomplish?
rocky's user avatar
  • 888