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

2011-05-25 Thread Dmitry Kurochkin
On Tue, 24 May 2011 16:20:34 -0700, Carl Worth wrote: > On Tue, 24 May 2011 18:43:41 -0400, Austin Clements > wrote: > > Saving point this way is a bit dangerous, though. For example, if > > you're near the end of the buffer and shorten the label, attempting to > > restore the point could

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

2011-05-25 Thread Dmitry Kurochkin
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. --- emacs/notmuch-wash.el | 13

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

2011-05-25 Thread Dmitry Kurochkin
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements wrote: > On Tue, May 24, 2011 at 6:16 PM, Dmitry Kurochkin > wrote: > > When a user clicks the button, the cursor is somewhere inside the old > > label. ?If we save the point as a marker, after step 3 it would end up > > at the position where

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

2011-05-25 Thread Dmitry Kurochkin
On Tue, 24 May 2011 15:01:04 -0700, Carl Worth wrote: > On Wed, 25 May 2011 00:43:20 +0400, Dmitry Kurochkin gmail.com> wrote: > > Now, looking at Emacs source code, save_excursion_save() uses > > point_marker() to save the point. As you said above, markers are > > updated when the

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

2011-05-25 Thread Dmitry Kurochkin
Hi Carl. On Tue, 24 May 2011 13:20:56 -0700, Carl Worth wrote: > On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin 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

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

2011-05-24 Thread Austin Clements
On Tue, May 24, 2011 at 6:16 PM, Dmitry Kurochkin wrote: > When a user clicks the button, the cursor is somewhere inside the old > label. ?If we save the point as a marker, after step 3 it would end up > at the position where the old label was. ?If the new label is inserted > before the old one,

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

2011-05-24 Thread Carl Worth
On Wed, 25 May 2011 03:27:51 +0400, Dmitry Kurochkin wrote: > (button-end cite-button) would move the point outside the button - to > the next character after it. OK. Your fix addresses my off-by-one bug. I've just pushed the whole series, with your final amended fix, (and some updates I made to

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

2011-05-24 Thread Carl Worth
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements wrote: > Saving point this way is a bit dangerous, though. For example, if > you're near the end of the buffer and shorten the label, attempting to > restore the point could result in an error (or, a more benign example: > the cursor could wind

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

2011-05-24 Thread Carl Worth
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements wrote: > Saving point this way is a bit dangerous, though. For example, if > you're near the end of the buffer and shorten the label, attempting to > restore the point could result in an error (or, a more benign example: > the cursor could wind

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

2011-05-24 Thread Carl Worth
On Wed, 25 May 2011 02:16:06 +0400, Dmitry Kurochkin wrote: > Since the newbutton is placed at the same position where the old one was, > restoring > the point to the same offset it was at the beginning works as we need. Thanks for explaining this. I'll experiment a bit and push the series,

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

2011-05-24 Thread Carl Worth
On Wed, 25 May 2011 00:43:20 +0400, Dmitry Kurochkin wrote: > Now, looking at Emacs source code, save_excursion_save() uses > point_marker() to save the point. As you said above, markers are > updated when the corresponding text is updated. That explains why the > cursor jumps when using

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

2011-05-24 Thread Carl Worth
On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin 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

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

2011-05-24 Thread Carl Worth
On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin dmitry.kuroch...@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

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

2011-05-24 Thread Dmitry Kurochkin
Hi Carl. On Tue, 24 May 2011 13:20:56 -0700, Carl Worth cwo...@cworth.org wrote: On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: Before the change, save-excursion was used to save the point. But the restored position is affected by buffer

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

2011-05-24 Thread Dmitry Kurochkin
On Tue, 24 May 2011 15:01:04 -0700, Carl Worth cwo...@cworth.org wrote: On Wed, 25 May 2011 00:43:20 +0400, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: Now, looking at Emacs source code, save_excursion_save() uses point_marker() to save the point. As you said above, markers are

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

2011-05-24 Thread Austin Clements
On Tue, May 24, 2011 at 6:16 PM, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: When a user clicks the button, the cursor is somewhere inside the old label.  If we save the point as a marker, after step 3 it would end up at the position where the old label was.  If the new label is inserted

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

2011-05-24 Thread Carl Worth
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements amdra...@mit.edu wrote: Saving point this way is a bit dangerous, though. For example, if you're near the end of the buffer and shorten the label, attempting to restore the point could result in an error (or, a more benign example: the

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

2011-05-24 Thread Dmitry Kurochkin
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements amdra...@mit.edu wrote: On Tue, May 24, 2011 at 6:16 PM, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: When a user clicks the button, the cursor is somewhere inside the old label.  If we save the point as a marker, after step 3 it

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

2011-05-24 Thread Dmitry Kurochkin
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. --- emacs/notmuch-wash.el | 13

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

2011-05-24 Thread Carl Worth
On Tue, 24 May 2011 18:43:41 -0400, Austin Clements amdra...@mit.edu wrote: Saving point this way is a bit dangerous, though. For example, if you're near the end of the buffer and shorten the label, attempting to restore the point could result in an error (or, a more benign example: the

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

2011-05-24 Thread Dmitry Kurochkin
On Tue, 24 May 2011 16:20:34 -0700, Carl Worth cwo...@cworth.org wrote: On Tue, 24 May 2011 18:43:41 -0400, Austin Clements amdra...@mit.edu wrote: Saving point this way is a bit dangerous, though. For example, if you're near the end of the buffer and shorten the label, attempting to

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

2011-05-24 Thread Carl Worth
On Wed, 25 May 2011 03:27:51 +0400, Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote: (button-end cite-button) would move the point outside the button - to the next character after it. OK. Your fix addresses my off-by-one bug. I've just pushed the whole series, with your final amended fix,

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

2011-05-23 Thread Dmitry Kurochkin
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. --- emacs/notmuch-wash.el | 13

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

2011-05-23 Thread Dmitry Kurochkin
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. --- emacs/notmuch-wash.el | 13