Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
15 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 ...
4
votes
0answers
891 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 ...
3
votes
2answers
84 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 ...
0
votes
1answer
36 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
45 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 ...
0
votes
1answer
157 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
35 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
67 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
66 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:...
1
vote
1answer
147 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
2answers
47 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-...
1
vote
1answer
90 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
45 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 ...
3
votes
2answers
105 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 ...
4
votes
2answers
242 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’ ...
2
votes
1answer
140 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 ...
5
votes
1answer
155 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 ...
3
votes
2answers
214 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
224 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 ...
1
vote
1answer
38 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 #[...
4
votes
0answers
165 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 ...
0
votes
1answer
106 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 ...
1
vote
1answer
44 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
82 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
36 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
219 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-...
4
votes
2answers
118 views

Prevent byte-compiler warnings after requiring features

In Elisp packages, we sometimes want to use a feature only if the user has installed another package without specifying that package as a dependency for our own. E.g. (when (require 'markdown-mode ...
3
votes
1answer
47 views

When I (byte-compile-file “my-package.el”), can I treat warnings as errors?

As part of CI testing, I'm byte-compiling package files to make sure there are no errors. I'd like to take this a step further and ensure there are no warnings, either (like 'function not known to be ...
2
votes
1answer
96 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....
0
votes
0answers
51 views

Byte Compiling Functions Using `defalias` for `progn`

The following code: (defalias 'new-progn 'progn) (defun foo () (new-progn "foo")) (byte-compile 'foo) (foo) gives this error: Debugger entered--Lisp error: (invalid-function #<subr progn>) ...
1
vote
1answer
142 views

Emacs init.el warning

When I load up emacs for the first time I get this warning Warning (bytecomp): ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead. [2 times] ...
0
votes
1answer
138 views

is byte-compile-dynamic compatible with use-package?

If I'm using use-package in a file that I plan to byte-compile, can I still leverage Emacs' byte-compile-dynamic setting to lazy-load compiled function definitions? From the Elisp manual: With ...
1
vote
1answer
39 views

w32-short-file-name: multi-OS user-configuration — silence byte-compiler

I have a multi-OS user-configuration. On OSX, when I byte-compile, the function w32-short-file-name is not defined (which is okay). What is the proper way to silence the byte-compiler for this ...
8
votes
1answer
292 views

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) (...
1
vote
1answer
112 views

Fixing “reference/assignment to free variable” warning during compilation if variable is dynamically bounded

For: (defun my-ag/font-lock-extend-region () (save-excursion (goto-char font-lock-beg) (forward-line 2) (setq font-lock-beg (point)))) I've got: Warning: reference to free variable '...
1
vote
2answers
233 views

Does `load` prefer .elc files over .el files?

Do .elc files take precedence over .el files when using load? Say I have two files in my load path: foo.el and foo.elc. If I call (load "foo"), will the byte-compiled version (foo.elc) always be ...
4
votes
1answer
93 views

Does package-install do byte-compilation?

When installing a package from the package menu, can/will package-install do automatic byte compilation of the installed package files? Or is this something the user must do manually himself ...
1
vote
2answers
49 views

byte compile warning: `unintern` called with 1 argument, but requires 2

Q:  How to fix elmo-unintern to use 2 arguments instead of 1, or silence the byte-compiler on this issue. Here is the macro definition: (defmacro elmo-unintern (string) "Delete the symbol named ...
4
votes
1answer
140 views

Which functions cannot be redefined after byte compilation?

Given a function that calls not: (defun my-not (x) (not x)) M-x disassemble gives: byte code for my-not: doc: ... args: (arg1) 0 dup 1 not 2 return I ...
13
votes
3answers
229 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
99 views

Warning assigning variables

I'm rebuilding my emacs configuration, and trying to compile without warnings. I'm using also cask. I have this case: (require 'magit) ;; Enable a right limit of 70 chars for git logs (add-hook '...
5
votes
1answer
161 views

How can I make Emacs warn about calls to my pure functions?

Emacs' byte-compiler can tell me if I call pure functions without saving the result: (defun foo-calls-add () ;; value returned from (+ 1 2) is unused: (+ 1 2) 12) However, I don't get any ...
0
votes
1answer
347 views

How can I refresh the ELPA directory content without having to select and re-download the packages manually? (for slowed ver. 25.1 in Windows 10)

Hi fellow Emacs users, I'm experience very slower performance of 25.1 but a startup with -Q indicated the problem is probably caused by my old packages. (Similar scenario: https://www.reddit.com/r/...
1
vote
0answers
243 views

byte-recompilation of files under a directory

As I move all my emacs.d between my machines using Git, and, obviously, I don’t version control byte-compiled files (*.elc), I sometimes get into a situation when my .el files are newer then the ...
0
votes
1answer
61 views

byte compiler warning: called with 2 arguments, but accepts only 1

When I byte compile an elisp file via emacs -batch -f batch-byte-compile I get Warning: load-theme called with 2 arguments, but accepts only 1. The code in question: (load-theme 'solarized-light t) ...
3
votes
2answers
395 views

Where and when should emacs lisp files be byte-compiled?

Do you have examples of packages that benefit substantially from byte-compilation? I would prefer to avoid byte-compiling files when it is not necessary, in particular when installing hundreds of ...
1
vote
0answers
168 views

Compiled configuration cannot find package

I am trying to have configuration byte-compiled to improve performances further. The original code works with no issue. However, adding the optional compile argument: (require 'ob-tangle) (org-babel-...
7
votes
1answer
116 views

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 ...
8
votes
1answer
1k 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 warning: ...
4
votes
1answer
371 views

Strange elisp byte-compiler warning about unused variables

The following elisp code inserts hello world! 10 times: -*- lexical-binding: t -*- (dotimes (i 10) (insert "hello world!\n")) If I byte-compile that code, I get the following message: hellos.el:2:1:...