Function: mailcap-maybe-eval

mailcap-maybe-eval is a byte-compiled function defined in mailcap.el.gz.

Signature

(mailcap-maybe-eval)

Documentation

Maybe evaluate a buffer of Emacs Lisp code.

Source Code

;; Defined in /usr/src/emacs/lisp/net/mailcap.el.gz
(defun mailcap-maybe-eval ()
  "Maybe evaluate a buffer of Emacs Lisp code."
  (let ((lisp-buffer (current-buffer)))
    (goto-char (point-min))
    (when
	(save-window-excursion
	  (delete-other-windows)
          (let ((buffer (generate-new-buffer "*Warning*")))
	    (unwind-protect
		(with-current-buffer buffer
		  (insert (substitute-command-keys
			   mailcap-maybe-eval-warning))
		  (goto-char (point-min))
		  (display-buffer buffer)
		  (yes-or-no-p "This is potentially dangerous emacs-lisp code, evaluate it? "))
	      (kill-buffer buffer))))
      (eval-buffer (current-buffer)))
    (when (buffer-live-p lisp-buffer)
      (with-current-buffer lisp-buffer
	(emacs-lisp-mode)))))