;;; pgg-gpg.el --- GnuPG support for PGG.
;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
-;; 2005, 2006 Free Software Foundation, Inc.
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Daiki Ueno <ueno@unixuser.org>
;; Symmetric encryption support added by: Sascha Wilde <wilde@sha-bang.de>
:type '(choice (const :tag "New `--recipient' option" "--recipient")
(const :tag "Old `--remote-user' option" "--remote-user")))
-(defcustom pgg-gpg-use-agent nil
+(defcustom pgg-gpg-use-agent t
"Whether to use gnupg agent for key caching."
:group 'pgg-gpg
:type 'boolean)
(forward-line))
(setq pgg-gpg-read-point (point)))))
-(eval-and-compile
- (cond ((and (fboundp 'string-to-multibyte)
- (subrp (symbol-function 'string-to-multibyte)))
- (defalias 'pgg-string-to-multibyte 'string-to-multibyte))
- ((and (fboundp 'string-as-multibyte)
- (subrp (symbol-function 'string-as-multibyte)))
- (defun pgg-string-to-multibyte (string) "\
-Return a multibyte string with the same individual chars as string."
- (mapconcat
- (lambda (ch) (string-as-multibyte (char-to-string ch)))
- string "")))
- (t
- (defalias 'pgg-string-to-multibyte 'identity))))
-
(defun pgg-gpg-process-sentinel (process status)
(if (buffer-live-p (process-buffer process))
(save-excursion
(erase-buffer)
(insert-buffer-substring (process-buffer process))
;; Read the contents of the output file to pgg-output-buffer.
- (set-buffer (let ((default-enable-multibyte-characters t))
- (get-buffer-create pgg-output-buffer)))
+ (set-buffer (get-buffer-create pgg-output-buffer))
(buffer-disable-undo)
(erase-buffer)
(if (equal status "finished\n")
(with-current-buffer (process-buffer process)
pgg-gpg-output-file-name)))
(when (file-exists-p output-file-name)
- ;; Buffer's multibyteness might be turned off after
- ;; inserting file's contents, as the case may be.
(let ((coding-system-for-read (if pgg-text-mode
'raw-text
'binary)))
(insert-file-contents output-file-name))
- (when (and (fboundp 'set-buffer-multibyte)
- (subrp (symbol-function 'set-buffer-multibyte))
- (not enable-multibyte-characters))
- (if (zerop (buffer-size))
- (set-buffer-multibyte t)
- (insert (pgg-string-to-multibyte
- (prog1
- (buffer-string)
- (erase-buffer)
- (set-buffer-multibyte t))))))
(delete-file output-file-name))))
(kill-buffer (process-buffer process)))))
'("--armor" "--always-trust" "--encrypt")
(if pgg-text-mode '("--textmode"))
(if sign (list "--sign" "--local-user" pgg-gpg-user-id))
- (if recipients
+ (if (or recipients pgg-encrypt-for-me)
(apply #'nconc
(mapcar (lambda (rcpt)
(list pgg-gpg-recipient-argument rcpt))