From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tomas Nordin Newsgroups: gmane.emacs.bugs Subject: bug#29346: dwim transpose-subr opportunity new suggestion Date: Sat, 25 Nov 2017 12:51:22 +0100 Message-ID: <873752zidh.fsf@fliptop> References: <87a7zkwooy.fsf@fliptop> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1511610734 15406 195.159.176.226 (25 Nov 2017 11:52:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2017 11:52:14 +0000 (UTC) To: 29346@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 25 12:52:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIZ09-0003SC-TP for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 Nov 2017 12:52:06 +0100 Original-Received: from localhost ([::1]:52809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIZ0H-0004Py-2N for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 Nov 2017 06:52:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIZ0B-0004Fs-7g for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2017 06:52:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIZ08-0005MG-1y for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2017 06:52:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48118) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIZ07-0005M5-Mj for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2017 06:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eIZ06-0006Z8-13 for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2017 06:52:03 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87a7zkwooy.fsf@fliptop> Resent-From: Tomas Nordin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Nov 2017 11:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29346-submit@debbugs.gnu.org id=B29346.151161069325202 (code B ref 29346); Sat, 25 Nov 2017 11:52:01 +0000 Original-Received: (at 29346) by debbugs.gnu.org; 25 Nov 2017 11:51:33 +0000 Original-Received: from localhost ([127.0.0.1]:56799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIYzc-0006YQ-S6 for submit@debbugs.gnu.org; Sat, 25 Nov 2017 06:51:33 -0500 Original-Received: from mout01.posteo.de ([185.67.36.141]:39029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIYzb-0006YC-18 for 29346@debbugs.gnu.org; Sat, 25 Nov 2017 06:51:31 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id EFC6B20C5A for <29346@debbugs.gnu.org>; Sat, 25 Nov 2017 12:51:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1511610684; bh=CQks7IMIMAVdHqcD10TimMsNh0bqGvHBpZ8+8jFqBo4=; h=From:To:Subject:Date:From; b=UiB5R5a6yqkKr/bDiW8nXbEkD1DzoFtXzb4xfDnX9Lq31Ace6VCxDAECpKtPvP0WY +30/JrUYtM4+myKekiSXoyzWcm+bST0TdzGrHpF7WflBPmU0Qxw+a6FNvXoHgAz4/r X+NY4rHOTr+Cj666yZk7tZ9GglCeu+wcc/QxvUecQET9MJoNMMxr37w22ruY/rQFqt vnHNAcZ0uYrBHsfUCDKAKGCtAYeAgagHbde4RC/WOt1MhNm5Npxm22VQsvPVbQslnk 1jun4fXFRKZYYpbO1kKK60/sKrOa80wKp+LVsXa2/y8YvF4PjnEcxpP5HpUOuu1DM9 vleEAuVYF+ntg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ykWcC2Xx0z9rxC for <29346@debbugs.gnu.org>; Sat, 25 Nov 2017 12:51:23 +0100 (CET) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140354 Archived-At: Hi Debbugs Here is an update on the request/suggestion based on a suggestion from the emacs help list, with a custom addition from myself. diff --git a/lisp/simple.el b/lisp/simple.el index 41f22b2396..7773a7d5d1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5431,6 +5431,15 @@ save-mark-and-excursion (save-excursion ,@body) (save-mark-and-excursion--restore ,saved-marker-sym))))) +(defcustom transpose-active-region-dwim nil + "Make transpose commands act as with a zero prefix when region active. + +If non-nil, a zero prefix is not required to operate over mark +and point when the region is active. See `transpose-words' for +example, (the last sentence)." + :type 'boolean + :group 'editing-basics) + (defcustom use-empty-active-region nil "Whether \"region-aware\" commands should act on empty regions. If nil, region-aware commands treat the empty region as inactive. @@ -6967,7 +6976,8 @@ transpose-subr (progn (funcall mover (- x)) (point)))))) pos1 pos2) (cond - ((= arg 0) + ((or (= arg 0) (and (= arg 1) (use-region-p) + transpose-active-region-dwim)) (save-excursion (setq pos1 (funcall aux 1)) (goto-char (or (mark) (error "No mark set in this buffer"))) Best regards -- Tomas