Function: mh-mh-to-mime-undo

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

Signature

(mh-mh-to-mime-undo NOCONFIRM)

Documentation

Undo effects of M-x mh-mh-to-mime (mh-mh-to-mime).

It does this by reverting to a backup file. You are prompted to confirm this action, but you can avoid the confirmation by adding a prefix argument NOCONFIRM.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
;;;###mh-autoload
(defun mh-mh-to-mime-undo (noconfirm)
  "Undo effects of \\[mh-mh-to-mime].

It does this by reverting to a backup file. You are prompted to
confirm this action, but you can avoid the confirmation by adding
a prefix argument NOCONFIRM."
  (interactive "*P")
  (if (null buffer-file-name)
      (error "Buffer does not seem to be associated with any file"))
  (let ((backup-strings '("," "#"))
        backup-file)
    (while (and backup-strings
                (not (file-exists-p
                      (setq backup-file
                            (concat (file-name-directory buffer-file-name)
                                    (car backup-strings)
                                    (file-name-nondirectory buffer-file-name)
                                    ".orig")))))
      (setq backup-strings (cdr backup-strings)))
    (or backup-strings
        (error "Backup file for %s no longer exists" buffer-file-name))
    (or noconfirm
        (yes-or-no-p (format "Revert buffer from file %s? "
                             backup-file))
        (error "Revert not confirmed"))
    (let ((buffer-read-only nil))
      (erase-buffer)
      (insert-file-contents backup-file))
    (after-find-file nil nil nil nil t)))