all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Thomas Lord <lord@emf.net>
Cc: Chong Yidong <cyd@stupidchicken.com>,
	Dan Nicolaescu <dann@ics.uci.edu>,
	emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
	"Kim F. Storm" <storm@cua.dk>
Subject: Re: Shift selection using interactive spec
Date: Sun, 16 Mar 2008 23:31:54 +0000	[thread overview]
Message-ID: <20080316233154.GD1544@muc.de> (raw)
In-Reply-To: <47DC38AD.5010400@emf.net>

Hi, Thomas!

On Sat, Mar 15, 2008 at 01:59:25PM -0700, Thomas Lord wrote:

[ .... ]

> The region between tenative-mark and point is called the
> tentative-region.

> save-excursion should save and restore the value of tentative-mark,
> setting it to nil when running its body.

Maybe.

> Low level functions (in C) that insert text into a buffer should
> unconditionally delete the tentative region first, if there is one, and
> set tentative-mark to nil.

No, I disagree.  Philosophically, this is a mixup of levels.  A low-level
function which is inserting text should NOT be messing around with
tentative regions.  This will surely cause pain, in some as yet unclear
way.  Surely higher level defuns should be built which call the C
primitives, allowing these primitives to remain primitive.

Also, can't we make Emacs a bit better?  A tentative region should be
_killed_, not deleted - i.e., there should be an easy way of recovering
it when it's accidentally de-regioned.

> Conceptually, this is a generalization of the notion of a "point".  A
> point is an index naming a theoretical "space between" two adjacent
> characters in a buffer, or the space at the beginning or end of buffer.
> A "tentative region" is like having a pseudo-point which indicates a
> conceptual "space between" in a hypothetical buffer that results from
> deleting the contents of the tentative region.

> That is the essential functionality that delete-selection-mode is
> aiming for but, by adding the concept of a tentative-mark, that
> essential functionality is simplified enough that it can reasonably be
> built-in as unconditional behavior of a few insertion commands.

That unconditionality would make the concept of a "tentative region" less
flexible and less useful, wouldn't it?  The user should be able to
customize when his tentative regions are killed by insertion commands;
for example, by major mode.

> There should be a a second and third variable:
> maybe-preserved-tentative-mark and preserved-tentative-mark.  These
> are, again, either nil or a mark.   These are used to control which
> commands preserve the tentative mark vs. which set it back to nil (the
> default behavior):

You've completely lost me, here.  I can't see how the first two sentences
connect with the last one.

I'm also getting lost in the sheer complexity of the proposal, and feel
that three "tentative-mark" variables is a bad idea - there will be too
much confusion between them.

> When a command returns to a command loop, the value of
> preserved-tentative-mark should be copied to tentative-mark,
> unconditionally.  Both maybe-preserved-... and preserved-... should be
> set to nil.    So, by default, commands implicitly "clear" the
> tentative mark.

Presumbaly, there would be customization commands to tailor this default.
For example, C-l is the sort of thing you'd want to do _without_ losing a
tentative region.

> Before a command loop invokes a command, it should first copy
> tenative-mark to maybe-preserved-...  That way, if a command wants to
> preserve the tentative mark if it is already present (the default
> interpretation of "shifted keysequences") then it can simply copy
> maybe-preserved-...  to preserved-tentative-mark.  When the command
> returns, that saved mark will be copied back to tentative-mark.

This sounds like the tail waggging the dog.  If a command wants to
preserve a tentative mark, it merely needs to do nothing.  Why should the
command loop be complicated for this purpose?

I really don't think we should be messing with the command loop for this
facility; that's a horrible kludge.  The mechanics of executing one
command after another should be kept separate from what these commands
do; conceptually, the "tentative region" mechanism has no connection with
the command loop, any more than scrolling, fontification or indentation
has.

[ .... ]

> So:

> three new variables
> one new display feature (clone of an existing feature)
> a couple unconditional variable copies in the command loop
> a few new functions
> unconditionally delete the transient region in some C code
> modify some core functions like yank and replace-string
> fix obscure commands that work similarly to yank or replace-string on-demand
> lots and lots of code that doesn't have to be modified at all
> a very simple "state machine" model of the behavior
> a behavior that highly agrees with "all those other GUIs"

