Function: pgg-pgp5-process-region
pgg-pgp5-process-region is a byte-compiled function defined in
pgg-pgp5.el.gz.
Signature
(pgg-pgp5-process-region START END PASSPHRASE PROGRAM ARGS)
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/pgg-pgp5.el.gz
(defun pgg-pgp5-process-region (start end passphrase program args)
(let* ((errors-file-name (pgg-make-temp-file "pgg-errors"))
(args
(append args
pgg-pgp5-extra-args
(list (concat "2>" errors-file-name))))
(shell-file-name pgg-pgp5-shell-file-name)
(shell-command-switch pgg-pgp5-shell-command-switch)
(process-environment process-environment)
(output-buffer pgg-output-buffer)
(errors-buffer pgg-errors-buffer)
(process-connection-type nil)
process status exit-status)
(with-current-buffer (get-buffer-create output-buffer)
(buffer-disable-undo)
(erase-buffer))
(when passphrase
(setenv "PGPPASSFD" "0"))
(unwind-protect
(progn
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary))
(setq process
(apply #'funcall
#'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))
(condition-case nil
(delete-file errors-file-name)
(file-error nil)))))