all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: npostavs@users.sourceforge.net
Cc: 25777@debbugs.gnu.org
Subject: bug#25777: 25.1; [PATCH] `rectangle--pos-cols' should not move point
Date: Tue, 28 Feb 2017 07:11:08 -0800 (PST)	[thread overview]
Message-ID: <512a3db8-49d0-4802-aecc-2d71049e0b25@default> (raw)
In-Reply-To: <87tw7edi9d.fsf@users.sourceforge.net>

> > I think it's great that a function such as `rectangle--pos-cols'
> > was added.  (But it has no business being considered "internal".)
> >
> > Do you really think that a function whose only purpose is
> > to let you know what the rectangle columns are should move
> > point and leave it in a position that is not one of the
> > rectangle corners?
> 
> After looking over this thread again, I conclude we got totally
> side-tracked on the question of whether this is a regression or not.
> That's just a distraction.

I agree, and that was my fault.  In my mind it caused my code
to regress.  My bad.

> I think it's reasonable to make rectangle--pos-cols preserve point.
> Could you update your patch to
> 
> 1. Use a single save-excursion around the whole body, instead of adding
> several.
> 2. Rename rectangle--pos-cols to rectangle-pos-cols.
> 3. Add a docstring to rectangle-pos-cols.

I could do that, yes.

But IMHO, it is generally better to scope a `save-excursion'
as tightly as possible around the movement that you want to
control (hide, erase, undo).

Unless there is something critical for performance (and I
don't think `save-excursion' is costly), that's better.

Why?  Because it makes the code much clearer.  It tells you
that outside the `save-excursion' zones point is unlikely
to be moved.  And that makes maintenance easier and less
error-prone.

Putting a `s-e' at a wider location is analogous to putting
a mutex block at an unnecessarily wide location.  (Yes,
there is no real connection between those two, but it comes
down to doing something only where/when it's needed.)

If you confirm that you really want that wider scope here
for `s-e' then I'll do that.  Otherwise, I'll keep the
`s-e' occurrences where they are but do the renaming and
add a doc string.  Let me know.  Thx.





  reply	other threads:[~2017-02-28 15:11 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
2017-02-28  4:57           ` npostavs
2017-02-28 15:11             ` Drew Adams [this message]
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=512a3db8-49d0-4802-aecc-2d71049e0b25@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.