Function: gnus-summary-enter-digest-group

gnus-summary-enter-digest-group is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-enter-digest-group &optional FORCE)

Documentation

Enter an nndoc group based on the current article.

If FORCE, force a digest interpretation. If not, try to guess what the document format is.

To control what happens when you exit the group, see the gnus-auto-select-on-ephemeral-exit variable.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-enter-digest-group (&optional force)
  "Enter an nndoc group based on the current article.
If FORCE, force a digest interpretation.  If not, try to guess
what the document format is.

To control what happens when you exit the group, see the
`gnus-auto-select-on-ephemeral-exit' variable."
  (interactive "P" gnus-summary-mode)
  (let ((conf gnus-current-window-configuration))
    (save-window-excursion
      (save-excursion
	(let (gnus-article-prepare-hook
	      gnus-display-mime-function
	      gnus-break-pages)
	  (gnus-summary-select-article))))
    (setq gnus-current-window-configuration conf)
    (let* ((name (format "%s-%d"
			 (gnus-group-prefixed-name
			  gnus-newsgroup-name (list 'nndoc ""))
			 (with-current-buffer gnus-summary-buffer
			   gnus-current-article)))
	   (ogroup gnus-newsgroup-name)
	   (params (append (gnus-info-params (gnus-get-info ogroup))
			   (list (cons 'to-group ogroup))
			   (list (cons 'parent-group ogroup))
			   (list (cons 'save-article-group ogroup))))
	   (case-fold-search t)
	   (buf (current-buffer))
	   dig to-address charset)
      (with-current-buffer gnus-original-article-buffer
	;; Have the digest group inherit the main mail address of
	;; the parent article.
	(when (setq to-address (or (gnus-fetch-field "reply-to")
				   (gnus-fetch-field "from")))
	  (setq params
		(append
		 params
		 (list (cons 'to-address
			     (funcall gnus-decode-encoded-address-function
				      to-address))))))
	(setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
	(insert-buffer-substring gnus-original-article-buffer)
	(narrow-to-region
	 (goto-char (point-min))
	 (or (search-forward "\n\n" nil t) (point)))
	;; Remove lines that may lead nndoc to misinterpret the
	;; document type.
	(goto-char (point-min))
	(delete-matching-lines "^Path:\\|^From ")
	;; Parse charset, and decode content transfer encoding.
	(setq charset (mail-content-type-get
		       (mail-header-parse-content-type
			(or (gnus-fetch-field "content-type") ""))
		       'charset))
	(let ((encoding (gnus-fetch-field "content-transfer-encoding")))
	  (when encoding
	    (message-remove-header "content-transfer-encoding")
	    (goto-char (point-max))
	    (widen)
	    (narrow-to-region (point) (point-max))
	    (mm-decode-content-transfer-encoding
	     (intern (downcase (mail-header-strip-cte encoding))))))
	(widen))
      (unwind-protect
	  (if (let ((gnus-newsgroup-ephemeral-charset
		     (if charset
			 (intern (downcase (gnus-strip-whitespace charset)))
		       gnus-newsgroup-charset))
		    (gnus-newsgroup-ephemeral-ignored-charsets
		     gnus-newsgroup-ignored-charsets))
		(gnus-group-read-ephemeral-group
		 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
			      (nndoc-article-type
			       ,(if force 'mbox 'guess)))
		 t nil nil nil
		 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
							"ADAPT")))))
	      ;; Make all postings to this group go to the parent group.
	      (nconc (gnus-info-params (gnus-get-info name))
		     params)
	    ;; Couldn't select this doc group.
	    (switch-to-buffer buf)
	    (gnus-set-global-variables)
	    (gnus-configure-windows 'summary)
	    (gnus-message 3 "Article couldn't be entered?"))
	(kill-buffer dig)))))