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: Fri, 3 Mar 2017 13:16:35 -0500 Message-ID: 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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1488565034 21413 195.159.176.226 (3 Mar 2017 18:17:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2017 18:17:14 +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 Fri Mar 03 19:17:10 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 1cjrlN-0004zk-Az for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 19:17:09 +0100 Original-Received: from localhost ([::1]:59531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjrlT-00080W-Gy for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 13:17:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjrlL-0007yq-Aw for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 13:17:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjrlH-0001Ra-7G for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 13:17:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjrlG-0001RM-OG for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 13:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cjrlG-0005Xi-IQ for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 13:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2017 18:17: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: Original-Received: via spool by 25777-submit@debbugs.gnu.org id=B25777.148856500421280 (code B ref 25777); Fri, 03 Mar 2017 18:17:02 +0000 Original-Received: (at 25777) by debbugs.gnu.org; 3 Mar 2017 18:16:44 +0000 Original-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 Original-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 Original-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) Original-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> X-Google-Sender-Auth: dkT5XPD0FZDzMyfBGqCwhmitv38 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:130121 Archived-At: 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?).