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'll want to turn it off again at some point (possibly immediately). To do this, call M-x toggle-debug-on-quit.
More information on using SIGUSR1 and SIGUSR2 ...
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 <emacs_pid_goes_here>
This will make Emacs attempt to break out of its current loop into the Lisp debugger.
Or use this one liner without typing 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 that comes up.
If C-g doesn't help, then the freeze probably happens in the C code, and you'll need to use an external debugger such as gdb. Hit C-h C-d to ...
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. That's rare, but we rule it out as a first step.
If you start Emacs from the command line with the -Q flag, i.e., emacs -Q, you'll get a bare or 'vanilla' emacs,...
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 probably shouldn't use Emacs). CEDET aims to be a complete solution that covers all your needs for supported languages, but I've personally never gotten it working ...
You can make C-g trigger the debugger by turning on debug-on-quit. Just do
Now every time you hit C-g you'll get a backtrace of what was going
on. This backtrace is interactive, so you can keep stepping through the function with d, and you can start moving out with c. (Give it a try, it's easier to see than to read).
This is the ...
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 to return valid completion data")
As the help text states:
If non-nil, debug if a message matching this regexp is displayed.
From this you should get a ...
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 never instrument them: from a file with `load',
and from the minibuffer with `eval-expression' (`M-:').
IOW, the easy way is to use C-M-x without prefix ...
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 directory tree for a Makefile, SConstruct, Git repo, SVN repo, and perhaps some other build system or version control files to automatically learn what files are ...
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-entry (of a function), debug-on-message (when seeing a specific regexp match of a message) and finally, debug itself as alternative to instrumenting a function ...
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 CFLAGS="-O0 -g3" to the ./configure script. This makes the C compiler turn off optimisations (which can make things confusing while debugging) and activates maximum ...
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 to see which paren matches your current one - this will help you with on-going code maintenance.
Use C-M-f/C-M-b to navigate by balanced parens; if you get an ...
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 (babel: small change in
API., 2015-10-29), but the old ob-sh.el is still trying to call it.
That means you should replace (sh . t) by (shell . t) in your call of ...
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 Emacs's point of view, an error was not raised. (Or at least not an error that is respected by --debug-init -- see user-error.)
Suggestions for debugging:
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-file.
On the other hand if you kill emacs using kill, it is NOT a graceful exit and there is no chance for emacs to save the files. So they will not be there ...
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 autoloads (among other things), and if there isn't an explicit call in your init file, it is called implicitly at the end of initialization.
I recommend putting a (...
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 could be 95% as good as Visual Studio, and it can do much more. but you might be not interested in the "more" part. So I will focus on your questions only.
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 really happens is that the error is triggered during jit-lock, i.e. during redisplay, and we can't easily enter the debugger at that moment (IIRC at some point Gerd ...
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 keyboard input, and has a very good chance of unhanging Emacs. (I've never seen it fail)
$ killall -USR2 emacs
Should do the trick. In addition USR2 creates a ...
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 edebug-initial-mode to go. This way, you will only get stopped in edebug if there is a breakpoint set. As of Emacs 25.1, you can do this quickly with edebug-set-...
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.
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.
(set-register ?E (cons 'file user-init-file))
PS: You can also use the backquote:
(set-register ?E `(file . ,user-init-file))
PPS: A side note: as far as I can tell this case is hard to debug by running ...
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 way is to use command find-function. You give it the function name and it takes you directly to its source code.
(I bind find-function-other-frame to C-x 5 F.)...
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 file. This email thread provides the necessary context.
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 file.
So if your theme relies on some package initialisation you can put your call in after-init-hook. For example
The reason you sometimes see “interactive compiled Lisp function” (or likewise for variables) with no file name is that the function was loaded from a byte-compiled file and the corresponding Elisp source file is not present. In order to show you the source code, Emacs has to be able to find the source code.
Many distributions ship Lisp source files in a ...
Replace func2 with #'func2:
(defun func2 (arg)
(if (listp arg)
(mapcar #'func2 arg)
Emacs Lisp is a lisp-2 (like Common Lisp), not lisp-1 (unlike, say, Scheme).
I.e., every symbol in ELisp has a
"value cell": accessed by symbol-value, tested by boundp, and used by the compiler when the symbol is in the "...
The procedure for reporting bugs, requesting features, and submitting pathces is outlined in the manual.
Or read online:
In a nutshell:
use report-emacs-bug for bug reporting and feature requests
ask the dev mailing list if you think your request requires more ...
To help you track it next time
This happened to me before. There was a situation where
string-to-int crashed Emacs, and it took me hours to pinpoint as
Sorry I can't provide a nicer answer, but Emacs crashes happen
deep down in the C code, and there aren't any built-in tools available
to track down such problems.
I suppose debugging it with gdb is ...