Questions tagged [debugging]
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program.
404
questions
58
votes
2answers
12k 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 ...
56
votes
3answers
7k 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 ...
53
votes
9answers
29k 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 ...
23
votes
1answer
3k 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 ...
19
votes
1answer
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 ...
18
votes
1answer
818 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
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 ...
17
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 ...
16
votes
2answers
2k 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 ...
14
votes
2answers
2k 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 ...
13
votes
1answer
3k views
How do I debug `Package cl is deprecated`?
While compiling an Elisp package from github, I get the
Warning: Package cl is deprecated
How do I find out what triggers it?
The specific file that triggers this is tiny and has no CL code.
I ...
12
votes
2answers
8k 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'...
12
votes
1answer
790 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 ...
12
votes
1answer
696 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 ...
12
votes
0answers
643 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 ...
10
votes
3answers
4k 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
10
votes
2answers
1k 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 ...
10
votes
2answers
192 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?
10
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
2answers
831 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
1answer
396 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, ...
9
votes
1answer
958 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-...
8
votes
3answers
6k 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 ...
8
votes
1answer
4k 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 ...
8
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 ...
8
votes
3answers
807 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
196 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
5k 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 ...
7
votes
3answers
4k 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-...
7
votes
2answers
899 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 ...
7
votes
1answer
139 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 ...
7
votes
0answers
811 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 ...
6
votes
1answer
144 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
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
958 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 ...
6
votes
1answer
1k 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 ...
6
votes
0answers
2k views
How to debug C++ (dap-mode + LLDB or GDB)
I want to use dap-mode to debug a C++ code. Until now I followed instructions dap-mode (LLDB) and lldb-vscode. I further enabled the mode and UI via
(dap-mode 1)
(dap-ui-mode 1)
When I execute dap-...
6
votes
1answer
2k 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
596 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
269 views
Obtaining a backtrace on batch invocation of Emacs?
The only way I know of printing a backtrace for errors in batch invocation of Emacs is by setting debug-on-error inline like so:
$ emacs -batch --eval "(setq debug-on-error t)" -f "my/foo-function"
...
5
votes
3answers
1k 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 ...
5
votes
3answers
2k 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
944 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
2answers
541 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 ...
5
votes
2answers
1k 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
2answers
1k 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
113 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
1answer
136 views
(RegEx-)Replace: Sporadic Match data clobbered by buffer modification hooks
I know this was asked in other contexts already, but I couldn't find anything related to C++ development with my hooks that could help me.
I am working a lot with replace and query-replace and query-...
5
votes
0answers
106 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 ...
5
votes
0answers
759 views
Emacs typing backwards
So, sometimes when I go into a buffer that has a [ as the first character (such as .ini files) emacs suddenly starts typing everything backwards. In other words, if I press the keys y e s I get out s ...