summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2017-12-02 19:38:36 -0500
committerNoam Postavsky <npostavs@gmail.com>2017-12-03 15:39:02 -0500
commit6e0008890ffcfdcd0a8fc827c7108907bfb25d0a (patch)
treed88ff5b50626c2b17e994f37bab9db0ed9720fdb /lisp/emacs-lisp
parentdbe410d9ad6f656069566c8d32c38f04574c1ba9 (diff)
downloademacs-6e0008890ffcfdcd0a8fc827c7108907bfb25d0a.tar.gz
emacs-6e0008890ffcfdcd0a8fc827c7108907bfb25d0a.tar.bz2
emacs-6e0008890ffcfdcd0a8fc827c7108907bfb25d0a.zip
* lisp/emacs-lisp/package.el (package-read-from-string): Simplify.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el17
1 files changed, 6 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 61bff5cfbca..f8b4cc888dd 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -961,17 +961,12 @@ This assumes that `pkg-desc' has already been activated with
(defun package-read-from-string (str)
"Read a Lisp expression from STR.
Signal an error if the entire string was not used."
- (let* ((read-data (read-from-string str))
- (more-left
- (condition-case nil
- ;; The call to `ignore' suppresses a compiler warning.
- (progn (ignore (read-from-string
- (substring str (cdr read-data))))
- t)
- (end-of-file nil))))
- (if more-left
- (error "Can't read whole string")
- (car read-data))))
+ (pcase-let ((`(,expr . ,offset) (read-from-string str)))
+ (condition-case ()
+ ;; The call to `ignore' suppresses a compiler warning.
+ (progn (ignore (read-from-string str offset))
+ (error "Can't read whole string"))
+ (end-of-file expr))))
(defun package--prepare-dependencies (deps)
"Turn DEPS into an acceptable list of dependencies.