From 2c8f256af5abcc0413ec57c862f2e02738f0789c Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 1 Sep 2005 22:19:02 +0000 Subject: [PATCH] Synch to No Gnus 200509012218. --- lisp/ChangeLog | 5 +++++ lisp/gnus-art.el | 48 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 805880b..d649471 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2005-09-01 Katsumi Yamaoka + + * gnus-art.el (gnus-article-part-wrapper): Error if there's no + valid article; point arrow and cursor at the MIME button. + 2005-08-30 Katsumi Yamaoka * gnus-art.el (gnus-mime-save-part-and-strip): Clarify prompt. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 672c253..d948123 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -4865,14 +4865,46 @@ If no internal viewer is available, use an external viewer." (funcall (cdr action-pair))))) (defun gnus-article-part-wrapper (n function &optional no-handle) - (with-current-buffer gnus-article-buffer - (when (> n (length gnus-article-mime-handle-alist)) - (error "No such part")) - (gnus-article-goto-part n) - (if no-handle - (funcall function) - (let ((handle (cdr (assq n gnus-article-mime-handle-alist)))) - (funcall function handle))))) + (let (window) + ;; 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))) + (error "No article is displayed")) + (with-current-buffer gnus-article-buffer + ;; Check whether the article displays the right contents. + (unless (with-current-buffer gnus-summary-buffer + (eq gnus-current-article (gnus-summary-article-number))) + (error "You should select the right article first")) + ;; Check whether the specified part exists. + (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 + ;; To select the window is needed so that the cursor + ;; might be visible on the MIME button. + (select-window window) + (when (gnus-article-goto-part n) + (let ((cursor-in-non-selected-windows t) ;; Display cursor. + (overlay-arrow-string "=>") ;; Display arrow. + (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))) + t)) + (if gnus-inhibit-mime-unbuttonizing + ;; This is the default though the program shouldn't reach here. + (error "No such part") + ;; The part which doesn't have the MIME button is selected. + ;; So, we display all the buttons and redo it. + (let ((gnus-inhibit-mime-unbuttonizing t)) + (gnus-summary-show-article) + (gnus-article-part-wrapper n function no-handle)))))) (defun gnus-article-pipe-part (n) "Pipe MIME part N, which is the numerical prefix." -- 1.7.10.4