and how about a name for this new editor?  ;-)

> For extra special featurefulness, you could build on that
> by adding a "transient region ring" -- a circular buffer that
> remembers the last N transient regions whenever some
> command nillifies the transient region at the top level.
> A "remembered" transient region is a pair of marks:
> the transient-mark and a marker at what was then the
> point.

Something like this is utterly required.

> N should probably be small but the idea is that recent
> transient regions are cached so that if the region is
> accidentally cleared by some command then a user
> can likely restore it, easily.

YES!!!

> So, in terms of "pronouns" again -- "addressing modes" for users -- the
> mark stack gives you a set of pronouns for recursing while the
> transient region ring gives you augmented short-term memory about "fat
> cursors".

> I'm really surprised, as I've been led to think about these features by
> the recent discussion, just exactly how complementary "GUI-style
> shift-select" and Emacs' user model and command interaction loop turn
> out to be.   They fit together like hand and glove, if only Emacs will
> actually implement it that way.

Hmm...  Do they really?  One good reason I've stayed with Emacs is that
it doesn't impose this (to me) ghastlily inefficient and nerve-wrackingly
fragile shift-select mechanism on me.  Please make sure that ALL the
features you're talking about are optional, even if they do become the
default.

> I'm one of those users who is both an Emacs power user *and* make
> pretty heavy use of GUI-style apps.   I constantly have the low-level
> frustration of how selection, cut, paste, etc. work differently between
> these environments:  often typing or mousing into some app as if it
> were Emacs or into Emacs as if it were some other app.   So, I feel
> pretty viscerally the pain that work on shift selection is trying to
> address.  

> I'm pretty convinced the little state machine model I've been
> developing here is a really good model for the desired functionality.
> So, I'm skeptical that all the hair of trying to use
> transient-mark-mode for this stuff is a good idea.

I rather think that these things are more flavour of the decade rather
than permanent; in ten or twenty years time, shift-select may well have
gone the way of autoexec.bat.  So lets not embed it too firmly inside
Emacs, below the level of individual commands.

> -t

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2008-03-16 23:31 UTC|newest]

