Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you stop a long (perhaps an infinite loop) internal emacs command?

Sometimes emacs enter in a loop, and I can't do anything but kill it.

I don't really know the exact key combination that I use to put it in that state.

Something with CTRL and %

like image 536
Diego Saravia Avatar asked Dec 09 '22 09:12

Diego Saravia


2 Answers

Is Ctrl-g what you are looking for?

https://www.gnu.org/software/emacs/manual/html_node/emacs/Quitting.html

like image 160
wap26 Avatar answered Mar 29 '23 23:03

wap26


I believe that C-g (keyboard-quit) is what you want. C-g is short for Ctrl-g. The keyboard-quit command tells Emacs to interrupt the current command (lisp code) that it is processing.

To get information about this command, enter the following in the minibar:

M-x describe-key C-g

-or-

C-h k C-g    

(M-x is generally mapped to Alt-x on Windows.)

C-g runs the command keyboard-quit
   which is an interactive compiled Lisp function in `simple'.
(keyboard-quit)

Signal a `quit' condition.
During execution of Lisp code, this character causes a quit directly.
At top-level, as an editor command, this simply beeps.
like image 30
DavidRR Avatar answered Mar 30 '23 00:03

DavidRR