X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=pgg-gpg.el;h=c46d33f9d7f7c230935e1a125f3a2bce99c80e3f;hb=b184a5d453660cd595b026b95bef186276899d9e;hp=5ac69f668b2dbb436c9210526a991158ac8d4407;hpb=17cacd9ff91f19bac96c1b6f9db2c414a53d2b68;p=elisp%2Fsemi.git diff --git a/pgg-gpg.el b/pgg-gpg.el index 5ac69f6..c46d33f 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -1,6 +1,6 @@ ;;; pgg-gpg.el --- GnuPG support for PGG. -;; Copyright (C) 1999,2000 Daiki Ueno +;; Copyright (C) 1999,2000 Free Software Foundation, Inc. ;; Author: Daiki Ueno ;; Created: 1999/10/28 @@ -25,6 +25,7 @@ ;;; Code: +(require 'mel) ; binary-to-text-funcall (eval-when-compile (require 'pgg)) (defgroup pgg-gpg () @@ -47,6 +48,9 @@ (defvar pgg-gpg-user-id nil "GnuPG ID of your default identity.") +(defvar pgg-gpg-messages-coding-system pgg-messages-coding-system + "Coding system used when reading from a GnuPG external process.") + (defvar pgg-scheme-gpg-instance nil) ;;;###autoload @@ -56,8 +60,7 @@ (luna-make-entity 'pgg-scheme-gpg)))) (defun pgg-gpg-process-region (start end passphrase program args) - (let* ((output-file-name - (concat temporary-file-directory (make-temp-name "pgg-output"))) + (let* ((output-file-name (make-temp-file "pgg-output")) (args `("--status-fd" "2" ,@(if passphrase '("--passphrase-fd" "0")) @@ -74,9 +77,11 @@ (unwind-protect (progn (set-default-file-modes 448) - (as-binary-output-file - (setq process - (apply #'start-process "*GnuPG*" errors-buffer program args))) + (setq process + (apply #'binary-to-text-funcall + pgg-gpg-messages-coding-system + #'start-process "*GnuPG*" errors-buffer + program args)) (set-process-sentinel process #'ignore) (when passphrase (process-send-string process (concat passphrase "\n"))) @@ -91,7 +96,8 @@ (buffer-disable-undo) (erase-buffer) (if (file-exists-p output-file-name) - (insert-file-contents-as-raw-text-CRLF output-file-name)) + (let ((coding-system-for-read 'raw-text-dos)) + (insert-file-contents output-file-name))) (set-buffer errors-buffer) (if (memq status '(stop signal)) (error "%s exited abnormally: '%s'" program exit-status)) @@ -185,6 +191,7 @@ (let ((args '("--batch" "--verify"))) (when (stringp signature) (setq args (append args (list signature)))) + (setq args (append args '("-"))) (pgg-gpg-process-region start end nil pgg-gpg-program args) (with-current-buffer pgg-errors-buffer (goto-char (point-min))