Subject: Re: bug#13769: gnus-tree-hightlight-article moves point in summary buffer

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 30 Jan 2014 16:25:06 -0800

Lars Ingebrigtsen <[email-masked]> writes:

> Dave Abrahams <[email-masked]> writes:
>
>> This bug affects gnus-summary-mark-forward; the point moves backward in
>> the summary buffer quite perplexingly.  The following patch seems to
>> suppress the symptoms of the bug:
>
> [...]
>
>>  (defun gnus-tree-highlight-article (article face)
>> +  (save-excursion
>>    (with-current-buffer (gnus-get-tree-buffer)
>>      (let (region)
>>        (when (setq region (gnus-tree-article-region article))
>>  	(gnus-put-text-property (car region) (cdr region) 'face face)
>>  	(set-window-point
>>  	 (gnus-get-buffer-window (current-buffer) t) (cdr region))))))
>> +  )
>
> Hm.  I don't quite understand this patch.  `save-excursion' saves the
> point in the current buffer, and what the current buffer is.  The bit
> inside the save-excursion all happens in a different buffer, so point in
> the current buffer shouldn't change at all.
>
> Does anybody have any ideas why this patch would help?  It could be some
> magic connected to `set-window-point', I guess...

Even though I don't understand why it helps, I've applied your patch
(but changed it slightly, so that it doesn't do both a save-excursion
and a with-current-buffer).

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/