Subject: Re: bug#9582: Annoying point movement

From: Leo <[email-masked]>
Date: Wed, 04 Jan 2012 11:44:41 +0800

On 2011-09-23 16:30 +0800, Lars Magne Ingebrigtsen wrote:
> Leo <[email-masked]> writes:
>
>> 1. In the group buffer, key 'a'
>> 2. In the popup message buffer, key C-c C-k
>
> I don't get anything popped up.
>
>> Point moved to the first group line.
>
> And I'm unable to reproduce this.  Do you have any local customisations
> that's moving point around?

I have just looked at the cause of this bug and it is due to
nndraft-update-unread-articles in message-kill-actions (it is also in
'postpone 'exit actions) which is added by
nndraft-request-associate-buffer.

,----[ C-h v message-kill-actions RET ]
| message-kill-actions is a variable defined in `message.el'.
| Its value is ((progn
|    (setq gnus-current-window-configuration 'article)
|    (when
|        (gnus-buffer-exists-p "*Summary nndoc+/tmp/leo-tmp-347GXu/gnus-temp-group-42680G9l-ephemeral:gnus-read-ephemeral-bug*")
|      (set-window-configuration #<window-configuration>)))
|  (nndraft-update-unread-articles))
| 
| Local in buffer *unsent wide reply to Lars Magne Ingebrigtsen*; global value is nil
| 
| Documentation:
| A list of actions to be performed before killing a message buffer.
| 
| [back]
`----

The following patch fixes this bug.

=== modified file 'lisp/gnus/nndraft.el'
--- lisp/gnus/nndraft.el	2011-08-17 00:10:46 +0000
+++ lisp/gnus/nndraft.el	2012-01-04 03:43:01 +0000
@@ -181,13 +181,14 @@
 	   (gnus-get-new-news-hook nil)
 	   (inhibit-read-only t))
       (gnus-group-get-new-news-this-group nil t)
-      (dolist (group groups)
-	(unless (and gnus-permanently-visible-groups
-		     (string-match gnus-permanently-visible-groups
-				   group))
-	  (gnus-group-goto-group group)
-	  (when (zerop (gnus-group-group-unread))
-	    (gnus-delete-line)))))))
+      (save-excursion
+	(dolist (group groups)
+	  (unless (and gnus-permanently-visible-groups
+		       (string-match gnus-permanently-visible-groups
+				     group))
+	    (gnus-group-goto-group group)
+	    (when (zerop (gnus-group-group-unread))
+	      (gnus-delete-line))))))))
 
 (deffoo nndraft-request-associate-buffer (group)
   "Associate the current buffer with some article in the draft group."

Leo