[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to quit?
From: |
Drew Adams |
Subject: |
RE: How to quit? |
Date: |
Wed, 25 Feb 2015 15:21:56 -0800 (PST) |
> OK, so I have a problem, and it doesn't show up when I do emacs -Q. So
> I take a deep breath and bisect my 900-line init.el...
>
> In LaTeX, however, when I have some weird problem, I can put \endinput
> in a file, and everything past that is ignored. Is there anything like
> that in Elisp?
>
> It just occured to me that (debug) /might/ work, and so might
> (keyboard-quit). Is this a good idea? Are there any others?
Just put `(top-level)' in your init file where you want it to stop.
Command `top-level' returns to, well, Emacs top-level. ;-)
But really you will find, I think, that commenting-out blocks of the
file is the handiest. I bind `C-x C-;' to `comment-region', which
comments or (with `C-u') uncomments the region, and which nests and
unnests such commented blocks (unlike `comment-dwim').
Actually, I bind `C-x C-;' to this command, from `misc-cmds.el'
(http://www.emacswiki.org/emacs/download/misc-cmds.el).
(defun comment-region-lines (beg end &optional arg)
"Like `comment-region' (which see), but comment/uncomment whole lines."
(interactive "*r\nP")
(if (> beg end) (let (mid) (setq mid beg beg end end mid)))
(let ((bol (save-excursion (goto-char beg) (line-beginning-position)))
(eol (save-excursion (goto-char end)
(if (bolp) (point) (line-end-position)))))
(comment-region bol eol arg)))