aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2014-05-27 20:50:44 -0400
committerStefan Monnier <[email protected]>2014-05-27 20:50:44 -0400
commit4c539a7b387874577136190d8e1a413da1d7e240 (patch)
treeec7fae72e576ba2cde3553fca04cd83cf0c16d35 /lisp
parent0e4857b7d84f958f66e726ed57b824427b272681 (diff)
* lisp/subr.el (zerop): Move from C. Add compiler-macro.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-zerop): Remove. * src/data.c (Fzerop): Move to Elisp. (syms_of_data): Don't defsubr it. * src/keyboard.c (echo_keystrokes_p): New function. (read_char, record_menu_key, read_key_sequence): Use it. Fixes: debbugs:17475
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/byte-opt.el9
-rw-r--r--lisp/subr.el10
3 files changed, 12 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8845b77b3b..22e88a453c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,10 +1,12 @@
2014-05-28 Stefan Monnier <[email protected]>
+ * subr.el (zerop): Move from C. Add compiler-macro (bug#17475).
+ * emacs-lisp/byte-opt.el (byte-optimize-zerop): Remove.
+
* subr.el (internal--funcall-interactively): New.
(internal--call-interactively): Remove.
(called-interactively-p): Detect funcall-interactively instead of
call-interactively.
-
* simple.el (repeat-complex-command): Use funcall-interactively.
(repeat-complex-command--called-interactively-skip): Remove.
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index b1e06410da..90d1dd913e 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -942,15 +942,6 @@
form
(nth 1 form)))
-(defun byte-optimize-zerop (form)
- (cond ((numberp (nth 1 form))
- (eval form))
- (byte-compile-delete-errors
- (list '= (nth 1 form) 0))
- (form)))
-
-(put 'zerop 'byte-optimizer 'byte-optimize-zerop)
-
(defun byte-optimize-and (form)
;; Simplify if less than 2 args.
;; if there is a literal nil in the args to `and', throw it and following
diff --git a/lisp/subr.el b/lisp/subr.el
index a72a026f19..8767511f65 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -334,6 +334,13 @@ Any list whose car is `frame-configuration' is assumed to be a frame
configuration."
(and (consp object)
(eq (car object) 'frame-configuration)))
+
+(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.
@@ -3845,7 +3852,8 @@ This function is called directly from the C code."
(byte-compile-log-warning msg))
(run-with-timer 0 nil
(lambda (msg)
- (message "%s" msg)) msg))))
+ (message "%s" msg))
+ msg))))
;; Finally, run any other hook.
(run-hook-with-args 'after-load-functions abs-file))