From: Drew Adams <drew.adams@oracle.com>
To: Emanuel Berg <moasen@zoho.com>, help-gnu-emacs@gnu.org
Subject: RE: on adding a function call to a s-exp
Date: Wed, 13 Jun 2018 11:23:58 -0700 (PDT) [thread overview]
Message-ID: <b44c0048-e7e6-4f9c-82f7-608d4f22adee@default> (raw)
In-Reply-To: <86a7rytyxs.fsf@zoho.com>
> > DWIM guessing
>
> DWIM is far from the computer "guessing" what the user wants!
Yes, that should be obvious. It's a loose use of the
term "guess". (It's more that users can have to guess
what's going on.)
> Because the different actions are very
> predictable based on the current state (which
> is known, all clear and visible, and often part
> of the workflow just one second ago), the Emacs
> user is very aware of what is going on, and the
> computer response is equally predictable!
Predictable in the code does not imply visible to
users and understood by them.
It doesn't follow that just because (1) the code of a
command is deterministic and can be well understood,
(2) a user understands it or knows what to expect.
The real problem comes when Emacs (e.g. by default)
substitutes a complex DWIM command for a clear command
with a simple behavior, e.g., by changing the default
key binding or by just redefining the command.
But just think about the name "DWIM". It supposes
(claims) that the predictable behavior of the code
is just what you, a user, really want to happen in
your current context. Really? In that case, all
DWIM commands can be equally applied in any context,
and they all do what you want. ;-)
What it really comes down to, I think, is that some
programmer wrote a command that s?he thinks is handy
in some context, and s?he wants to get the point
across to users that it does different things, depending,
and that users will be happy with what it does, without
knowing just what or why.
The code assumes that if this, this, and that condition
hold then what the user wants is this behavior. Yes, in
effect it's guessing what the user wants in that context.
The programmer guessed. The user might be guessing too
(What's going on?). But the code is deterministic.
----
To be clear, I do define and use some commands that
one might call "DWIM".
But the possible alternative behaviors typically depend
on an explicit user choice, e.g., by using different
kinds of prefix arg. Multiple behaviors are still
available on a single key, but they're picked by
explicit user action, not by context.
A _command_ picking a behavior based only on context
requires a user to understand what the context is, as
defined by that command. Sometimes that's fine.
Sometimes it's not clear at all.
A _user_ picking a behavior pretty much guarantees that
s?he agrees with that choice (modulo misunderstanding).
Sure, in both cases a user might need to consult the
doc string of the command. But in the case of explicit
user action the user at least (usually) knows what s?he
did and can figure out what the resulting behavior is
all about.
As an example of a quite complex command that I defined
and use, consider `secondary-yank|select|move|swap'.
Yes, someone else might have called it `secondary-dwim'
(and that's what I called it at first). I prefer the name
I use now. Anyway, you use it via a key (I use `C-M-y').
What does it do? `C-h f' tells you:
__________________
secondary-yank|select|move|swap is an interactive compiled Lisp
function in ‘second-sel.el’.
It is bound to C-M-y, menu-bar edit secondary-yank|select|move|swap.
(secondary-yank|select|move|swap ARG)
Yank the secondary selection. With a prefix arg, interact with region.
Prefix arg:
None: Yank secondary.
Zero: Select secondary as region.
> 0: Move secondary to region.
< 0: Swap region and secondary.
Details:
No prefix arg: Yank the secondary selection at point. Move point to
the end of the inserted text. Leave mark where it was.
Zero arg: Select the secondary selection and pop to its buffer.
Non-zero arg: Move the secondary selection to this buffer’s region.
Negative arg: Also go to where the secondary selection was and select
it as the region. That is, swap the region and the secondary
selection.
__________________
So the default behavior is just to yank the secondary
selection. In any context. Doesn't matter whether the
moon is full or the coast is clear. Same with each of
the alternative behaviors (which are used much less).
And each of those possible actions is also realized by a
separate command, so you are not _obliged_ to bind and
use only the complex command.
And the doc tells you what it does, and its name suggests
the combination that it is.
The name `secondary-dwim' tells you nothing, except that
there's some mystery to check out.
And not all DWIM commands have doc that accurately and
clearly describes context-dependent behavior. Too often
they count on the behavior being "what someone would want",
and related to that assumption is the assumption that no
one needs to be told what they do. Just try it - it'll do
what you want/expect. No, not always; not so much.
next prev parent reply other threads:[~2018-06-13 18:23 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-09 22:05 on adding a function call to a s-exp Robert Girault
2018-06-10 2:38 ` Noam Postavsky
2018-06-10 4:46 ` João Távora
[not found] ` <mailman.1619.1528606007.1292.help-gnu-emacs@gnu.org>
2018-06-11 1:04 ` Robert Girault
2018-06-11 1:30 ` Noam Postavsky
2018-06-12 14:40 ` João Távora
2018-06-12 21:34 ` Noam Postavsky
[not found] ` <mailman.1644.1528680649.1292.help-gnu-emacs@gnu.org>
2018-06-11 14:29 ` Robert Girault
2018-06-12 14:24 ` João Távora
[not found] ` <mailman.1739.1528813488.1292.help-gnu-emacs@gnu.org>
2018-06-13 21:06 ` Robert Girault
2018-06-10 21:28 ` Xavier Maillard
[not found] ` <mailman.1614.1528598292.1292.help-gnu-emacs@gnu.org>
2018-06-11 0:59 ` Robert Girault
2018-06-11 1:21 ` Michael Heerdegen
2018-06-11 1:26 ` Michael Heerdegen
2018-06-11 2:18 ` Michael Heerdegen
[not found] ` <mailman.1642.1528680086.1292.help-gnu-emacs@gnu.org>
2018-06-11 14:35 ` Robert Girault
2018-06-12 14:34 ` João Távora
2018-06-12 15:14 ` Óscar Fuentes
2018-06-12 16:17 ` Drew Adams
2018-06-12 16:26 ` João Távora
2018-06-13 7:11 ` Andreas Röhler
2018-06-13 10:44 ` João Távora
2018-06-13 14:39 ` Drew Adams
2018-06-13 15:31 ` João Távora
2018-06-13 16:03 ` Drew Adams
2018-06-13 16:01 ` Andreas Röhler
2018-06-13 16:17 ` João Távora
[not found] ` <mailman.1823.1528906669.1292.help-gnu-emacs@gnu.org>
2018-06-13 16:48 ` Emanuel Berg
2018-06-13 17:32 ` João Távora
2018-06-13 18:23 ` Drew Adams [this message]
[not found] ` <mailman.1848.1528914250.1292.help-gnu-emacs@gnu.org>
2018-06-13 19:18 ` Emanuel Berg
2018-06-12 16:24 ` João Távora
2018-06-12 17:00 ` Eric Abrahamsen
2018-06-12 17:04 ` Óscar Fuentes
2018-06-12 17:07 ` Eric Abrahamsen
2018-06-12 17:19 ` João Távora
2018-06-12 17:26 ` Eric Abrahamsen
2018-06-12 17:16 ` João Távora
[not found] ` <mailman.1747.1528820272.1292.help-gnu-emacs@gnu.org>
2018-06-13 21:09 ` Robert Girault
[not found] ` <mailman.1740.1528814086.1292.help-gnu-emacs@gnu.org>
2018-06-13 21:02 ` Robert Girault
2018-06-13 21:32 ` João Távora
[not found] ` <mailman.1637.1528666199.1292.help-gnu-emacs@gnu.org>
2018-06-11 1:05 ` Robert Girault
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=b44c0048-e7e6-4f9c-82f7-608d4f22adee@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=moasen@zoho.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.
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).