unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Chong Yidong'" <cyd@stupidchicken.com>,
	<5122@emacsbugs.donarmstrong.com>,
	"'Eli Zaretskii'" <eliz@gnu.org>
Cc: deniz.a.m.dogan@gmail.com
Subject: bug#5122: Mismatched parentheses when dealing with hugebuffercontent
Date: Sat, 5 Dec 2009 18:08:08 -0800	[thread overview]
Message-ID: <7CFBD14168FC4B1389C926E26A54B9E1@us.oracle.com> (raw)
In-Reply-To: <87d42trs02.fsf@stupidchicken.com>

> >> Error messages shouldn't be so verbose---they can't spell 
> >> out every bell and whistle related to the error.
> >
> > I'd say adding a couple of words is hardly verbose, and certainly
> > isn't spelling out every detail.
> >
> >> I prefer leaving things the way they are.
> >
> > And leave users without a clue? how's that preferable?

Eli is right.

It is plain poor judgment to leave things the way they are in this case.
 
> The circumstances in which the parenthesis are mismatched probably
> vastly outweigh the circumstances in which the user wants to change
> blink-matching-paren-distance.

That's one point, sure. But the opposing consideration is how much damage occurs
when the problem, rare though it might be, does arise.

When a false mismatch occurs, the user has no clue - truly no clue - as to what
is going on. (This is in fact truer the rarer the event is!)

I know this because it happened to me. That's why I was able to respond to
Deniz's bug report so quickly. I just went through the same thing a month or so
back.

(And yes, I had already known this years ago, but had forgotten - perhaps
because of the rarity. I was looking at code from someone else (BBDB), which
uses much larger function definitions than I do.)

I spent quite a bit of time trying, in vain, to figure out what the problem was
with the code (e.g. an unescaped left paren in col 1 of a doc string, escape
sequences in regexp strings,...).

And that's the point, the opposing consideration: the difficulty and
improbability of finding the explanation/solution. One's reflex is not to
suppose that this is normal behavior governed by some user option. Believe me.
The tendency is to try to find out what is causing the mismatch. No one
spontaneously doubts that there is a mismatch.

This is very different from some other limits we have in Emacs. When a buffer is
bigger than the default font-locking buffer size, you can tell: there simply is
no font-locking. So if you're ignorant of the cause/remedy in that case, you
naturally search for something having to do with font-locking - you can tell
that there is a font-locking problem. You search a bit, and you eventually find
`font-lock-fontify-buffer' and solve the problem.

But here the natural inclination is to assume, since there is mismatch
highlighting, that there is, well, a mismatch. Duh.

I said the user has no clue as to what's going on in this situation. But it's
actually worse than that. We lead the user down the garden path. We say, in
effect, "Look over there! (without saying where)".

Gotcha! Look all you want over there, but there is nothing to find. The problem
is right here. It lies with the messenger who's telling you to look over there.

The paren-mismatch-highlighting code itself _knows_ when it has reached its
limit (or it should know), so it _knows_ when its highlighting no longer makes
any sense and can only mislead. It is up to that code to DTRT and - at a minimum
- do nothing in this context; do no harm. Better would be for it to signal
explicitly that it has gone beyond its limit.

> So, it is arguably more confusing to the average user if the error
> message mumbles something about blink-matching-paren-distance.  For
> those who care, it's an apropos search away.

You seem to have an interesting understanding of what is confusing to users,
average or otherwise.

And I couldn't disagree more about the ease of finding the problem, "for those
who care". To find it, you need to be looking for it. You need to have some idea
of what is going on, some idea that the paren highlighting is not functioning
normally and its helpful indicator should not be trusted. You need some hint
that you should look for an option concerning parens.

When you see mismatch highlighting, you do not assume that something is wrong
with the highlighting (or that some limit has been surpassed for its normal
functioning). You assume instead that there is in fact a mismatch somewhere.
_You trust what Emacs tells you._

Imagine if compiler error messages showed up spuriously, incorrectly, whenever
some esoteric threshold was surpassed - a setting that you didn't even know
about. Would you even think to look for such a setting? Or would you instead,
naturally, believe the compiler error message and dive into a close examination
of your code to try to understand its problem. Yes, you would look over there...

Emacs is misleading users in this situation. It is staring up at the top of a
building, causing others to look up also, even though there is nothing to see
there.

If you are really worried about the intrusiveness of an explanation in the echo
message or in a tooltip (remember, the mouse would need to be over the
"mismatched" paren for the tooltip message to appear, and the message would only
need to be displayed when the threshold is in fact surpassed), then consider
simply _not highlighting_ at all whenever the search distance has been exceeded.

Turning off highlighting in this case would at least clue the user to look for
something having to do with paren highlighting. What is bad design ("confusing
to the average user") is blindly signaling an error (mismatch) when the
measuring tool knows (or should know) that it is currently incapable of
measuring at all!

[Also, this option/feature should not necessarily be called "blink" anything, or
at least an alias should be provided, so that it would be easier to find for
those who use `show-paren-mode'. If one uses paren highlighting, then this is
more obviously about paren highlighting than paren blinking.]







  reply	other threads:[~2009-12-06  2:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05 20:57 bug#5122: Mismatched parentheses when dealing with huge buffercontent Chong Yidong
2009-12-05 21:42 ` Stefan Monnier
2009-12-05 22:06   ` Chong Yidong
2009-12-05 21:47 ` Eli Zaretskii
2009-12-05 22:11   ` Chong Yidong
2009-12-06  2:08     ` Drew Adams [this message]
2009-12-06 15:15       ` bug#5122: Mismatched parentheses when dealing with hugebuffercontent Drew Adams
2009-12-06 19:13       ` Chong Yidong
2009-12-06 20:57         ` Drew Adams
2009-12-06  4:03     ` bug#5122: Mismatched parentheses when dealing with huge buffercontent Eli Zaretskii
2009-12-06 15:30       ` Chong Yidong
2009-12-06 17:05         ` bug#5122: Mismatched parentheses when dealing with hugebuffercontent Drew Adams
2009-12-06 17:52         ` bug#5122: Mismatched parentheses when dealing with huge buffercontent Eli Zaretskii
2009-12-06 18:59           ` Chong Yidong
2009-12-06 19:23             ` bug#5122: Mismatched parentheses when dealing with hugebuffercontent Drew Adams
2009-12-07  2:25   ` bug#5122: Mismatched parentheses when dealing with huge buffercontent Stefan Monnier
2011-07-13 14:59     ` Lars Magne Ingebrigtsen
2011-07-13 16:35       ` Drew Adams
2011-07-13 17:26       ` Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=7CFBD14168FC4B1389C926E26A54B9E1@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=5122@emacsbugs.donarmstrong.com \
    --cc=cyd@stupidchicken.com \
    --cc=deniz.a.m.dogan@gmail.com \
    --cc=eliz@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).