aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2014-05-27 20:50:44 -0400
committerStefan Monnier2014-05-27 20:50:44 -0400
commit4c539a7b387874577136190d8e1a413da1d7e240 (patch)
treeec7fae72e576ba2cde3553fca04cd83cf0c16d35 /src
parent0e4857b7d84f958f66e726ed57b824427b272681 (diff)
downloademacs-4c539a7b387874577136190d8e1a413da1d7e240.tar.gz
emacs-4c539a7b387874577136190d8e1a413da1d7e240.zip
* 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 'src')
-rw-r--r--src/ChangeLog21
-rw-r--r--src/data.c21
-rw-r--r--src/keyboard.c25
3 files changed, 31 insertions, 36 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f88a1b31dba..b57aec9770e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12014-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * data.c (Fzerop): Move to Elisp.
4 (syms_of_data): Don't defsubr it.
5 * keyboard.c (echo_keystrokes_p): New function.
6 (read_char, record_menu_key, read_key_sequence): Use it.
7
8 * callint.c (Qfuncall_interactively): New var.
9 (Qcall_interactively): Remove.
10 (Ffuncall_interactively): New function.
11 (Fcall_interactively): Use it.
12 (syms_of_callint): Defsubr it.
13
12014-05-27 Stefan Monnier <monnier@iro.umontreal.ca> 142014-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 15
3 * bytecode.c (FETCH) [BYTE_CODE_SAFE]: Check the bytecode wasn't 16 * bytecode.c (FETCH) [BYTE_CODE_SAFE]: Check the bytecode wasn't
@@ -360,8 +373,8 @@
360 373
361 * term.c (tty_menu_display): Move the cursor to the active menu item. 374 * term.c (tty_menu_display): Move the cursor to the active menu item.
362 (tty_menu_activate): Return the cursor to the active menu item 375 (tty_menu_activate): Return the cursor to the active menu item
363 after displaying the menu and after displaying help-echo. See 376 after displaying the menu and after displaying help-echo.
364 http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html 377 See http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html
365 for the details of why this is needed by screen readers and 378 for the details of why this is needed by screen readers and
366 Braille displays. 379 Braille displays.
367 380
@@ -480,8 +493,8 @@
480 493
4812014-04-17 Daniel Colascione <dancol@dancol.org> 4942014-04-17 Daniel Colascione <dancol@dancol.org>
482 495
483 * term.c (Qtty_mode_set_strings, Qtty_mode_reset_strings): New 496 * term.c (Qtty_mode_set_strings, Qtty_mode_reset_strings):
484 symbols. 497 New symbols.
485 (tty_send_additional_strings): New function. 498 (tty_send_additional_strings): New function.
486 (tty_set_terminal_modes, tty_reset_terminal_modes): Use it. 499 (tty_set_terminal_modes, tty_reset_terminal_modes): Use it.
487 (syms_of_term): Intern tty-mode-set-strings and 500 (syms_of_term): Intern tty-mode-set-strings and
diff --git a/src/data.c b/src/data.c
index bf863aaed79..0c90944f0ad 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2332,7 +2332,7 @@ arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args,
2332 ptrdiff_t argnum; 2332 ptrdiff_t argnum;
2333 for (argnum = 1; argnum < nargs; ++argnum) 2333 for (argnum = 1; argnum < nargs; ++argnum)
2334 { 2334 {
2335 if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison))) 2335 if (EQ (Qnil, arithcompare (args[argnum - 1], args[argnum], comparison)))
2336 return Qnil; 2336 return Qnil;
2337 } 2337 }
2338 return Qt; 2338 return Qt;
@@ -2386,24 +2386,6 @@ DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
2386{ 2386{
2387 return arithcompare (num1, num2, ARITH_NOTEQUAL); 2387 return arithcompare (num1, num2, ARITH_NOTEQUAL);
2388} 2388}
2389
2390DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
2391 doc: /* Return t if NUMBER is zero. */)
2392 (register Lisp_Object number)
2393{
2394 CHECK_NUMBER_OR_FLOAT (number);
2395
2396 if (FLOATP (number))
2397 {
2398 if (XFLOAT_DATA (number) == 0.0)
2399 return Qt;
2400 return Qnil;
2401 }
2402
2403 if (!XINT (number))
2404 return Qt;
2405 return Qnil;
2406}
2407 2389
2408/* Convert the cons-of-integers, integer, or float value C to an 2390/* Convert the cons-of-integers, integer, or float value C to an
2409 unsigned value with maximum value MAX. Signal an error if C does not 2391 unsigned value with maximum value MAX. Signal an error if C does not
@@ -3650,7 +3632,6 @@ syms_of_data (void)
3650 defsubr (&Sleq); 3632 defsubr (&Sleq);
3651 defsubr (&Sgeq); 3633 defsubr (&Sgeq);
3652 defsubr (&Sneq); 3634 defsubr (&Sneq);
3653 defsubr (&Szerop);
3654 defsubr (&Splus); 3635 defsubr (&Splus);
3655 defsubr (&Sminus); 3636 defsubr (&Sminus);
3656 defsubr (&Stimes); 3637 defsubr (&Stimes);
diff --git a/src/keyboard.c b/src/keyboard.c
index 26afc02ec23..0308b7106d7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2376,6 +2376,13 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
2376 } 2376 }
2377} 2377}
2378 2378
2379static bool
2380echo_keystrokes_p (void)
2381{
2382 return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
2383 : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 : false);
2384}
2385
2379/* Read a character from the keyboard; call the redisplay if needed. */ 2386/* Read a character from the keyboard; call the redisplay if needed. */
2380/* commandflag 0 means do not autosave, but do redisplay. 2387/* commandflag 0 means do not autosave, but do redisplay.
2381 -1 means do not redisplay, but do autosave. 2388 -1 means do not redisplay, but do autosave.
@@ -2711,8 +2718,7 @@ read_char (int commandflag, Lisp_Object map,
2711 && !current_kboard->immediate_echo 2718 && !current_kboard->immediate_echo
2712 && this_command_key_count > 0 2719 && this_command_key_count > 0
2713 && ! noninteractive 2720 && ! noninteractive
2714 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 2721 && echo_keystrokes_p ()
2715 && NILP (Fzerop (Vecho_keystrokes))
2716 && (/* No message. */ 2722 && (/* No message. */
2717 NILP (echo_area_buffer[0]) 2723 NILP (echo_area_buffer[0])
2718 /* Or empty message. */ 2724 /* Or empty message. */
@@ -3173,8 +3179,7 @@ read_char (int commandflag, Lisp_Object map,
3173 { 3179 {
3174 3180
3175 /* Don't echo mouse motion events. */ 3181 /* Don't echo mouse motion events. */
3176 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 3182 if (echo_keystrokes_p ()
3177 && NILP (Fzerop (Vecho_keystrokes))
3178 && ! (EVENT_HAS_PARAMETERS (c) 3183 && ! (EVENT_HAS_PARAMETERS (c)
3179 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement))) 3184 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
3180 { 3185 {
@@ -3250,8 +3255,7 @@ record_menu_key (Lisp_Object c)
3250#endif 3255#endif
3251 3256
3252 /* Don't echo mouse motion events. */ 3257 /* Don't echo mouse motion events. */
3253 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 3258 if (echo_keystrokes_p ())
3254 && NILP (Fzerop (Vecho_keystrokes)))
3255 { 3259 {
3256 echo_char (c); 3260 echo_char (c);
3257 3261
@@ -8931,8 +8935,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8931 echo_now (); 8935 echo_now ();
8932 } 8936 }
8933 else if (cursor_in_echo_area 8937 else if (cursor_in_echo_area
8934 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 8938 && echo_keystrokes_p ())
8935 && NILP (Fzerop (Vecho_keystrokes)))
8936 /* This doesn't put in a dash if the echo buffer is empty, so 8939 /* This doesn't put in a dash if the echo buffer is empty, so
8937 you don't always see a dash hanging out in the minibuffer. */ 8940 you don't always see a dash hanging out in the minibuffer. */
8938 echo_dash (); 8941 echo_dash ();
@@ -9064,8 +9067,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9064 { 9067 {
9065 key = keybuf[t]; 9068 key = keybuf[t];
9066 add_command_key (key); 9069 add_command_key (key);
9067 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 9070 if (echo_keystrokes_p ()
9068 && NILP (Fzerop (Vecho_keystrokes))
9069 && current_kboard->immediate_echo) 9071 && current_kboard->immediate_echo)
9070 { 9072 {
9071 echo_add_key (key); 9073 echo_add_key (key);
@@ -9729,8 +9731,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9729 Better ideas? */ 9731 Better ideas? */
9730 for (; t < mock_input; t++) 9732 for (; t < mock_input; t++)
9731 { 9733 {
9732 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 9734 if (echo_keystrokes_p ())
9733 && NILP (Fzerop (Vecho_keystrokes)))
9734 echo_char (keybuf[t]); 9735 echo_char (keybuf[t]);
9735 add_command_key (keybuf[t]); 9736 add_command_key (keybuf[t]);
9736 } 9737 }