]> code.delx.au - gnu-emacs/commitdiff
* ses.el (macroexp): add require for this package, so that function
authorVincent Belaïche <vincentb1@users.sourceforge.net>
Fri, 24 Oct 2014 23:02:25 +0000 (01:02 +0200)
committerVincent Belaïche <vincentb1@users.sourceforge.net>
Fri, 24 Oct 2014 23:02:25 +0000 (01:02 +0200)
`ses--cell gets macroexp-quote.
(ses--cell): makes formula a macroexp-quote of value when formula
is nil. The rationale of this changr is to allow in the future
shorter SES files, e.g. we could have only `(ses-cell A1 1.0)'
instead of `(ses-cell A1 1.0 1.0 nil REFLIST)'. In such a case
reference list REFLIST would be re-computed after load --- thus
trading off load time against file size.

* emacs-lisp/package.el (package--alist-to-plist-args): use
macroexp-quote instead of a lambda expression which has the same
content as macroexp-quote.
(macroexp): add require for this package, so that function
`package--alist-to-plist-args' gets macroexp-quote.

* emacs-lisp/macroexp.el (macroexp-quote): new defun.

lisp/ChangeLog
lisp/emacs-lisp/macroexp.el
lisp/emacs-lisp/package.el
lisp/ses.el

index da6c936810a531e34db47caa5a49c3cc5df36ebc..da3ce647cf7e50db622d65802bb6f27e7d27a824 100644 (file)
@@ -1,3 +1,22 @@
+2014-10-24  Vincent Belaïche  <vincentb1@users.sourceforge.net>
+
+       * ses.el (macroexp): add require for this package, so that function
+       `ses--cell gets macroexp-quote.
+       (ses--cell): makes formula a macroexp-quote of value when formula
+       is nil. The rationale of this changr is to allow in the future
+       shorter SES files, e.g. we could have only `(ses-cell A1 1.0)'
+       instead of `(ses-cell A1 1.0 1.0 nil REFLIST)'. In such a case
+       reference list REFLIST would be re-computed after load --- thus
+       trading off load time against file size.
+
+       * emacs-lisp/package.el (package--alist-to-plist-args): use
+       macroexp-quote instead of a lambda expression which has the same
+       content as macroexp-quote.
+       (macroexp): add require for this package, so that function
+       `package--alist-to-plist-args' gets macroexp-quote.
+
+       * emacs-lisp/macroexp.el (macroexp-quote): new defun.
+
 2014-10-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * term/ns-win.el (ns-store-cut-buffer-internal)
index 44727daf76ae21df6943669aa1e271343b04a978..b3bcc2d40783a323685b8d49d5bdffe29ea6018d 100644 (file)
@@ -370,6 +370,18 @@ symbol itself."
   "Return non-nil if EXP can be copied without extra cost."
   (or (symbolp exp) (macroexp-const-p exp)))
 
+(defun macroexp-quote (v)
+  "Returns an expression E such that `(eval E)' is V.
+
+E is either V or (quote V) depending on whether V evaluates to
+itself or not."
+  (if (and (not (consp v))
+          (or (keywordp v)
+              (not (symbolp v))
+              (memq v '(nil t))))
+      v
+    (list 'quote v)))
+
 ;;; Load-time macro-expansion.
 
 ;; Because macro-expansion used to be more lazy, eager macro-expansion
index b8370fde33705a75a7f5bf125d2f759e955aef17..e375a1e2301ede8ae3fb317c30e2859562f85d75 100644 (file)
 (eval-when-compile (require 'epg))      ;For setf accessors.
 
 (require 'tabulated-list)
+(require 'macroexp)
 
 (defgroup package nil
   "Manager for Emacs Lisp packages."
@@ -723,12 +724,7 @@ untar into a directory named DIR; otherwise, signal an error."
        nil pkg-file nil 'silent))))
 
 (defun package--alist-to-plist-args (alist)
-  (mapcar (lambda (x)
-            (if (and (not (consp x))
-                     (or (keywordp x)
-                         (not (symbolp x))
-                         (memq x '(nil t))))
-                x `',x))
+  (mapcar 'macroexp-quote
           (apply #'nconc
                  (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist))))
 (defun package-unpack (pkg-desc)
index 541c1e1976959dd01b09df1b0accc45251d16a5d..09001fdb358bdf962ebd7b3d5b70b515dd7d27eb 100644 (file)
@@ -491,7 +491,8 @@ Safety-checking for FORMULA and PRINTER are deferred until first use."
   (let ((rowcol (ses-sym-rowcol sym)))
     (ses-formula-record formula)
     (ses-printer-record printer)
-    (unless formula (setq formula value))
+    (unless (or formula (eq formula '*skip*))
+      (setq formula (macroexp-quote value)))
     (or (atom formula)
        (eq safe-functions t)
        (setq formula `(ses-safe-formula ,formula)))