From 0ec1c2eec824ea5498fce5a4792a468faddc3d94 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 29 Aug 2005 14:14:37 +0000 Subject: [PATCH] Synch to No Gnus 200508291253. --- lisp/ChangeLog | 17 +++++++++++ lisp/gnus-art.el | 90 ++++++++++++++++++++++++++++++++++++------------------ lisp/gnus-fun.el | 4 +-- 3 files changed, 80 insertions(+), 31 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7220168..52abc5c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2005-08-29 Romain Francoise + + * gnus-fun.el (gnus-convert-image-to-face-command): Fix typo in + docstring. + (gnus-face-from-file): Likewise. + +2005-08-29 Reiner Steib + + * gnus-art.el (gnus-mime-save-part-and-strip): Don't prompt. + (gnus-mime-delete-part): Don't prompt if `gnus-expert-user' is + non-nil. + (gnus-auto-select-part): New variable. + (gnus-article-jump-to-part): New function. + (gnus-article-edit-part, gnus-mime-save-part-and-strip) + (gnus-mime-delete-part): Allow selecting specified part after + deleting or stripping parts. + 2005-08-22 Karl Chen (tiny change) * gnus-art.el (gnus-treatment-function-alist): Move date-lapsed to diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 9a168cd..166a313 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -972,6 +972,19 @@ used." :type '(repeat (cons (string :tag "name") (function)))) +(defcustom gnus-auto-select-part 1 + "Advance to next MIME part when deleting or stripping parts. + +When 0, point will be placed on the same part as before. When +positive (negative), move point forward (backwards) this many +parts. When nil, redisplay article." + :version "23.0" ;; No Gnus + :group 'gnus-article-mime + :type '(choice (const nil :tag "Redisplay article.") + (const 1 :tag "Next part.") + (const 0 :tag "Current part.") + integer)) + ;;; ;;; The treatment variables ;;; @@ -4442,8 +4455,23 @@ General format specifiers can also be used. See Info node (delete-region (point) (point-max)) (mm-display-parts handles)))))) +(defun gnus-article-jump-to-part (n) + "Jump to MIME part N." + (interactive "P") + (pop-to-buffer gnus-article-buffer) + (let ((parts (length gnus-article-mime-handle-alist))) + (while (not (and (integerp n) (<= n parts) (>= n 1))) + (setq n (read-number + (concat + (if n + (format "`%s' is not a valid part. " n) + "") + (format "Jump to part (2..%s): " parts)) + parts))) + (gnus-article-goto-part n))) + (eval-when-compile - (defsubst gnus-article-edit-part (handles) + (defsubst gnus-article-edit-part (handles &optional current-id) "Edit an article in order to delete a mime part. This function is exclusively used by `gnus-mime-save-part-and-strip' and `gnus-mime-delete-part', and not provided at run-time normally." @@ -4485,7 +4513,10 @@ and `gnus-mime-delete-part', and not provided at run-time normally." ,gnus-summary-buffer no-highlight))) (gnus-article-edit-done) (gnus-summary-expand-window) - (gnus-summary-show-article))) + (gnus-summary-show-article) + (when (and current-id (integerp gnus-auto-select-part)) + (gnus-article-jump-to-part + (+ current-id gnus-auto-select-part))))) (defun gnus-mime-save-part-and-strip () "Save the MIME part under point then replace it with an external body." @@ -4496,29 +4527,28 @@ and `gnus-mime-delete-part', and not provided at run-time normally." (when (mm-complicated-handles gnus-article-mime-handles) (error "\ The current article has a complicated MIME structure, giving up...")) - (when (gnus-yes-or-no-p "\ -Deleting parts may malfunction or destroy the article; continue? ") - (let* ((data (get-text-property (point) 'gnus-data)) - file param - (handles gnus-article-mime-handles)) - (setq file (and data (mm-save-part data))) - (when file - (with-current-buffer (mm-handle-buffer data) - (erase-buffer) - (insert "Content-Type: " (mm-handle-media-type data)) - (mml-insert-parameter-string (cdr (mm-handle-type data)) - '(charset)) - (insert "\n") - (insert "Content-ID: " (message-make-message-id) "\n") - (insert "Content-Transfer-Encoding: binary\n") - (insert "\n")) - (setcdr data - (cdr (mm-make-handle nil - `("message/external-body" - (access-type . "LOCAL-FILE") - (name . ,file))))) - (set-buffer gnus-summary-buffer) - (gnus-article-edit-part handles))))) + (let* ((data (get-text-property (point) 'gnus-data)) + (id (get-text-property (point) 'gnus-part)) + file param + (handles gnus-article-mime-handles)) + (setq file (and data (mm-save-part data))) + (when file + (with-current-buffer (mm-handle-buffer data) + (erase-buffer) + (insert "Content-Type: " (mm-handle-media-type data)) + (mml-insert-parameter-string (cdr (mm-handle-type data)) + '(charset)) + (insert "\n") + (insert "Content-ID: " (message-make-message-id) "\n") + (insert "Content-Transfer-Encoding: binary\n") + (insert "\n")) + (setcdr data + (cdr (mm-make-handle nil + `("message/external-body" + (access-type . "LOCAL-FILE") + (name . ,file))))) + ;; (set-buffer gnus-summary-buffer) + (gnus-article-edit-part handles id)))) (defun gnus-mime-delete-part () "Delete the MIME part under point. @@ -4530,9 +4560,11 @@ Replace it with some information about the removed part." (when (mm-complicated-handles gnus-article-mime-handles) (error "\ The current article has a complicated MIME structure, giving up...")) - (when (gnus-yes-or-no-p "\ -Deleting parts may malfunction or destroy the article; continue? ") + (when (or gnus-expert-user + (gnus-yes-or-no-p "\ +Deleting parts may malfunction or destroy the article; continue? ")) (let* ((data (get-text-property (point) 'gnus-data)) + (id (get-text-property (point) 'gnus-part)) (handles gnus-article-mime-handles) (none "(none)") (description @@ -4563,8 +4595,8 @@ Deleting parts may malfunction or destroy the article; continue? ") nil `("text/plain") nil nil (list "attachment") (format "Deleted attachment (%s bytes)" bsize)))))) - (set-buffer gnus-summary-buffer) - (gnus-article-edit-part handles)))) + ;; (set-buffer gnus-summary-buffer) + (gnus-article-edit-part handles id)))) (defun gnus-mime-save-part () "Save the MIME part under point." diff --git a/lisp/gnus-fun.el b/lisp/gnus-fun.el index ab13f68..52eba30 100644 --- a/lisp/gnus-fun.el +++ b/lisp/gnus-fun.el @@ -54,7 +54,7 @@ on stdout." :type 'string) (defcustom gnus-convert-image-to-face-command "djpeg %s | ppmnorm | pnmscale -width 48 -height 48 | ppmquant %d | pnmtopng" - "Command for converting an image to an Face. + "Command for converting an image to a Face. By default it takes a JPEG filename and output the Face header data on stdout." :version "22.1" @@ -134,7 +134,7 @@ Output to the current buffer, replace text, and don't mingle error." ;;;###autoload (defun gnus-face-from-file (file) - "Return an Face header based on an image file." + "Return a Face header based on an image file." (interactive "fImage file name (by default JPEG): ") (when (file-exists-p file) (let ((done nil) -- 1.7.10.4