From d3959d885875e1b01d71c13924ebb1efbf669c63 Mon Sep 17 00:00:00 2001 From: yoichi Date: Fri, 23 Dec 2005 02:40:10 +0000 Subject: [PATCH] Merge following changes from semi-1_14 branch: 2003-12-18 Daiki Ueno * pgg-gpg.el (pgg-gpg-process-region): Set environment variable LANGUAGE as well. GNU gettext gives precedence to LANGUAGE over LC_ALL, when different language code is specified. Thanks to Tatsuya Kinoshita . [cf. ] 2003-12-17 Daiki Ueno * pgg-gpg.el (pgg-gpg-messages-locale): New user option. (pgg-gpg-process-region): Set environment variable LC_ALL when pgg-gpg-messages-locale is specified. * pgg-def.el (pgg-messages-locale): New user option. * mime-pgp.el (mime-verify-application/pgp-signature): Copy messages from pgg-errors-buffer. (mime-add-application/pgp-keys): Ditto. --- ChangeLog | 20 ++++++++++++++++++++ mime-pgp.el | 19 ++++++++----------- pgg-def.el | 3 +++ pgg-gpg.el | 27 +++++++++++++++++++++------ 4 files changed, 52 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac7be86..a66865f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-12-18 Daiki Ueno + + * pgg-gpg.el (pgg-gpg-process-region): Set environment variable + LANGUAGE as well. GNU gettext gives precedence to LANGUAGE over + LC_ALL, when different language code is specified. Thanks to + Tatsuya Kinoshita . + [cf. ] + +2003-12-17 Daiki Ueno + + * pgg-gpg.el (pgg-gpg-messages-locale): New user option. + (pgg-gpg-process-region): Set environment variable LC_ALL when + pgg-gpg-messages-locale is specified. + + * pgg-def.el (pgg-messages-locale): New user option. + + * mime-pgp.el (mime-verify-application/pgp-signature): Copy + messages from pgg-errors-buffer. + (mime-add-application/pgp-keys): Ditto. + 2005-09-06 Katsumi Yamaoka * mm-view.el (mime-view-insert-fontified-text-content): Disable diff --git a/mime-pgp.el b/mime-pgp.el index ecdc0d3..7b4aa91 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -136,8 +136,7 @@ (1- knum) (1+ knum))) (orig-entity (nth onum (mime-entity-children mother))) - (sig-file (make-temp-file "tm" nil ".asc")) - status) + (sig-file (make-temp-file "tm" nil ".asc"))) (save-excursion (mime-show-echo-buffer) (set-buffer mime-echo-buffer-name) @@ -152,12 +151,11 @@ (while (progn (end-of-line) (not (eobp))) (insert "\r") (forward-line 1)) - (setq status (pgg-verify-region (point-min)(point-max) - sig-file 'fetch)) + (pgg-verify-region (point-min)(point-max) + sig-file 'fetch) (save-excursion (set-buffer mime-echo-buffer-name) - (insert-buffer-substring (if status pgg-output-buffer - pgg-errors-buffer)))) + (insert-buffer-substring pgg-errors-buffer))) (delete-file sig-file)))) @@ -193,11 +191,10 @@ (mime-insert-entity-content entity) (mime-decode-region (point-min) (point-max) (cdr (assq 'encoding situation))) - (let ((status (pgg-snarf-keys-region (point-min)(point-max)))) - (save-excursion - (set-buffer mime-echo-buffer-name) - (insert-buffer-substring (if status pgg-output-buffer - pgg-errors-buffer)))))) + (pgg-snarf-keys-region (point-min)(point-max)) + (save-excursion + (set-buffer mime-echo-buffer-name) + (insert-buffer-substring pgg-errors-buffer)))) ;;; @ Internal method for application/pkcs7-signature diff --git a/pgg-def.el b/pgg-def.el index 2e38bdd..c793816 100644 --- a/pgg-def.el +++ b/pgg-def.el @@ -65,6 +65,9 @@ (defvar pgg-messages-coding-system nil "Coding system used when reading from a PGP external process.") +(defvar pgg-messages-locale nil + "Locale set before running a PGP external process.") + (defvar pgg-status-buffer " *PGG status*") (defvar pgg-errors-buffer " *PGG errors*") (defvar pgg-output-buffer " *PGG output*") diff --git a/pgg-gpg.el b/pgg-gpg.el index 6826184..104dad0 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -48,6 +48,9 @@ (defvar pgg-gpg-user-id nil "GnuPG ID of your default identity.") +(defvar pgg-gpg-messages-locale pgg-messages-locale + "Locale set before running a GnuPG external process.") + (defvar pgg-scheme-gpg-instance nil) ;;;###autoload @@ -69,7 +72,12 @@ (output-buffer pgg-output-buffer) (errors-buffer pgg-errors-buffer) (process-connection-type nil) + (process-environment process-environment) process status exit-status) + (when pgg-gpg-messages-locale + (setq process-environment (copy-sequence process-environment)) + (setenv "LC_ALL" pgg-gpg-messages-locale) + (setenv "LANGUAGE" pgg-gpg-messages-locale)) (with-current-buffer (get-buffer-create errors-buffer) (buffer-disable-undo) (erase-buffer)) @@ -196,9 +204,12 @@ (goto-char (point-min)) (prog1 (re-search-forward "^\\[GNUPG:] GOODSIG\\>" nil t) (goto-char (point-min)) - (delete-matching-lines "^warning\\|\\[GNUPG:]") - (set-buffer pgg-output-buffer) - (insert-buffer-substring pgg-errors-buffer))))) + (delete-matching-lines "^\\[GNUPG:] ") + ;; XXX: copy contents of pgg-errors-buffer into + ;; pgg-output-buffer for backward compatibility. + (with-current-buffer pgg-output-buffer + (set-buffer-multibyte t) + (insert-buffer-substring pgg-errors-buffer)))))) (luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-gpg)) (let* ((user-id (or pgg-overriding-user-id pgg-gpg-user-id @@ -228,9 +239,13 @@ (aref status 11))) (if (zerop (aref status 9)) "" - "\tSecret keys are imported.\n"))) - (append-to-buffer pgg-output-buffer (point-min)(point-max)) - (pgg-process-when-success))) + "\tSecret keys are imported.\n")) + ;; XXX: copy contents of pgg-errors-buffer into + ;; pgg-output-buffer for backward compatibility. + (with-current-buffer pgg-output-buffer + (set-buffer-multibyte t) + (insert-buffer-substring pgg-errors-buffer)) + t))) (provide 'pgg-gpg) -- 1.7.10.4