Function: feedmail-vm-mail-mode
feedmail-vm-mail-mode is a byte-compiled function defined in
feedmail.el.gz.
Signature
(feedmail-vm-mail-mode &optional _)
Documentation
Make something like a buffer that has been created via vm-mail.
The optional argument is ignored and is just for argument compatibility with
feedmail-queue-runner-mode-setter. This function is suitable for being
applied to a file after you've just read it from disk: for example, a
feedmail FQM message file from a queue. You could use something like
this:
(add-to-list 'auto-mode-alist '("\\\\.fqm\\\\\\='" . feedmail-vm-mail-mode))
Source Code
;; Defined in /usr/src/emacs/lisp/mail/feedmail.el.gz
(defun feedmail-vm-mail-mode (&optional _)
"Make something like a buffer that has been created via `vm-mail'.
The optional argument is ignored and is just for argument compatibility with
`feedmail-queue-runner-mode-setter'. This function is suitable for being
applied to a file after you've just read it from disk: for example, a
feedmail FQM message file from a queue. You could use something like
this:
(add-to-list \\='auto-mode-alist \\='(\"\\\\.fqm\\\\\\='\" . feedmail-vm-mail-mode))"
(feedmail-say-debug ">in-> feedmail-vm-mail-mode")
(let ((the-buf (current-buffer)))
(vm-mail)
(delete-region (point-min) (point-max))
(insert-buffer-substring the-buf)
(setq buffer-file-name (buffer-file-name the-buf))
(set-buffer-modified-p (buffer-modified-p the-buf))
;; For some versions of emacs, saving the message to a queue
;; triggers running the mode function on the buffer, and that
;; leads (through a series of events I don't really understand)
;; to this function being called while the buffer is still
;; marked modified even though it is in the process of being
;; saved. I guess the function gets called during the renaming
;; that takes place en route to the save.
;;
;; This clearing of the marker probably wastes a buffer copy
;; but it's easy to do and more reliable than figuring out what
;; each variant of emacs does in this strange case.
(with-current-buffer the-buf
(set-buffer-modified-p nil))
(kill-buffer the-buf)
))