Function: rmail-apply-in-message

rmail-apply-in-message is a byte-compiled function defined in rmail.el.gz.

Signature

(rmail-apply-in-message MSGNUM FUNCTION &rest ARGS)

Documentation

Call FUNCTION on ARGS while narrowed to message MSGNUM.

Point is at the start of the message. This returns what the call to FUNCTION returns. If MSGNUM is nil, use the current message.

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-apply-in-message (msgnum function &rest args)
  "Call FUNCTION on ARGS while narrowed to message MSGNUM.
Point is at the start of the message.
This returns what the call to FUNCTION returns.
If MSGNUM is nil, use the current message."
  (with-current-buffer rmail-buffer
    (or msgnum (setq msgnum rmail-current-message))
    (when (> msgnum 0)
      (let (msgbeg msgend)
	(setq msgbeg (rmail-msgbeg msgnum))
	(setq msgend (rmail-msgend msgnum))
	;; All access to the rmail-buffer's local variables is now finished...
	(save-excursion
	  ;; ... so it is ok to go to a different buffer.
	  (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer))
	  (save-excursion
	    (save-restriction
	      (widen)
	      (goto-char msgbeg)
	      (narrow-to-region msgbeg msgend)
	      (apply function args))))))))