Function: rmail-mime-toggle-hidden

rmail-mime-toggle-hidden is an interactive and byte-compiled function defined in rmailmm.el.gz.

Signature

(rmail-mime-toggle-hidden)

Documentation

Hide or show the body of the MIME-entity at point.

Probably introduced at or before Emacs version 23.3.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmailmm.el.gz
(defun rmail-mime-toggle-hidden ()
  "Hide or show the body of the MIME-entity at point."
  (interactive)
  (when (rmail-mime-message-p)
    (let* ((rmail-mime-mbox-buffer rmail-view-buffer)
	   (rmail-mime-view-buffer (current-buffer))
	   (pos (if (eobp) (1- (point-max)) (point)))
	   (entity (get-text-property pos 'rmail-mime-entity))
	   (current (aref (rmail-mime-entity-display entity) 0))
	   (segment (rmail-mime-entity-segment pos entity)))
      (if (rmail-mime-display-body current)
	  ;; Enter the hidden mode.
	  (progn
	    ;; If point is in the body part, move it to the tagline
	    ;; (or the header if tagline is not displayed).
	    (if (= (aref segment 0) 3)
		(goto-char (aref segment 2)))
	    (rmail-mime-hidden-mode entity)
	    ;; If the current entity is the topmost one, display the
	    ;; header.
	    (if (and rmail-mime-mbox-buffer (= (aref segment 1) (point-min)))
		(let ((new (aref (rmail-mime-entity-display entity) 1)))
		  (setf (rmail-mime-display-header new) t))))
	;; Query as a warning before showing if truncated.
	(if (and (not (stringp entity))
		 (rmail-mime-entity-truncated entity))
	    (unless (y-or-n-p "This entity is truncated; show anyway? ")
	      (error "Aborted")))
	;; Enter the shown mode.
	(rmail-mime-shown-mode entity)
	;; Force this body shown.
	(let ((new (aref (rmail-mime-entity-display entity) 1)))
	  (setf (rmail-mime-display-body new) t)))
      (let ((inhibit-read-only t)
	    (modified (buffer-modified-p))
	    (rmail-mime-mbox-buffer rmail-view-buffer)
	    (rmail-mime-view-buffer rmail-buffer))
	(save-excursion
	  (goto-char (aref segment 1))
	  (rmail-mime-insert entity)
	  (restore-buffer-modified-p modified))))))