emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master aeefbc4: Fix the bootstrap differently, so zerop ca


From: Stefan Monnier
Subject: [Emacs-diffs] master aeefbc4: Fix the bootstrap differently, so zerop can be where it belongs
Date: Thu, 12 Jul 2018 10:29:34 -0400 (EDT)

branch: master
commit aeefbc41be093ceb1222d9b430fb44b69de660e2
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    Fix the bootstrap differently, so zerop can be where it belongs
    
    Suggested by Robert Pluim <address@hidden>.
    
    * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Avoid cadr/cddr.
    * lisp/subr.el (zerop): Un-revert 2018-07-10T23:08:58-07:address@hidden
---
 lisp/emacs-lisp/byte-run.el |  9 ++++++---
 lisp/subr.el                | 17 +++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index aa10bd3..5edf5a2 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.")
              (if (not (eq (car-safe compiler-function) 'lambda))
                  `(eval-and-compile
                     (function-put ',f 'compiler-macro #',compiler-function))
-               (let ((cfname (intern (concat (symbol-name f) 
"--anon-cmacro"))))
+               (let ((cfname (intern (concat (symbol-name f) "--anon-cmacro")))
+                     ;; Avoid cadr/cddr so we can use `compiler-macro' before
+                     ;; defining cadr/cddr.
+                     (data (cdr compiler-function)))
                  `(progn
                     (eval-and-compile
                       (function-put ',f 'compiler-macro #',cfname))
@@ -125,8 +128,8 @@ If `error-free', drop calls even if 
`byte-compile-delete-errors' is nil.")
                     ;; if needed.
                     :autoload-end
                     (eval-and-compile
-                      (defun ,cfname (,@(cadr compiler-function) ,@args)
-                        ,@(cddr compiler-function))))))))
+                      (defun ,cfname (,@(car data) ,@args)
+                        ,@(cdr data))))))))
    (list 'doc-string
          #'(lambda (f _args pos)
              (list 'function-put (list 'quote f)
diff --git a/lisp/subr.el b/lisp/subr.el
index a5108eb..10343e6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -359,6 +359,13 @@ was called."
   (lambda (&rest args2)
     (apply fun (append args args2))))
 
+(defun zerop (number)
+  "Return t if NUMBER is zero."
+  ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
+  ;; = has a byte-code.
+  (declare (compiler-macro (lambda (_) `(= 0 ,number))))
+  (= 0 number))
+
 
 ;;;; List functions.
 
@@ -548,16 +555,6 @@ If N is omitted or nil, remove the last element."
           (if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil))
           list))))
 
-;; This function appears here instead of under the 'Basic Lisp
-;; functions' heading because during bootstrap its compiler-macro
-;; requires functions defined under the 'List functions' heading.
-(defun zerop (number)
-  "Return t if NUMBER is zero."
-  ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
-  ;; = has a byte-code.
-  (declare (compiler-macro (lambda (_) `(= 0 ,number))))
-  (= 0 number))
-
 (defun proper-list-p (object)
   "Return OBJECT's length if it is a proper list, nil otherwise.
 A proper list is neither circular nor dotted (i.e., its last cdr



reply via email to

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