bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point


From: npostavs
Subject: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point
Date: Fri, 03 Mar 2017 08:28:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Drew Adams <drew.adams@oracle.com> 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))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]