summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorVincent Belaïche <vincentb1@users.sourceforge.net>2014-10-25 01:02:25 +0200
committerVincent Belaïche <vincentb1@users.sourceforge.net>2014-10-25 01:02:25 +0200
commitb5dc75aed71ecb2310a6689e2f7082243aa7e4ab (patch)
tree9ad2eec33d866431a581a8b6533f75c1ce1fda7f /lisp/emacs-lisp
parentac6839a839e08749669e2f25873ac911afbfe42c (diff)
downloademacs-b5dc75aed71ecb2310a6689e2f7082243aa7e4ab.tar.gz
emacs-b5dc75aed71ecb2310a6689e2f7082243aa7e4ab.tar.bz2
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/macroexp.el12
-rw-r--r--lisp/emacs-lisp/package.el8
2 files changed, 14 insertions, 6 deletions
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."
"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
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 @@
(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)