aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-09-22 13:47:58 +0300
committerEli Zaretskii2013-09-22 13:47:58 +0300
commit474163ac51d921be386bea1bf2101d4ec33983a8 (patch)
tree7c309cd1d3fcc041dedf0a4e6fa20d804fbaff0f /src
parentf0177f86f745ef86357214b110f9d98e4ed63b7a (diff)
downloademacs-474163ac51d921be386bea1bf2101d4ec33983a8.tar.gz
emacs-474163ac51d921be386bea1bf2101d4ec33983a8.zip
Prevent redisplay and keystroke echo during menu navigation.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 8318d4eb3b1..c029239b446 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -357,6 +357,8 @@ Lisp_Object Qvertical_line;
357static Lisp_Object Qvertical_scroll_bar; 357static Lisp_Object Qvertical_scroll_bar;
358Lisp_Object Qmenu_bar; 358Lisp_Object Qmenu_bar;
359 359
360static Lisp_Object Qecho_keystrokes;
361
360static void recursive_edit_unwind (Lisp_Object buffer); 362static void recursive_edit_unwind (Lisp_Object buffer);
361static Lisp_Object command_loop (void); 363static Lisp_Object command_loop (void);
362static Lisp_Object Qcommand_execute; 364static Lisp_Object Qcommand_execute;
@@ -1308,7 +1310,7 @@ some_mouse_moved (void)
1308 sans error-handling encapsulation. */ 1310 sans error-handling encapsulation. */
1309 1311
1310static int read_key_sequence (Lisp_Object *, int, Lisp_Object, 1312static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
1311 bool, bool, bool); 1313 bool, bool, bool, bool);
1312void safe_run_hooks (Lisp_Object); 1314void safe_run_hooks (Lisp_Object);
1313static void adjust_point_for_property (ptrdiff_t, bool); 1315static void adjust_point_for_property (ptrdiff_t, bool);
1314 1316
@@ -1434,7 +1436,7 @@ command_loop_1 (void)
1434 1436
1435 /* Read next key sequence; i gets its length. */ 1437 /* Read next key sequence; i gets its length. */
1436 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], 1438 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
1437 Qnil, 0, 1, 1); 1439 Qnil, 0, 1, 1, 0);
1438 1440
1439 /* A filter may have run while we were reading the input. */ 1441 /* A filter may have run while we were reading the input. */
1440 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 1442 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
@@ -1699,8 +1701,17 @@ read_menu_command (void)
1699{ 1701{
1700 Lisp_Object cmd; 1702 Lisp_Object cmd;
1701 Lisp_Object keybuf[30]; 1703 Lisp_Object keybuf[30];
1702 int i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], 1704 ptrdiff_t count = SPECPDL_INDEX ();
1703 Qnil, 0, 1, 1); 1705 int i;
1706
1707 /* We don't want to echo the keystrokes while navigating the
1708 menus. */
1709 specbind (Qecho_keystrokes, make_number (0));
1710
1711 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
1712 Qnil, 0, 1, 1, 1);
1713
1714 unbind_to (count, Qnil);
1704 1715
1705 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 1716 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
1706 Fkill_emacs (Qnil); 1717 Fkill_emacs (Qnil);
@@ -8813,6 +8824,9 @@ test_undefined (Lisp_Object binding)
8813 8824
8814 Echo starting immediately unless `prompt' is 0. 8825 Echo starting immediately unless `prompt' is 0.
8815 8826
8827 If PREVENT_REDISPLAY is non-zero, avoid redisplay by calling
8828 read_char with a suitable COMMANDFLAG argument.
8829
8816 Where a key sequence ends depends on the currently active keymaps. 8830 Where a key sequence ends depends on the currently active keymaps.
8817 These include any minor mode keymaps active in the current buffer, 8831 These include any minor mode keymaps active in the current buffer,
8818 the current buffer's local map, and the global map. 8832 the current buffer's local map, and the global map.
@@ -8845,7 +8859,7 @@ test_undefined (Lisp_Object binding)
8845static int 8859static int
8846read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, 8860read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8847 bool dont_downcase_last, bool can_return_switch_frame, 8861 bool dont_downcase_last, bool can_return_switch_frame,
8848 bool fix_current_buffer) 8862 bool fix_current_buffer, bool prevent_redisplay)
8849{ 8863{
8850 ptrdiff_t count = SPECPDL_INDEX (); 8864 ptrdiff_t count = SPECPDL_INDEX ();
8851 8865
@@ -8926,8 +8940,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8926 { 8940 {
8927 if (!NILP (prompt)) 8941 if (!NILP (prompt))
8928 { 8942 {
8929 /* Install the string STR as the beginning of the string of 8943 /* Install the string PROMPT as the beginning of the string
8930 echoing, so that it serves as a prompt for the next 8944 of echoing, so that it serves as a prompt for the next
8931 character. */ 8945 character. */
8932 kset_echo_string (current_kboard, prompt); 8946 kset_echo_string (current_kboard, prompt);
8933 current_kboard->echo_after_prompt = SCHARS (prompt); 8947 current_kboard->echo_after_prompt = SCHARS (prompt);
@@ -9082,7 +9096,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9082 { 9096 {
9083 KBOARD *interrupted_kboard = current_kboard; 9097 KBOARD *interrupted_kboard = current_kboard;
9084 struct frame *interrupted_frame = SELECTED_FRAME (); 9098 struct frame *interrupted_frame = SELECTED_FRAME ();
9085 key = read_char (NILP (prompt), 9099 /* Calling read_char with COMMANDFLAG = -2 avoids
9100 redisplay in read_char and its subroutines. */
9101 key = read_char (prevent_redisplay ? -2 : NILP (prompt),
9086 current_binding, last_nonmenu_event, 9102 current_binding, last_nonmenu_event,
9087 &used_mouse_menu, NULL); 9103 &used_mouse_menu, NULL);
9088 if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ 9104 if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
@@ -9778,7 +9794,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object continue_echo,
9778 9794
9779 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), 9795 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])),
9780 prompt, ! NILP (dont_downcase_last), 9796 prompt, ! NILP (dont_downcase_last),
9781 ! NILP (can_return_switch_frame), 0); 9797 ! NILP (can_return_switch_frame), 0, 0);
9782 9798
9783#if 0 /* The following is fine for code reading a key sequence and 9799#if 0 /* The following is fine for code reading a key sequence and
9784 then proceeding with a lengthy computation, but it's not good 9800 then proceeding with a lengthy computation, but it's not good
@@ -11038,6 +11054,8 @@ syms_of_keyboard (void)
11038 11054
11039 DEFSYM (Qhelp_form_show, "help-form-show"); 11055 DEFSYM (Qhelp_form_show, "help-form-show");
11040 11056
11057 DEFSYM (Qecho_keystrokes, "echo-keystrokes");
11058
11041 Fset (Qinput_method_exit_on_first_char, Qnil); 11059 Fset (Qinput_method_exit_on_first_char, Qnil);
11042 Fset (Qinput_method_use_echo_area, Qnil); 11060 Fset (Qinput_method_use_echo_area, Qnil);
11043 11061