From: ueno Date: Mon, 21 Feb 2000 15:12:14 +0000 (+0000) Subject: * pgg-gpg.el (pgg-gpg-process-region): Fix cleanup form. X-Git-Tag: emiko-1_13_11~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=387d8a8209684a70480ce30b3a9551a13aaf6d26;p=elisp%2Fsemi.git * pgg-gpg.el (pgg-gpg-process-region): Fix cleanup form. * pgg-pgp.el (pgg-pgp-process-region): Ditto. * pgg-pgp5.el (pgg-pgp5-process-region): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 3388ba5..0b58de0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2000-02-21 Daiki Ueno + * pgg-gpg.el (pgg-gpg-process-region): Fix cleanup form. + + * pgg-pgp.el (pgg-pgp-process-region): Ditto. + + * pgg-pgp5.el (pgg-pgp5-process-region): Ditto. + * semi-setup.el (mime-setup-enable-inline-image): Remove checking of bitmap-mule; use `eval-after-load' instead of `call-after-loaded' to require `mime-image'. diff --git a/pgg-gpg.el b/pgg-gpg.el index aa4b50c..0a715db 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -91,42 +91,46 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (with-current-buffer (get-buffer-create output-buffer) (buffer-disable-undo) (erase-buffer)) - (as-binary-process - (setq process - (apply #'start-process-shell-command "*GnuPG*" output-buffer - program args))) - (set-process-sentinel process #'ignore) - (when passphrase - (process-send-string process (concat passphrase "\n"))) - (process-send-region process start end) - (process-send-eof process) - (while (eq 'run (process-status process)) - (accept-process-output process 5)) - (setq status (process-status process) - exit-status (process-exit-status process)) - (delete-process process) - (with-current-buffer output-buffer - (pgg-convert-lbt-region (point-min)(point-max) 'LF) + (unwind-protect + (progn + (as-binary-process + (setq process + (apply #'start-process-shell-command "*GnuPG*" output-buffer + program args))) + (set-process-sentinel process #'ignore) + (when passphrase + (process-send-string process (concat passphrase "\n"))) + (process-send-region process start end) + (process-send-eof process) + (while (eq 'run (process-status process)) + (accept-process-output process 5)) + (setq status (process-status process) + exit-status (process-exit-status process)) + (delete-process process) + (with-current-buffer output-buffer + (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) - (error "%s could not be found" program)) + (if (memq status '(stop signal)) + (error "%s exited abnormally: '%s'" program exit-status)) + (if (= 127 exit-status) + (error "%s could not be found" program)) - (set-buffer (get-buffer-create errors-buffer)) - (buffer-disable-undo) - (erase-buffer) - (insert-file-contents errors-file-name) - (delete-file errors-file-name) + (set-buffer (get-buffer-create errors-buffer)) + (buffer-disable-undo) + (erase-buffer) + (insert-file-contents errors-file-name) - (set-buffer (get-buffer-create status-buffer)) - (buffer-disable-undo) - (erase-buffer) - (insert-file-contents status-file-name) - (delete-file status-file-name) - + (set-buffer (get-buffer-create status-buffer)) + (buffer-disable-undo) + (erase-buffer) + (insert-file-contents status-file-name))) (if (and process (eq 'run (process-status process))) - (interrupt-process process))))) + (interrupt-process process)) + (condition-case nil + (progn + (delete-file status-file-name) + (delete-file errors-file-name)) + (file-error nil))))) (luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-gpg) string &optional type) diff --git a/pgg-pgp.el b/pgg-pgp.el index f407bde..4b033e5 100644 --- a/pgg-pgp.el +++ b/pgg-pgp.el @@ -85,36 +85,39 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (erase-buffer)) (when passphrase (setenv "PGPPASSFD" "0")) - (as-binary-process - (setq process - (apply #'start-process-shell-command "*PGP*" output-buffer - program args))) - (set-process-sentinel process #'ignore) - (when passphrase - (process-send-string process (concat passphrase "\n"))) - (process-send-region process start end) - (process-send-eof process) - (while (eq 'run (process-status process)) - (accept-process-output process 5)) - (setq status (process-status process) - exit-status (process-exit-status process)) - (delete-process process) - (with-current-buffer output-buffer - (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) - (error "%s could not be found" program)) - - (set-buffer (get-buffer-create errors-buffer)) - (buffer-disable-undo) - (erase-buffer) - (insert-file-contents errors-file-name) - (delete-file errors-file-name) - + (unwind-protect + (progn + (as-binary-process + (setq process + (apply #'start-process-shell-command "*PGP*" output-buffer + program args))) + (set-process-sentinel process #'ignore) + (when passphrase + (process-send-string process (concat passphrase "\n"))) + (process-send-region process start end) + (process-send-eof process) + (while (eq 'run (process-status process)) + (accept-process-output process 5)) + (setq status (process-status process) + exit-status (process-exit-status process)) + (delete-process process) + (with-current-buffer output-buffer + (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) + (error "%s could not be found" program)) + + (set-buffer (get-buffer-create errors-buffer)) + (buffer-disable-undo) + (erase-buffer) + (insert-file-contents errors-file-name))) (if (and process (eq 'run (process-status process))) - (interrupt-process process))))) + (interrupt-process process)) + (condition-case nil + (delete-file errors-file-name) + (file-error nil))))) (luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp) string &optional type) diff --git a/pgg-pgp5.el b/pgg-pgp5.el index 89aeda9..cde2b6f 100644 --- a/pgg-pgp5.el +++ b/pgg-pgp5.el @@ -100,36 +100,39 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (erase-buffer)) (when passphrase (setenv "PGPPASSFD" "0")) - (as-binary-process - (setq process - (apply #'start-process-shell-command "*PGP*" output-buffer - program args))) - (set-process-sentinel process #'ignore) - (when passphrase - (process-send-string process (concat passphrase "\n"))) - (process-send-region process start end) - (process-send-eof process) - (while (eq 'run (process-status process)) - (accept-process-output process 5)) - (setq status (process-status process) - exit-status (process-exit-status process)) - (delete-process process) - (with-current-buffer output-buffer - (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) - (error "%s could not be found" program)) - - (set-buffer (get-buffer-create errors-buffer)) - (buffer-disable-undo) - (erase-buffer) - (insert-file-contents errors-file-name) - (delete-file errors-file-name) - + (unwind-protect + (progn + (as-binary-process + (setq process + (apply #'start-process-shell-command "*PGP*" output-buffer + program args))) + (set-process-sentinel process #'ignore) + (when passphrase + (process-send-string process (concat passphrase "\n"))) + (process-send-region process start end) + (process-send-eof process) + (while (eq 'run (process-status process)) + (accept-process-output process 5)) + (setq status (process-status process) + exit-status (process-exit-status process)) + (delete-process process) + (with-current-buffer output-buffer + (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) + (error "%s could not be found" program)) + + (set-buffer (get-buffer-create errors-buffer)) + (buffer-disable-undo) + (erase-buffer) + (insert-file-contents errors-file-name))) (if (and process (eq 'run (process-status process))) - (interrupt-process process))))) + (interrupt-process process)) + (condition-case nil + (delete-file errors-file-name) + (file-error nil))))) (luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp5) string &optional type)