Is there anyway to use a command in .emacs
that tells Emacs to ignore anything that comes after it?
I am trying to isolate the source of problem in my .emacs
file, and commenting in and out code is quite cumbersome.
Canceling an Action You can use 'C-g' to cancel any action you have started. For some actions, you may need to repeat this. (If even this doesn't clear things up entirely, then try ` C-] ' or 'M-x top-level' ; that should do the trick.)
2) Exiting Files in Emacs To close a particular buffer, hit the keys Ctrl + x, followed by k, and then enter the buffer name. To completely close and exit Emacs, hit the keys Ctrl + x, followed by Ctrl + c.
To exit emacs, use C-x C-c . It will ask you whether you want to save the changes. To prevent the question, precede the combination with C-u (but it will save the changes). If you want to kill Emacs without saving any changes, you can use the kill-emacs function ( M-x kill-emacs ).
To close emacs, type C-x, C-c, which is shorthand for typing the Control and x key, followed by the Control and c key.
Put an (error "Done")
in your .emacs
file at the point where you're bisecting it. You'll get the error that you signaled upon startup, but it will stop emacs from processing the rest of the .emacs
file.
@Tom's suggestion about comment-dwim
(and @Drew's comment about comment-region
) are good ones, but the (error "Done")
option has the advantage that you only need to move one line to various points in your .emacs
file without commenting/uncommenting other bits of it -- which could get tedious and error-prone.
Commenting and uncommenting is pretty easy if you use M-;
, aka comment-dwim
. Just mark the region and type it -- it will comment or uncomment as appropriate.
Alternatively, sure, you can use the trick of wrapping the remainder of the file by putting (quote
at the beginning and )
at the end. This will make the rest of the file appear as a constant, and it will just be discarded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With