all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 25777@debbugs.gnu.org
Subject: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point
Date: Mon, 27 Feb 2017 12:35:46 -0800 (PST)	[thread overview]
Message-ID: <10ab8045-4123-4b3c-b0ea-f981cb99825e@default> (raw)
In-Reply-To: <CAM-tV--Fbc3QtTpvT4H_YHBdfhGE5K0DMybqwT-am9taLs=+Ng@mail.gmail.com>

> > 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.

You still don't understand, it seems.  The workaround for my
code is obvious, and I have made it: wrapped each call to
`rectangle--pos-cols' in `save-excursion'.

The point of filing the bug is to help Emacs, not my code.
I wanted you to be able to test to repro the bug using my
code before adding a `save-excursion' wrapper.

Clearly I have to add such a wrapper anyway, since my library
needs to support Emacs 25.1 (in addition to 22-24).  A fix of
`rectangle--pos-cols' for Emacs 25.2 or later would not let me
avoid wrapping with `save-excursion'.  It cannot possibly be
for the benefit of my code that this bug gets fixed or that I
filed the bug.

Clearly I think that this function should clean up after
itself, using `save-excursion'.  Its _only_ purpose, AFAICT,
is its return value, not (also) the side effect of leaving
point somewhere other than at the rectangle corner.

Clearly you disagree about that - that it should clean up
after itself.  Do you also think that it is important that
it leave point at a new location?  Is there a reason that
it _should_ have that side effect, and not simply return
the proper value?

> > 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 you call "unneeded" and "clutter" I call normal and clean.
What you call uncluttered code I call irresponsible code.  We
will, I guess, just have to agree to disagree about this.

> > 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.

Not if code calls only `apply-on-rectangle', no.

Apparently you don't think that `rectangle--pos-cols' is (or
could be, if the bug were fixed) a useful general function.
That's OK.  Users will just roll their own.  I think we can
end this discussion now - feel free to close it as wont-fix.
Thanks for spending time looking into it, anyway (sincerely).





  reply	other threads:[~2017-02-27 20:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 17:51 bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point Drew Adams
2017-02-19 17:38 ` Drew Adams
2017-02-27  1:37   ` npostavs
2017-02-27  6:24     ` Drew Adams
2017-02-27 13:44       ` npostavs
2017-02-27 17:51         ` Drew Adams
2017-02-27 18:50           ` Noam Postavsky
2017-02-27 19:21             ` Drew Adams
2017-02-27 19:47               ` Noam Postavsky
2017-02-27 20:35                 ` Drew Adams [this message]
2017-02-28  4:57           ` npostavs
2017-02-28 15:11             ` Drew Adams
2017-03-02  1:21               ` npostavs
2017-03-02  2:32                 ` Drew Adams
2017-03-02 18:13                   ` Drew Adams
2017-03-03  2:09                     ` npostavs
2017-03-03  6:29                       ` Drew Adams
2017-03-03 13:28                         ` npostavs
2017-03-03 16:44                           ` Drew Adams
2017-03-03 18:16                             ` Noam Postavsky
2017-03-03 19:17                               ` Drew Adams
2019-06-24 17:10             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10ab8045-4123-4b3c-b0ea-f981cb99825e@default \
    --to=drew.adams@oracle.com \
    --cc=25777@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.