From b184a5d453660cd595b026b95bef186276899d9e Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 15 May 2003 14:44:43 +0000 Subject: [PATCH] * pgg-gpg.el (pgg-gpg-process-region): Use `make-temp-file' instead of `make-temp-name'. * pgg-pgp5.el (pgg-pgp5-process-region): Ditto. (pgg-scheme-verify-region): Ditto. (pgg-scheme-snarf-keys-region): Ditto. * pgg-pgp.el (pgg-pgp-process-region): Ditto. (pgg-scheme-verify-region): Ditto. (pgg-scheme-snarf-keys-region): Ditto. * smime.el (smime-process-region): Ditto. (smime-verify-region): Ditto. * mime-pgp.el (mime-verify-application/pgp-signature): Ditto. (mime-verify-application/pkcs7-signature): Ditto. * mime-play.el (mime-activate-mailcap-method): Make a temporary directory of a temporary file for the mailcap application. (mime-mailcap-method-sentinel): Follow the change above. (mime-store-message/partial-piece): Set `default-file-modes' for `make-directory'. * mime-edit.el (mime-edit-split-and-send): Remove local variable `mime-edit-draft-file-name'. --- ChangeLog | 28 ++++++++++++++++++++++++++++ mime-edit.el | 6 +----- mime-pgp.el | 6 ++---- mime-play.el | 31 +++++++++++++++++++++---------- pgg-gpg.el | 3 +-- pgg-pgp.el | 10 +++------- pgg-pgp5.el | 10 +++------- smime.el | 7 ++----- 8 files changed, 61 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ba2294..b66b12e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2003-05-15 Yuuichi Teranishi + + * pgg-gpg.el (pgg-gpg-process-region): Use `make-temp-file' instead of + `make-temp-name'. + + * pgg-pgp5.el (pgg-pgp5-process-region): Ditto. + (pgg-scheme-verify-region): Ditto. + (pgg-scheme-snarf-keys-region): Ditto. + + * pgg-pgp.el (pgg-pgp-process-region): Ditto. + (pgg-scheme-verify-region): Ditto. + (pgg-scheme-snarf-keys-region): Ditto. + + * smime.el (smime-process-region): Ditto. + (smime-verify-region): Ditto. + + * mime-pgp.el (mime-verify-application/pgp-signature): Ditto. + (mime-verify-application/pkcs7-signature): Ditto. + + * mime-play.el (mime-activate-mailcap-method): Make a temporary + directory of a temporary file for the mailcap application. + (mime-mailcap-method-sentinel): Follow the change above. + (mime-store-message/partial-piece): Set `default-file-modes' for + `make-directory'. + + * mime-edit.el (mime-edit-split-and-send): Remove local variable + `mime-edit-draft-file-name'. + 2003-05-12 Yoichi NAKAYAMA * mime-edit.el (turn-on-mime-edit): Protect 1st arg of `message'. diff --git a/mime-edit.el b/mime-edit.el index 9a3a725..d9bb359 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -2606,11 +2606,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (or (cdr (assq major-mode mime-edit-message-max-lines-alist)) mime-edit-message-default-max-lines)) ) - (let* ((mime-edit-draft-file-name - (or (buffer-file-name) - (make-temp-name - (expand-file-name "mime-draft" temporary-file-directory)))) - (separator mail-header-separator) + (let* ((separator mail-header-separator) (id (concat "\"" (replace-space-with-underline (current-time-string)) "@" (system-name) "\""))) diff --git a/mime-pgp.el b/mime-pgp.el index 718ad9e..187e4ec 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -141,8 +141,7 @@ (1- knum) (1+ knum))) (orig-entity (nth onum (mime-entity-children mother))) - (basename (expand-file-name "tm" temporary-file-directory)) - (sig-file (concat (make-temp-name basename) ".asc")) + (sig-file (make-temp-file "tm" nil ".asc")) status) (save-excursion (mime-show-echo-buffer) @@ -219,8 +218,7 @@ (1- knum) (1+ knum))) (orig-entity (nth onum (mime-entity-children mother))) - (basename (expand-file-name "tm" temporary-file-directory)) - (sig-file (concat (make-temp-name basename) ".asc")) + (sig-file (make-temp-file "tm" nil ".asc")) status) (save-excursion (mime-show-echo-buffer) diff --git a/mime-play.el b/mime-play.el index ed78440..a3bf086 100644 --- a/mime-play.el +++ b/mime-play.el @@ -141,11 +141,10 @@ specified, play as it. Default MODE is \"play\"." (defun mime-activate-mailcap-method (entity situation) (let ((method (cdr (assoc 'method situation))) (name (mime-entity-safe-filename entity))) - (setq name - (if (and name (not (string= name ""))) - (expand-file-name name temporary-file-directory) - (make-temp-name - (expand-file-name "EMI" temporary-file-directory)))) + (setq name (expand-file-name (if (and name (not (string= name ""))) + name + (make-temp-name "EMI")) + (make-temp-file "EMI" 'directory))) (mime-write-entity-content entity name) (message "External method is starting...") (let ((process @@ -162,9 +161,10 @@ specified, play as it. Default MODE is \"play\"." (defun mime-mailcap-method-sentinel (process event) (let ((file (cdr (assq process mime-mailcap-method-filename-alist)))) - (if (file-exists-p file) + (when (file-exists-p file) + (ignore-errors (delete-file file) - )) + (delete-directory (file-name-directory file))))) (remove-alist 'mime-mailcap-method-filename-alist process) (message "%s %s" process event)) @@ -354,13 +354,24 @@ It is registered to variable `mime-preview-quitting-method-alist'." (number (cdr (assoc "number" cal))) (total (cdr (assoc "total" cal))) file - (mother (current-buffer))) + (mother (current-buffer)) + orig-modes (default-file-modes)) (or (file-exists-p root-dir) - (make-directory root-dir)) + (unwind-protect + (progn + (set-default-file-modes 448) + (make-directory root-dir)) + (set-default-file-modes orig-modes))) (setq id (replace-as-filename id)) (setq root-dir (concat root-dir "/" id)) + (or (file-exists-p root-dir) - (make-directory root-dir)) + (unwind-protect + (progn + (set-default-file-modes 448) + (make-directory root-dir)) + (set-default-file-modes orig-modes))) + (setq file (concat root-dir "/FULL")) (if (file-exists-p file) (let ((full-buf (get-buffer-create "FULL")) diff --git a/pgg-gpg.el b/pgg-gpg.el index dc6c5ae..c46d33f 100644 --- a/pgg-gpg.el +++ b/pgg-gpg.el @@ -60,8 +60,7 @@ (luna-make-entity 'pgg-scheme-gpg)))) (defun pgg-gpg-process-region (start end passphrase program args) - (let* ((output-file-name - (concat temporary-file-directory (make-temp-name "pgg-output"))) + (let* ((output-file-name (make-temp-file "pgg-output")) (args `("--status-fd" "2" ,@(if passphrase '("--passphrase-fd" "0")) diff --git a/pgg-pgp.el b/pgg-pgp.el index 91f6134..d34445b 100644 --- a/pgg-pgp.el +++ b/pgg-pgp.el @@ -68,9 +68,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-make-entity 'pgg-scheme-pgp)))) (defun pgg-pgp-process-region (start end passphrase program args) - (let* ((errors-file-name - (concat temporary-file-directory - (make-temp-name "pgg-errors"))) + (let* ((errors-file-name (make-temp-file "pgg-errors")) (args (append args pgg-pgp-extra-args @@ -192,8 +190,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp) start end &optional signature) - (let* ((basename (expand-file-name "pgg" temporary-file-directory)) - (orig-file (make-temp-name basename)) + (let* ((orig-file (make-temp-file "pgg")) (args '("+verbose=1" "+batchmode" "+language=us")) (orig-mode (default-file-modes))) (unwind-protect @@ -230,8 +227,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp) start end) (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) - (basename (expand-file-name "pgg" temporary-file-directory)) - (key-file (make-temp-name basename)) + (key-file (make-temp-file "pgg")) (args (list "+verbose=1" "+batchmode" "+language=us" "-kaf" key-file))) diff --git a/pgg-pgp5.el b/pgg-pgp5.el index 58c3309..515ca5a 100644 --- a/pgg-pgp5.el +++ b/pgg-pgp5.el @@ -83,9 +83,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-make-entity 'pgg-scheme-pgp5)))) (defun pgg-pgp5-process-region (start end passphrase program args) - (let* ((errors-file-name - (concat temporary-file-directory - (make-temp-name "pgg-errors"))) + (let* ((errors-file-name (make-temp-file "pgg-errors")) (args (append args pgg-pgp5-extra-args @@ -204,8 +202,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp5) start end &optional signature) - (let* ((basename (expand-file-name "pgg" temporary-file-directory)) - (orig-file (make-temp-name basename)) + (let* ((orig-file (make-temp-file "pgg")) (args '("+verbose=1" "+batchmode=1" "+language=us")) (orig-mode (default-file-modes))) (unwind-protect @@ -239,8 +236,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp5) start end) (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) - (basename (expand-file-name "pgg" temporary-file-directory)) - (key-file (make-temp-name basename)) + (key-file (make-temp-file "pgg")) (args (list "+verbose=1" "+batchmode=1" "+language=us" "-a" key-file))) diff --git a/smime.el b/smime.el index 839c715..f13d811 100644 --- a/smime.el +++ b/smime.el @@ -193,9 +193,7 @@ (pop files))))) (defun smime-process-region (start end program args) - (let* ((errors-file-name - (concat temporary-file-directory - (make-temp-name "smime-errors"))) + (let* ((errors-file-name (make-temp-file "smime-errors")) (args (append args (list (concat "2>" errors-file-name)))) (shell-file-name smime-shell-file-name) (shell-command-switch smime-shell-command-switch) @@ -297,8 +295,7 @@ a detached signature." "Verify the current region between START and END. If the optional 3rd argument SIGNATURE is non-nil, it is treated as the detached signature of the current region." - (let* ((basename (expand-file-name "smime" temporary-file-directory)) - (orig-file (make-temp-name basename)) + (let* ((orig-file (make-temp-file "smime")) (orig-mode (default-file-modes))) (unwind-protect (progn -- 1.7.10.4