Thread overview: 167+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 23:29 Shift selection using interactive spec Chong Yidong
2008-03-14  0:44 ` Thomas Lord
2008-03-14  0:10   ` David Kastrup
2008-03-14  1:22     ` Thomas Lord
2008-03-14  9:46       ` David Kastrup
2008-03-14 10:01         ` Johan Bockgård
2008-03-14 10:30           ` David Kastrup
2008-03-14 11:18           ` Thomas Lord
2008-03-14 11:11         ` Thomas Lord
2008-03-14 10:42           ` David Kastrup
2008-03-14 11:36             ` Thomas Lord
2008-03-14 11:50             ` Thomas Lord
2008-03-14 11:39               ` David Kastrup
2008-03-14 18:41                 ` Thomas Lord
2008-03-14  4:06 ` Dan Nicolaescu
2008-03-14 14:26   ` Kim F. Storm
2008-03-14 14:32     ` Chong Yidong
2008-03-14 14:53       ` Kim F. Storm
2008-03-14 16:19         ` David Kastrup
2008-03-14 15:54       ` Stefan Monnier
2008-03-14 16:09         ` Drew Adams
2008-03-14 20:52         ` Chong Yidong
2008-03-14 20:59           ` David Kastrup
2008-03-14 21:08             ` Chong Yidong
2008-03-15  0:56           ` Stefan Monnier
2008-03-15  2:02             ` Chong Yidong
2008-03-15  3:31               ` Stefan Monnier
2008-03-15 14:07                 ` Chong Yidong
2008-03-15 15:07                   ` Stefan Monnier
2008-03-15 17:11                     ` Chong Yidong
2008-03-15 20:52                       ` Stefan Monnier
2008-03-15 21:45                         ` Thomas Lord
2008-03-16 14:15                           ` Chong Yidong
2008-03-16 14:37                             ` Lennart Borgman (gmail)
2008-03-15 22:01                         ` shift-select harmony Thomas Lord
2008-03-15 23:38                           ` Thomas Lord
2008-03-15 17:16                   ` Shift selection using interactive spec Kim F. Storm
2008-03-15 20:59                     ` Thomas Lord
2008-03-16 23:31                       ` Alan Mackenzie [this message]
2008-03-15 21:08                     ` Thomas Lord
2008-03-16  0:27                       ` Chong Yidong
2008-03-16  1:37                         ` Thomas Lord
2008-03-16  9:09                           ` Mathias Dahl
2008-03-16 14:21                             ` Chong Yidong
2008-03-16 16:56                               ` Thomas Lord
2008-03-16 16:34                             ` Dear lazyweb (Re: Shift selection using interactive spec) Thomas Lord
2008-03-16 18:40                           ` Shift selection using interactive spec Stefan Monnier
2008-03-16 21:00                             ` Thomas Lord
2008-03-16 20:45                               ` Thien-Thi Nguyen
2008-03-16 21:46                                 ` Thomas Lord
2008-03-16 21:24                                   ` Thien-Thi Nguyen
2008-03-16 22:27                                     ` Thomas Lord
2008-03-16 23:04                               ` Lennart Borgman (gmail)
2008-03-16 23:17                                 ` Lennart Borgman (gmail)
2008-03-17  0:46                                 ` Thomas Lord
2008-03-17  0:21                                   ` Lennart Borgman (gmail)
2008-03-17  1:16                                     ` Thomas Lord
2008-03-16 23:35                               ` Stephen J. Turnbull
2008-03-17  0:55                                 ` Thomas Lord
2008-03-17  2:23                                   ` Stefan Monnier
2008-03-17  3:12                                     ` Thomas Lord
2008-03-17  2:21                               ` Stefan Monnier
2008-03-17  3:47                                 ` what's the point (re shift selection) Thomas Lord
2008-03-16 14:40                     ` Shift selection using interactive spec Chong Yidong
2008-03-16 15:04                       ` Lennart Borgman (gmail)
2008-03-16 17:13                         ` Thomas Lord
2008-03-17  0:54                       ` Chong Yidong
2008-03-17  2:40                         ` Stefan Monnier
2008-03-17  3:24                           ` Chong Yidong
2008-03-17 13:26                             ` Stefan Monnier
2008-03-17 16:33                               ` Chong Yidong
2008-03-17 17:21                                 ` Lennart Borgman (gmail)
2008-03-17 19:11                                 ` Stefan Monnier
2008-03-17 21:10                                   ` Chong Yidong
2008-03-17 21:44                                     ` Drew Adams
2008-03-18 11:40                                     ` Kim F. Storm
2008-03-18 14:16                                       ` Chong Yidong
2008-03-18 15:07                                         ` Kim F. Storm
2008-03-18 16:24                                       ` Stefan Monnier
2008-03-18 17:54                                         ` Drew Adams
2008-03-20  5:03                                   ` Chong Yidong
2008-03-23  1:39                                     ` Stefan Monnier
2008-03-17 22:24                                 ` martin rudalics
2008-03-17 22:37                                   ` Lennart Borgman (gmail)
2008-03-18  0:50                                     ` Thomas Lord
2008-03-18  7:48                                       ` martin rudalics
2008-03-18 17:46                                         ` Thomas Lord
2008-03-18 17:36                                           ` Lennart Borgman (gmail)
2008-03-18 19:07                                             ` Thomas Lord
2008-03-18  7:48                                     ` martin rudalics
2008-03-17 22:53                                   ` Chong Yidong
2008-03-18  3:12                                   ` Stefan Monnier
2008-03-18  7:49                                     ` martin rudalics
2008-03-18 16:36                                       ` Stefan Monnier
2008-03-18 16:44                                         ` Lennart Borgman (gmail)
2008-03-18 14:45                               ` Chong Yidong
2008-03-18 16:39                                 ` Stefan Monnier
2008-03-18 18:28                                   ` Chong Yidong
2008-03-18 21:42                                     ` Stefan Monnier
2008-03-18 22:30                                       ` Kim F. Storm
2008-03-18 22:39                                         ` Lennart Borgman (gmail)
2008-03-19  4:40                                         ` M Jared Finder
2008-03-26  8:09                                           ` David Kastrup
2008-03-26 10:48                                             ` Juri Linkov
2008-03-26 11:32                                               ` David Kastrup
2008-03-26 11:39                                                 ` Juri Linkov
2008-03-26 12:20                                                   ` David Kastrup
2008-03-26 13:14                                                     ` Johan Bockgård
2008-03-26 13:26                                                       ` David Kastrup
2008-03-26 14:52                                                     ` Stefan Monnier
2008-03-27  0:46                                                     ` Juri Linkov
2008-03-26 12:02                                                 ` Lennart Borgman (gmail)
2008-03-26 11:47                                               ` Lennart Borgman (gmail)
2008-03-26 22:26                                                 ` Richard Stallman
2008-03-26 23:31                                                   ` Lennart Borgman (gmail)
2008-03-27  7:02                                                     ` David Kastrup
2008-03-27  8:19                                                       ` Lennart Borgman (gmail)
2008-03-27  8:41                                                         ` David Kastrup
2008-03-27 13:57                                                           ` Lennart Borgman (gmail)
2008-03-27 14:39                                                             ` David Kastrup
2008-03-27 15:01                                                               ` Juanma Barranquero
2008-03-27 15:34                                                                 ` David Kastrup
2008-03-27 15:41                                                                   ` Juanma Barranquero
2008-03-27 15:13                                                               ` Johan Bockgård
2008-03-27 19:41                                                     ` Richard Stallman
2008-03-27 23:52                                                       ` Juri Linkov
2008-03-28  7:33                                                         ` David Kastrup
2008-03-29  0:47                                                           ` Juri Linkov
2008-03-29  7:03                                                             ` David Kastrup
2008-03-29 11:53                                                               ` Lennart Borgman (gmail)
2008-03-29 12:30                                                               ` Juri Linkov
2008-03-29 14:07                                                                 ` David Kastrup
2008-03-29 14:45                                                                   ` Lennart Borgman (gmail)
2008-03-29 15:09                                                                     ` David Kastrup
2008-03-29 15:30                                                                       ` Lennart Borgman (gmail)
2008-03-30  0:52                                                                   ` Juri Linkov
2008-03-30 17:56                                                                     ` David Kastrup
2008-03-30  5:49                                                                 ` Richard Stallman
2008-03-28  4:05                                                       ` M Jared Finder
2008-03-28 11:10                                                         ` David Kastrup
2008-03-28 17:14                                                           ` Lennart Borgman (gmail)
2008-03-28 20:05                                                             ` David Kastrup
2008-03-28 23:49                                                               ` Lennart Borgman (gmail)
2008-03-28 20:42                                                         ` Richard Stallman
2008-03-28 21:47                                                           ` Chong Yidong
2008-03-28 22:01                                                             ` David Kastrup
2008-03-30  0:48                                                               ` Juri Linkov
2008-03-30 17:55                                                                 ` David Kastrup
2008-03-30 18:55                                                                   ` Juri Linkov
2008-03-27  0:49                                                   ` Juri Linkov
2008-03-27  2:59                                                     ` Chong Yidong
2008-03-27 19:41                                                     ` Richard Stallman
2008-03-27 23:48                                                       ` Juri Linkov
2008-03-28 20:41                                                         ` Richard Stallman
2008-03-29  0:54                                                           ` Juri Linkov
2008-03-29  1:15                                                             ` Lennart Borgman (gmail)
2008-03-29 16:37                                                             ` Richard Stallman
2008-03-30  1:05                                                               ` Juri Linkov
2008-03-30  4:12                                                                 ` Stefan Monnier
2008-03-30 18:33                                                                   ` Juri Linkov
2008-03-31 16:24                                                                     ` Richard Stallman
2008-03-30 19:56                                                                 ` Richard Stallman
2008-03-30 22:46                                                                   ` Juri Linkov
2008-03-26 22:26                                               ` Richard Stallman
2008-03-18 17:45                                 ` Thomas Lord
2008-03-16  2:33                 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2008-03-16 12:58 Robert J. Chassell

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=20080316233154.GD1544@muc.de \
    --to=acm@muc.de \
    --cc=cyd@stupidchicken.com \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=lord@emf.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=storm@cua.dk \
    /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.