Questions tagged [debugging]

Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program.

Filter by
Sorted by
Tagged with
49
votes
9answers
24k views

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

I have been trying off and on for over a year now to use Emacs as a C/C++ IDE. I have only been marginally successful thus far, but have run into a few brick walls along the way. Currently I am ...
46
votes
2answers
6k views

Debugging a frozen Emacs

I am using mew for my e-mail. I need to use TLS with my email provider for SMTP. However, when I try to invoke that, Emacs freezes. I would like to take this opportunity to learn more about Emacs ...
43
votes
2answers
8k views

What do I do when Emacs is frozen? [duplicate]

What should I do when Emacs stops responding? My current "emacs-is-frozen" protocol looks like this: Spam C-g (it sometimes works) Wait for a while. pkill -9 emacs What alternate steps could I try ...
21
votes
1answer
2k views

How do I troubleshoot Emacs problems?

In a situation where Emacs is not behaving like I want, what can I do to troubleshoot the problem? What steps can I take to find and fix the problem myself? Or, failing that, how can I gather useful ...
17
votes
1answer
709 views

Interrupt evaluation and observe current stack in the emacs-lisp debugger?

If some emacs-lisp function, such as a major mode hook, is taking longer than expected to execute, I would sometimes like to interrupt it and look at the current stack. Ideally, I'd also like to be ...
17
votes
0answers
1k views

How can I debug random Emacs server crashes?

I generally have a long-running instance of emacs --daemon, which I connect to with various emacsclients. Recently I have started experiencing random crashes. I say "random" because I haven't been ...
16
votes
1answer
2k views

How do I debug an emacs crash?

I am debugging why emacs crashes when using a function from a package1. The aim of this debug process is to get useful data to submit using M-x report-emacs-bug. To get help on how to debug emacs ...
15
votes
3answers
3k views

Show line number on error

Say that emacs throws some error that I don't understand. Or maybe the error says "Symbol's value as variable is void: modes", but there are many occurrences of the symbol modes in my code, so I need ...
13
votes
2answers
1k views

How to cancel `edebug-defun`?

How do I undo the effects of edebug-defun? In other words, how do I rescind the directive that causes edebug to enter debugging mode when a particular function is invoked? Also, I'd really like to ...
13
votes
2answers
1k views

How to kill a buffer when it causes Emacs to stop responding? [duplicate]

