diff options
| author | Vincent Belaïche | 2014-10-25 01:02:25 +0200 |
|---|---|---|
| committer | Vincent Belaïche | 2014-10-25 01:02:25 +0200 |
| commit | b5dc75aed71ecb2310a6689e2f7082243aa7e4ab (patch) | |
| tree | 9ad2eec33d866431a581a8b6533f75c1ce1fda7f | |
| parent | ac6839a839e08749669e2f25873ac911afbfe42c (diff) | |
| download | emacs-b5dc75aed71ecb2310a6689e2f7082243aa7e4ab.tar.gz emacs-b5dc75aed71ecb2310a6689e2f7082243aa7e4ab.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/emacs-lisp/macroexp.el | 12 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 8 | ||||
| -rw-r--r-- | lisp/ses.el | 3 |
4 files changed, 35 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index da6c936810a..da3ce647cf7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2014-10-24 Vincent Belaïche <vincentb1@users.sourceforge.net> | ||
| 2 | |||
| 3 | * ses.el (macroexp): add require for this package, so that function | ||
| 4 | `ses--cell gets macroexp-quote. | ||
| 5 | (ses--cell): makes formula a macroexp-quote of value when formula | ||
| 6 | is nil. The rationale of this changr is to allow in the future | ||
| 7 | shorter SES files, e.g. we could have only `(ses-cell A1 1.0)' | ||
| 8 | instead of `(ses-cell A1 1.0 1.0 nil REFLIST)'. In such a case | ||
| 9 | reference list REFLIST would be re-computed after load --- thus | ||
| 10 | trading off load time against file size. | ||
| 11 | |||
| 12 | * emacs-lisp/package.el (package--alist-to-plist-args): use | ||
| 13 | macroexp-quote instead of a lambda expression which has the same | ||
| 14 | content as macroexp-quote. | ||
| 15 | (macroexp): add require for this package, so that function | ||
| 16 | `package--alist-to-plist-args' gets macroexp-quote. | ||
| 17 | |||
| 18 | * emacs-lisp/macroexp.el (macroexp-quote): new defun. | ||
| 19 | |||
| 1 | 2014-10-24 Stefan Monnier <monnier@iro.umontreal.ca> | 20 | 2014-10-24 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 21 | ||
| 3 | * term/ns-win.el (ns-store-cut-buffer-internal) | 22 | * term/ns-win.el (ns-store-cut-buffer-internal) |
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 44727daf76a..b3bcc2d4078 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el | |||
| @@ -370,6 +370,18 @@ symbol itself." | |||
| 370 | "Return non-nil if EXP can be copied without extra cost." | 370 | "Return non-nil if EXP can be copied without extra cost." |
| 371 | (or (symbolp exp) (macroexp-const-p exp))) | 371 | (or (symbolp exp) (macroexp-const-p exp))) |
| 372 | 372 | ||
| 373 | (defun macroexp-quote (v) | ||
| 374 | "Returns an expression E such that `(eval E)' is V. | ||
| 375 | |||
| 376 | E is either V or (quote V) depending on whether V evaluates to | ||
| 377 | itself or not." | ||
| 378 | (if (and (not (consp v)) | ||
| 379 | (or (keywordp v) | ||
| 380 | (not (symbolp v)) | ||
| 381 | (memq v '(nil t)))) | ||
| 382 | v | ||
| 383 | (list 'quote v))) | ||
| 384 | |||
| 373 | ;;; Load-time macro-expansion. | 385 | ;;; Load-time macro-expansion. |
| 374 | 386 | ||
| 375 | ;; Because macro-expansion used to be more lazy, eager macro-expansion | 387 | ;; Because macro-expansion used to be more lazy, eager macro-expansion |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index b8370fde337..e375a1e2301 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -165,6 +165,7 @@ | |||
| 165 | (eval-when-compile (require 'epg)) ;For setf accessors. | 165 | (eval-when-compile (require 'epg)) ;For setf accessors. |
| 166 | 166 | ||
| 167 | (require 'tabulated-list) | 167 | (require 'tabulated-list) |
| 168 | (require 'macroexp) | ||
| 168 | 169 | ||
| 169 | (defgroup package nil | 170 | (defgroup package nil |
| 170 | "Manager for Emacs Lisp packages." | 171 | "Manager for Emacs Lisp packages." |
| @@ -723,12 +724,7 @@ untar into a directory named DIR; otherwise, signal an error." | |||
| 723 | nil pkg-file nil 'silent)))) | 724 | nil pkg-file nil 'silent)))) |
| 724 | 725 | ||
| 725 | (defun package--alist-to-plist-args (alist) | 726 | (defun package--alist-to-plist-args (alist) |
| 726 | (mapcar (lambda (x) | 727 | (mapcar 'macroexp-quote |
| 727 | (if (and (not (consp x)) | ||
| 728 | (or (keywordp x) | ||
| 729 | (not (symbolp x)) | ||
| 730 | (memq x '(nil t)))) | ||
| 731 | x `',x)) | ||
| 732 | (apply #'nconc | 728 | (apply #'nconc |
| 733 | (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) | 729 | (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) |
| 734 | (defun package-unpack (pkg-desc) | 730 | (defun package-unpack (pkg-desc) |
diff --git a/lisp/ses.el b/lisp/ses.el index 541c1e19769..09001fdb358 100644 --- a/lisp/ses.el +++ b/lisp/ses.el | |||
| @@ -491,7 +491,8 @@ Safety-checking for FORMULA and PRINTER are deferred until first use." | |||
| 491 | (let ((rowcol (ses-sym-rowcol sym))) | 491 | (let ((rowcol (ses-sym-rowcol sym))) |
| 492 | (ses-formula-record formula) | 492 | (ses-formula-record formula) |
| 493 | (ses-printer-record printer) | 493 | (ses-printer-record printer) |
| 494 | (unless formula (setq formula value)) | 494 | (unless (or formula (eq formula '*skip*)) |
| 495 | (setq formula (macroexp-quote value))) | ||
| 495 | (or (atom formula) | 496 | (or (atom formula) |
| 496 | (eq safe-functions t) | 497 | (eq safe-functions t) |
| 497 | (setq formula `(ses-safe-formula ,formula))) | 498 | (setq formula `(ses-safe-formula ,formula))) |