unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: bruce.connor.am@gmail.com,
	Jean-Christophe Helary <jean.christophe.helary@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: RE: char equivalence classes in search - why not symmetric?
Date: Thu, 3 Sep 2015 10:15:01 -0700 (PDT)	[thread overview]
Message-ID: <66ae6614-75bf-4b1b-9c16-5e7755a824f8@default> (raw)
In-Reply-To: <CAAdUY-+Xi1-rT_ntjNxUDD+sw2BdoT__nGDz-Oi0FdOwt9jCMw@mail.gmail.com>

> Yes, and you can count me among those objections. 
> When I first started with emacs, case folding by default was something
> I liked a lot, before I ever knew how to configure this stuff.
> I also only learned about lax whitespace when it became the default (IIRC).
> It was a feature that already existed and yet I had no idea because
> it wasn't default.

Emacs _should_ work on improving discoverability, IMO, but that
is a separate discussion.

IMO and FWIW, it is misguided to provide confusing, dwim behavior
by default.  Hard for a newbie to guess what the behavior really
is, because it is too complex, conditional, contextual, whatever.

The argument that we have this nifty feature and newbies won't
discover it on their own easily, so let's foist it upon them
from the outset, as the default behavior, is quite misguided.

What should be done is to have simple, obvious default behavior,
easy to fathom.  AND to have easy ways to discover alternate,
optional, fancy behavior that some of us might be convinced is
handier, more powerful, more elegant, or more clever.

Discoverability is not an argument for choosing any default
behavior.  Poor discoverability is an argument for improving
discoverability.  Nothing more.

That should be a no-brainer, IMO, but we hear this over and over
again.  Developers like to show off the clever things they come
up with.  That's human and normal.  Add such things, sure, but
don't make them the default behavior.  Especially when they are
brand new.

That a somewhat dwimish default was chosen for case folding 40
years ago, back when I was programming FORTRAN and most editing 
and programming involved case-insensitive contexts, should not be
an argument for using it today - and certainly not for doubling
down on it for new developments (e.g. char folding).

It should instead be a reason to revisit whether we, in 2015,
should continue to have search be case-insensitive by default.

There is only one reasonable argument I can see in favor of
keeping case insensitivity the default, and it does not at all
apply to the other kinds of folding we are talking about now
(char folding, whitespace folding).  This is why I said:

 But I won't bother making that argument for case folding.
 I am not arguing for a change now in the longstanding
 case-fold behavior.  I am arguing that we get this right
 for char folding.

What is that somewhat reasonable argument for turning on case
insensitivity by default?  Habit.  I see no other good argument
for it "nowadays".  Forty years ago, yes; today, no.  Today,
most contexts involve both uppercase and lowercase letters,
and they are distinguished semantically (case-sensitive).

It's perhaps a bit odd that some of those who are so quick to
argue for "modernizing" Emacs might also argue to keep their
case insensitivity by default.  Old-fartness is relative?

The rule about least surprise for newbies I expressed above
applies even more to the dwim rule that an uppercase letter
in the search string magically flips search to case sensitivity.

Handy as you might find that dwim, it is hardly immediately
clear to a newbie what is going on.  Other editors that are
case-insensitive by default do not throw such a gotcha at new
users.  (Emacs is not your average editor, and it is great
that Emacs does fancier things than most do, but we're talking
about default behavior here.)

I mention this to try to put a stop to the application of an
old rationale for case folding to char folding etc., not to
argue that we should (now) consider changing the default
behavior for case folding.

To be clear, and to try to forestall the usual whining from some:
I don't care much what the _default_ behavior is for char folding.
That's not what this thread is about.

I, like Jean-Christophe apparently, think that it helps newbies
more to have Isearch, by default, search for just what you type
(imagine!).  But I don't feel strongly about that.

What is more important is to be able to (a) customize the default
behavior and (b) toggle it anytime during Isearch.

