Function: mm-uu-dissect

mm-uu-dissect is an autoloaded and byte-compiled function defined in mm-uu.el.gz.

Signature

(mm-uu-dissect &optional NOHEADER MIME-TYPE)

Documentation

Dissect the current buffer and return a list of uu handles.

The optional NOHEADER means there's no header in the buffer. MIME-TYPE specifies a MIME type and parameters, which defaults to the value of mm-uu-text-plain-type.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mm-uu.el.gz
;;;###autoload
(defun mm-uu-dissect (&optional noheader mime-type)
  "Dissect the current buffer and return a list of uu handles.
The optional NOHEADER means there's no header in the buffer.
MIME-TYPE specifies a MIME type and parameters, which defaults to the
value of `mm-uu-text-plain-type'."
  (let ((case-fold-search t)
	(mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type))
	text-start start-point end-point file-name result mm-uu-entry)
    (save-excursion
      (goto-char (point-min))
      (cond
       (noheader)
       ((looking-at "\n")
	(forward-line))
       ((search-forward "\n\n" nil t)
	t)
       (t (goto-char (point-max))))
      (setq text-start (point))
      (while (re-search-forward mm-uu-beginning-regexp nil t)
	(setq start-point (match-beginning 0)
	      mm-uu-entry nil)
	(let ((alist mm-uu-type-alist)
	      (beginning-regexp (match-string 0)))
	  (while (not mm-uu-entry)
	    (if (string-match (mm-uu-beginning-regexp (car alist))
			      beginning-regexp)
		(setq mm-uu-entry (car alist))
	      (pop alist))))
	(funcall (or (mm-uu-function-1 mm-uu-entry) #'ignore))
	(forward-line);; in case of failure
	(when (and (not (mm-uu-configure-p (mm-uu-type mm-uu-entry) 'disabled))
		   (let ((end-regexp (mm-uu-end-regexp mm-uu-entry)))
		     (if (not end-regexp)
			 (or (setq end-point (point-max)) t)
		       (prog1
			   (re-search-forward end-regexp nil t)
			 (forward-line)
			 (setq end-point (point)))))
		   (funcall (or (mm-uu-function-2 mm-uu-entry)
                                (lambda () t))))
	  (if (and (> start-point text-start)
		   (progn
		     (goto-char text-start)
		     (re-search-forward "." start-point t)))
	      (push
	       (mm-make-handle
		(mm-uu-copy-to-buffer
		 text-start
		 ;; A start-separator is likely accompanied by
		 ;; a leading newline.
		 (if (and (eq (char-before start-point) ?\n)
			  (eq (char-before (1- start-point)) ?\n))
		     (1- start-point)
		   start-point))
		mm-uu-text-plain-type)
	       result))
	  (push
	   (funcall (mm-uu-function-extract mm-uu-entry))
	   result)
	  (goto-char (setq text-start end-point))))
      (when result
	(goto-char text-start)
	(when (re-search-forward "." nil t)
	  (push (mm-make-handle
		 (mm-uu-copy-to-buffer
		  ;; An end-separator is likely accompanied by
		  ;; a trailing newline.
		  (if (eq (char-after text-start) ?\n)
		      (1+ text-start)
		    text-start)
		  (point-max))
		 mm-uu-text-plain-type)
		result))
	(setq result (cons "multipart/mixed" (nreverse result))))
      result)))