From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point Date: Mon, 27 Feb 2017 12:35:46 -0800 (PST) Message-ID: <10ab8045-4123-4b3c-b0ea-f981cb99825e@default> References: <1efbacdb-7d86-454d-b0e0-7a783c47b804@default> <87poi4e7mv.fsf@users.sourceforge.net> <877f4beok7.fsf@users.sourceforge.net> <3e265625-6c16-424c-9fb2-6a7144dcc349@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1488230134 29042 195.159.176.226 (27 Feb 2017 21:15:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 21:15:34 +0000 (UTC) Cc: 25777@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 27 22:15:29 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciSde-0006Mj-L2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 22:15:22 +0100 Original-Received: from localhost ([::1]:56926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciSdk-00059q-Np for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 16:15:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciS1g-0005Pj-2l for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 15:36:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciS1b-0002Ez-4i for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 15:36:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60524) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciS1a-0002Eq-Qo for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 15:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ciS1a-0007sb-EH for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 15:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2017 20:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25777 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25777-submit@debbugs.gnu.org id=B25777.148822775730278 (code B ref 25777); Mon, 27 Feb 2017 20:36:02 +0000 Original-Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 20:35:57 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 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)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129911 Archived-At: > > 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).