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
0
votes
0answers
19 views

How to compile 3rd party packages ahread of time with native compilation?

Currently Emacs compiles packages on demand (native compilation, creating *.eln files). How can I scan my locally installed packages and compile them ahead of time, so this is a one time operation ...
1
vote
1answer
70 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." (...
1
vote
2answers
229 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 '("...
3
votes
1answer
97 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 ...
3
votes
1answer
35 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 ...
0
votes
0answers
21 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. ...
0
votes
0answers
31 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) ...
0
votes
0answers
24 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 (...
0
votes
0answers
44 views

Fixing "Warning: Unknown slot " emitted when a slot referenced by its :initarg name

The code below works but compiles with: foobar.el:9:9:Warning: Unknown slot ‘:baz’ (require 'eieio) (defclass foo-bar () ((baz :initarg :baz :initform t :type boolean))) (defmethod ...
0
votes
1answer
26 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 ...
16
votes
1answer
5k views

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 ...
2
votes
3answers
592 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 ...
4
votes
0answers
250 views

Is there an ELISP decompiler?

I'm thinking of writing one so that when I get those horrible tracebacks from bytecode files, I can better see where I was at. Is there one already? Are there any other tools for showing an error ...
5
votes
1answer
254 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 ...
1
vote
2answers
49 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 ...
0
votes
1answer
29 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 ...
4
votes
0answers
123 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 ...
3
votes
1answer
214 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 ...
1
vote
1answer
81 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 ...
1
vote
1answer
35 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) #+...
6
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 () (...
0
votes
1answer
27 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 ...
2
votes
1answer
177 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 ...
0
votes
0answers
169 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/...
4
votes
3answers
199 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 ...
3
votes
2answers
169 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 ...
4
votes
0answers
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 ...
0
votes
1answer
44 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 ...
2
votes
0answers
79 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 ...
2
votes
1answer
202 views

What effect does eval-and-compile have on a defun-within-let?

The byte-compiler does not currently seem to recognise that a function has been defined when using defun within a let expression under lexical-binding, as explained in Stefan's answer to this question....
12
votes
2answers
2k 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' ...
4
votes
0answers
47 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 ...
3
votes
1answer
84 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 ...
0
votes
1answer
85 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:...
4
votes
1answer
198 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 ...)...
0
votes
1answer
70 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 ...
16
votes
3answers
517 views

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, ...
0
votes
2answers
129 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-...
3
votes
2answers
302 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?
1
vote
1answer
337 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 ...
0
votes
1answer
195 views

Ignore byte-compiled files without source file

I recently refactored my Emacs config, part of which involved deleting some old files which had been byte-compiled. My new configuration (ab)uses the load-dir package to load all my customisation ...
3
votes
1answer
2k views

How do you recompile an .el source file and make it active in my current session

I have been writing some elisp code, current i have to open the file edit quit and reload emacs seems there must be a better way ? I know i can recompile the current file but that does not seem to ...
3
votes
2answers
151 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 ...
5
votes
2answers
598 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’ ...
6
votes
1answer
255 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 ...
1
vote
1answer
44 views

What does `#[0` (hash angle bracket 0) mean in the elisp debugger?

When using the debugger I get lines like the following in the stack trace: #[0 "\302\303!\210\300\211\207" [describe-input-method this-command helm-mode 1] 2 "\n\n(fn)"]() I have no clue what the #[...
1
vote
1answer
62 views

Requiring user-installed packages from byte-compiled .emacs

I have the following in my .emacs.el: (when (require 'edit-server nil t) (custom-set-variables '(edit-server-default-major-mode 'markdown-mode) '(edit-server-new-frame nil)) (edit-server-...
6
votes
0answers
113 views

How to build Emacs without byte-compiling Lisp files

Q:  Is there an option to build Emacs without byte-compiling the Lisp files? BACKGROUND:  The length of time needed to build Emacs makes debugging / developing an extremely slow process. For example,...
0
votes
1answer
45 views

`error' called with 1 args to fill 0 format field(s)

I'm getting an error called with 1 args to fill 0 format field(s) error when byte-compiling cider-repl-history.el with Emacs 24.4 and 24.5. No such error is reported for Emacs 25.1. Line 422 of cider-...
2
votes
1answer
468 views

Function might not be defined at runtim

To use directory-files-recursively in Emacs 24.x, I'm adding the following to a file cider-compat.el: (eval-and-compile (unless (fboundp 'directory-files-recursively) (defun directory-files-...