Function: mh-get-new-mail
mh-get-new-mail is a byte-compiled function defined in
mh-folder.el.gz.
Signature
(mh-get-new-mail MAILDROP-NAME)
Documentation
Read new mail from MAILDROP-NAME into the current buffer.
Return in the current buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;; Support Routines
(defun mh-get-new-mail (maildrop-name)
"Read new mail from MAILDROP-NAME into the current buffer.
Return in the current buffer."
(let ((point-before-inc (point))
(folder mh-current-folder)
(new-mail-flag nil))
(with-mh-folder-updating (t)
(if maildrop-name
(message "inc %s -file %s..." folder maildrop-name)
(message "inc %s..." folder))
(setq mh-next-direction 'forward)
(goto-char (point-max))
(mh-remove-cur-notation)
(let ((start-of-inc (point)))
(if maildrop-name
;; I think MH 5 used "-ms-file" instead of "-file",
;; which would make inc'ing from maildrops fail.
(mh-exec-cmd-output mh-inc-prog nil folder
(mh-scan-format)
"-file" (expand-file-name maildrop-name)
"-width" (window-width)
"-truncate")
(mh-exec-cmd-output mh-inc-prog nil
(mh-scan-format)
"-width" (window-width)))
(if maildrop-name
(message "inc %s -file %s...done" folder maildrop-name)
(message "inc %s...done" folder))
(goto-char start-of-inc)
(cond ((save-excursion
(re-search-forward "^inc: no mail" nil t))
(message "No new mail%s%s" (if maildrop-name " in " "")
(if maildrop-name maildrop-name "")))
((and (when mh-folder-view-stack
(let ((saved-text (buffer-substring-no-properties
start-of-inc (point-max))))
(delete-region start-of-inc (point-max))
(unwind-protect (mh-widen t)
(mh-remove-cur-notation)
(goto-char (point-max))
(setq start-of-inc (point))
(insert saved-text)
(goto-char start-of-inc))))
nil))
((re-search-forward "^inc:" nil t) ; Error messages
(error "Error incorporating mail"))
((and
(equal mh-scan-format-file t)
mh-adaptive-cmd-note-flag
;; Have we reached an edge condition?
(save-excursion
(re-search-forward mh-scan-msg-overflow-regexp nil 0 1))
(setq start-of-inc (mh-generate-new-cmd-note folder))
nil))
(t
(setq new-mail-flag t)))
(keep-lines mh-scan-valid-regexp) ; Flush random scan lines
(let* ((sequences (mh-read-folder-sequences folder t))
(new-cur (assoc 'cur sequences))
(new-unseen (assoc mh-unseen-seq sequences)))
(unless (assoc 'cur mh-seq-list)
(push (list 'cur) mh-seq-list))
(unless (assoc mh-unseen-seq mh-seq-list)
(push (list mh-unseen-seq) mh-seq-list))
(setcdr (assoc 'cur mh-seq-list) (cdr new-cur))
(setcdr (assoc mh-unseen-seq mh-seq-list) (cdr new-unseen)))
(when (equal (point-max) start-of-inc)
(mh-notate-cur))
(if new-mail-flag
(progn
(mh-make-folder-mode-line)
(when (mh-speed-flists-active-p)
(mh-speed-flists t mh-current-folder))
(when (memq 'unthread mh-view-ops)
(mh-thread-inc folder start-of-inc))
(mh-goto-cur-msg))
(goto-char point-before-inc))
(mh-notate-user-sequences (cons start-of-inc (point-max)))))))