unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Sebastien Vauban <sva-news@mygooglest.com>
Cc: 20408@debbugs.gnu.org
Subject: bug#20408: 24.5; How to escape the transient region when C-x TAB'ing?
Date: Sun, 03 Jul 2016 14:31:17 -0400	[thread overview]
Message-ID: <87y45iefpm.fsf@users.sourceforge.net> (raw)
In-Reply-To: <867ft3qkre.fsf@example.com> (Sebastien Vauban's message of "Thu,  23 Apr 2015 11:03:33 +0200")

[-- 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


      reply	other threads:[~2016-07-03 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=87y45iefpm.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=20408@debbugs.gnu.org \
    --cc=sva-news@mygooglest.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).