I use Emacs Dired to manage files. Accidentally, I hit Enter on an image file, Emacs tries to open the image and stop response. Is there a way to kill this process? (Since I am running other ...
12
votes
1answer
537 views

Get backtrace from error programmatically

If an error is signalled in Emacs Lisp code, and debug-on-error is t, I get a backtrace buffer that makes it easy to figure out where the error occurred. However, for errors that occur while ...
10
votes
1answer
634 views

Find elisp origin of warning

I ran a command and received a warning in the minibuffer. The exact warning was comint-completion-at-point failed to return valid completion data, after I autocompleted a command in shell-mode. How ...
10
votes
1answer
307 views

How to debug errors in sentinels and during font-lock

When an error occurs inside a process sentinel or during font-locking, then Emacs doesn't show a backtrace even though debug-on-error was previously enabled. I understand why these errors are caught, ...
10
votes
1answer
788 views

How to find out where a function is called from (backtrace/stacktrace)?

I've hit a problem that region is deactivated (in transient-mark-mode). The function deactivate-mark is called and I would like to find out where (and why) it is called from. I tried M-x debug-on-...
9
votes
2answers
744 views

Better debugging of crashing Emacs?

Although Emacs (24.3.93.1) runs fine if launched from the Finder, if the terminal version is launched: /Applications/Emacs.app/Contents/MacOS/Emacs -nw Emacs crashes with: Fatal error 11: ...
9
votes
2answers
743 views

Navigate to the source code of built-in functions and variables

Throughout the day I am constantly using C-h f or C-h v (describe-function and describe-variable) to look up documentation for functions and variables. More often than not, if I don't get all the ...
9
votes
1answer
1k views

How to compile emacs with debug symbols?

I'm having trouble walking through emacs source code in gdb. I think I'm missing debug symbols. Following a suggestion from https://stackoverflow.com/a/4298982/2752242, I tried: ./configure CFLAGS="...
9
votes
0answers
456 views

Edebug orgmode source code blocks with input variables

What is the standard method to debug emacs-lisp orgmode source code blocks with input variables as header arguments? I found the hacky solution to insert the following snipped in front of a source ...
8
votes
2answers
5k views

debugging some elisp — “end of file during parsing error” in init.el

After a long debugging of my init.el file, it looks like the first line of the following elisp-code, i.e (custom-set-variablesis provoking an 'End of file during parsing' error) which I absolutely don'...
8
votes
2answers
3k views

How do you configure emacs for julia?

What is a recomended way for making emacs as julia code editor? The things which I would like to have are: autocomplete julia shell in emacs with abbility to send the code from buffer debugging
7
votes
2answers
173 views

Why expression fails in init file, but works fine during session [duplicate]

I want to understand why an expression of the form (load-theme 'my-kewl-theme t) fails1 when run as the last expression in my init (~/.emacs) file, but works fine if I evaluate it as soon as soon as ...
7
votes
1answer
3k views

How to fix “Symbol's function definition is void: org-babel-get-header”

How do you trouble shoot this? (trying to run a sh block async) #+BEGIN_SRC sh /tmp/7.sh ...
7
votes
3answers
481 views

how to get Emacs to locate the error in my init file without relaunching?

When there's an error in one of my init files, I get a vague message like this when I launch Emacs: Warning (initialization): An error occurred while loading /Users/im/.emacs.d/init.elc: (wrong-type-...
7
votes
2answers
700 views

How to debug Helm

I am having some trouble with helm, so I have set debug-on-error in an effort to locate the problem. Now whenever the problem occurs, the *Backtrace* buffer appears as expected, but I am still in one ...
6
votes
3answers
4k views

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

When I launch Emacs24 (in an Ubuntu machine) I get an error message in the init procedure. Warning (initialization): An error occurred while loading `/home/nivaca/.emacs': But when I launch it with ...
6
votes
1answer
120 views

Surprisingly persistent local variable

A local variable keeps coming back, and I know not whence. In a certain buffer, TeX-command-extra-options is "--synctex=1", even after I have removed this from my init.el and restarted Emacs. I tried ...
6
votes
1answer
2k views

How to fix this startup package initialization problem?

All of a sudden Emacs returns an error at the startup, when I run $ emacs --debug-init from the terminal (linux) I get this debug error message: Debugger entered--Lisp error: (wrong-type-argument ...
6
votes
4answers
1k views

Debugging slowness in init file (not hostname related)

I am seeing some slowness in my init file loading: $ time emacs --debug-init -eval '(kill-emacs)' -Q real 0m0.672s user 0m0.338s sys 0m0.057s $ time emacs --debug-init --eval '(kill-emacs)...
6
votes
1answer
106 views

Can emacs auto-save backtrace?

Trying to debug a problem with debug-on-error. Backtrace appears for a second and then some other parts of the system make it disappear and emacs becomes dysfunctional so I can never read it. Is ...
6
votes
1answer
1k views

How do I change the working directory used by pdb/gud?

When running M-x pdb from Emacs, the current directory seems to be set to that of the directory of the script you are running, so pdb ~/path/to/project/__main__.py Would set the working directory ...
5
votes
2answers
408 views

How to visit file containing source code for a given function?

To open a buffer on the source code for a command definition, I usually follow a convoluted procedure something like this: Guess the name of the mode from the function name Guess the name of an elisp ...
5
votes
1answer
3k views

Wrong number of arguments on lambda key binding

I am not able to figure out what is wrong in this elisp form: (define-key ggtags-mode-map (kbd "M-.") (lambda () (interactive) (ggtags-find-tag-dwim) (recenter))) I keep getting this ...
5
votes
3answers
3k views

'wrong-type-argument stringp nil' Error With org-babel-load-file Function

I'm following the tutorial here to implement my init.el file in org mode. I therefore cleaned out my init.el file and added this only: (require 'org) (org-babel-load-file (expand-file-name "emacs-...
5
votes
3answers
1k views

How do I debug an “Invalid face reference: quote” message?

After using Emacs for some time, the message Invalid face reference: quote starts popping up in my message buffer. I'm not sure what causes it to start appearing. debug-on-message doesn't do anything ...
5
votes
1answer
666 views

Is it possible to get stack trace of currently running code? Or profile? Or how do you diagnose „hangs”

I look for ideas, how to diagnose reason of Emacs freezes (by which I mean taking 100% CPU and being irresponsive for some time). This question is not about any specific case¹ but about approach… Is ...
5
votes
1answer
706 views

How to better debug Emacs CPU management?

I can't remember since when exactly, but Emacs is getting slow with basic operations (moving cursor around). It's not exactly slow, but feeling laggy. Before I try and halven my configuration files ...
5
votes
2answers
744 views

How to set gud gdb -i=mi not to replace current buffer?

When using gdb -i=mi to debug a program, I typically split the window into two buffers vertically. But every time my program prints something gud automatically replaces my source code buffer with I/O ...
5
votes
3answers
91 views

Is there any setting in Emacs to choose perlbrew over perl?

I have a Perl project (developed in Ubuntu 14.04) which cannot be built on perl 5.18.2, but it works on Perlbrew 5.22.0. I have tried to use M-x perldb in Emacs but it looks like Emacs calls Perl 5.18....
5
votes
0answers
507 views

Display all local variables within a edebug session

When using edebug one can get a local variable by command describe-variable (C-h v), but are there any ways to display all local variables? For example in Python you can call locals() in a pdb ...
5
votes
0answers
68 views

How to investigate “color bleeding”?

I frequently have color-bleed issues in emacs, most often with AUCTeX: all of a sudden and for no apparent reason, the line I'm writing will be fontified as math. First things first: no, I do not ...
4
votes
1answer
763 views

Recentf doesn't remember all files

I have the following problem with recentf. If I open a file from commandline like emacs myfile the file myfile doesn't appear in the list of recently opened files (I also checked directly the file ....
4
votes
2answers
389 views

How to write assertions

How does one write assertions in Emacs Lisp? I know that cl-macs.el has cl-assert and cl-check-type, but I'm wondering if there's a native Emacs way to perform something that basic.
4
votes
1answer
340 views

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

I have (set-register ?E '(file . user-init-file)), so that I can easily jump to my config file. Previously I used a string to specify the path to my init file, but I figured I'd tidy it up a bit. ...
4
votes
2answers
694 views

Can't get out of minibuffer completion

Since upgrading from v. 24 to v. 25 [OSX 10.11.6] I find myself frequently fighting with minibuffer completion, as typing a tab after doing switch-to-buffer. ^G just beeps, and the completions ...
4
votes
2answers
963 views

Python remote debugging?

How do I debug remote python/twisted code from within Emacs? The closest I got with an internet search was Geben, if I understand correctly, but it has not been maintained for a few years now.
4
votes
1answer
763 views

how to increase the debugging message level

I believe that there is a way to increase the debug level, but I don't recall how. Perhaps I am using the wrong terms, but web searches and looking on StackExchange are not providing me anything ...
4
votes
0answers
273 views

list of current variables in a buffer for Python code

I would like to find a way to reproduce the "Workspace" of Matlab or the equivalent "Variables" window of the awesome pudb debugger directly in emacs for python code: it is a window which details the ...
4
votes
0answers
251 views

Quitting emacs is very slow

Quitting my Emacs takes a really long time. Is there a good way to track what's happening while quitting Emacs? (So far I'm turning to git blame to figure out what changes I have made to cause this ...
3
votes
2answers
520 views

Tracking down a write to a variable

Something setqs desktop-dirname to nil after my "init.el" is loaded. I want to track down the offending code. Just before the end of "init.el", desktop-dirname is correctly set. I checked run-hooks ...
3
votes
1answer
121 views

detecting obsolete/deprecated settings in elisp files, particularly .emacs

I recently got bitten by a deprecated setting breaking a new package I was trying to use. The same behaviour had been reported by a number of users before me, but the authors were unable to reproduce ...