From 1ef7bd2f36dbc0ec8bec8928413beff71d16f405 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 5 Sep 2005 05:39:55 +0000 Subject: [PATCH] Synch to No Gnus 200509050539. --- lisp/ChangeLog | 8 ++++++++ lisp/gnus-art.el | 41 +++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2532555..617fe71 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2005-09-05 Katsumi Yamaoka + + * gnus-art.el (gnus-article-jump-to-part): Redisplay the article + using `(sit-for 0)' before moving the point to the specified part; + skip unbuttonized parts. + (gnus-article-part-wrapper): Don't use save-window-excursion; don't + return to the summary window if gnus-auto-select-part is non-nil. + 2005-09-04 Reiner Steib * mml.el (mml-dnd-protocol-alist, mml-dnd-attach-options): New diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 663bdd2..9957a3c 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -4459,6 +4459,8 @@ General format specifiers can also be used. See Info node "Jump to MIME part N." (interactive "P") (pop-to-buffer gnus-article-buffer) + ;; FIXME: why is it necessary? + (sit-for 0) (let ((parts (length gnus-article-mime-handle-alist))) (or n (setq n (string-to-number @@ -4471,7 +4473,16 @@ General format specifiers can also be used. See Info node n parts) parts))) (gnus-message 9 "Jumping to part %s." n) - (gnus-article-goto-part n))) + (cond ((>= gnus-auto-select-part 1) + (while (and (<= n parts) + (not (gnus-article-goto-part n))) + (setq n (1+ n)))) + ((< gnus-auto-select-part 0) + (while (and (>= n 1) + (not (gnus-article-goto-part n))) + (setq n (1- n)))) + (t + (gnus-article-goto-part n))))) (eval-when-compile (defsubst gnus-article-edit-part (handles &optional current-id) @@ -4865,11 +4876,11 @@ If no internal viewer is available, use an external viewer." (funcall (cdr action-pair))))) (defun gnus-article-part-wrapper (n function &optional no-handle) - (let (window) + (let (window frame) ;; Check whether the article is displayed. (unless (and (gnus-buffer-live-p gnus-article-buffer) (setq window (get-buffer-window gnus-article-buffer t)) - (frame-visible-p (window-frame window))) + (frame-visible-p (setq frame (window-frame window)))) (error "No article is displayed")) (with-current-buffer gnus-article-buffer ;; Check whether the article displays the right contents. @@ -4880,22 +4891,32 @@ If no internal viewer is available, use an external viewer." (when (> n (length gnus-article-mime-handle-alist)) (error "No such part"))) (unless - ;; We point the cursor and the arrow at the MIME button - ;; when the `function' prompt the user for something. - (save-window-excursion + (progn ;; To select the window is needed so that the cursor ;; might be visible on the MIME button. - (select-window window) + (select-window (prog1 + window + (setq window (selected-window)) + ;; Article may be displayed in the other frame. + (gnus-select-frame-set-input-focus + (prog1 + frame + (setq frame (selected-frame)))))) (when (gnus-article-goto-part n) - (let ((cursor-in-non-selected-windows t) ;; Display cursor. - (overlay-arrow-string "=>") ;; Display arrow. + ;; We point the cursor and the arrow at the MIME button + ;; when the `function' prompt the user for something. + (let ((cursor-in-non-selected-windows t) + (overlay-arrow-string "=>") (overlay-arrow-position (point-marker))) (unwind-protect (if no-handle (funcall function) (funcall function (cdr (assq n gnus-article-mime-handle-alist)))) - (set-marker overlay-arrow-position nil))) + (set-marker overlay-arrow-position nil) + (unless gnus-auto-select-part + (gnus-select-frame-set-input-focus frame) + (select-window window)))) t)) (if gnus-inhibit-mime-unbuttonizing ;; This is the default though the program shouldn't reach here. -- 1.7.10.4