Function: mml1991-mailcrypt-encrypt

mml1991-mailcrypt-encrypt is a byte-compiled function defined in mml1991.el.gz.

Signature

(mml1991-mailcrypt-encrypt CONT &optional SIGN)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mml1991.el.gz
(defun mml1991-mailcrypt-encrypt (_cont &optional sign)
  (let ((text (current-buffer))
	(mc-pgp-always-sign
	 (or mc-pgp-always-sign
	     sign
	     (eq t (or (message-options-get 'message-sign-encrypt)
		       (message-options-set
			'message-sign-encrypt
			(or (y-or-n-p "Sign the message? ")
			    'not))))
	     'never))
	cipher
	(result-buffer (get-buffer-create "*GPG Result*")))
    ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMORED
    (goto-char (point-min))
    (while (looking-at "^Content[^ ]+:") (forward-line))
    (unless (bobp)
      (delete-region (point-min) (point)))
    (with-temp-buffer
      (inline (mm-disable-multibyte))
      (setq cipher (current-buffer))
      (insert-buffer-substring text)
      (unless (mc-encrypt-generic
               (or
                (message-options-get 'message-recipients)
                (message-options-set 'message-recipients
                                     (read-string "Recipients: ")))
               nil
               (point-min) (point-max)
               (message-options-get 'message-sender)
               'sign)
        (unless (> (point-max) (point-min))
          (pop-to-buffer result-buffer)
          (error "Encrypt error")))
      (goto-char (point-min))
      (while (re-search-forward "\r+$" nil t)
        (replace-match "" t t))
      (set-buffer text)
      (delete-region (point-min) (point-max))
      ;;(insert "Content-Type: application/pgp-encrypted\n\n")
      ;;(insert "Version: 1\n\n")
      (insert "\n")
      (insert-buffer-substring cipher)
      (goto-char (point-max)))))