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
50
votes
9answers
25k 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 ...
48
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 ...
46
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
718 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
4k 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
563 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
647 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
309 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
811 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
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'...
9
votes
2answers
755 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
810 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
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
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
471 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 ...
7
votes
2answers
177 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
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 ...
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
495 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
727 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
1answer
124 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
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-...
6
votes
2answers
75 views

Can emacs show formatted backtraces?

When getting an Elisp error and trying to debug the problem, the backtrace buffer is quite hard to read with its long lines. Is there a way to get a pretty-printed backtrace buffer?
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
109 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
432 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
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
2answers
991 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.
5
votes
1answer
700 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
722 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
815 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
92 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
548 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
69 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
800 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
3answers
124 views

How to trace the evaluation of all forms in the body of an Elisp function

When working with bash scripts, when something is not behaving the way you want it to, you can add a set -x and the next time you run the script you can see the methods and the sub methods being ...
4
votes
2answers
412 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
354 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
3answers
787 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
1answer
333 views

how to debug constant freezing with emacs org-mode on windows?

I use org-mode with emacs heavily. On LINUX, everything is great. When I have to use windows emacs regularly freezes and I have to kill via task manager and restart. Any suggestions on how I can ...
4
votes
1answer
813 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
301 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 ...