GNU bug report logs -
#25777
25.1; [PATCH] `rectangle--pos-cols' should not move point
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Fri, 17 Feb 2017 17:52:01 UTC
Severity: wishlist
Tags: fixed
Found in version 25.1
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #62 received at 25777 <at> debbugs.gnu.org (full text, mbox):
On Fri, Mar 3, 2017 at 11:44 AM, Drew Adams <drew.adams <at> oracle.com> 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?).
This bug report was last modified 6 years and 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.