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? Date: Sun, 26 Nov 2017 14:54:20 +0100 Message-ID: <87d145w3g3.fsf@fliptop> References: <87a7zkwooy.fsf@fliptop> <83bmk0gh8l.fsf@gnu.org> <87375bwvz9.fsf@fliptop> <83k1ynfxwm.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1511704522 7879 195.159.176.226 (26 Nov 2017 13:55:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Nov 2017 13:55:22 +0000 (UTC) Cc: 29346@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 26 14:55:18 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 1eIxOp-00013s-TV for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Nov 2017 14:55:12 +0100 Original-Received: from localhost ([::1]:56789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIxOs-0000aA-IK for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Nov 2017 08:55:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIxOj-0000Yg-8u for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 08:55:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIxOg-0005mn-4V for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 08:55:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIxOg-0005mi-0j for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 08:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eIxOf-000785-Ow for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 08:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Nordin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2017 13:55: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.151170447127361 (code B ref 29346); Sun, 26 Nov 2017 13:55:01 +0000 Original-Received: (at 29346) by debbugs.gnu.org; 26 Nov 2017 13:54:31 +0000 Original-Received: from localhost ([127.0.0.1]:58669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIxOB-00077E-6p for submit@debbugs.gnu.org; Sun, 26 Nov 2017 08:54:31 -0500 Original-Received: from mout01.posteo.de ([185.67.36.141]:49948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIxO9-000771-D1 for 29346@debbugs.gnu.org; Sun, 26 Nov 2017 08:54:30 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 3A62720F94 for <29346@debbugs.gnu.org>; Sun, 26 Nov 2017 14:54:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1511704463; bh=UdRahLdJTV92nmBuf1eSo48wm6BnMHZ6/lKSZa7Mcac=; h=From:To:Cc:Subject:Date:From; b=QKBrlr2uQwI5TgUAHcMBFo5t7LjeHJ5sxygBGTWMkodwJrssD/PhVgbAeWs9zL3cV A25srggtOP8yWYrGbfXcxlLGvXJuaFl1Qwy8RlvD5Pzif6Dsv2uzig8+mj57faceud 1R1q6gLPMtLdiLX7HSJC4wwmrhcORHV9xXFwLhAx1V/HmUFQIvc3Hc7K7bZZyJMZvx 07ZQ6nL0vmfFhvqCqLG76/iS0CUjy9yacNjoHHynPBRnAES94geEsVcfERUUJGudZa FSNbyj4fM1rTajWa+WH3asp21NjgT7MR9FOTx7rqvtFlHJkrcC2UgYqxJNJZH4DlZQ Cj/XMW20WqlnQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ylBHd4yvcz9rxG; Sun, 26 Nov 2017 14:54:20 +0100 (CET) In-Reply-To: <83k1ynfxwm.fsf@gnu.org> 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:140406 Archived-At: Hello Debbugs Sorry if this gets double posted, I sent it first directly to 29346@debbugs.gnu.org without hooking onto this thread and I couldn't see any signs of it coming through somewhere. Anyways, 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