diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2015-09-13 14:12:22 -0400 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2015-09-15 11:11:16 -0400 |
commit | c051487fcf379febf4ce5b38de7017609c84a106 (patch) | |
tree | f35ec33352ad7326848a6a7e30906fec0bc0d768 /lisp | |
parent | 7f6b6f1a165b5a52481aa3b1d06ac4cdbce24da3 (diff) | |
download | emacs-c051487fcf379febf4ce5b38de7017609c84a106.tar.gz |
lisp/custom.el (load-theme): Only compute hash when needed
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/custom.el | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/custom.el b/lisp/custom.el index ea5ab7a4773..e212e32807d 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1214,13 +1214,11 @@ Return t if THEME was successfully loaded, nil otherwise." (put theme 'theme-documentation nil)) (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") (custom-theme--load-path) - '("" "c"))) - hash) + '("" "c")))) (unless fn (error "Unable to find theme file for `%s'" theme)) (with-temp-buffer (insert-file-contents fn) - (setq hash (secure-hash 'sha256 (current-buffer))) ;; Check file safety with `custom-safe-themes', prompting the ;; user if necessary. (when (or no-confirm @@ -1228,8 +1226,9 @@ Return t if THEME was successfully loaded, nil otherwise." (and (memq 'default custom-safe-themes) (equal (file-name-directory fn) (expand-file-name "themes/" data-directory))) - (member hash custom-safe-themes) - (custom-theme-load-confirm hash)) + (let ((hash (secure-hash 'sha256 (current-buffer)))) + (or (member hash custom-safe-themes) + (custom-theme-load-confirm hash)))) (let ((custom--inhibit-theme-enable t) (buffer-file-name fn)) ;For load-history. (eval-buffer)) |