72
votes
Accepted
What do I do when Emacs is frozen?
When C-g doesn't work, you can sometimes get control back with:
pkill -SIGUSR2 emacs
As @Archenoth points out, sending the SIGUSR2 signal to Emacs turns on debug-on-quit. This can be useful, but you'...
- 21.1k
34
votes
debugging some elisp -- "end of file during parsing error" in init.el
The "end of file during parsing" error means that you have not closed a paren.
To debug this, you should
Do M-x check-parens RET to pinpoint the location of the current error.
Enable show-paren-mode ...
- 5,634
33
votes
Accepted
How do I troubleshoot Emacs problems?
Step 1: running emacs -Q
The first thing you need to do is run emacs without any of your customizations. If you can reproduce the problem in vanilla Emacs, it may actually be a bug in Emacs itself. ...
- 21.1k
24
votes
Accepted
How do I debug `Package cl is deprecated`?
Try the following in an Emacs session with the code in question loaded up:
(require 'loadhist)
(file-dependents (feature-file 'cl))
- 21.4k
21
votes
Accepted
How to cancel `edebug-defun`?
From (info "(elisp) Instrumenting") :
To remove instrumentation from a definition, simply re-evaluate its
definition in a way that does not instrument. There are two ways of
evaluating forms that ...
- 3,446
19
votes
Accepted
Show line number on error
Emacs provides a good amount of debugging facilities including M-x toggle-debug-on-error, M-x toggle-debug-on-quit, debug on signal (which can be used by sending USR2 to Emacs from outside), debug-on-...
- 21.4k
19
votes
Accepted
Find elisp origin of warning
As pointed out in the other answer you'll find the fine manual useful for all the debug tools it has. For you specific problem I'd consider:
(setq debug-on-message "comint-completion-at-point failed ...
- 4,586
18
votes
Accepted
Interrupt evaluation and observe current stack in the emacs-lisp debugger?
You can make C-g trigger the debugger by turning on debug-on-quit. Just do
M-x toggle-debug-on-quit
Now every time you hit C-g you'll get a backtrace of what was going
on. This backtrace is ...
- 22.6k
15
votes
Accepted
How do I debug an emacs crash?
The easiest way to debug an Emacs crash is to start Emacs under gdb, and then do whatever thing it is that reproduces the crash.
Assuming you're building your Emacs from source, you should pass ...
- 5,952
15
votes
Accepted
Wrong number of arguments on lambda key binding
“Wrong number of arguments: (1 . 2), 0” means that a function expects at least 1 and at most 2 arguments (i.e. 1 mandatory and 1 optional argument), but it was called with 0 arguments.
As npostavs ...
14
votes
Accepted
Recentf doesn't remember all files
When you open emacs, open several files and exit emacs using C-x C-c (graceful exit), it will call the recentf-save-list function which saves recently opened files to a file specified by recentf-save-...
- 3,992
12
votes
How to kill a buffer when it causes Emacs to stop responding?
I've personally experienced hangs that cannot be broken by any number of C-g presses.
A more forceful method on UNIX OSs is to send Emacs a USR2 signal. Signal processing is a lot lower-level than ...
- 10.1k
12
votes
How to fix "Symbol's function definition is void: org-babel-get-header"
According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there:
org-babel-get-header was removed in 0d000f5 (...
- 31.4k
11
votes
How to kill a buffer when it causes Emacs to stop responding?
Press C-g repeatably. The first time might be ignored, the second time it should do the trick. If that fails also try pressing ESC three times.
- 24.8k
11
votes
Accepted
Error void-variable on function name
Short Answer
Replace func2 with #'func2:
(defun func2 (arg)
(if (listp arg)
(mapcar #'func2 arg)
arg))
Explanation
Emacs Lisp is a lisp-2 (like Common Lisp), not lisp-1 (unlike, say, ...
- 5,634
11
votes
Accepted
Melpa - 'Failed to download melpa'
The error seems to be saying that ((\, "http://melpa.org/packages/")) doesn't match the regex "\`https?:"
Let's look at that value, the one being added to package-archives:
'("melpa", "http://melpa....
- 8,749
10
votes
Why expression fails in init file, but works fine during session
I believe it is standard practice for themes installed as packages to add their own paths to custom-theme-load-path as an autoload. A call to package-initialize will execute all of your package ...
- 2,624
10
votes
How to cancel `edebug-defun`?
In other words, how do I rescind the directive that causes edebug to enter debugging mode when a particular function is invoked?
You can get this effect without removing instrumentation by setting ...
- 8,923
10
votes
Accepted
Tracking down a write to a variable
This is still under development, but in Emacs 26.1 (assuming nothing goes wrong) you will be able to do M-x debug-watch <variable> RET and then any change to the variable will land in the ...
- 8,923
10
votes
Accepted
Packages I never knew they existed cause problems
There was an issue with the latest straight.el commit.
https://github.com/doomemacs/doomemacs/issues/6960
One way to fix it, is to update straight repo and getting latest
version of straight , that ...
9
votes
Accepted
How to debug errors in sentinels and during font-lock
For process sentinels, I don't think there's a good reason. IOW I think it's just a missing feature, so I suggest you M-x report-emacs-bug.
For font-lock, the issue is more tricky because what ...
- 25.8k
8
votes
Accepted
How to fix this startup package initialization problem?
The "misbehaving" file ~/.emacs.d/elpa/archives/gnu/archive-contents was most likely overwritten by HTML content of a page reporting a connection error. It should be safe to remove it. Emacs will ...
- 11.1k
8
votes
Accepted
Multiple URL formats for bug-reference-mode
Update
Starting with Emacs 28, bug-reference is able to automatically detect and configure itself for Git forges including GitHub and GitLab. Quoth (info "(emacs) Bug Reference"):
[...]
...
- 11.7k
8
votes
Accepted
Surprisingly persistent local variable
In case someone else runs into this, I had enabled TeX-auto-save, which saves settings to an auto/ directory and loads them when a file is revisited.
https://www.gnu.org/software/auctex/manual/...
- 3,044
7
votes
Show line number on error
Maybe because it's 2018 now, but in my case,
I only had to turn on debugging like wasamasa suggested:
M-x toggle-debug-on-error
After this, M-x eval-buffer on my faulty Elisp file
gave context ...
- 169
7
votes
How to debug startup problem, if `--debug-init' has no effect
You can use elisp-bug-hunter to automatically bisect your init file.
Automated error hunting
If your Emacs init file signals an error during startup, but you don’t
know why, simply issue
...
- 6,790
7
votes
Accepted
How to visit file containing source code for a given function?
As @Dan said in his comment, if you know the name of the function, then just use C-h f plus the function name, to see a description of it. Then hit RET on, or click, the file-name link.
A more direct ...
- 72.5k
7
votes
Accepted
How to debug the "message" function on entry ?
You want to use the debug-on-message variable in this situation.
If non-nil, debug if a message matching this regexp is displayed.
- 45.4k
7
votes
Accepted
Debugging slowness in init file (not hostname related)
Thanks to @kmicu for the comment to my post. His answer was correct.
This is a recent TRAMP issue and worked around by adding
(setq tramp-ssh-controlmaster-options "")
to the beginning of my .emacs ...
- 251
7
votes
Accepted
Why expression fails in init file, but works fine during session
From the emacs manual regarding packages:
By default, Emacs also automatically loads all installed packages in
subsequent Emacs sessions. This happens at startup, after processing
the init ...
- 3,337
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
debugging × 504init-file × 40
org-mode × 32
python × 27
package × 16
edebug × 16
debug × 16
key-bindings × 15
variables × 15
spacemacs × 14
gud × 13
gdb × 12
backtrace × 11
microsoft-windows × 10
start-up × 10
error-handling × 10
buffers × 9
osx × 9
tramp × 9
c++ × 9
performance × 9
latex × 8
auctex × 8
elisp × 8
hooks × 8