all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Emanuel Berg <embe8573@student.uu.se>, help-gnu-emacs@gnu.org
Subject: RE: How to quit?
Date: Thu, 26 Feb 2015 19:33:52 -0800 (PST)	[thread overview]
Message-ID: <2e492143-7154-479b-90a7-0d4d05107b23@default> (raw)
In-Reply-To: <874mq89nur.fsf@debian.uxu>

> > 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').
> 
> I don't like the idea of commenting out code blocks.
> The code will be hard to read as code (as a comment!?)
> with no font lock (or worse: the same color as the
> "real" comments which are now drowned). It'll just be
> bulky and in the way.

I think you are perhaps missing the point of debugging
an init file this way (binary search).  You should not
be trying to read the code that is commented out.

Binary search is essentially blind, except for noticing
the result of each test to inform the next division.
You don't read any code.

(And that is why many of us have learned its value the
hard way, over and over.  We feel that we are too clever
for that.)

Commenting and uncommenting is just a way of making the
code invisible to evaluation.

If you want to also make it invisible to yourself for
some reason - e.g., if you are bothered by it being
"bulky and in the way", or if you are tempted to "read
[it] as code (as a comment!?)" - you can do that too
(see, e.g., library `hide-comnts.el',
http://www.emacswiki.org/emacs/download/hide-comnt.el).

As for confusion with "real" comments - no such problem.
That's the point of `comment-region', which nests and
unnests correctly.

This nesting behavior is similar to the behavior of
Common Lisp block-commenting (envelopes of `#|' + `|#').

> I have a better idea, and that is for the OP to split
> his init file into several files all dedicated a
> specific area of configuration and/or extention. The
> OP mentioned 900 lines of Elisp - myself, I use
> several files and very few are longer than 100 lines
> (those which are often has ambitious documentation
> inline which makes for a huge bulk of lines).

Meme combat, I'm afraid.  My init file is so split.
So what?  I still use a binary search on it - and then,
if necessary, on whichever library I discover is the
culprit.

No matter how finely you split your mass of code, or
conversely how much you clump it together in a giant
sack of spaghetti, a dumb, blind binary search can
often be your friend.  More often than you might think.

> Besides many other advantages, in this specific
> situation, one could load all the files from .emacs
> (with `load-file') and then just comment out a single
> line to not have a specific file loaded.

Which single line?  That's the point.

Are you going to try each one in turn?  Are you going
to try to guess, based on your intelligent division of
subject matter into sacks that are each "dedicated [to]
a specific area of configuration and/or extention"?

If so, then you are being clever.  For this kind of
search, you will (eventually) find that you are often
being too clever.  Dumb binary search will beat you to
the punch much of the time, I'm afraid.

If the answer were so obvious as to lead you to the
culprit library & line right off the bat then there would
be no question of how to proceed.  No one would bother to
ask how to debug their init file in such an obvious case.

But when things are not so obvious (and when things you
thought were obvious turn out not to be what you thought),
binary search can be your friend.

That's the point of using a binary search - in whatever
file, however big or small it might be.  *You don't know
which line is the culprit*, whether that line loads another
library or calculates the high tides at full moon at your
location.



  reply	other threads:[~2015-02-27  3:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 15:36 How to quit? Marcin Borkowski
2015-02-25 16:07 ` Doug Lewan
2015-02-25 16:24   ` Marcin Borkowski
2015-02-25 16:19 ` Thien-Thi Nguyen
     [not found] ` <mailman.810.1424880439.31049.help-gnu-emacs@gnu.org>
2015-02-25 17:11   ` Emanuel Berg
2015-02-25 17:57     ` J. David Boyd
2015-02-25 18:55       ` Marcin Borkowski
2015-02-25 18:54 ` Bob Proulx
2015-02-25 23:21 ` Drew Adams
2015-02-26  1:29 ` Robert Thorpe
     [not found] ` <mailman.849.1424906531.31049.help-gnu-emacs@gnu.org>
2015-02-27  0:53   ` Emanuel Berg
2015-02-27  3:33     ` Drew Adams [this message]
     [not found]     ` <mailman.909.1425008047.31049.help-gnu-emacs@gnu.org>
2015-02-27 19:09       ` Emanuel Berg
     [not found] <mailman.808.1424878616.31049.help-gnu-emacs@gnu.org>
2015-02-25 23:08 ` unfrostedpoptart
     [not found] <mailman.854.1424914176.31049.help-gnu-emacs@gnu.org>
2015-02-27  0:56 ` Emanuel Berg
2015-02-27  2:57   ` Robert Thorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e492143-7154-479b-90a7-0d4d05107b23@default \
    --to=drew.adams@oracle.com \
    --cc=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.