aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2018-07-12 10:29:28 -0400
committerStefan Monnier2018-07-12 10:29:28 -0400
commitaeefbc41be093ceb1222d9b430fb44b69de660e2 (patch)
treeb74878610dce5ad1a50c6047ef12504c4a9c7604
parent84e5986902c7d7274f438c48c82949436eb9093d (diff)
downloademacs-aeefbc41be093ceb1222d9b430fb44b69de660e2.tar.gz
emacs-aeefbc41be093ceb1222d9b430fb44b69de660e2.zip
Fix the bootstrap differently, so zerop can be where it belongs
Suggested by Robert Pluim <rpluim@gmail.com>. * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Avoid cadr/cddr. * lisp/subr.el (zerop): Un-revert 2018-07-10T23:08:58-07:00!contovob@tcd.ie.
-rw-r--r--lisp/emacs-lisp/byte-run.el9
-rw-r--r--lisp/subr.el17
2 files changed, 13 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index aa10bd3e804..5edf5a28db8 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -116,7 +116,10 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
116 (if (not (eq (car-safe compiler-function) 'lambda)) 116 (if (not (eq (car-safe compiler-function) 'lambda))
117 `(eval-and-compile 117 `(eval-and-compile
118 (function-put ',f 'compiler-macro #',compiler-function)) 118 (function-put ',f 'compiler-macro #',compiler-function))
119 (let ((cfname (intern (concat (symbol-name f) "--anon-cmacro")))) 119 (let ((cfname (intern (concat (symbol-name f) "--anon-cmacro")))
120 ;; Avoid cadr/cddr so we can use `compiler-macro' before
121 ;; defining cadr/cddr.
122 (data (cdr compiler-function)))
120 `(progn 123 `(progn
121 (eval-and-compile 124 (eval-and-compile
122 (function-put ',f 'compiler-macro #',cfname)) 125 (function-put ',f 'compiler-macro #',cfname))
@@ -125,8 +128,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
125 ;; if needed. 128 ;; if needed.
126 :autoload-end 129 :autoload-end
127 (eval-and-compile 130 (eval-and-compile
128 (defun ,cfname (,@(cadr compiler-function) ,@args) 131 (defun ,cfname (,@(car data) ,@args)
129 ,@(cddr compiler-function)))))))) 132 ,@(cdr data))))))))
130 (list 'doc-string 133 (list 'doc-string
131 #'(lambda (f _args pos) 134 #'(lambda (f _args pos)
132 (list 'function-put (list 'quote f) 135 (list 'function-put (list 'quote f)
diff --git a/lisp/subr.el b/lisp/subr.el
index a5108eb6558..10343e69db8 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -359,6 +359,13 @@ was called."
359 (lambda (&rest args2) 359 (lambda (&rest args2)
360 (apply fun (append args args2)))) 360 (apply fun (append args args2))))
361 361
362(defun zerop (number)
363 "Return t if NUMBER is zero."
364 ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
365 ;; = has a byte-code.
366 (declare (compiler-macro (lambda (_) `(= 0 ,number))))
367 (= 0 number))
368
362 369
363;;;; List functions. 370;;;; List functions.
364 371
@@ -548,16 +555,6 @@ If N is omitted or nil, remove the last element."
548 (if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil)) 555 (if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil))
549 list)))) 556 list))))
550 557
551;; This function appears here instead of under the 'Basic Lisp
552;; functions' heading because during bootstrap its compiler-macro
553;; requires functions defined under the 'List functions' heading.
554(defun zerop (number)
555 "Return t if NUMBER is zero."
556 ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
557 ;; = has a byte-code.
558 (declare (compiler-macro (lambda (_) `(= 0 ,number))))
559 (= 0 number))
560
561(defun proper-list-p (object) 558(defun proper-list-p (object)
562 "Return OBJECT's length if it is a proper list, nil otherwise. 559 "Return OBJECT's length if it is a proper list, nil otherwise.
563A proper list is neither circular nor dotted (i.e., its last cdr 560A proper list is neither circular nor dotted (i.e., its last cdr