68 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'...
user avatar
  • 20.3k
57 votes

Debugging a frozen Emacs

Before resorting to gdb, if you're using a Unix-y operating system, you can try sending SIGUSR2 to the Emacs process, like documented in the DEBUG file mentioned in the other answer. $ kill -SIGUSR2 &...
user avatar
  • 3,268
41 votes

Debugging a frozen Emacs

If the freeze goes away when you hit C-g, then you can use the built-in debugger. Type M-x toggle-debug-on-quit before sending the message, hit C-g when it freezes, and inspect the *Backtrace* buffer ...
user avatar
  • 5,834
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. ...
user avatar
  • 20.3k
30 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 ...
user avatar
  • 5,477
28 votes

Using Emacs as a full-featured C/C++ IDE

Different levels of "IDE-ness" exist for different languages, and unfortunately you're never going to get full IDE features without some configuration (if you don't like configuring things, you ...
user avatar
  • 4,968
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))
user avatar
  • 21k
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 ...
user avatar
  • 3,351
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 ...
user avatar
  • 4,546
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-...
user avatar
  • 21k
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 ...
user avatar
  • 22.4k
16 votes

Using Emacs as a full-featured C/C++ IDE

I used this guide to get started using Emacs as a C++ IDE. It introduces Helm and Projectile which help answer a number of your questions. To wit, Projectile manages projects. It searches up the ...
user avatar
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 ...
user avatar
  • 5,834
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 ...
user avatar
13 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-...
user avatar
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 ...
user avatar
  • 10k
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 (...
user avatar
  • 30.3k
11 votes
Accepted

How to debug startup problem, if `--debug-init' has no effect

You do not enter the debugger from --debug-init in this case because the message is a warning, not an error message. IOW, in spite of the text in the warning message, which speaks of an "error", from ...
user avatar
  • 69.7k
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.
user avatar
  • 24.3k
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, ...
user avatar
  • 5,477
10 votes

Using Emacs as a full-featured C/C++ IDE

Since you are asking for a full-featureed C/C++ IDE now, I might be qualified. I used all MS IDEs from vc4 to Visual Studio 2010, so I fully understand what you want. The good news is that Emacs ...
user avatar
  • 4,611
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 ...
user avatar
  • 2,594
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 ...
user avatar
  • 8,793
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 ...
user avatar
  • 8,793
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 ...
user avatar
  • 25.3k
9 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....
user avatar
  • 8,574
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 ...
user avatar
  • 10.9k
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"): [...] ...
user avatar
  • 11.4k
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/...
user avatar
  • 2,924
7 votes
Accepted

Why did I get an error message: wrong-type-argument stringp user-init-file

In your code user-init-file is not evaluated (it is quoted), so expand-file-name gets a symbol (and not a string), and complains about that. Try this: (set-register ?E (cons 'file user-init-file)) ...
user avatar
  • 8,952

Only top scored, non community-wiki answers of a minimum length are eligible