From 7fb88fc4dbca5cfc1f93494f5fb24efeea796842 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Fri, 30 Dec 2011 14:01:13 +0100 Subject: [PATCH] echo-area: Remove unnecessary clearing and get default minibuffer displayed Each time we push a keyboard key the clear_message(1, 0) is called even if the echo-area is already cleared. When the echo area is cleared, the default minibuffer should be displayed instead of an empty message. With this patch, it is possible to display information in the echo area using the default minibuffer when the echo area is cleared and the minibuffer is inactive. Signed-off-by: Jeremy Compostella --- src/keyboard.c | 5 +++-- src/xdisp.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 2df1ba7..771ee98 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2982,9 +2982,10 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, || (!(EQ (Qhelp_echo, XCAR (c))) && !(EQ (Qswitch_frame, XCAR (c))))) { - if (!NILP (echo_area_buffer[0])) + if (!NILP (echo_area_buffer[0])) { safe_run_hooks (Qecho_area_clear_hook); - clear_message (1, 0); + clear_message (1, 0); + } } reread_for_input_method: diff --git a/src/xdisp.c b/src/xdisp.c index 90375ba..77cd80c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12666,6 +12666,9 @@ redisplay_internal (void) frames. Zero means, only selected_window is considered. */ int consider_all_windows_p; + /* Non-zero means redisplay has to redisplay the miniwindow */ + int update_miniwindow_p = 0; + TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p)); /* No redisplay if running in batch mode or frame is not yet fully @@ -12852,6 +12855,10 @@ redisplay_internal (void) && !MINI_WINDOW_P (XWINDOW (selected_window)))) { int window_height_changed_p = echo_area_display (0); + + if (message_cleared_p) + update_miniwindow_p = 1; + must_finish = 1; /* If we don't display the current message, don't clear the @@ -13227,7 +13234,7 @@ redisplay_internal (void) } else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { - Lisp_Object mini_window; + Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); struct frame *mini_frame; displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); @@ -13236,6 +13243,10 @@ redisplay_internal (void) internal_condition_case_1 (redisplay_window_1, selected_window, list_of_error, redisplay_window_error); + if (update_miniwindow_p) + internal_condition_case_1 (redisplay_window_1, mini_window, + list_of_error, + redisplay_window_error); /* Compare desired and current matrices, perform output. */ -- 1.7.2.5