From unknown Fri Aug 15 15:27:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#25777 <25777@debbugs.gnu.org> To: bug#25777 <25777@debbugs.gnu.org> Subject: Status: 25.1; [PATCH] `rectangle--pos-cols' should not move point Reply-To: bug#25777 <25777@debbugs.gnu.org> Date: Fri, 15 Aug 2025 22:27:56 +0000 retitle 25777 25.1; [PATCH] `rectangle--pos-cols' should not move point reassign 25777 emacs submitter 25777 Drew Adams severity 25777 wishlist tag 25777 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 12:51:20 2017 Received: (at submit) by debbugs.gnu.org; 17 Feb 2017 17:51:20 +0000 Received: from localhost ([127.0.0.1]:43795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cemgi-0007K5-4T for submit@debbugs.gnu.org; Fri, 17 Feb 2017 12:51:20 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cemgg-0007Js-OZ for submit@debbugs.gnu.org; Fri, 17 Feb 2017 12:51:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cemga-0008C6-FC for submit@debbugs.gnu.org; Fri, 17 Feb 2017 12:51:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cemga-0008Bt-BD for submit@debbugs.gnu.org; Fri, 17 Feb 2017 12:51:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cemgZ-0001TL-3j for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 12:51:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cemgV-00088q-6h for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 12:51:11 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:23749) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cemgU-00087q-TX for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 12:51:07 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1HHp4Xn008775 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 17 Feb 2017 17:51:04 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v1HHp3jK008795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 17 Feb 2017 17:51:03 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v1HHp2ud026013 for ; Fri, 17 Feb 2017 17:51:03 GMT MIME-Version: 1.0 Message-ID: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> Date: Fri, 17 Feb 2017 09:51:01 -0800 (PST) From: Drew Adams To: bug-gnu-emacs@gnu.org Subject: 25.1; [PATCH] `rectangle--pos-cols' should not move point X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) The code defining `rectangle--pos-cols' mistakenly moves point. All of the calls to `goto-char' in this function need to be wrapped in `save-excursion'. Below is a patch that does this. (This bug causes a regression from the correct behavior in Emacs 24.5, BTW.) I think that most, if not all, of the other uses of `goto-char' in rect.el also need to be wrapped with `save-excursion'. But as I am not sure of this, I leave it to someone else to take a close look and DTRT. ------------------------- diff -u rect.el rect-2017-02-17-patched.el --- rect.el=092017-02-17 09:37:56.938748300 -0800 +++ rect-2017-02-17-patched.el=092017-02-17 09:43:13.884439700 -0800 @@ -85,26 +85,26 @@ (cdr rectangle--mark-crutches) (if rectangle--mark-crutches (setq rectangle--mark-crutches nil)) - (goto-char end) (current-column)))) + (save-excursion (goto-char end) (current-column))))) (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec)))) ((eq end (car cw)) (if (eq start (car rectangle--mark-crutches)) (cons (cdr rectangle--mark-crutches) (cdr cw)) (if rectangle--mark-crutches (setq rectangle--mark-crutches nil)) - (cons (progn (goto-char start) (current-column)) (cdr cw)))) + (cons (save-excursion (goto-char start) (current-column)) (cdr cw)= ))) ((progn (if cw (setf (window-parameter nil 'rectangle--point-crutches) nil= )) (eq start (car rectangle--mark-crutches))) (let ((sc (cdr rectangle--mark-crutches)) - (ec (progn (goto-char end) (current-column)))) + (ec (save-excursion (goto-char end) (current-column)))) (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec)))) ((eq end (car rectangle--mark-crutches)) - (cons (progn (goto-char start) (current-column)) + (cons (save-excursion (goto-char start) (current-column)) (cdr rectangle--mark-crutches))) (t (if rectangle--mark-crutches (setq rectangle--mark-crutches nil)) - (cons (progn (goto-char start) (current-column)) - (progn (goto-char end) (current-column))))))) + (cons (save-excursion (goto-char start) (current-column)) + (save-excursion (goto-char end) (current-column))))))) =20 (defun rectangle--col-pos (col kind) (let ((c (move-to-column col))) --------------------- In GNU Emacs 25.1.1 (x86_64-w64-mingw32) of 2016-11-15 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --without-dbus --without-compress-install 'CFLAGS=3D-O2 -static -g3'' From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 19 12:39:02 2017 Received: (at 25777) by debbugs.gnu.org; 19 Feb 2017 17:39:02 +0000 Received: from localhost ([127.0.0.1]:46434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfVRt-0001rQ-RQ for submit@debbugs.gnu.org; Sun, 19 Feb 2017 12:39:01 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:27545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfVRs-0001r9-QC for 25777@debbugs.gnu.org; Sun, 19 Feb 2017 12:39:01 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1JHcrJS017406 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <25777@debbugs.gnu.org>; Sun, 19 Feb 2017 17:38:54 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v1JHcrKp017144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <25777@debbugs.gnu.org>; Sun, 19 Feb 2017 17:38:53 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v1JHcqn7019214 for <25777@debbugs.gnu.org>; Sun, 19 Feb 2017 17:38:53 GMT MIME-Version: 1.0 Message-ID: Date: Sun, 19 Feb 2017 09:38:48 -0800 (PST) From: Drew Adams To: 25777@debbugs.gnu.org Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> In-Reply-To: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 25777 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) As I mentioned, this is a regression. I think the bug and the patch are pretty self-explanatory, but if you feel you need a recipe to show that this causes cursor movement then let me know. I hope this patch or similar can be applied soon. Thx. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 20:36:34 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 01:36:34 +0000 Received: from localhost ([127.0.0.1]:57321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciAEo-0004pE-AH for submit@debbugs.gnu.org; Sun, 26 Feb 2017 20:36:34 -0500 Received: from mail-it0-f47.google.com ([209.85.214.47]:37195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciAEg-0004ov-Hk for 25777@debbugs.gnu.org; Sun, 26 Feb 2017 20:36:29 -0500 Received: by mail-it0-f47.google.com with SMTP id 203so56944706ith.0 for <25777@debbugs.gnu.org>; Sun, 26 Feb 2017 17:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zJ8/0xkHcHJQWWalRHiXiGQFpwD+bRNEt3Vvmc0ed+M=; b=FadzN7YjUR+qztzWNd+yzRPo1uXgy2sRBzVGRZnIp6oWa8iKCL/HmAAAzYx4gJuOCX i745zXN1SKu4Etm3YGlYmYVyGf0Vkxg+bt/h/T/0VLapKhCVT1Vb0EU5cXZqHX8nv0RT maPBYrOtomJrAW3anPGh3qV40JZtkBz1M7oXUik8gA9dnewk5HUgIcy6lsJ0/UAGW1Fn 2n9zB+5WTS79c4PC5XaXUFubfmhz3R8AUUlmpngncSSbkbtiXRknTf6ZV37O6kNnriTS QD82Pgezupt0lxKRSKV411g4POFcWSn6SZZfDYV8m7lK35bsK72zuZb/uM66JvvIb8ms lS8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=zJ8/0xkHcHJQWWalRHiXiGQFpwD+bRNEt3Vvmc0ed+M=; b=mMD53sh+goU5pvtVoWZVx7vfig3Y0rrr70F7VqqSr+1QPSvZTPvfKcDCztTTz5K9hc AlFrHxsQOsJDyVbeKEceJVXp2PfVmANQIQjSikhZ72KvZSdaBMHUqW0Cl8hlLii6e5Kq jqR1oeXhDoyDS9+RPBy4OrKPxRBHHLxXKR3nq2aJMjoT1Pou7nqxgWAUUAaKUAbZniT8 gZzpnz4OYP8Bg08BMhxuUy98QKuhnkAisbTnoq7dTH0F7byWlNYQU/Tr9NVVMs6X6sMp oPIiMTYWdML9FOgmdPIR+6+L1h8UQPRewCRBJSAt2jpKHY7M4z4N2f7U+8LVdNiadWRf phsA== X-Gm-Message-State: AMke39kEEKty0RbNGunYZ8ERfDtJWpUqhRqkTv/hpiBJzQb0/AFDDfafhuxhhoTp6yVmiQ== X-Received: by 10.36.21.71 with SMTP id 68mr8722837itq.35.1488159376992; Sun, 26 Feb 2017 17:36:16 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id d5sm4448291itd.3.2017.02.26.17.36.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 Feb 2017 17:36:16 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> Date: Sun, 26 Feb 2017 20:37:28 -0500 In-Reply-To: (Drew Adams's message of "Sun, 19 Feb 2017 09:38:48 -0800 (PST)") Message-ID: <87poi4e7mv.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Drew Adams writes: > As I mentioned, this is a regression. I think the bug and the patch > are pretty self-explanatory, but if you feel you need a recipe to > show that this causes cursor movement then let me know. Yes, an example would be useful. Perhaps it's the callers of rectangle--pos-cols that should use save-excursion. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 01:25:14 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 06:25:15 +0000 Received: from localhost ([127.0.0.1]:57440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciEkE-0006W1-Jb for submit@debbugs.gnu.org; Mon, 27 Feb 2017 01:25:14 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:34778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciEkD-0006Vl-0l for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 01:25:13 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1R6P4i6010537 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 06:25:05 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v1R6P3RO029491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Feb 2017 06:25:04 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v1R6P1wP011621; Mon, 27 Feb 2017 06:25:02 GMT MIME-Version: 1.0 Message-ID: Date: Sun, 26 Feb 2017 22:24:59 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> In-Reply-To: <87poi4e7mv.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) > > As I mentioned, this is a regression. I think the bug and the patch > > are pretty self-explanatory, but if you feel you need a recipe to > > show that this causes cursor movement then let me know. >=20 > Yes, an example would be useful. Perhaps it's the callers of > rectangle--pos-cols that should use save-excursion. I can certainly wrap all calls of `rectangle--pos-cols' with `save-excursion'. But that should not be necessary. There is no reason for that function to leave point moved. It's only aim in moving point is to do so temporarily. Point is moved in Emacs 25, and it was not moved before. It's a gratuitous regression. `rectangle--pos-cols' does not benefit in any way by leaving point moved. Anyway, thanks for looking at this. Here is a recipe. You can try to make it more minimal if you like, but it is pretty simple and it shows the problem easily enough. Download library `modeline-posn.el', from here: https://www.emacswiki.org/emacs/download/modeline-posn.el Evaluate these 3 variables: option `modelinepos-style' and defvars `modelinepos-region-acting-on' and `modelinepos-rect-p'. Evaluate this: (defadvice rectangle-mark-mode (after bind-modelinepos-region-acting-on activate) (setq modelinepos-region-acting-on rectangle-mark-mode modelinepos-rect-p rectangle-mark-mode) =20 (redisplay 'force)) And evaluate the setq-default sexp for `mode-line-position' (the one for Emacs > 22). In buffer *scratch*: M-x show-paren-mode RET M-x set-variable RET show-paren-style RET mixed RET Type this at the beginning of a line at the end of the buffer (in *scratch*): () RET () RET So you see this, with the cursor (_) at eob, i.e., after the final newline: () () _ Then do `C-x SPC C-p'. The cursor moves briefly up one line and then immediately jumps back to where mark was, at the end of the buffer. It should stay where `C-p' put it, on the second left paren. The problem seems to come from an error being raised in the context of the show-paren code. An easier way to repro it is to just load file modeline-posn.el and then do what I described starting with "In buffer *scratch:". In that case you will see the intended effect of the library when the region is active in `rectangle-mark-mode': The mode line says how many rows & columns are in the rectangular region. Of course, for the recipe the cursor will not move, but stays stuck at eob, so the mode line just reads "0 rows, 0 cols". Actually, you can see it briefly change to "1 rows, 0 cols" and then change back to "0 rows, 0 cols". To debug this, since I could not use the debugger (the code is initiated while updating the mode-line during redisplay), I had to just insert calls to `message' etc. I commented out parts of `modelinepos-style', to find the part that matters. Commenting out this, and replacing it by 999, prevents the problem: (let ((rpc (rectangle--pos-cols (region-beginning) (region-end)))) (abs (- (car rpc) (cdr rpc)))) I then replaced just the (abs...) with this: (message "RPC: %S" rpc) 999 That printed (0 . 0) for RPC, but the problem was reproduced. That told me that the problem came from just calling `rectangle--pos-cols'. Changing the above to just this removed the problem: (let ((rpc '(0 . 0))) (abs (- (car rpc) (cdr rpc)))) I checked the code of `rectangle--pos-cols' and saw that it now does `goto-char' (and it did not do so before Emacs 25.1). Wrapping it in `save-excursion' fixed the problem, without any negative effect on the function (it does not need point to remain moved). Such code should not gratuitously add cursor motion. Other `goto-char' calls were also added, in other parts of the same file, for Emacs 25. Perhaps the person who updated the code did not think about the consequence. Point is not moved by the code in order to leave it in a different place. It is changed only for a temporary effect. That point-moving code should be wrapped in `save-excursion'. My advice is to check the other such bare `goto-char' occurrences that were added in Emacs 25. I'm guessing that none of them need to leave point moved. Code should be able to call `rectangle--pos-cols' just for its value, without getting side effects like cursor movement. If `rectangle--pos-cols' needed, or intended, to leave point moved somewhere for some reason then yes, of course, any calling code that doesn't want that should be responsible for wrapping the calls with `save-excursion'. But that's not the case: There is no reason for the function to have the side effect of leaving point in a different position. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 08:43:05 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 13:43:05 +0000 Received: from localhost ([127.0.0.1]:57640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciLZx-000377-1r for submit@debbugs.gnu.org; Mon, 27 Feb 2017 08:43:05 -0500 Received: from mail-it0-f48.google.com ([209.85.214.48]:33827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciLZu-00036d-LQ for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 08:43:03 -0500 Received: by mail-it0-f48.google.com with SMTP id k200so19815197itb.1 for <25777@debbugs.gnu.org>; Mon, 27 Feb 2017 05:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=/78z8TuKSnIAlVlF584tGk/H3Cws9ecougHb1QlZnRI=; b=gEzJ05IYj3IjrrGIylQhWzV+YaOAzsHALosNMulTJRgYEC+61XXxmHGf1Zgtna7u3j gQ6ZkZ/Ddj9G4JFQXreU/rsqYwmvPSL5xZ4brQes04S+vlBhPFe6Pi6KZ+GrPcSG6Sn0 23Nsv1rOVEW0aSkuNdJXBNPgHDzlzgclS4Y8Lhgq/vK5OtUFTxCbrRV2CHhCRnRfePQV E4VxpK9KXSSG3KuHUIXiMAzLq+sKK08fx0vkxcD7Fy6q9FD45S4+bwUh8e2TdiWfGwqK stuwjgmsgC3i9yTWYXA4toUXjoQwZpRa5pQO/Acep8CR0BmKVuC2x6mhbjaCNHDXBxlr h+LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=/78z8TuKSnIAlVlF584tGk/H3Cws9ecougHb1QlZnRI=; b=D+eQVdYRBGcVOqoK/HB+v397+mgbnOJjbgjb9Y0ByNdZlRr+kZKi/Tjxji+G8434Ut ll6DNB1LaB7mOBZddIjVlGNr1alpl6F4hpXzggo9FscxpzcKuHAU6lgpinY+sggpF3r7 iBb2apQrkjXEXCPohPMb58jOVpCmTrLtES71xAqXhA5+eijE5N2WZN6KkKbnJOWWFsS8 eWGH7lKD9NjPy8P5ZjE01ffXGhzicq/Cn65urn2yf1ep/kfdjlbGePLtiJHzl25gd6ls s2PD2I6kMZCM293j/IFweJnxaUdw9n38M+5FHICXKNyZmhyJ7Z0JUyMMLvNkM6jtEiv+ ithA== X-Gm-Message-State: AMke39lBeXZ8q74aAa0kAGiOw1K5A5hUN9lB6iKAYuEjk7Iqou6Kx5FWX4lctdbar6eKsg== X-Received: by 10.36.215.194 with SMTP id y185mr5157030itg.101.1488202977033; Mon, 27 Feb 2017 05:42:57 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id o20sm6716408ioo.37.2017.02.27.05.42.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2017 05:42:56 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> Date: Mon, 27 Feb 2017 08:44:08 -0500 In-Reply-To: (Drew Adams's message of "Sun, 26 Feb 2017 22:24:59 -0800 (PST)") Message-ID: <877f4beok7.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Drew Adams writes: > > I checked the code of `rectangle--pos-cols' and saw that > it now does `goto-char' (and it did not do so before > Emacs 25.1). I'm confused as to what you mean by this, since `rectangle--pos-cols' did not exist before 25.1. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 12:51:43 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 17:51:44 +0000 Received: from localhost ([127.0.0.1]:58629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciPSZ-00046i-Od for submit@debbugs.gnu.org; Mon, 27 Feb 2017 12:51:43 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:27407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciPSW-00046U-D3 for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 12:51:40 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1RHpXhY025749 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Feb 2017 17:51:33 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v1RHpWu8027977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Feb 2017 17:51:33 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v1RHpVJY023869; Mon, 27 Feb 2017 17:51:32 GMT MIME-Version: 1.0 Message-ID: Date: Mon, 27 Feb 2017 09:51:30 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> In-Reply-To: <877f4beok7.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > > I checked the code of `rectangle--pos-cols' and saw that > > it now does `goto-char' (and it did not do so before > > Emacs 25.1). >=20 > I'm confused as to what you mean by this, since `rectangle--pos-cols' > did not exist before 25.1. Sorry, my bad about that expression. I meant to say that _there is no such problem in Emacs 24.5_. In Emacs 24.5, following the recipe DTRT: the C-p moves point up one line. Emacs 24.5, like 25.1, has rectangle support. Nothing changes in that regard for my code: I take advantage of exactly the same functionality offered by rect.el as before. What has changed is how rect.el obtains and returns the columns delimiting the current region rectangle. I changed my code accordingly. Perhaps I'm not being sufficiently clear about this regression. I think it's great that a function such as `rectangle--pos-cols' was added. (But it has no business being considered "internal".) Just as, for Emacs 24.5, I reused some code from rect.el to do what I need to get the rectangle columns, so I reused the corresponding code from Emacs 25. Look at function `apply-on-rectangle'. In Emacs 25 it calls `rectangle--pos-cols' to get the rectangle columns - and so do I. In Emacs 24.5 it also does just what I do (I stole the code) to obtain those columns. Do you really think that a function whose only purpose is to let you know what the rectangle columns are should move point and leave it in a position that is not one of the rectangle corners? If so, then you will say that all callers of this function should wrap with `save-excursion' if they don't want point moved. I think that's the job of a function whose only purpose is to return those columns. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 13:50:10 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 18:50:10 +0000 Received: from localhost ([127.0.0.1]:58654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciQN8-0005SJ-GI for submit@debbugs.gnu.org; Mon, 27 Feb 2017 13:50:10 -0500 Received: from mail-ot0-f170.google.com ([74.125.82.170]:33336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciQN7-0005S6-0Y for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 13:50:09 -0500 Received: by mail-ot0-f170.google.com with SMTP id k4so57918203otc.0 for <25777@debbugs.gnu.org>; Mon, 27 Feb 2017 10:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=j9iZ10KmrO6lY50pEJ4aEfPoUI/mONMwpIe6tOnfoQQ=; b=tyyutNd/GTFtltkACM4tbB4QFo8yV33VioXw+V3pkDigjIO+2SzF/Qtzz25EU1P3zy hbrdPwSXiVjQ8f5JaLvZmIrqUG9tSgDVDxNHb8IbEu71M0CamXJUKM7XRJbxthccgmBJ y9sA6mvCjiXc8XQVUWfQp/PWjP4t0WcqMSljHXWOBGCoKQBX6b53hIBbNAFyOQ4F5Yqm TFcSYU5qSMudsSTPsXvZYgwr6ccKnLh7B3NCSv0Mu8naVySU1TAVOX1gMHDLfn3xHUXR WC2JsUaM1n5N7E4HVbJ+IdAAhw1GoB6wLWUbywtFXmethVYzBthqJa4UM+ZJkGnbOsw0 rJJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=j9iZ10KmrO6lY50pEJ4aEfPoUI/mONMwpIe6tOnfoQQ=; b=KU6oFgw+tmHgiyF71U77YksPasp5VuzDpInEWQcM81s2Xqrf4MMJEzv4sRzKhDorm+ WTRRB25SbJojW88dwrZiqgHc2oiqcPwGbUbPIltmlb8MZ3hEzpFtVZJA9+/jPjHQ94lh m0DZD5fqdAsqWRB71tPWMOHO9TFBC/7YvQQXOxEDY9b/vkIqH8zFEABW5G15WhUUb+ck 15cFyqhKPcO6ZMi4VZ9O070QgV1xtOGpJBTKHtsQVloIMQxot04LHTGHUNm2j91SQDcX hOhq04NkC5VVwzCTqCZl5Qd5GDg8WerswohDojXaZbLSWfnCd6s+/8t9m05GlX+Yuivv 0ldA== X-Gm-Message-State: AMke39lAi7YXtKySLVp6fx1r7vZ1FjNHQKkKe8S8mMJc+A61pgPElHrrYW3yy8LDUS8KGEc814RMROoDy9AwuA== X-Received: by 10.157.62.203 with SMTP id b69mr8605101otc.30.1488221403209; Mon, 27 Feb 2017 10:50:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.35.87 with HTTP; Mon, 27 Feb 2017 10:50:02 -0800 (PST) In-Reply-To: References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> From: Noam Postavsky Date: Mon, 27 Feb 2017 13:50:02 -0500 X-Google-Sender-Auth: -aYywXv8PBbcfzC1SfrCbruio6U Message-ID: Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point To: Drew Adams Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Mon, Feb 27, 2017 at 12:51 PM, Drew Adams wrote: > Just as, for Emacs 24.5, I reused some code from rect.el to > do what I need to get the rectangle columns, so I reused > the corresponding code from Emacs 25. > > Look at function `apply-on-rectangle'. In Emacs 25 it calls > `rectangle--pos-cols' to get the rectangle columns - and so > do I. In Emacs 24.5 it also does just what I do (I stole > the code) to obtain those columns. In both 24.5 and 25.1, apply-on-rectangle wraps its body in save-excursion, and in both versions the body contains no nested save-excursions. So it looks to me like the regression is in your code which decides not to call save-excursion when running on Emacs 25. (if modelinepos-rect-p (if (fboundp 'rectangle--pos-cols) ; Emacs 25+ (let ((rpc (rectangle--pos-cols (region-beginning) (region-end)))) (abs (- (car rpc) (cdr rpc)))) (let ((start (region-beginning)) (end (region-end)) startcol endcol) (save-excursion ... From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:21:44 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 19:21:44 +0000 Received: from localhost ([127.0.0.1]:58668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciQrg-0006B7-JL for submit@debbugs.gnu.org; Mon, 27 Feb 2017 14:21:44 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:50807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciQre-0006At-Rb for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 14:21:43 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1RJLaiN020741 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 19:21:36 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v1RJLaUU009468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 19:21:36 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v1RJLZcB013609; Mon, 27 Feb 2017 19:21:36 GMT MIME-Version: 1.0 Message-ID: <3e265625-6c16-424c-9fb2-6a7144dcc349@default> Date: Mon, 27 Feb 2017 11:21:34 -0800 (PST) From: Drew Adams To: Noam Postavsky Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > > Just as, for Emacs 24.5, I reused some code from rect.el to > > do what I need to get the rectangle columns, so I reused > > the corresponding code from Emacs 25. > > > > Look at function `apply-on-rectangle'. In Emacs 25 it calls > > `rectangle--pos-cols' to get the rectangle columns - and so > > do I. In Emacs 24.5 it also does just what I do (I stole > > the code) to obtain those columns. >=20 > In both 24.5 and 25.1, apply-on-rectangle wraps its body in > save-excursion, and in both versions the body contains no nested > save-excursions. So it looks to me like the regression is in your code > which decides not to call save-excursion when running on Emacs 25. OK, clearly I'm not getting through to you. The bug will remain, and I'll wrap my calls to `rectangle--pos-cols' in `save-excursion'. For the record: 1. I do not call `apply-on-rectangle'. 2. The purpose of `rectangle--pos-cols', just as was the purpose of the previous (Emacs 24.5) code, is to return the rectangle columns. Nothing more. Its purpose is not to move point and leave it in some other place that is not a rectangle corner. 3. `rectangle--pos-cols' is a general function. It should not be considered internal. It is useful generally - I have reused it, as one example. (I have not used `apply-on-rectangle'.) Is there a reason to have `rectangle--pos-cols' move point, instead of use `save-excursion'? You've given none. Do you argue that performance matters here? What's the argument in favor of not having this code be as clean as it was in Emacs 24.5? Why favor this regression? From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:48:05 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 19:48:05 +0000 Received: from localhost ([127.0.0.1]:58691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciRHB-0006mb-8x for submit@debbugs.gnu.org; Mon, 27 Feb 2017 14:48:05 -0500 Received: from mail-oi0-f44.google.com ([209.85.218.44]:33838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciRH9-0006m6-Rb for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 14:48:04 -0500 Received: by mail-oi0-f44.google.com with SMTP id m124so17662030oig.1 for <25777@debbugs.gnu.org>; Mon, 27 Feb 2017 11:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=oSycmdqX+oalaESPQuSoRuYwLh1rfNdA30rCVN9jRVk=; b=ju5CI1VHDSPNy3j43uj80lApzg14CAaI+qNONOKl3AZ+Bj0QM6A8Vg0tsBB0hRnNCg z4F07+s0mePrOSesGnxcOztCuaxkN0tZoGT4+zL9jV3UDxCf1pGVxZnkpT0CVW43oqzx DvgCYY9+f4HWQuVPPPXBDCM6HgMFls51h3IyEjp80husWuzrUWq0PXUHZzGrkNFDhw8b WBHZc3VfXP+QxT1ZNfomFu6BsoTV7CqRFsIumeD+kXBKXiwozy3wYgFXr5njg8JZCwKS j9HwmWeRK9NHHVD7N8soo4Y+twF6RYlR1UhICSiUDQpjwdKvDdBNJ2Spslhare6OdQoT s/3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=oSycmdqX+oalaESPQuSoRuYwLh1rfNdA30rCVN9jRVk=; b=BAEV2+b9YtaYu5qipw/fvcI0Y6FoHI7RlXpcA09LQM5MYTSkBiNXBaoJr8dv1gjWCG saBb06t6hIdfBuZpAnwrXKOQK9o9WrC4QscOgQueZHoLqdzt05XH5oxWT5zKkkwMBnN9 0382AUrVYshep72j78zziMqtq8zh/iOnlKLG0pLn56s1pm1hQncyjMy/76t87xwBN4ZQ uQjzLDJQlerf2yPeiY6c6/qq/knss3ls+8TIE8EWAWXPKLaeNEVRQX5FXE7/3WTQOmLj HsUn6zdM1xKiVyix1ylcZCKb2220CgWlVWQ6klEB42SH+XucGqp2Oo5TCLPvXYJ1aABL 6Zzw== X-Gm-Message-State: AMke39k6bU2RbpFfmFSH3mBPiEeyWpaQx3PZyMvZMFdskqcNaH8CknM8AxBj8ry+JRF49k1t4QLlo7JVukXwkg== X-Received: by 10.202.89.139 with SMTP id n133mr8726949oib.70.1488224877993; Mon, 27 Feb 2017 11:47:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.35.87 with HTTP; Mon, 27 Feb 2017 11:47:57 -0800 (PST) In-Reply-To: <3e265625-6c16-424c-9fb2-6a7144dcc349@default> References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <3e265625-6c16-424c-9fb2-6a7144dcc349@default> From: Noam Postavsky Date: Mon, 27 Feb 2017 14:47:57 -0500 X-Google-Sender-Auth: 0AFTGa6at_ty9pa7cwLagQ0QciY Message-ID: Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point To: Drew Adams Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Mon, Feb 27, 2017 at 2:21 PM, Drew Adams wrote: > 2. The purpose of `rectangle--pos-cols', just as was the purpose > of the previous (Emacs 24.5) code, is to return the rectangle > columns. Nothing more. Its purpose is not to move point and > leave it in some other place that is not a rectangle corner. The code you extracted in 24.5 is (modulo a few dropped lines) (save-excursion (goto-char start) (setq startcol (current-column)) (beginning-of-line) (setq startpt (point)) ;; [dropped in modeline-posn] (goto-char end) (setq endcol (current-column)) (forward-line 1) ;; [dropped in modeline-posn] (setq endpt (point-marker)) ;; [dropped in modeline-posn] ;; ensure the start column is the left one. (if (< endcol startcol) (let ((col startcol)) (setq startcol endcol endcol col))) The equivalent in 25.1 is (save-excursion (let* ((cols (rectangle--pos-cols start end)) (startcol (car cols)) (endcol (cdr cols)) But for some reason you don't want to extract the save-excursion from 25.1. > > 3. `rectangle--pos-cols' is a general function. It should not > be considered internal. It is useful generally - I have > reused it, as one example. (I have not used `apply-on-rectangle'.) > > Is there a reason to have `rectangle--pos-cols' move point, > instead of use `save-excursion'? I don't want to add unneeded clutter. > What's the argument in > favor of not having this code be as clean as it was in Emacs > 24.5? Why favor this regression? It's clearly not a regression. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 15:35:57 2017 Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 20:35:57 +0000 Received: from localhost ([127.0.0.1]:58723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciS1V-0007sI-Ah for submit@debbugs.gnu.org; Mon, 27 Feb 2017 15:35:57 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:24838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciS1T-0007s2-5E for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 15:35:56 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1RKZmoT020840 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 20:35:49 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v1RKZlJo022840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 20:35:48 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v1RKZkCc017367; Mon, 27 Feb 2017 20:35:47 GMT MIME-Version: 1.0 Message-ID: <10ab8045-4123-4b3c-b0ea-f981cb99825e@default> Date: Mon, 27 Feb 2017 12:35:46 -0800 (PST) From: Drew Adams To: Noam Postavsky Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <3e265625-6c16-424c-9fb2-6a7144dcc349@default> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > > 2. The purpose of `rectangle--pos-cols', just as was the purpose > > of the previous (Emacs 24.5) code, is to return the rectangle > > columns. Nothing more. Its purpose is not to move point and > > leave it in some other place that is not a rectangle corner. >=20 > The code you extracted in 24.5 is (modulo a few dropped lines) >=20 > (save-excursion > (goto-char start) > (setq startcol (current-column)) > (beginning-of-line) > (setq startpt (point)) ;; [dropped in modeline-posn] > (goto-char end) > (setq endcol (current-column)) > (forward-line 1) ;; [dropped in modeline-posn] > (setq endpt (point-marker)) ;; [dropped in modeline-posn] > ;; ensure the start column is the left one. > (if (< endcol startcol) > (let ((col startcol)) > (setq startcol endcol endcol col))) >=20 > The equivalent in 25.1 is >=20 > (save-excursion > (let* ((cols (rectangle--pos-cols start end)) > (startcol (car cols)) > (endcol (cdr cols)) >=20 > But for some reason you don't want to extract the > save-excursion from 25.1. You still don't understand, it seems. The workaround for my code is obvious, and I have made it: wrapped each call to `rectangle--pos-cols' in `save-excursion'. The point of filing the bug is to help Emacs, not my code. I wanted you to be able to test to repro the bug using my code before adding a `save-excursion' wrapper. Clearly I have to add such a wrapper anyway, since my library needs to support Emacs 25.1 (in addition to 22-24). A fix of `rectangle--pos-cols' for Emacs 25.2 or later would not let me avoid wrapping with `save-excursion'. It cannot possibly be for the benefit of my code that this bug gets fixed or that I filed the bug. Clearly I think that this function should clean up after itself, using `save-excursion'. Its _only_ purpose, AFAICT, is its return value, not (also) the side effect of leaving point somewhere other than at the rectangle corner. Clearly you disagree about that - that it should clean up after itself. Do you also think that it is important that it leave point at a new location? Is there a reason that it _should_ have that side effect, and not simply return the proper value? > > 3. `rectangle--pos-cols' is a general function. It should not > > be considered internal. It is useful generally - I have > > reused it, as one example. (I have not used `apply-on-rectangle'.) > > > > Is there a reason to have `rectangle--pos-cols' move point, > > instead of use `save-excursion'? >=20 > I don't want to add unneeded clutter. What you call "unneeded" and "clutter" I call normal and clean. What you call uncluttered code I call irresponsible code. We will, I guess, just have to agree to disagree about this. > > What's the argument in > > favor of not having this code be as clean as it was in Emacs > > 24.5? Why favor this regression? >=20 > It's clearly not a regression. Not if code calls only `apply-on-rectangle', no. Apparently you don't think that `rectangle--pos-cols' is (or could be, if the bug were fixed) a useful general function. That's OK. Users will just roll their own. I think we can end this discussion now - feel free to close it as wont-fix. Thanks for spending time looking into it, anyway (sincerely). From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 23:56:46 2017 Received: (at 25777) by debbugs.gnu.org; 28 Feb 2017 04:56:46 +0000 Received: from localhost ([127.0.0.1]:58929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciZqA-000413-3M for submit@debbugs.gnu.org; Mon, 27 Feb 2017 23:56:46 -0500 Received: from mail-it0-f51.google.com ([209.85.214.51]:38516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciZq8-00040r-DV for 25777@debbugs.gnu.org; Mon, 27 Feb 2017 23:56:44 -0500 Received: by mail-it0-f51.google.com with SMTP id y135so2466980itc.1 for <25777@debbugs.gnu.org>; Mon, 27 Feb 2017 20:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=18m8YJVm4Ejhf4Bo6uKNDhcLYYx+gJjLjbHDv+daLHM=; b=XLWfkgofomrYlYpTOUl9k7mW5jnI0pkCfdPmgEmWJHdK46Fq/0BvBgm2okMRDrkAHW BTsJjzVoZFpjq9Wl5R84xwsMM6YgrdBJ1yoWnQ0QtpntxsaCtAgDXwlY9U0MagyJxK+W Hucqqcur1CXhoPdvTYMfgSUMB2rDxFVSBSMp2tzoIryzB3YOuy2q7BMwu9mNOIzP0atE hhTBJ/9yP/91D0to/dE1mN0gusRkuOOIOuROMHVOZOrQAAs/jRlvaMcic55M8hxXKYTy LXPnrd/UaNeClUHVatoMD7lEdX2520aw38TUaha504lYpUcdg2nxVO7qnMilTgV4zzEu p45A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=18m8YJVm4Ejhf4Bo6uKNDhcLYYx+gJjLjbHDv+daLHM=; b=c48fuAcbqt3eiHbW1igJwn7dhVJGyfT7bn4jGHylZ+gXP+ZDEzhNFmiQBJy7tjVYZf K0030Ye4Idjwry6ubS2fMrUSvCpQ0+p7o9t5Ojd4eFVKqx2ZzSi9e9zJhSN7ajUaNfXV YBcne4+VHmOvAGIDKjCW1sHp+mjkeF1NyQW5e6oeoUnsM88WQYfqwtALhdorbLCSdwe/ rxiumfVkki71NqvAo3nkInQw+OxF62lsRhgR3m25tgmLtKo6degA7xGSTWMi4d1BzQIq FNCPEJxoRBwahA6Jekd/eHdI8jTD6kYCxVnOOGDhrtQpg7bMMeYq+SJjgijeBP1j4vp1 /6Lg== X-Gm-Message-State: AMke39l42ZHny1OI20xoU1hd14jDSqVOZz7ji2Y2Xya1ZWCMuy4yxYzhzBsbCfA4epEFSw== X-Received: by 10.36.200.9 with SMTP id w9mr18411302itf.113.1488257798816; Mon, 27 Feb 2017 20:56:38 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p68sm428090iop.8.2017.02.27.20.56.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2017 20:56:38 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> Date: Mon, 27 Feb 2017 23:57:50 -0500 In-Reply-To: (Drew Adams's message of "Mon, 27 Feb 2017 09:51:30 -0800 (PST)") Message-ID: <87tw7edi9d.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Drew Adams writes: > I think it's great that a function such as `rectangle--pos-cols' > was added. (But it has no business being considered "internal".) > > Do you really think that a function whose only purpose is > to let you know what the rectangle columns are should move > point and leave it in a position that is not one of the > rectangle corners? After looking over this thread again, I conclude we got totally side-tracked on the question of whether this is a regression or not. That's just a distraction. I think it's reasonable to make rectangle--pos-cols preserve point. Could you update your patch to 1. Use a single save-excursion around the whole body, instead of adding several. 2. Rename rectangle--pos-cols to rectangle-pos-cols. 3. Add a docstring to rectangle-pos-cols. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 10:11:19 2017 Received: (at 25777) by debbugs.gnu.org; 28 Feb 2017 15:11:19 +0000 Received: from localhost ([127.0.0.1]:60397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cijQt-00019a-CM for submit@debbugs.gnu.org; Tue, 28 Feb 2017 10:11:19 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:47946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cijQs-00019O-4h for 25777@debbugs.gnu.org; Tue, 28 Feb 2017 10:11:18 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1SFBA7i029714 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Feb 2017 15:11:11 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v1SFBAaI002594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Feb 2017 15:11:10 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v1SFB98X018568; Tue, 28 Feb 2017 15:11:09 GMT MIME-Version: 1.0 Message-ID: <512a3db8-49d0-4802-aecc-2d71049e0b25@default> Date: Tue, 28 Feb 2017 07:11:08 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> In-Reply-To: <87tw7edi9d.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > > I think it's great that a function such as `rectangle--pos-cols' > > was added. (But it has no business being considered "internal".) > > > > Do you really think that a function whose only purpose is > > to let you know what the rectangle columns are should move > > point and leave it in a position that is not one of the > > rectangle corners? >=20 > After looking over this thread again, I conclude we got totally > side-tracked on the question of whether this is a regression or not. > That's just a distraction. I agree, and that was my fault. In my mind it caused my code to regress. My bad. > I think it's reasonable to make rectangle--pos-cols preserve point. > Could you update your patch to >=20 > 1. Use a single save-excursion around the whole body, instead of adding > several. > 2. Rename rectangle--pos-cols to rectangle-pos-cols. > 3. Add a docstring to rectangle-pos-cols. I could do that, yes. But IMHO, it is generally better to scope a `save-excursion' as tightly as possible around the movement that you want to control (hide, erase, undo). Unless there is something critical for performance (and I don't think `save-excursion' is costly), that's better. Why? Because it makes the code much clearer. It tells you that outside the `save-excursion' zones point is unlikely to be moved. And that makes maintenance easier and less error-prone. Putting a `s-e' at a wider location is analogous to putting a mutex block at an unnecessarily wide location. (Yes, there is no real connection between those two, but it comes down to doing something only where/when it's needed.) If you confirm that you really want that wider scope here for `s-e' then I'll do that. Otherwise, I'll keep the `s-e' occurrences where they are but do the renaming and add a doc string. Let me know. Thx. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 01 20:20:40 2017 Received: (at 25777) by debbugs.gnu.org; 2 Mar 2017 01:20:40 +0000 Received: from localhost ([127.0.0.1]:35126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjFQ7-0006Wr-OL for submit@debbugs.gnu.org; Wed, 01 Mar 2017 20:20:39 -0500 Received: from mail-it0-f41.google.com ([209.85.214.41]:38385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjFQ5-0006We-Dy for 25777@debbugs.gnu.org; Wed, 01 Mar 2017 20:20:37 -0500 Received: by mail-it0-f41.google.com with SMTP id m27so20111957iti.1 for <25777@debbugs.gnu.org>; Wed, 01 Mar 2017 17:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=8hkqOGYDPLkG2LZsmnQjEx0M9gnaLqBJIfdn27sm3kw=; b=JhPpHdfnREqEqSltUGK6ilmRFU2rwCvVCz9DzwHfRABitgAuCv18zsQndMw38Qnbar GtVUAHSnPWpJJj5E3PhVPV4FrFDJ7ZfDQurOgLiub3mKlXIorHBgvqeasErWJnLj/PZE t+WJjQoNFE/9/J0GqGzdtyhqyXoqLbIuP7I7BhkmyockRwEEokQgSu/s5Qd2SKRYfYkX VngsXf+oHkl2r5qYd0V20X/woWglSkesSW2o2zx53zGzaUkYrsKfRkq2+LsgeBBm+Cdn xQ6+VR0kzVRtyR/onaHxYLLJo/dHG/DnYGoIJyIrz/rQ1IP025QWskhXYvqdpIUPZDSe 95sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=8hkqOGYDPLkG2LZsmnQjEx0M9gnaLqBJIfdn27sm3kw=; b=oaTExf3ScWArPU67ShmS2VOSY7qta6EIpA7QCirhZW0pVlnfcPJBM2BzH/iQP5aVu/ gDvFZANwbA2UO7//kaXW4Bwq5HPsVyMn95b5PIcajt03xmefGQekHoyhC3+B/7nkLIYi oXsELV/HLWBhyg6LcLbT3WspKvcRsTwuPksZPiQ5OKv0LB75tvuuneWW/21r5nw0Ws5d YUQsTk8JdG2KTdq2udtYaDKHuqHMcjaAMX+wRwCHNgOx10ysq6K1zfoTFTsEMjjxMhAv DZLSx9wueS8/MJCkcJkKFuQvPAXaSuAjlWO/g1KnNHaK/5AgmXpvfWxdD2bdmyzP9/OK wDLw== X-Gm-Message-State: AMke39npy1XbF4v1ub7yJxmQWWHMg07N8t3H/cdYKqaOc9mmct5gIE4HJUAo1Iq05XzdOA== X-Received: by 10.36.137.68 with SMTP id s65mr6982978itd.70.1488417631883; Wed, 01 Mar 2017 17:20:31 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id h62sm2840217ioe.4.2017.03.01.17.20.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Mar 2017 17:20:30 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> Date: Wed, 01 Mar 2017 20:21:44 -0500 In-Reply-To: <512a3db8-49d0-4802-aecc-2d71049e0b25@default> (Drew Adams's message of "Tue, 28 Feb 2017 07:11:08 -0800 (PST)") Message-ID: <87zih4bhhz.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Tue, Feb 28, 2017 at 10:11 AM, Drew Adams wrote: > > But IMHO, it is generally better to scope a `save-excursion' > as tightly as possible around the movement that you want to > control (hide, erase, undo). Well, my opinion is just about the opposite, but I won't block the patch for that. > Why? Because it makes the code much clearer. It tells you > that outside the `save-excursion' zones point is unlikely > to be moved. And that makes maintenance easier and less > error-prone. I find wider scoping of `save-excursion' to be clearer. It tells you that the code outside the save-excursion zone cares about the original value of point. If there are multiple `save-excursion' zones, I have to look at what comes after each of them, to see what they're using point for. Therefore maintenance becomes harder and more error-prone with many smaller save-excursion calls. With a single save-excursion, it's immediately clear that the value of point is unchanged by the function. And it's clear that adding more code to the function will preserve that property, so maintenance is easier. > Putting a `s-e' at a wider location is analogous to putting > a mutex block at an unnecessarily wide location. (Yes, > there is no real connection between those two, but it comes > down to doing something only where/when it's needed.) I agree they are roughly analogous, but again come to the opposite conclusion. It would be simpler and clearer to make the mutex as wide as possible without causing deadlock, but for performance reasons, we choose as narrow a scope as possible. The performance reasons don't apply to save-excursion though. It comes down to doing something (grabbing/releasing a mutex or saving/restoring point) only where/when it's needed (which would be once at the beginning and end of the function in this case) rather than many redundant times (which would be each time goto-char is called). > If you confirm that you really want that wider scope here > for `s-e' then I'll do that. Otherwise, I'll keep the > `s-e' occurrences where they are but do the renaming and > add a doc string. Let me know. Thx. As I've explained, I prefer wider scope. However, the Emacs project doesn't have a policy on this as far as I know, so we're in a similar situation with pcase vs cond thing: the person making the patch makes the final decision. If you found my arguments for it unconvincing, and still feel strongly that narrower scope is better, I'll accept a patch with the small scopes too. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 01 21:32:24 2017 Received: (at 25777) by debbugs.gnu.org; 2 Mar 2017 02:32:24 +0000 Received: from localhost ([127.0.0.1]:35154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjGXY-00089P-84 for submit@debbugs.gnu.org; Wed, 01 Mar 2017 21:32:24 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:36666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjGXW-00089C-Lg for 25777@debbugs.gnu.org; Wed, 01 Mar 2017 21:32:23 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v222WFYc017903 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Mar 2017 02:32:15 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v222WF6S029380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Mar 2017 02:32:15 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v222WEXA015791; Thu, 2 Mar 2017 02:32:14 GMT MIME-Version: 1.0 Message-ID: <2560c8d7-532e-4882-b3d4-3845312d218f@default> Date: Wed, 1 Mar 2017 18:32:12 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> In-Reply-To: <87zih4bhhz.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > > But IMHO, it is generally better to scope a `save-excursion' > > as tightly as possible around the movement that you want to > > control (hide, erase, undo). >=20 > Well, my opinion is just about the opposite, but I won't block > the patch for that. >=20 > > Why? Because it makes the code much clearer. It tells you > > that outside the `save-excursion' zones point is unlikely > > to be moved. And that makes maintenance easier and less > > error-prone. >=20 > I find wider scoping of `save-excursion' to be clearer. It tells you > that the code outside the save-excursion zone cares about the original > value of point. It cannot really tell you that code outside the zone cares about point. That's not what `s-e' does. `s-e' only acts on code inside it. It can only tell you that code inside it will not move point (because of the `s-e'). Which means that any code outside it CAN care about (rely on) point. And that applies to the code outside the more narrowly defined zones too: they CAN care about point. A maintainer can use the value of point anywhere outside those narrowly defined zones. Whether the current code actually cares about point outside a given `s-e' is less important for maintenence than knowing where code in general _could_ care about point. And if do want `s-e' placement to suggest something about some code outside it actually using point then `s-e', i.e., if you want to adopt that as a coding convention (since it is not something that `s-e' tells you, itself), then such a convention does a poor job of telling you which outside code does the using. The `s-e' would have to be placed so that the _use_ of point were immediately next to the `s-e' occurrence (_just_ outside it). Otherwise, your principle would not be followed - you would not be masking as much point movement as possible, just up to where point is actually used. Such placement is too coarse - far coarser than placement with the intention (and the actual effect, because it is what `s-e' does) of indicating where `s-e' NEEDS to protect from point movement. But I accord that people can disagree about whether `s-e' placement should be done only where it is _needed_ or as widely as possible, just barely beyond where point is used. > If there are multiple `save-excursion' zones, I have > to look at what comes after each of them, to see what > they're using point for. No, you don't. What you can be pretty sure of is that _any_ code there _could_ use point. IOW, the normal state of affairs pertains outside the `s-e': you can use point. The default in Emacs is to not use `save-excursion' gratuitously. Code uses it only when/where it matters - where it's needed. Limiting its scope to where it really matters makes it clearer just where/when that is. There is no need to wrap wider, so why do it? > Therefore maintenance becomes harder and more error-prone > with many smaller save-excursion calls. That doesn't follow. Outside those zones, including anywhere else within the function body, maintenance is free to use or change point anyway that is called for. And on the contrary: If you put lots of stuff inside `s-e', stuff that need not use point, then when you go to make a change to something there you have to figure out whether - at that position inside - you could use point if you moved the `s-e' a bit etc. Where `s-e' is should tell you, "Here we're moving point only temporarily. We undo any such movement, so that beyond this zone you can continue to use it normally." > With a single save-excursion, it's immediately clear that > the value of point is unchanged by the function. By the function! Sure. But it tells you nothing about the code within the function. You seem to be assuming that all that matters is whether the function moves point. And that abstracts totally from the possibility of making future changes to the function code. What's more: that argument you just made is the same one I'm making, but for the code where the movement can be undone. IOW, you are making the same argument as I, but you are applying it only to the whole function. The whole function _need not_ have point-movement-must-be-undone imposed on it. That stops you from making changes to the code of the function that might need, here or there, to make use of point. > And it's clear that adding more code to the function will > preserve that property, so maintenance is easier. If you wrap the entire world with a `s-e' then clearly you can add code to the world and it will still be true that the world will not move point. However, you will be unable to treat any of the code in the function itself as places where you can make _use_ of point. You will not be able to use point anywhere in the world, if you've wrapped it all in `s-e'. > It comes down to doing something > (grabbing/releasing a mutex or saving/restoring point) > only where/when it's needed That's _my_ argument. I put it only where it is _needed_, which is where point movement _needs_ to be undone. You gratuitously want to envelope also other code, where point movement does _not_ need to be undone. Doing that, you tie your hands for future changes to other parts of the same function where you might want to use point. > (which would be once at the beginning and end of the > function in this case) rather than many redundant times > (which would be each time goto-char is called). We seem to have different meanings of "needing" to cancel (undo) point movement. It seems clear to me that if only the parts that actually move point have that movement canceled the result is correct behavior. Which means that there is no need to wrap more code. Wrapping more code is gratuitous, not necessary. And those places where point is moved can be independent. There is nothing inherently "redundant" about them. > > If you confirm that you really want that wider scope here > > for `s-e' then I'll do that. Otherwise, I'll keep the > > `s-e' occurrences where they are but do the renaming and > > add a doc string. Let me know. Thx. >=20 > As I've explained, I prefer wider scope. However, the Emacs project > doesn't have a policy on this as far as I know, so we're in a similar > situation with pcase vs cond thing: the person making the patch makes > the final decision. If you found my arguments for it unconvincing, > and still feel strongly that narrower scope is better, I'll accept a > patch with the small scopes too. And I feel just as accommodating. ;-) I wanted to make my argument, and have done so, but I really don't care what is done here to fix the bug. My suggestion, since I think we've both had our say and are unlikely to convince one another on the level of principle or guideline, is for you to please make the fix. Since it is you who will kindly make the actual code change and commit, you should/can do it however you like. I have no problem with that. But do you really need another patch for that, especially since wrapping widely, a single time, is so much simpler? ;-) Could you please make the change? Your way is fine by me, for this. Thx. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 02 13:13:47 2017 Received: (at 25777) by debbugs.gnu.org; 2 Mar 2017 18:13:47 +0000 Received: from localhost ([127.0.0.1]:36852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjVEZ-0002Sw-EP for submit@debbugs.gnu.org; Thu, 02 Mar 2017 13:13:47 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:49527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjVEX-0002Sg-Kl for 25777@debbugs.gnu.org; Thu, 02 Mar 2017 13:13:46 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v22IDds8025708 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Mar 2017 18:13:39 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v22IDcx8015904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Mar 2017 18:13:39 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v22IDbOi011140; Thu, 2 Mar 2017 18:13:38 GMT MIME-Version: 1.0 Message-ID: Date: Thu, 2 Mar 2017 10:13:36 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> In-Reply-To: <2560c8d7-532e-4882-b3d4-3845312d218f@default> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > My suggestion, since I think we've both had our say and are > unlikely to convince one another on the level of principle > or guideline, is for you to please make the fix. >=20 > Since it is you who will kindly make the actual code change > and commit, you should/can do it however you like. I have > no problem with that. >=20 > But do you really need another patch for that, especially > since wrapping widely, a single time, is so much simpler? ;-) > Could you please make the change? Your way is fine by me, > for this. Thx. Here is a possible doc string for the renamed `rectangle-pos-cols': "Return cons (START-COLUMN . END-COLUMN) of columns delimiting a rectangle. START and END are buffer positions of the rectangle corners. Optional argument WINDOW is the window displaying the rectangle. It defaults to the selected window." I'm not sure it is accurate, but I think so. (I'm no expert on this.) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 02 21:08:07 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 02:08:07 +0000 Received: from localhost ([127.0.0.1]:37210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjcdb-0002Ro-K5 for submit@debbugs.gnu.org; Thu, 02 Mar 2017 21:08:07 -0500 Received: from mail-it0-f46.google.com ([209.85.214.46]:38674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjcda-0002RI-1v for 25777@debbugs.gnu.org; Thu, 02 Mar 2017 21:08:06 -0500 Received: by mail-it0-f46.google.com with SMTP id m27so5136368iti.1 for <25777@debbugs.gnu.org>; Thu, 02 Mar 2017 18:08:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Qo2JQ8wm+sXup+U5sr2IEnUmHXsLIwn/HvVGld0wBhE=; b=ND+KXbdda0O9coIo+E02bGP9a5JYTs/sT8o6a+Ei4DSGSnhOwoREl24zYwhWG+S2Nw uujX9Q4oW3Ipfpf8ea04nV2FH1hAxg+ye4VykkbbDjaMYvcqXw++a0uk4DFkAbW09ZuQ vwqxaLqBtM5BKwLJGTzVgv9DVjIl8wiiJOnivky44lYJX8R3LXcQMmTURv2q6bx3Jb4U p+PZMcwvpudjKNHQcLTwHbYqPgqdFxTpIGvPXavXdD5q7jkeXt5vS+k03DkTVvN/FGjO UjBX3lSHIpVaHW/Mim4DQWtR3mRavawtxoKnvZT2Th7SQhrTMYvj9WQGDCKhkub9ncqz EhIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Qo2JQ8wm+sXup+U5sr2IEnUmHXsLIwn/HvVGld0wBhE=; b=bdqh8mk48cCxij9VONQ4cRTTC3Z2PbsuNWGBNfBC3IiMMMm4xVwcUIfLZ1qu55Hy9T M5No1e4i/G93HRSFr7jKufWwdwsjuXqMAKVo2DX+n7GrIglEuLW+FYRU2ZjtxBpoiL0t oEgtHTAcEY5ckECOlms+No3DrdWdhT1ED2kMZJi4LSdUbGCL4kG/AGNFSdiIMcqCkfyc k5BZB2WwsUqjCRBVpkX2I7ttzq/bkwoqrE0OytuBiNAlIEfgGyqEzL9qy3ldFms97HVe wXxN/xFUpu6oukuWMG2B2DcgoTfZyNlsGFwEN0mUByQ709U6jFL50ew9cdApb+5GgaeG sS1w== X-Gm-Message-State: AMke39kDonGp/vycgQzAIcu40OBDqBEubTiRIJ4gKcCCF9u3lb9CyP4wVXcU3y24jweQow== X-Received: by 10.36.23.74 with SMTP id 71mr1316170ith.37.1488506880384; Thu, 02 Mar 2017 18:08:00 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id e62sm4148781ioj.2.2017.03.02.18.07.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2017 18:07:59 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> Date: Thu, 02 Mar 2017 21:09:12 -0500 In-Reply-To: (Drew Adams's message of "Thu, 2 Mar 2017 10:13:36 -0800 (PST)") Message-ID: <8737evaz7b.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Drew Adams writes: >> My suggestion, since I think we've both had our say and are >> unlikely to convince one another on the level of principle >> or guideline, is for you to please make the fix. >> >> Since it is you who will kindly make the actual code change >> and commit, you should/can do it however you like. I have >> no problem with that. >> >> But do you really need another patch for that, especially >> since wrapping widely, a single time, is so much simpler? ;-) >> Could you please make the change? Your way is fine by me, >> for this. Thx. > > Here is a possible doc string for the renamed `rectangle-pos-cols': Yeah, the doc string is the tricky part. > > "Return cons (START-COLUMN . END-COLUMN) of columns delimiting a rectangle. I think the first line is too long. > START and END are buffer positions of the rectangle corners. > > Optional argument WINDOW is the window displaying the rectangle. > It defaults to the selected window." > > I'm not sure it is accurate, but I think so. (I'm no expert on this.) And looking at the function body again, I think it's checking some other things, and seems to have some side effects with respect to the current rectangle. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 01:30:00 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 06:30:00 +0000 Received: from localhost ([127.0.0.1]:37296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjgj2-0000Ei-4N for submit@debbugs.gnu.org; Fri, 03 Mar 2017 01:30:00 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:42351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjgiz-0000ET-Vq for 25777@debbugs.gnu.org; Fri, 03 Mar 2017 01:29:58 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v236TpoS004425 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Mar 2017 06:29:51 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v236Tpqe023638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Mar 2017 06:29:51 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v236TosC011761; Fri, 3 Mar 2017 06:29:50 GMT MIME-Version: 1.0 Message-ID: <9d559ea2-b66f-4b05-9b95-243651239e13@default> Date: Thu, 2 Mar 2017 22:29:48 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> <8737evaz7b.fsf@users.sourceforge.net> In-Reply-To: <8737evaz7b.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > > Here is a possible doc string for the renamed `rectangle-pos-cols': >=20 > Yeah, the doc string is the tricky part. >=20 > > > > "Return cons (START-COLUMN . END-COLUMN) of columns delimiting a > rectangle. >=20 > I think the first line is too long. "Return cons (START-COLUMN . END-COLUMN) of rectangle columns." > > START and END are buffer positions of the rectangle corners. > > > > Optional argument WINDOW is the window displaying the rectangle. > > It defaults to the selected window." > > > > I'm not sure it is accurate, but I think so. (I'm no expert on this.) >=20 > And looking at the function body again, I think it's checking some other > things, and seems to have some side effects with respect to the current > rectangle. No, I don't think so. What did you have in mind? It can reset window parameter `rectangle--point-crutches' or variable `rectangle--mark-crutches', but I don't think those actions are worth mentioning. Do you? Or did you have something else in mind? What side effects do you think it has on the current rectangle? Feel free to propose something different or let me know what you think needs to be said. I'll try to help with the wording, if needed. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 08:27:49 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 13:27:49 +0000 Received: from localhost ([127.0.0.1]:37526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjnFN-0005EM-9H for submit@debbugs.gnu.org; Fri, 03 Mar 2017 08:27:49 -0500 Received: from mail-it0-f47.google.com ([209.85.214.47]:34256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjnFM-0005E9-AD for 25777@debbugs.gnu.org; Fri, 03 Mar 2017 08:27:48 -0500 Received: by mail-it0-f47.google.com with SMTP id 207so929625ita.1 for <25777@debbugs.gnu.org>; Fri, 03 Mar 2017 05:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=vNuW6ys68UyA0fRPbER13MBQs/fzR357y1jrcAHJieA=; b=Wnu6da+q+O7m08dA3ekpJVXtsE5wJ8TatDprlT79e2CAmNw/Y2xl35gf0pX/Ys/1qO DQ26pH4nKZ7zdEqY3reKBA//do8ErWYcDW1ap4SUFu4xpJKg23JltZhDAZ/hXtUmzjpn qDMp+EnOmjNFPnJsMn6g6QwSjapTHtIk+T1BixYVnQ5YcZhZ3ARDs7QgyCfWMbuWBrCt 6dL5ttfRk8pdCIwmnzVDDhCYgxMi2DxgigU1kM3rmCql25iAfKRCk33cxGxoOEKkeO9f 3AUCy2c8KLuBzZzaglcu6zWdw+XiyP5dnw3vBZE7amaQsuDmoWBj7xutseR39kVgq61A RgWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=vNuW6ys68UyA0fRPbER13MBQs/fzR357y1jrcAHJieA=; b=Tj9Se5JwOey66JlCiM0xJhT8BIi9qrJKIHfebVdjmUE4NU6hjyUJrNgxITD6Grwt6p FR2M4b1GeiTpHLXloJJkOTTr2Mpi9CoIijZY//SDf1QuSdDIib6AZfCg4UuL7sWhAObd tJtUnCiCePEfurDGFLsFJCfb+aP2OUTtT7D7jDNmAfMs9EHLwAsiJM1nOlpPA3tX2Qw5 LIqU78faZEosHOVtEI5EavtvDgIUdHis0+qJp9vh0FcWVb8PGnMV/dblE1YcJUAx6j8Y 1UfXVH66Mo29s+Ma99H9YNwdy4leApNus8kNOusF67yH+udj5KmDHBYy8eTn9WICM5FR OFsQ== X-Gm-Message-State: AMke39kYFjdXI44PzorWQF4WtV4rfgvbYu8CYCi4h1t3aFBs8ZINGJUe8iAmy4qtxmH11w== X-Received: by 10.36.199.66 with SMTP id t63mr2711022itg.10.1488547662825; Fri, 03 Mar 2017 05:27:42 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id u206sm845942itc.24.2017.03.03.05.27.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Mar 2017 05:27:42 -0800 (PST) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> <8737evaz7b.fsf@users.sourceforge.net> <9d559ea2-b66f-4b05-9b95-243651239e13@default> Date: Fri, 03 Mar 2017 08:28:55 -0500 In-Reply-To: <9d559ea2-b66f-4b05-9b95-243651239e13@default> (Drew Adams's message of "Thu, 2 Mar 2017 22:29:48 -0800 (PST)") Message-ID: <87zih2a3qg.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Drew Adams writes: >> And looking at the function body again, I think it's checking some other >> things, and seems to have some side effects with respect to the current >> rectangle. > > No, I don't think so. What did you have in mind? It can > reset window parameter `rectangle--point-crutches' or variable > `rectangle--mark-crutches', but I don't think those actions are > worth mentioning. Do you? I thought they might be important. I'm not really sure what the user-visible effect of those are though. But perhaps if you're not interested in them, we should just add a function that does only what you want? (defun rectangle-columns (start end) "Return cons (START-COLUMN . END-COLUMN) of rectangle columns. START and END are buffer positions of the rectangle corners." (save-excursion (let ((startcol (progn (goto-char start) (current-column))) (endcol (progn (goto-char end) (current-column)))) ;; ensure the start column is the left one. (when (< endcol startcol) (let ((col startcol)) (setq startcol endcol endcol col))) (cons starcol endcol)))) From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 11:44:38 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 16:44:38 +0000 Received: from localhost ([127.0.0.1]:38673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjqJp-0003Im-QN for submit@debbugs.gnu.org; Fri, 03 Mar 2017 11:44:38 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:25091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjqJn-0003IZ-B0 for 25777@debbugs.gnu.org; Fri, 03 Mar 2017 11:44:36 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v23GiSWL001115 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 16:44:29 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v23GiSOK022224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 16:44:28 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v23GiRLi011679; Fri, 3 Mar 2017 16:44:28 GMT MIME-Version: 1.0 Message-ID: <2b01eb6e-53b3-4ca1-abe9-ef3090981863@default> Date: Fri, 3 Mar 2017 08:44:26 -0800 (PST) From: Drew Adams To: npostavs@users.sourceforge.net Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> <8737evaz7b.fsf@users.sourceforge.net> <9d559ea2-b66f-4b05-9b95-243651239e13@default> <87zih2a3qg.fsf@users.sourceforge.net> In-Reply-To: <87zih2a3qg.fsf@users.sourceforge.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > >> And looking at the function body again, I think it's checking some oth= er > >> things, and seems to have some side effects with respect to the curren= t > >> rectangle. > > > > No, I don't think so. What did you have in mind? It can > > reset window parameter `rectangle--point-crutches' or variable > > `rectangle--mark-crutches', but I don't think those actions are > > worth mentioning. Do you? >=20 > I thought they might be important. I'm not really sure what the > user-visible effect of those are though. AFAICT, those make use of recorded "crutches" (which are nowhere described explicitly, but which apparently associate a buffer position with a display column). And that, for a given window. They seem important for proper handling of a rectangle regarded with respect to display (columns are a display thing in this context). Put differently, and comparing the code and doc for Emacs 25 with previous releases, it seems that Emacs 25 started treating rectangles, in at least some cases, wrt _display_ and not just buffer position: respect of wide chars, window, places past eol, overlay, redisplay highlighting, even bidi to some extent, etc. The Emacs 25 NEWS says: Rectangle Mark mode can have corners past EOL or in the middle of a TAB. 'C-x C-x' in 'rectangle-mark-mode' now cycles through the four corners. 'string-rectangle' provides on-the-fly preview of the result. This seems to be an ongoing initiative (see the code comments, including for `rectangle--*-char'). We can perhaps expect even more treatment of a "rectangle" wrt its display. > But perhaps if you're not interested in them, we should just > add a function that does only what you want? >=20 > (defun rectangle-columns (start end)... That handles a rectangle in the older sense, but not, I guess, wrt the new concerns that Emacs 25 starts to address (display characteristics and needs - see above). I am really no expert on this. Perhaps the author of the Emacs 25 rectangle code could weigh in on it. My suggestion would be to stick to the code as is, since it is the way it is in order to handle rectangle display better. Sure, the housekeeping code it includes that deals with the "crutches" might not be needed to return columns in most cases. But it is apparently needed in some cases. Columns do need to take wide chars etc. into account. In any case, this code is used in the context of other rect.el code, where that housekeeping seems to play a role. I'd opt for keeping the display/housekeeping code, since the more complex code and the use cases that it handles subsumes the simpler use case that you propose. You can use it wrt rectangle appearance generally, including the rectangular region in a particular window. The use case I have, in `modeline-posn.el', is about the rectangular region. It tries to report on displayed columns, not buffer positions. So I think that for my use case, at least, I need the full-blown `rectangle--pos-cols' code (under whatever name). Now, you will say that `current-column' also claims to DTRT wrt display, taking into account "widths of all the displayed representations of the character...". I don't understand this stuff well enough to say why so much more code apparatus (crutches, a window parameter) is needed for the Emacs 25 support of rectangles. Partly out of concern for my ignorance I'd opt to not try to simplify this. Just one opinion, and quite uninformed in this case. Enlightenment welcome. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 13:16:44 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 18:16:44 +0000 Received: from localhost ([127.0.0.1]:38754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjrky-0005X9-48 for submit@debbugs.gnu.org; Fri, 03 Mar 2017 13:16:44 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:35754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjrkw-0005Ww-7R for 25777@debbugs.gnu.org; Fri, 03 Mar 2017 13:16:42 -0500 Received: by mail-oi0-f43.google.com with SMTP id 62so59878208oih.2 for <25777@debbugs.gnu.org>; Fri, 03 Mar 2017 10:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qSLTR0LuQ/f2wcnPJElloZEvjp4/xdCYtGSO/pUFxgo=; b=KLb58tcCQl3r8rQp31JQHexbpc9sDPHWGpTHuWLOVtRSg6HsHJJx9DkFAXcK8hlk1j 6fUpAyj55DI7VSAsEybEpHLBteFcGvtf+0/rMIc3QI7zXYBzVZkamZmSD2EPN6Vt6Fju L9J72IHQWIjGYAJ0AXlTTLS7fF2NVNlz3td+kKKdoELD9F5dJil0PzqU64jDLNCOjvEU lwiCpKxTXgtOI/RfvcJ/s6hjCEb6MVyuyutQliuNL7v1ufSTpvOa7SMoxgA+a/MXMopC D7J7JM/ETS0ZblVnS01v0cq5A1hFUePSMD3+cRk2KbBc2lT15exBqXQB0pnxRhyuLWz1 Fe8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qSLTR0LuQ/f2wcnPJElloZEvjp4/xdCYtGSO/pUFxgo=; b=MKwgbaqXnQhnCTwldD8aDxWKp5l7gMsKt0C5ltkvANOUltGeXebrSV7dVA/10sSniJ 1/ttb8R7bjcNYQMypICX2COnPQF48tLzxy5XZCVHnzJXND7prC2UiWwF58v5znh/fht+ 0WduidUUnRatH09A323UcnSVJMOSF9oDaUq6fUDUGwY706dS7Lm93BiZ8XBB60MDBmqZ Q1KSaPTJZru5L2UihRdl/4VhXp4amScy6IrQqEghlcmurN1U3Woq+TJzv+O475eA9yQS D6753Lqy6PEKsUUWGWZ5jym40Qbyg0Ra14/Nyaf3aNFhL31GpdKeQfcKKcU5/TYY6kTi UesA== X-Gm-Message-State: AMke39mhft2q4T1UnddVs8MbE3qfUEgOMGTHTs+LnDOhTfSYCbAEKTVul+tMiTaz/TVACbIOQg4c8DTBJch+Hw== X-Received: by 10.202.89.139 with SMTP id n133mr1955217oib.70.1488564996441; Fri, 03 Mar 2017 10:16:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.35.87 with HTTP; Fri, 3 Mar 2017 10:16:35 -0800 (PST) In-Reply-To: <2b01eb6e-53b3-4ca1-abe9-ef3090981863@default> References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> <8737evaz7b.fsf@users.sourceforge.net> <9d559ea2-b66f-4b05-9b95-243651239e13@default> <87zih2a3qg.fsf@users.sourceforge.net> <2b01eb6e-53b3-4ca1-abe9-ef3090981863@default> From: Noam Postavsky Date: Fri, 3 Mar 2017 13:16:35 -0500 X-Google-Sender-Auth: dkT5XPD0FZDzMyfBGqCwhmitv38 Message-ID: Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point To: Drew Adams Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Fri, Mar 3, 2017 at 11:44 AM, Drew Adams wrote: >> > >> > No, I don't think so. What did you have in mind? It can >> > reset window parameter `rectangle--point-crutches' or variable >> > `rectangle--mark-crutches', but I don't think those actions are >> > worth mentioning. Do you? >> >> I thought they might be important. I'm not really sure what the >> user-visible effect of those are though. > > AFAICT, those make use of recorded "crutches" (which are > nowhere described explicitly, but which apparently associate > a buffer position with a display column). And that, for a > given window. > > They seem important for proper handling of a rectangle > regarded with respect to display (columns are a display > thing in this context). > > Put differently, and comparing the code and doc for Emacs 25 > with previous releases, it seems that Emacs 25 started > treating rectangles, in at least some cases, wrt _display_ > and not just buffer position: respect of wide chars, window, > places past eol, Ah, with this hint I figured out what the user-visible side-effect is, from 'emacs -Q' do: C-x SPC C-3 C-p M-f ;; the bottom 2 lines of the rectangle now extend past eol C-x C-x ;; point is now past eol M-: (save-excursion (rectangle--pos-cols 1 3)) RET ;; => (0 . 2) C-f ;; Now point jumps to column 1 instead of 8. So calling rectangle--pos-cols with START and END not corresponding to the current rectangle can mess with the selection. > > The use case I have, in `modeline-posn.el', is about the > rectangular region. It tries to report on displayed > columns, not buffer positions. So I think that for my > use case, at least, I need the full-blown > `rectangle--pos-cols' code (under whatever name). Perhaps you want this: (defun rectangle-columns () "Return the current rectangle's columns. The return value is a cons of the form (START-COLUMN . END-COLUMN)." (save-excursion (rectangle--pos-cols (region-beginning) (region-end)))) Which should call rectangle--pos-cols only with positions corresponding to the current rectangle, and so won't be able to affect the selection (I think?). From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 14:17:27 2017 Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 19:17:27 +0000 Received: from localhost ([127.0.0.1]:38785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjshi-0006yl-OS for submit@debbugs.gnu.org; Fri, 03 Mar 2017 14:17:26 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:41259) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjshh-0006yY-9Q for 25777@debbugs.gnu.org; Fri, 03 Mar 2017 14:17:25 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v23JHIHV006060 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 19:17:19 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v23JHHVo027352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 19:17:18 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v23JHGvx017001; Fri, 3 Mar 2017 19:17:17 GMT MIME-Version: 1.0 Message-ID: <55d34807-bfb8-4543-842b-220af90d5557@default> Date: Fri, 3 Mar 2017 11:17:15 -0800 (PST) From: Drew Adams To: Noam Postavsky Subject: RE: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> <512a3db8-49d0-4802-aecc-2d71049e0b25@default> <87zih4bhhz.fsf@users.sourceforge.net> <2560c8d7-532e-4882-b3d4-3845312d218f@default> <8737evaz7b.fsf@users.sourceforge.net> <9d559ea2-b66f-4b05-9b95-243651239e13@default> <87zih2a3qg.fsf@users.sourceforge.net> <2b01eb6e-53b3-4ca1-abe9-ef3090981863@default> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 25777 Cc: 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > Ah, with this hint I figured out what the user-visible side-effect is, > from 'emacs -Q' do: >=20 > C-x SPC > C-3 C-p M-f ;; the bottom 2 lines of the rectangle now extend past eol > C-x C-x ;; point is now past eol > M-: (save-excursion (rectangle--pos-cols 1 3)) RET ;; =3D> (0 . 2) > C-f ;; Now point jumps to column 1 instead of 8. Thanks. Yes, I see that. Except that even though point is in column 1, M-: (current-column) says it is in column 0 (should it?). > So calling rectangle--pos-cols with START and END not corresponding to > the current rectangle can mess with the selection. (I call it only with START and END for the selection, i.e., the active region.) > > The use case I have, in `modeline-posn.el', is about the > > rectangular region. It tries to report on displayed > > columns, not buffer positions. So I think that for my > > use case, at least, I need the full-blown > > `rectangle--pos-cols' code (under whatever name). >=20 > Perhaps you want this: >=20 > (defun rectangle-columns () > "Return the current rectangle's columns. > The return value is a cons of the form (START-COLUMN . END-COLUMN)." > (save-excursion > (rectangle--pos-cols (region-beginning) (region-end)))) (save-excursion (rectangle--pos-cols (region-beginning) (region-end))) is indeed what I use. > Which should call rectangle--pos-cols only with positions > corresponding to the current rectangle, and so won't be able to affect > the selection (I think?). That makes sense. But I don't think that is what a function called `rectangle-columns' should do. What you show is a function that is better called something like `rectangle-region-columns', and its doc string would need to say that it returns the columns for the region. And I think it is probably not useful when the region is active - in that case, what you showed before, which just uses `current-column', is probably more useful. I'm not sure where we should go from here. The fix to _this bug_ is to add `save-excursion', however you want to do that. Whether this function should be renamed or another function should be created, and in the latter case, whether it should be able to work correctly whether or not the region is active, I'm not sure. I propose that you (please) fix and close this bug by adding `save-excursion', and you (please) submit a question to emacs-devel about what should be done for a (new) function that returns the column positions of an arbitrary rectangle (defined by START and END positions). Is such a function useful, and if yes, just what should it do? One possibility might be to give such a function conditional behavior: . If region is active, use it (as you do above, and as I do in my code). . If not, do the simpler calculation, not trying to take any special display matters into account, beyond what `current-column' handles. Dunno. I have the answer for my code (I wrap the `rectangle--pos-cols' calls with `save-excursion'). And I think it would be good to fix `r--p-c' by adding `save-excursion'. (And I suspect that other `goto-char' occurrences added for Emacs 25 to rect.el should also be so wrapped.) Beyond that, what might be a useful `rectangle-pos-cols' function, I'm not sure. We'd want a function that, given `pos' (i.e., two positions START and END) returns `cols' (i.e., two columns). And I think we'd want it to DTRT for both the active-region case and the case where the region is not active (and so not taken into account). When the region is not active, I don't think (but I'm not sure) that things need to be complicated, since `current-column' should already DTRT wrt wide chars etc. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 24 13:11:09 2019 Received: (at 25777) by debbugs.gnu.org; 24 Jun 2019 17:11:09 +0000 Received: from localhost ([127.0.0.1]:57863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfSUk-0003h2-Lv for submit@debbugs.gnu.org; Mon, 24 Jun 2019 13:11:09 -0400 Received: from quimby.gnus.org ([80.91.231.51]:33744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfSUi-0003gq-NL for 25777@debbugs.gnu.org; Mon, 24 Jun 2019 13:11:05 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfSUd-0005e3-NB; Mon, 24 Jun 2019 19:11:01 +0200 From: Lars Ingebrigtsen To: npostavs@users.sourceforge.net Subject: Re: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <87tw7edi9d.fsf@users.sourceforge.net> Date: Mon, 24 Jun 2019 19:10:59 +0200 In-Reply-To: <87tw7edi9d.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Mon, 27 Feb 2017 23:57:50 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: npostavs@users.sourceforge.net writes: > I think it's reasonable to make rectangle--pos-cols preserve point. > Could you update your patch to > > 1. Use a single save-excursion around the whole body, instead of adding > several. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 25777 Cc: Drew Adams , 25777@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) npostavs@users.sourceforge.net writes: > I think it's reasonable to make rectangle--pos-cols preserve point. > Could you update your patch to > > 1. Use a single save-excursion around the whole body, instead of adding > several. I've now done this change, which seem obviously correct. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 24 13:11:10 2019 Received: (at control) by debbugs.gnu.org; 24 Jun 2019 17:11:11 +0000 Received: from localhost ([127.0.0.1]:57866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfSUo-0003hI-Ns for submit@debbugs.gnu.org; Mon, 24 Jun 2019 13:11:10 -0400 Received: from quimby.gnus.org ([80.91.231.51]:33770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfSUl-0003h3-D5 for control@debbugs.gnu.org; Mon, 24 Jun 2019 13:11:09 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfSUi-0005eH-VJ for control@debbugs.gnu.org; Mon, 24 Jun 2019 19:11:06 +0200 Date: Mon, 24 Jun 2019 19:11:04 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #25777 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 25777 fixed close 25777 27.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 25777 fixed close 25777 27.1 quit From unknown Fri Aug 15 15:27:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 23 Jul 2019 11:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator