all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: A problem (apparently) connected with window point
Date: Sat, 03 Apr 2021 11:22:07 -0400	[thread overview]
Message-ID: <jwvk0pjxuq0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 87r1js82xc.fsf@mbork.pl

>> That's right.  To avoid the problem you have to understand that
>> `(with-current-buffer reorder-sentence--buffer ...)` will select the
>> right buffer but will place point at a location that depends on what was
>> the last use of that buffer (and redisplay *is* a use of that buffer,
>> which is why having the buffer displayed makes a difference).
>> In your case I think you have two options:
>
> Thanks!  I have to admit that I still don't get _why_ this is
> happening.

Where do you expect `with-current-buffer` (or `set-buffer` for that
matter) to put the position of `point`?  Remember that between execution
of two commands, there can be a *lot* of other code that will be running
(via redisplay, jit-lock, post/pre-command-hook, you name it).

So while you want to go back to where *you* were, Emacs doesn't really
know what you mean by that.


        Stefan




      reply	other threads:[~2021-04-03 15:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  4:15 A problem (apparently) connected with window point Marcin Borkowski
2021-04-02  5:54 ` Eli Zaretskii
2021-04-02 12:13 ` Stefan Monnier
2021-04-03  3:25   ` Marcin Borkowski
2021-04-03 15:22     ` Stefan Monnier [this message]

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=jwvk0pjxuq0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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.