[PATCH] Save and restore point explicitly in `notmuch-wash-toggle-invisible-action'.

Carl Worth cworth at cworth.org
Tue May 24 13:20:56 PDT 2011


On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> Before the change, save-excursion was used to save the point.
> But the restored position is affected by buffer modifications,
> which results in jumping cursor.  The patch saves and restores
> point explicitly by using a variable instead of save-excursion.

Dmitry,

Thanks so much for the improvement to the button text! This will be a
nice thing to add.

But this patch confuses me. I can understand how a buffer-position
variable can cause the cursor to jump. That's usually the kind of thing
that can be fixed by switching from an integer position to a marker
instead, (since markers are updated when the corresponding text is
updated).

But in this case, I don't see how:

	(let ((old-point (point)))
        	... code here ...
	  (goto-char old-point))

is distinct from:

	(save-excursion
		... code here ...
	 )

except that save-excursion actually does the right thing in the case of
abnormal exit (throw or error).

Can you help me understand what I'm missing here?

-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110524/002c6264/attachment.pgp>


More information about the notmuch mailing list