Also important, to me, is to be able, as I proposed and as Juri
apparently seconded, to have `á' match any of the `a' variants,
just like `a' can do.  That is, be able to toggle whether `á'
(or `a') matches only itself or all `a' variants - e.g., as Juri
proposed, using `M-''.

And that, BTW, is the topic of this thread (see Subject line).

What goes for `a' should also go for `á': either of them should
be able to match, au choix, either itself alone or any of its
char-folding variants (and yes, they _are_ equivalences).

I also support Juri's mention of doing the same for whitespace
folding: letting `M-s SPC' toggle whitespace dwimming (option
`search-whitespace-regexp').  But we can also separate out that
discussion from the current topic, which is about char folding.

The general argument about the default behavior is that what a
user puts in the search string is what should be looked for.
If s?he inserts a SPC char then only a SPC char should be sought.
If s?he inserts two consecutive SPC chars then only a two
consecutive SPC chars should be sought.  You want cleverer,
handier behavior?  Customize the option.

Attempts to finesse the confusion and the possible useful dwim
behaviors tend to end with even more complex dwim behavior: rules
upon rules.  See recent discussions about whitespace, where we
hear things like SPC should (by default) match any amount of any
whitespace, but SPC SPC should match only SPC SPC.  Unless the
moon is full or it is Tuesday before noon...  Epicycles upon
epicycles.

Far better to keep the default behavior simple and immediately
understandable - no need to look up the doc and study a dwim
flowchart.  On top of that we can add any fancy alternative
behaviors we think are handier or more clever.

But let's not impose those on newbies as default behavior,
no matter how helpful and ingenious we are convinced they
might be.  And certainly not with the excuse that it makes
the fancy feature more discoverable.

[The last (so far) of the folding things is what `M-s i' does:
it toggles search behavior for invisible text.  I'm OK with the
default value in this case, but it too could be open for
discussion in the general context of folding.  That too is best
left for a separate discussion.]



  reply	other threads:[~2015-09-03 17:15 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 15:46 char equivalence classes in search - why not symmetric? Drew Adams
2015-09-01 15:52 ` Davis Herring
2015-09-01 16:51   ` Stefan Monnier
2015-09-01 17:51   ` Drew Adams
2015-09-01 18:40     ` Davis Herring
2015-09-01 19:09       ` Drew Adams
2015-09-01 22:45       ` Juri Linkov
2015-09-02  0:33         ` Drew Adams
2015-09-01 20:10     ` Stephen J. Turnbull
2015-09-01 16:16 ` Eli Zaretskii
     [not found]   ` <<38061f42-eaf1-47c6-b74d-f676ac952b18@default>
     [not found]     ` <<83r3miatvl.fsf@gnu.org>
     [not found]       ` <<21998.29683.916211.867479@a1i15.kph.uni-mainz.de>
     [not found]         ` <<9A972800-D8F0-4DA8-877E-07D5BDC2E1F9@gmail.com>
2015-09-01 17:50   ` Drew Adams
2015-09-01 18:15     ` Eli Zaretskii
2015-09-01 18:46       ` Drew Adams
2015-09-01 19:19         ` Eli Zaretskii
2015-09-01 20:15           ` Drew Adams
2015-09-08  5:36       ` Ulrich Mueller
2015-09-08  6:04         ` Jean-Christophe Helary
2015-09-08 13:31           ` Stephen J. Turnbull
2015-09-08 14:24             ` Drew Adams
2015-09-08 15:21               ` Stephen J. Turnbull
2015-09-08 16:58                 ` Drew Adams
2015-09-08 17:38                   ` Stephen J. Turnbull
2015-09-09 22:52                     ` Drew Adams
2015-09-10  3:12                       ` Drew Adams
2015-09-10 21:46                         ` Drew Adams
2015-09-08 20:15               ` Richard Stallman
2015-09-08 20:15               ` Richard Stallman
2015-09-08 21:25                 ` Drew Adams
2015-09-09 15:07                   ` Richard Stallman
2015-09-09 15:21                     ` Drew Adams
2015-09-10  2:03                       ` Richard Stallman
2015-09-10  3:23                         ` Drew Adams
2015-09-11 10:28                           ` Richard Stallman
2015-09-11 13:28                             ` Stefan Monnier
2015-09-11 16:33                               ` Drew Adams
2015-09-11 20:59                                 ` Juri Linkov
2015-09-11 23:11                                   ` Drew Adams
2015-09-12 15:28                               ` Richard Stallman
2015-09-11 16:31                             ` Drew Adams
2015-09-11 10:28                           ` Richard Stallman
2015-09-11 16:31                             ` Drew Adams
2015-09-12 15:29                               ` Richard Stallman
     [not found]             ` <<8cf269bc-69d8-4752-8506-de8d992512e1@default>
     [not found]               ` <<E1ZZPIS-0005rf-DJ@fencepost.gnu.org>
2015-09-08 21:46                 ` Drew Adams
     [not found]               ` <<E1ZZPIT-0005s6-ST@fencepost.gnu.org>
     [not found]                 ` <<da54a6cb-90eb-481d-aa20-acfad612e709@default>
     [not found]                   ` <<E1ZZgxz-0006X2-Bg@fencepost.gnu.org>
     [not found]                     ` <<cb107072-7f90-41fb-9aff-075d50eb65bb@default>
     [not found]                       ` <<E1ZZrCm-0001x4-9a@fencepost.gnu.org>
     [not found]                         ` <<4f3b1db3-d3d2-480f-8662-fbf7c74aa67f@default>
     [not found]                           ` <<E1ZaLZR-0002Bf-8q@fencepost.gnu.org>
     [not found]                             ` <<e77f8e7b-581f-436d-816a-c8daed734ff5@default>
     [not found]                               ` <<E1ZamkM-0005d4-RN@fencepost.gnu.org>
2015-09-12 15:59                                 ` Drew Adams
2015-09-08 13:39           ` Drew Adams
2015-09-08 21:19             ` Juri Linkov
2015-09-09 15:07               ` Richard Stallman
2015-09-08 15:47         ` Eli Zaretskii
2015-09-08 16:57           ` Drew Adams
2015-09-08 21:20           ` Juri Linkov
2015-09-09  2:42             ` Eli Zaretskii
2015-09-09 11:23               ` Artur Malabarba
2015-09-09 13:32                 ` Drew Adams
2015-09-09 15:12                 ` Richard Stallman
2015-09-11 20:50                   ` Juri Linkov
     [not found]               ` <<CAAdUY-JMQVsRFku8nwX8JcA9k6Y9sHWoVL6ZC60RHnjoj0cd+Q@mail.gmail.com>
     [not found]                 ` <<E1ZZh2a-0003u6-Fj@fencepost.gnu.org>
2015-09-09 15:22                   ` Drew Adams
2015-09-10  2:03                     ` Richard Stallman
2015-09-10  3:15                       ` Drew Adams
2015-09-10  6:57                         ` David Kastrup
2015-09-10 15:02                           ` Drew Adams
2015-09-10 15:50                         ` Richard Stallman
2015-09-08 20:09         ` Richard Stallman
2015-09-08 21:00           ` Drew Adams
2015-09-09 15:06             ` Richard Stallman
2015-09-08 21:47           ` Ulrich Mueller
2015-09-02 15:34   ` Richard Stallman
2015-09-02 15:56     ` Drew Adams
2015-09-02 16:05     ` Eli Zaretskii
2015-09-02 21:51       ` Jean-Christophe Helary
2015-09-02 22:15         ` Drew Adams
2015-09-03 15:37           ` Richard Stallman
2015-09-03  2:41         ` Eli Zaretskii
2015-09-03  3:08           ` Jean-Christophe Helary
2015-09-03  7:28             ` Artur Malabarba
2015-09-03 17:15               ` Drew Adams [this message]
2015-09-07 13:52                 ` Nix
2015-09-07 17:07                   ` Drew Adams
2015-09-07 23:23                     ` Nix
2015-09-08  2:17                   ` Richard Stallman
2015-09-03 14:33             ` Eli Zaretskii
2015-09-03 15:00         ` Stefan Monnier
2015-09-03 16:15           ` Drew Adams
2015-09-03 16:23             ` Eli Zaretskii
2015-09-03 16:46               ` Drew Adams
2015-09-02 16:10     ` Artur Malabarba
2015-09-03 19:49     ` Pip Cet
     [not found] <<2a7b9134-af2a-462d-af6c-d02bad60bbe8@default>

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=66ae6614-75bf-4b1b-9c16-5e7755a824f8@default \
    --to=drew.adams@oracle.com \
    --cc=bruce.connor.am@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jean.christophe.helary@gmail.com \
    /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).