Function: gnus-article-mime-handles

gnus-article-mime-handles is a byte-compiled function defined in gnus-art.el.gz.

Signature

(gnus-article-mime-handles &optional ALIST ID ALL)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-article-mime-handles (&optional alist id all)
  (if alist
      (let ((i 1) newid flat)
	(dolist (handle alist flat)
	  (setq newid (append id (list i))
		i (1+ i))
	  (if (stringp (car handle))
	      (setq flat (nconc flat (gnus-article-mime-handles
				      (cdr handle) newid all)))
	    (delq (rassq handle all) all)
	    (setq flat (nconc flat (list (cons newid handle)))))))
    (let ((flat (list nil)))
      ;; Assume that elements of `gnus-article-mime-handle-alist'
      ;; are in the decreasing order, but unnumbered subsidiaries
      ;; in each element are in the increasing order.
      (dolist (handle (reverse gnus-article-mime-handle-alist))
	(if (stringp (cadr handle))
	    (when (cddr handle)
	      (setq flat (nconc flat (gnus-article-mime-handles
				      (cddr handle) (list (car handle)) flat))))
	  (delq (rassq (cdr handle) flat) flat)
	  (setq flat (nconc flat (list (cons (list (car handle))
					     (cdr handle)))))))
      (setq flat (cdr flat))
      (mapc (lambda (handle)
	      (if (cdar handle)
		  ;; This is a hidden (i.e. unnumbered) handle.
		  (progn
		    (setcar handle
			    (1+ (caar gnus-article-mime-handle-alist)))
		    (push handle gnus-article-mime-handle-alist))
		(setcar handle (caar handle))))
	    flat)
      flat)))