From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point Date: Mon, 27 Feb 2017 14:47:57 -0500 Message-ID: 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 X-Trace: blaine.gmane.org 1488225695 29953 195.159.176.226 (27 Feb 2017 20:01:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 20:01:35 +0000 (UTC) Cc: 25777@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 27 21:01:28 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 1ciRU0-0006P6-M5 for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 21:01:20 +0100 Original-Received: from localhost ([::1]:56443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciRU6-00037P-Lk for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 15:01:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciRIA-0001nn-3E for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 14:49:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciRI6-0000Kb-6m for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 14:49:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciRI6-0000KV-39 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 14:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ciRI5-0006nl-TV for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 14:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2017 19:49:01 +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.148822488526081 (code B ref 25777); Mon, 27 Feb 2017 19:49:01 +0000 Original-Received: (at 25777) by debbugs.gnu.org; 27 Feb 2017 19:48:05 +0000 Original-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 Original-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 Original-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) Original-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> X-Google-Sender-Auth: 0AFTGa6at_ty9pa7cwLagQ0QciY 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:129904 Archived-At: 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.