unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20408: 24.5; How to escape the transient region when C-x TAB'ing?
@ 2015-04-23  9:03 Sebastien Vauban
  2016-07-03 18:31 ` npostavs
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Vauban @ 2015-04-23  9:03 UTC (permalink / raw)
  To: 20408-ubl+/3LiMTaZdePnXv/OxA

Hello,

When using C-x TAB, I can't escape from the transient mode as described
in the help:

  ┌────
  │ `C-x <TAB>'
  │      This command is used to change the indentation of all lines that
  │      begin in the region, moving the affected lines as a "rigid" unit.
  │ 
  │      If called with no argument, the command activates a transient mode
  │      for adjusting the indentation of the affected lines interactively.
  │      While this transient mode is active, typing <LEFT> or <RIGHT>
  │      indents leftward and rightward, respectively, by one space.  You
  │      can also type `S-<LEFT>' or `S-<RIGHT>' to indent leftward or
  │      rightward to the next tab stop (*note Tab Stops::).  Typing any
  │      other key disables the transient mode, and resumes normal editing.
  └────

If I type a letter, it replaces the region.

That must come from my setting:

  ┌────
  │ (delete-selection-mode 1)             ; Overwrite region.
  └────

Then, how do we escape in such a case?

- C-g does not seem right -- even if it works.
- M-w is what I do, but that has a side effect...

Any other adviced way?

Should the above be mentioned in the doc?

In GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570

Best regards,
  Seb

-- 
Sebastien Vauban





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#20408: 24.5; How to escape the transient region when C-x TAB'ing?
  2015-04-23  9:03 bug#20408: 24.5; How to escape the transient region when C-x TAB'ing? Sebastien Vauban
@ 2016-07-03 18:31 ` npostavs
  0 siblings, 0 replies; 2+ messages in thread
From: npostavs @ 2016-07-03 18:31 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: 20408

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

tags 20408 patch
quit

Sebastien Vauban <sva-news@mygooglest.com> writes:
>
> When using C-x TAB, I can't escape from the transient mode as described
> in the help:
>
[...]
>
> If I type a letter, it replaces the region.
>
> That must come from my setting:
>
>   ┌────
>   │ (delete-selection-mode 1)             ; Overwrite region.
>   └────
>
> Then, how do we escape in such a case?
>
> - C-g does not seem right -- even if it works.

What's wrong with C-g?  It's the standard Emacs way to exit any kind of
state.

But it seems with a tiny patch (see below), we can make this command
work nicely with delete-selection-mode too.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1065 bytes --]

From 8575af7322ed318cb02c74f64f0d1b488ad9cbaf Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 3 Jul 2016 14:00:19 -0400
Subject: [PATCH v1] Don't delete selection after indent-rigidly

* lisp/indent.el (indent-rigidly): Pass `deactivate-mark' as the ON-EXIT
function to `set-transient-map', this prevents `delete-selection-mode'
from deleting the text that was just indented.
---
 lisp/indent.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index 0bbb520..0f6c68d 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -218,7 +218,7 @@ indent-rigidly
         (message
 	 (substitute-command-keys
 	  "Indent region with \\<indent-rigidly-map>\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop]."))
-        (set-transient-map indent-rigidly-map t))
+        (set-transient-map indent-rigidly-map t #'deactivate-mark))
     (save-excursion
       (goto-char end)
       (setq end (point-marker))
-- 
2.8.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-03 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23  9:03 bug#20408: 24.5; How to escape the transient region when C-x TAB'ing? Sebastien Vauban
2016-07-03 18:31 ` npostavs

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).