emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6e00088 3/5: * lisp/emacs-lisp/package.el (package-


From: Noam Postavsky
Subject: [Emacs-diffs] master 6e00088 3/5: * lisp/emacs-lisp/package.el (package-read-from-string): Simplify.
Date: Sun, 3 Dec 2017 15:41:02 -0500 (EST)

branch: master
commit 6e0008890ffcfdcd0a8fc827c7108907bfb25d0a
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    * lisp/emacs-lisp/package.el (package-read-from-string): Simplify.
---
 lisp/emacs-lisp/package.el | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 61bff5c..f8b4cc8 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]