* 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
2014-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
+ * 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.
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
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))
\f
;;;; List functions.
(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))
+2014-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * data.c (Fzerop): Move to Elisp.
+ (syms_of_data): Don't defsubr it.
+ * keyboard.c (echo_keystrokes_p): New function.
+ (read_char, record_menu_key, read_key_sequence): Use it.
+
+ * callint.c (Qfuncall_interactively): New var.
+ (Qcall_interactively): Remove.
+ (Ffuncall_interactively): New function.
+ (Fcall_interactively): Use it.
+ (syms_of_callint): Defsubr it.
+
2014-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
* bytecode.c (FETCH) [BYTE_CODE_SAFE]: Check the bytecode wasn't
* term.c (tty_menu_display): Move the cursor to the active menu item.
(tty_menu_activate): Return the cursor to the active menu item
- after displaying the menu and after displaying help-echo. See
- http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html
+ after displaying the menu and after displaying help-echo.
+ See http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html
for the details of why this is needed by screen readers and
Braille displays.
2014-04-17 Daniel Colascione <dancol@dancol.org>
- * term.c (Qtty_mode_set_strings, Qtty_mode_reset_strings): New
- symbols.
+ * term.c (Qtty_mode_set_strings, Qtty_mode_reset_strings):
+ New symbols.
(tty_send_additional_strings): New function.
(tty_set_terminal_modes, tty_reset_terminal_modes): Use it.
(syms_of_term): Intern tty-mode-set-strings and
ptrdiff_t argnum;
for (argnum = 1; argnum < nargs; ++argnum)
{
- if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison)))
+ if (EQ (Qnil, arithcompare (args[argnum - 1], args[argnum], comparison)))
return Qnil;
}
return Qt;
{
return arithcompare (num1, num2, ARITH_NOTEQUAL);
}
-
-DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
- doc: /* Return t if NUMBER is zero. */)
- (register Lisp_Object number)
-{
- CHECK_NUMBER_OR_FLOAT (number);
-
- if (FLOATP (number))
- {
- if (XFLOAT_DATA (number) == 0.0)
- return Qt;
- return Qnil;
- }
-
- if (!XINT (number))
- return Qt;
- return Qnil;
-}
\f
/* Convert the cons-of-integers, integer, or float value C to an
unsigned value with maximum value MAX. Signal an error if C does not
defsubr (&Sleq);
defsubr (&Sgeq);
defsubr (&Sneq);
- defsubr (&Szerop);
defsubr (&Splus);
defsubr (&Sminus);
defsubr (&Stimes);
}
}
+static bool
+echo_keystrokes_p (void)
+{
+ return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
+ : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 : false);
+}
+
/* Read a character from the keyboard; call the redisplay if needed. */
/* commandflag 0 means do not autosave, but do redisplay.
-1 means do not redisplay, but do autosave.
&& !current_kboard->immediate_echo
&& this_command_key_count > 0
&& ! noninteractive
- && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes))
+ && echo_keystrokes_p ()
&& (/* No message. */
NILP (echo_area_buffer[0])
/* Or empty message. */
{
/* Don't echo mouse motion events. */
- if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes))
+ if (echo_keystrokes_p ()
&& ! (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
{
#endif
/* Don't echo mouse motion events. */
- if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes)))
+ if (echo_keystrokes_p ())
{
echo_char (c);
echo_now ();
}
else if (cursor_in_echo_area
- && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes)))
+ && echo_keystrokes_p ())
/* This doesn't put in a dash if the echo buffer is empty, so
you don't always see a dash hanging out in the minibuffer. */
echo_dash ();
{
key = keybuf[t];
add_command_key (key);
- if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes))
+ if (echo_keystrokes_p ()
&& current_kboard->immediate_echo)
{
echo_add_key (key);
Better ideas? */
for (; t < mock_input; t++)
{
- if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
- && NILP (Fzerop (Vecho_keystrokes)))
+ if (echo_keystrokes_p ())
echo_char (keybuf[t]);
add_command_key (keybuf[t]);
}