comparison lisp/gnus/gnus-sum.el @ 110006:6c405a2a9f8e

gnus-summary-(move,delete)-article: Save excursion while copying, moving, and deleting articles in order to prevent the cursor from jumping to unforeseen place.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 27 Aug 2010 01:53:01 +0000
parents 23ac97042af1
children 5f352fd4346a
comparison
equal deleted inserted replaced
110005:670be26d955d 110006:6c405a2a9f8e
9846 select-method)) 9846 select-method))
9847 9847
9848 ;;;!!!Why is this necessary? 9848 ;;;!!!Why is this necessary?
9849 (set-buffer gnus-summary-buffer) 9849 (set-buffer gnus-summary-buffer)
9850 9850
9851 (gnus-summary-goto-subject article)
9852 (when (eq action 'move) 9851 (when (eq action 'move)
9853 (gnus-summary-mark-article article gnus-canceled-mark)))) 9852 (save-excursion
9853 (gnus-summary-goto-subject article)
9854 (gnus-summary-mark-article article gnus-canceled-mark)))))
9854 (push article articles-to-update-marks)) 9855 (push article articles-to-update-marks))
9855 9856
9856 (apply 'gnus-summary-remove-process-mark articles-to-update-marks) 9857 (save-excursion
9858 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
9857 ;; Re-activate all groups that have been moved to. 9859 ;; Re-activate all groups that have been moved to.
9858 (with-current-buffer gnus-group-buffer 9860 (with-current-buffer gnus-group-buffer
9859 (let ((gnus-group-marked to-groups)) 9861 (let ((gnus-group-marked to-groups))
9860 (gnus-group-get-new-news-this-group nil t))) 9862 (gnus-group-get-new-news-this-group nil t)))
9861 9863
10107 "this article"))))) 10109 "this article")))))
10108 () 10110 ()
10109 ;; Delete the articles. 10111 ;; Delete the articles.
10110 (setq not-deleted (gnus-request-expire-articles 10112 (setq not-deleted (gnus-request-expire-articles
10111 articles gnus-newsgroup-name 'force)) 10113 articles gnus-newsgroup-name 'force))
10112 (while articles 10114 (save-excursion
10113 (gnus-summary-remove-process-mark (car articles)) 10115 (while articles
10114 ;; The backend might not have been able to delete the article 10116 (gnus-summary-remove-process-mark (car articles))
10115 ;; after all. 10117 ;; The backend might not have been able to delete the article
10116 (unless (memq (car articles) not-deleted) 10118 ;; after all.
10117 (gnus-summary-mark-article (car articles) gnus-canceled-mark)) 10119 (unless (memq (car articles) not-deleted)
10118 (let* ((article (car articles)) 10120 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
10119 (ghead (gnus-data-header 10121 (let* ((article (car articles))
10120 (assoc article (gnus-data-list nil))))) 10122 (ghead (gnus-data-header
10121 (run-hook-with-args 'gnus-summary-article-delete-hook 10123 (assoc article (gnus-data-list nil)))))
10122 'delete ghead gnus-newsgroup-name nil 10124 (run-hook-with-args 'gnus-summary-article-delete-hook
10123 nil)) 10125 'delete ghead gnus-newsgroup-name nil
10124 (setq articles (cdr articles))) 10126 nil))
10127 (setq articles (cdr articles))))
10125 (when not-deleted 10128 (when not-deleted
10126 (gnus-message 4 "Couldn't delete articles %s" not-deleted))) 10129 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10127 (gnus-summary-position-point) 10130 (gnus-summary-position-point)
10128 (gnus-set-mode-line 'summary) 10131 (gnus-set-mode-line 'summary)
10129 not-deleted)) 10132 not-deleted))