From: ueno Date: Sat, 6 Nov 1999 10:41:09 +0000 (+0000) Subject: * pgg-pgp.el (sign-region): Use `pgg-as-lbt'. X-Git-Tag: emiko-1_13_7~43 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9c5c6b84996b4cf995c6bb27a7793b1fefc7955;p=elisp%2Fsemi.git * pgg-pgp.el (sign-region): Use `pgg-as-lbt'. (pgg-gpg-process-region): Use `pgg-convert-lbt-region'. (encrypt-region): Don't ask passphrase. * pgg-pgp5.el (sign-region): Use `pgg-as-lbt'. (pgg-pgp5-process-region): Use `pgg-convert-lbt-region'. (encrypt-region): Don't ask passphrase. * pgg-pgp.el (verify-region): Fill errors buffer. (pgg-pgp-process-region): Use `pgg-convert-lbt-region'. (sign-region): Use `pgg-as-lbt'. (encrypt-region): Don't ask passphrase. --- diff --git a/pgg-gpg.el b/pgg-gpg.el index c98504e..0f5a140 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -106,9 +106,8 @@ exit-status (process-exit-status process)) (delete-process process) (with-current-buffer output-buffer - (goto-char (point-min)) - (while (search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) + (if (memq status '(stop signal)) (error "%s exited abnormally: '%s'" program exit-status)) (if (= 127 exit-status) @@ -163,22 +162,13 @@ (mapcar (lambda (rcpt) (list "--remote-user" (concat "\"" rcpt "\""))) - recipients))))) - (inhibit-read-only t) - buffer-read-only) - (goto-char start) - (setq end (set-marker (make-marker) (point-max))) - (while (progn (end-of-line) (> (marker-position end) (point))) - (insert "\r") - (forward-line 1)) - (pgg-gpg-process-region start end passphrase pgg-gpg-program args) - (goto-char start) - (while (re-search-forward "\r$" end t) - (replace-match "")) + recipients)))))) + (pgg-as-lbt start end 'CRLF + (pgg-gpg-process-region start end passphrase + pgg-gpg-program args) + ) (pgg-process-when-success - (goto-char (point-min)) - (while (re-search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) (let ((packet (cdr (assq 1 (pgg-parse-armor-region (point-min)(point-max)))))) @@ -214,19 +204,11 @@ "--local-user" pgg-gpg-user-id)) (inhibit-read-only t) buffer-read-only) - (goto-char start) - (setq end (set-marker (make-marker) (point-max))) - (while (progn (end-of-line) (> (marker-position end) (point))) - (insert "\r") - (forward-line 1)) - (pgg-gpg-process-region start end passphrase pgg-gpg-program args) - (goto-char start) - (while (re-search-forward "\r$" end t) - (replace-match "")) + (pgg-as-lbt start end 'CRLF + (pgg-gpg-process-region start end passphrase pgg-gpg-program args) + ) (pgg-process-when-success - (goto-char (point-min)) - (while (re-search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX (let ((packet (cdr (assq 2 (pgg-parse-armor-region diff --git a/pgg-pgp.el b/pgg-pgp.el index b66e5b8..448fd30 100644 --- a/pgg-pgp.el +++ b/pgg-pgp.el @@ -100,9 +100,8 @@ exit-status (process-exit-status process)) (delete-process process) (with-current-buffer output-buffer - (goto-char (point-min)) - (while (search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) + (if (memq status '(stop signal)) (error "%s exited abnormally: '%s'" program exit-status)) (if (= 127 exit-status) @@ -143,26 +142,15 @@ (luna-define-method encrypt-region ((scheme pgg-scheme-pgp) start end recipients) (let* ((pgg-pgp-user-id pgg-default-user-id) - (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp-user-id) - (luna-send scheme 'lookup-key-string - scheme pgg-pgp-user-id 'encrypt))) (args `("+encrypttoself=off +verbose=1" "+batchmode" "+language=us" "-fate" ,@(if recipients (mapcar (lambda (rcpt) (concat "\"" rcpt "\"")) recipients))))) - (pgg-pgp-process-region start end passphrase + (pgg-pgp-process-region start end nil pgg-pgp-program args) - (pgg-process-when-success - (let ((packet - (cdr (assq 1 (pgg-parse-armor-region - (point-min)(point-max)))))) - (pgg-add-passphrase-cache - (cdr (assq 'key-identifier packet)) - passphrase))) + (pgg-process-when-success nil) )) (luna-define-method decrypt-region ((scheme pgg-scheme-pgp) @@ -191,10 +179,15 @@ (args (list (if clearsign "-fast" "-fbast") "+verbose=1" "+language=us" "+batchmode" - "-u" pgg-pgp-user-id))) - (pgg-pgp-process-region start end passphrase - pgg-pgp-program args) + "-u" pgg-pgp-user-id)) + (inhibit-read-only t) + buffer-read-only) + (pgg-as-lbt start end 'CRLF + (pgg-pgp-process-region start end passphrase + pgg-pgp-program args) + ) (pgg-process-when-success + (pgg-convert-lbt-region (point-min)(point-max) 'LF) (goto-char (point-min)) (when (re-search-forward "^-+BEGIN PGP" nil t);XXX (let ((packet @@ -221,7 +214,17 @@ pgg-pgp-program args) (delete-file orig-file) (if signature (delete-file signature)) - (pgg-process-when-success nil) + (pgg-process-when-success + (goto-char (point-min)) + (let ((case-fold-search t)) + (while (re-search-forward "^warning: " nil t) + (delete-region (match-beginning 0) + (progn (beginning-of-line 2) (point))))) + (goto-char (point-min)) + (when (re-search-forward "^\\.$" nil t) + (delete-region (point-min) + (progn (beginning-of-line 2) + (point))))) )) (luna-define-method insert-key ((scheme pgg-scheme-pgp)) diff --git a/pgg-pgp5.el b/pgg-pgp5.el index e4d4136..4ca4b16 100644 --- a/pgg-pgp5.el +++ b/pgg-pgp5.el @@ -115,9 +115,8 @@ exit-status (process-exit-status process)) (delete-process process) (with-current-buffer output-buffer - (goto-char (point-min)) - (while (search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) + (if (memq status '(stop signal)) (error "%s exited abnormally: '%s'" program exit-status)) (if (= 127 exit-status) @@ -154,11 +153,6 @@ (luna-define-method encrypt-region ((scheme pgg-scheme-pgp5) start end recipients) (let* ((pgg-pgp5-user-id pgg-default-user-id) - (passphrase - (pgg-read-passphrase - (format "PGP passphrase for %s: " pgg-pgp5-user-id) - (luna-send scheme 'lookup-key-string - scheme pgg-pgp5-user-id 'encrypt))) (args `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" ,@(if recipients @@ -167,24 +161,9 @@ (list "-r" (concat "\"" rcpt "\""))) recipients)))))) - (pgg-pgp5-process-region start end passphrase + (pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args) - (with-current-buffer pgg-output-buffer - (if (zerop (buffer-size)) - (insert-buffer-substring pgg-errors-buffer) - (let ((packet - (cdr (assq 1 (pgg-parse-armor-region - (point-min)(point-max)))))) - (pgg-add-passphrase-cache - (cdr (assq 'key-identifier packet)) - passphrase)))) - (pgg-process-when-success - (let ((packet - (cdr (assq 1 (pgg-parse-armor-region - (point-min)(point-max)))))) - (pgg-add-passphrase-cache - (cdr (assq 'key-identifier packet)) - passphrase))) + (pgg-process-when-success nil) )) (luna-define-method decrypt-region ((scheme pgg-scheme-pgp5) @@ -214,12 +193,12 @@ (list (if clearsign "-fat" "-fbat") "+verbose=1" "+language=us" "+batchmode=1" "-u" pgg-pgp5-user-id))) - (pgg-pgp5-process-region start end passphrase - pgg-pgp5-pgps-program args) + (pgg-as-lbt start end 'CRLF + (pgg-pgp5-process-region start end passphrase + pgg-pgp5-pgps-program args) + ) (pgg-process-when-success - (goto-char (point-min)) - (while (re-search-forward "\r$" nil t) - (replace-match "")) + (pgg-convert-lbt-region (point-min)(point-max) 'LF) (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX (let ((packet (cdr (assq 2 (pgg-parse-armor-region