Function: gnus-summary-save-article

gnus-summary-save-article is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-save-article &optional N NOT-SAVED)

Documentation

Save the current article using the default saver function.

If N is a positive number, save the N next articles. If N is a negative number, save the N previous articles. If N is nil and any articles have been marked with the process mark, save those articles instead. The variable gnus-default-article-saver specifies the saver function.

If the optional second argument NOT-SAVED is non-nil, articles saved will not be marked as saved.

The gnus-prompt-before-saving variable says how prompting is performed.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
;; Summary saving commands.

(defun gnus-summary-save-article (&optional n not-saved)
  "Save the current article using the default saver function.
If N is a positive number, save the N next articles.
If N is a negative number, save the N previous articles.
If N is nil and any articles have been marked with the process mark,
save those articles instead.
The variable `gnus-default-article-saver' specifies the saver function.

If the optional second argument NOT-SAVED is non-nil, articles saved
will not be marked as saved.

The `gnus-prompt-before-saving' variable says how prompting is
performed."
  (interactive "P" gnus-summary-mode)
  (require 'gnus-art)
  (let* ((articles (gnus-summary-work-articles n))
	 (save-buffer (save-excursion
			(nnheader-set-temp-buffer " *Gnus Save*")))
	 (num (length articles))
	 ;; Whether to save decoded articles or raw articles.
	 (decode (when gnus-article-save-coding-system
		   (get gnus-default-article-saver :decode)))
	 ;; When saving many articles in a single file, use the other
	 ;; function to save articles other than the first one.
	 (saver2 (get gnus-default-article-saver :function))
	 (gnus-prompt-before-saving (if saver2
					t
				      gnus-prompt-before-saving))
	 (gnus-default-article-saver gnus-default-article-saver)
	 header file)
    (dolist (article articles)
      (setq header (gnus-summary-article-header article))
      (if (not (mail-header-p header))
	  ;; This is a pseudo-article.
	  (if (assq 'name header)
	      (gnus-copy-file (cdr (assq 'name header)))
	    (gnus-message 1 "Article %d is unsavable" article))
	;; This is a real article.
	(save-window-excursion
	  (gnus-summary-select-article decode decode nil article)
	  (gnus-summary-goto-subject article))
	;; The article may have expired.
	(let ((art-buf (if decode
			   gnus-article-buffer
			 gnus-original-article-buffer)))
	  (when (zerop (buffer-size (get-buffer art-buf)))
	    (error "Couldn't select article %s" article))
	  (with-current-buffer save-buffer
	    (erase-buffer)
	    (insert-buffer-substring art-buf)))
	(setq file (gnus-article-save save-buffer file num))
	(gnus-summary-remove-process-mark article)
	(unless not-saved
	  (gnus-summary-set-saved-mark article)))
      (when saver2
	(setq gnus-default-article-saver saver2
	      saver2 nil)))
    (gnus-kill-buffer save-buffer)
    (gnus-summary-position-point)
    (gnus-set-mode-line 'summary)
    n))