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

Previous Next

Package: emacs;

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 #29 received at 25777 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 25777 <at> debbugs.gnu.org
Subject: Re: bug#25777: 25.1;
 [PATCH] `rectangle--pos-cols' should not move point
Date: Mon, 27 Feb 2017 14:47:57 -0500
On Mon, Feb 27, 2017 at 2:21 PM, Drew Adams <drew.adams <at> oracle.com> 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.




This bug report was last modified 6 years and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.