summaryrefslogtreecommitdiff
path: root/lisp/doc-view.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-05-14 10:15:15 -0700
committerGlenn Morris <rgm@gnu.org>2014-05-14 10:15:15 -0700
commitd63d883a97e385392a12a5155201417dea7437ec (patch)
tree7141dda616156ada1c5935d49dfc9e6915a5857b /lisp/doc-view.el
parentabad7b05fa544e5dfccf240180c37157dd92ac54 (diff)
downloademacs-d63d883a97e385392a12a5155201417dea7437ec.tar.gz
Add with-file-modes macro, and use it
* lisp/subr.el (with-file-modes): New macro. * lisp/printing.el (pr-save-file-modes): * lisp/eshell/esh-util.el (eshell-with-file-modes): Make obsolete. * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Add with-file-modes. * lisp/doc-view.el (doc-view-make-safe-dir): * lisp/epg.el (epg--start): * lisp/files.el (locate-user-emacs-file, make-temp-file) (backup-buffer-copy, move-file-to-trash): * printing.el (pr-despool-print, pr-call-process, pr-text2ps): * eshell/esh-util.el (eshell-with-private-file-modes) (eshell-make-private-directory): * lisp/net/browse-url.el (browse-url-mosaic): * lisp/obsolete/mailpost.el (post-mail-send-it): * lisp/obsolete/pgg-pgp.el (pgg-pgp-verify-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-verify-region): * lisp/url/url-util.el (url-make-private-file): Use with-file-modes. * doc/lispref/files.texi (Changing Files): Mention with-file-modes. * etc/NEWS: Mention this.
Diffstat (limited to 'lisp/doc-view.el')
-rw-r--r--lisp/doc-view.el14
1 files changed, 4 insertions, 10 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 4ff78b55d4b..5d2c897e4f9 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -654,16 +654,10 @@ at the top edge of the page moves to the previous page."
(defun doc-view-make-safe-dir (dir)
(condition-case nil
- (let ((umask (default-file-modes)))
- (unwind-protect
- (progn
- ;; Create temp files with strict access rights. It's easy to
- ;; loosen them later, whereas it's impossible to close the
- ;; time-window of loose permissions otherwise.
- (set-default-file-modes #o0700)
- (make-directory dir))
- ;; Reset the umask.
- (set-default-file-modes umask)))
+ ;; Create temp files with strict access rights. It's easy to
+ ;; loosen them later, whereas it's impossible to close the
+ ;; time-window of loose permissions otherwise.
+ (with-file-modes #o0700 (make-directory dir))
(file-already-exists
(when (file-symlink-p dir)
(error "Danger: %s points to a symbolic link" dir))