Subject: Re: bug#16438: 24.3.50; `C-x TAB right right' fails with error (mark-inactive)

From: Stefan Monnier <[email-masked]>
Date: Thu, 16 Jan 2014 09:00:41 -0500

>>> I fixed this by using (eq (cadr overriding-terminal-local-map) indent-rigidly-map)
>> That's hideous, tho :-(
> I borrowed this condition from
>     (not (eq map (cadr overriding-terminal-local-map)))

I know.  But it has problems:
- if there's a nested use of set-transient-map (e.g. C-u), your code will
  deactivate the mark even tho we're not finished with C-x TAB.
- it relies on internal details of implementation of set-transient-map.
- now C-x TAB does not deactivate the mark any more :-(

> Maybe it should be refactored to a separate predicate function.

Could be, tho the two tests need to be different.
Another option is to move the deactivation into the exit condition.
Yet another option is to change C-x TAB so that it uses (mark t) when
called repeatedly.

I'm not sure exactly how the deactivation should behave, tho:
- The current behavior seems wrong: C-x TAB does use the region, so it
  should "consume it", so C-x TAB right right right up should end with
  a deactivated region.
- But should the region be highlighted *during* C-x TAB?  If yes, then
  we have a conflict with the previous point, since just before hitting
  `up' the region would still need to be highlighted, so it'd be counter
  intuitive to deactivate the region right between when the user hits
  `up' and when we run the corresponding `previous-line' command.

So I think that the region should *not* be highlighted during C-x TAB.
Which implies using (mark t).

        Stefan