unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Robert Weiner <rsw@gnu.org>
Cc: rswgnu@gmail.com,  emacs-devel <emacs-devel@gnu.org>
Subject: Re: [elpa] externals/hyperbole c501027 2/2: Fix set-buffer byte-compiler warnings; remove outdated references
Date: Mon, 10 May 2021 21:25:11 -0400	[thread overview]
Message-ID: <jwvsg2uqds7.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CA+OMD9hR+cf6wP_CUanPrB3ZaZfP8V5=2QV+W7J=jheQLTpuwQ@mail.gmail.com> (Robert Weiner's message of "Mon, 10 May 2021 20:18:11 -0400")

> Eli and I exchanged messages about this on the emacs-devel list and settled
> on the outer save-excursion as you first wrote below since it is indeed the
> original buffer whose point we want to save which may be manipulated by
> some subroutine deep within the with-current-buffer that changes the buffer
> back to the original.  Thanks as always for the pointers though.  -- Bob

That seems to point at a very unusual arrangement which you might want
(in the longer term) to reconsider, e.g. by moving the `save-excursion`
to the "deep within" place that actually moves the point in the "outer
buffer".

In the mean time, adding a comment explaining what's going on
(e.g. giving an example scenario where point would be moved unexpectedly
in the outer buffer)would go a long way.

Similarly for the

  (save-excursion
    (with-current-buffer (find-file-noselect (expand-file-name hbmap:filename hbmap:dir-user))
      (save-excursion

in `gbut:ebut-program` because without an explanatory comment, this looks
like the kind of code you get when the author just "added
`save-excursion`s a bit at random until point stopped moving" ;-)


        Stefan




  reply	other threads:[~2021-05-11  1:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210510035708.29543.25002@vcs0.savannah.gnu.org>
     [not found] ` <20210510035709.E742920DFD@vcs0.savannah.gnu.org>
2021-05-10 13:59   ` [elpa] externals/hyperbole c501027 2/2: Fix set-buffer byte-compiler warnings; remove outdated references Stefan Monnier
2021-05-11  0:18     ` Robert Weiner
2021-05-11  1:25       ` Stefan Monnier [this message]
2021-05-11 15:15     ` Jean Louis

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvsg2uqds7.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=rsw@gnu.org \
    --cc=rswgnu@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).