Function: mh-undo

mh-undo is an autoloaded, interactive and byte-compiled function defined in mh-folder.el.gz.

Signature

(mh-undo RANGE)

Documentation

Undo pending deletes or refiles in RANGE.

If you've deleted a message or refiled it, but changed your mind, you can cancel the action before you've executed it. Use this command to undo a refile on or deletion of a single message. You can also undo refiles and deletes for messages that are found in a given RANGE.

Check the documentation of mh-interactive-range to see how RANGE is read in interactive use.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;;###mh-autoload
(defun mh-undo (range)
  "Undo pending deletes or refiles in RANGE.

If you've deleted a message or refiled it, but changed your mind,
you can cancel the action before you've executed it. Use this
command to undo a refile on or deletion of a single message. You
can also undo refiles and deletes for messages that are found in
a given RANGE.

Check the documentation of `mh-interactive-range' to see how
RANGE is read in interactive use."
  (interactive (list (mh-interactive-range "Undo")))
  (cond ((numberp range)
         (let ((original-position (point)))
           (beginning-of-line)
           (while (not (or (looking-at mh-scan-refiled-msg-regexp)
                           (looking-at mh-scan-deleted-msg-regexp)
                           (looking-at mh-scan-blocklisted-msg-regexp)
                           (looking-at mh-scan-allowlisted-msg-regexp)
                           (and (eq mh-next-direction 'forward) (bobp))
                           (and (eq mh-next-direction 'backward)
                                (save-excursion (forward-line) (eobp)))))
             (forward-line (if (eq mh-next-direction 'forward) -1 1)))
           (if (or (looking-at mh-scan-refiled-msg-regexp)
                   (looking-at mh-scan-deleted-msg-regexp)
                   (looking-at mh-scan-blocklisted-msg-regexp)
                   (looking-at mh-scan-allowlisted-msg-regexp))
               (progn
                 (mh-undo-msg (mh-get-msg-num t))
                 (mh-maybe-show))
             (goto-char original-position)
             (error "Nothing to undo"))))
        (t (mh-iterate-on-range () range
             (mh-undo-msg nil))))
  (if (not (mh-outstanding-commands-p))
      (mh-set-folder-modified-p nil)))