diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-04-05 22:44:17 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-04-06 11:19:04 +0100 |
commit | b6610d55470c7e835472a581977ab6fad537c8b6 (patch) | |
tree | 77eed8df0f30685295bc063e632d0bbfbd9a87a6 /test | |
parent | 7436b68132daa1a941bfbc73a16ce43f5e72a746 (diff) | |
download | emacs-b6610d55470c7e835472a581977ab6fad537c8b6.tar.gz |
emacs-lisp/package.el: Refactor pre-execute prompt
Diffstat (limited to 'test')
-rw-r--r-- | test/automated/package-test.el | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/test/automated/package-test.el b/test/automated/package-test.el index 359f3541b41..5fae216ef7d 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -113,7 +113,6 @@ process-environment)) (package-user-dir package-test-user-dir) (package-archives `(("gnu" . ,package-test-data-dir))) - (old-yes-no-defn (symbol-function 'yes-or-no-p)) (default-directory package-test-file-dir) abbreviated-home-dir package--initialized @@ -128,25 +127,25 @@ (unwind-protect (progn ,(if basedir `(cd ,basedir)) - (setf (symbol-function 'yes-or-no-p) #'(lambda (&rest r) t)) (unless (file-directory-p package-user-dir) (mkdir package-user-dir)) - ,@(when install - `((package-initialize) - (package-refresh-contents) - (mapc 'package-install ,install))) - (with-temp-buffer - ,(if file - `(insert-file-contents ,file)) - ,@body)) + (cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest r) t)) + ((symbol-function 'y-or-n-p) (lambda (&rest r) t))) + ,@(when install + `((package-initialize) + (package-refresh-contents) + (mapc 'package-install ,install))) + (with-temp-buffer + ,(if file + `(insert-file-contents ,file)) + ,@body))) (when (file-directory-p package-test-user-dir) (delete-directory package-test-user-dir t)) (when (and (boundp 'package-test-archive-upload-base) (file-directory-p package-test-archive-upload-base)) - (delete-directory package-test-archive-upload-base t)) - (setf (symbol-function 'yes-or-no-p) old-yes-no-defn)))) + (delete-directory package-test-archive-upload-base t))))) (defmacro with-fake-help-buffer (&rest body) "Execute BODY in a temp buffer which is treated as the \"*Help*\" buffer." |