diff options
| author | Ken Raeburn | 2000-08-08 14:36:34 +0000 |
|---|---|---|
| committer | Ken Raeburn | 2000-08-08 14:36:34 +0000 |
| commit | 23dd2d9798032cf7fbdc4193b2ac52f93b72a7a6 (patch) | |
| tree | efd344c2f7afb0b2cf311b17c8874d1b19b152a2 /src | |
| parent | 975f250a8eda55ea305e8568152c50d9cc8fadeb (diff) | |
| download | emacs-23dd2d9798032cf7fbdc4193b2ac52f93b72a7a6.tar.gz emacs-23dd2d9798032cf7fbdc4193b2ac52f93b72a7a6.zip | |
(message_dolog): Save and protect string "*Messages*" to reuse as buffer name,
instead of recreating (and discarding) every time a message is logged.
(with_echo_area_buffer): Make callback arg A2 a lisp object.
(current_message_1, truncate_message_1, set_message_1, display_echo_area_1,
resize_mini_window_1): Signatures changed.
(current_message, truncate_echo_area, display_echo_area,
resize_echo_area_axactly): Changed calls.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 14d88ddf9b6..eceb3822f20 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -630,16 +630,15 @@ static struct glyph_row *row_containing_pos P_ ((struct window *, int, | |||
| 630 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); | 630 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); |
| 631 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); | 631 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); |
| 632 | static int with_echo_area_buffer P_ ((struct window *, int, | 632 | static int with_echo_area_buffer P_ ((struct window *, int, |
| 633 | int (*) (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT), | 633 | int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), |
| 634 | EMACS_INT, EMACS_INT, EMACS_INT, | 634 | EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 635 | EMACS_INT)); | ||
| 636 | static void clear_garbaged_frames P_ ((void)); | 635 | static void clear_garbaged_frames P_ ((void)); |
| 637 | static int current_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 636 | static int current_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 638 | static int truncate_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 637 | static int truncate_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 639 | static int set_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 638 | static int set_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 640 | static int display_echo_area P_ ((struct window *)); | 639 | static int display_echo_area P_ ((struct window *)); |
| 641 | static int display_echo_area_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 640 | static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 642 | static int resize_mini_window_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 641 | static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 643 | static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); | 642 | static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); |
| 644 | static int string_char_and_length P_ ((unsigned char *, int, int *)); | 643 | static int string_char_and_length P_ ((unsigned char *, int, int *)); |
| 645 | static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, | 644 | static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, |
| @@ -4899,9 +4898,18 @@ message_dolog (m, len, nlflag, multibyte) | |||
| 4899 | Lisp_Object old_deactivate_mark, tem; | 4898 | Lisp_Object old_deactivate_mark, tem; |
| 4900 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 4899 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 4901 | 4900 | ||
| 4901 | static Lisp_Object messages_buffer_name; | ||
| 4902 | static int buffer_name_initialized; | ||
| 4903 | |||
| 4902 | old_deactivate_mark = Vdeactivate_mark; | 4904 | old_deactivate_mark = Vdeactivate_mark; |
| 4903 | oldbuf = current_buffer; | 4905 | oldbuf = current_buffer; |
| 4904 | Fset_buffer (Fget_buffer_create (build_string ("*Messages*"))); | 4906 | if (!buffer_name_initialized) |
| 4907 | { | ||
| 4908 | messages_buffer_name = build_string ("*Messages*"); | ||
| 4909 | staticpro (&messages_buffer_name); | ||
| 4910 | buffer_name_initialized = 1; | ||
| 4911 | } | ||
| 4912 | Fset_buffer (Fget_buffer_create (messages_buffer_name)); | ||
| 4905 | current_buffer->undo_list = Qt; | 4913 | current_buffer->undo_list = Qt; |
| 4906 | 4914 | ||
| 4907 | oldpoint = Fpoint_marker (); | 4915 | oldpoint = Fpoint_marker (); |
| @@ -5483,8 +5491,10 @@ static int | |||
| 5483 | with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) | 5491 | with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) |
| 5484 | struct window *w; | 5492 | struct window *w; |
| 5485 | int which; | 5493 | int which; |
| 5486 | int (*fn) P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | 5494 | int (*fn) P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); |
| 5487 | EMACS_INT a1, a2, a3, a4; | 5495 | EMACS_INT a1; |
| 5496 | Lisp_Object a2; | ||
| 5497 | EMACS_INT a3, a4; | ||
| 5488 | { | 5498 | { |
| 5489 | Lisp_Object buffer; | 5499 | Lisp_Object buffer; |
| 5490 | int this_one, the_other, clear_buffer_p, rc; | 5500 | int this_one, the_other, clear_buffer_p, rc; |
| @@ -5722,7 +5732,7 @@ display_echo_area (w) | |||
| 5722 | window_height_changed_p | 5732 | window_height_changed_p |
| 5723 | = with_echo_area_buffer (w, display_last_displayed_message_p, | 5733 | = with_echo_area_buffer (w, display_last_displayed_message_p, |
| 5724 | display_echo_area_1, | 5734 | display_echo_area_1, |
| 5725 | (EMACS_INT) w, 0, 0, 0); | 5735 | (EMACS_INT) w, Qnil, 0, 0); |
| 5726 | 5736 | ||
| 5727 | if (no_message_p) | 5737 | if (no_message_p) |
| 5728 | echo_area_buffer[i] = Qnil; | 5738 | echo_area_buffer[i] = Qnil; |
| @@ -5740,7 +5750,9 @@ display_echo_area (w) | |||
| 5740 | 5750 | ||
| 5741 | static int | 5751 | static int |
| 5742 | display_echo_area_1 (a1, a2, a3, a4) | 5752 | display_echo_area_1 (a1, a2, a3, a4) |
| 5743 | EMACS_INT a1, a2, a3, a4; | 5753 | EMACS_INT a1; |
| 5754 | Lisp_Object a2; | ||
| 5755 | EMACS_INT a3, a4; | ||
| 5744 | { | 5756 | { |
| 5745 | struct window *w = (struct window *) a1; | 5757 | struct window *w = (struct window *) a1; |
| 5746 | Lisp_Object window; | 5758 | Lisp_Object window; |
| @@ -5774,7 +5786,7 @@ resize_echo_area_axactly () | |||
| 5774 | int resized_p; | 5786 | int resized_p; |
| 5775 | 5787 | ||
| 5776 | resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, | 5788 | resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, |
| 5777 | (EMACS_INT) w, 0, 0, 0); | 5789 | (EMACS_INT) w, Qnil, 0, 0); |
| 5778 | if (resized_p) | 5790 | if (resized_p) |
| 5779 | { | 5791 | { |
| 5780 | ++windows_or_buffers_changed; | 5792 | ++windows_or_buffers_changed; |
| @@ -5792,7 +5804,9 @@ resize_echo_area_axactly () | |||
| 5792 | 5804 | ||
| 5793 | static int | 5805 | static int |
| 5794 | resize_mini_window_1 (a1, a2, a3, a4) | 5806 | resize_mini_window_1 (a1, a2, a3, a4) |
| 5795 | EMACS_INT a1, a2, a3, a4; | 5807 | EMACS_INT a1; |
| 5808 | Lisp_Object a2; | ||
| 5809 | EMACS_INT a3, a4; | ||
| 5796 | { | 5810 | { |
| 5797 | return resize_mini_window ((struct window *) a1, 1); | 5811 | return resize_mini_window ((struct window *) a1, 1); |
| 5798 | } | 5812 | } |
| @@ -5904,7 +5918,7 @@ current_message () | |||
| 5904 | else | 5918 | else |
| 5905 | { | 5919 | { |
| 5906 | with_echo_area_buffer (0, 0, current_message_1, | 5920 | with_echo_area_buffer (0, 0, current_message_1, |
| 5907 | (EMACS_INT) &msg, 0, 0, 0); | 5921 | (EMACS_INT) &msg, Qnil, 0, 0); |
| 5908 | if (NILP (msg)) | 5922 | if (NILP (msg)) |
| 5909 | echo_area_buffer[0] = Qnil; | 5923 | echo_area_buffer[0] = Qnil; |
| 5910 | } | 5924 | } |
| @@ -5915,7 +5929,9 @@ current_message () | |||
| 5915 | 5929 | ||
| 5916 | static int | 5930 | static int |
| 5917 | current_message_1 (a1, a2, a3, a4) | 5931 | current_message_1 (a1, a2, a3, a4) |
| 5918 | EMACS_INT a1, a2, a3, a4; | 5932 | EMACS_INT a1; |
| 5933 | Lisp_Object a2; | ||
| 5934 | EMACS_INT a3, a4; | ||
| 5919 | { | 5935 | { |
| 5920 | Lisp_Object *msg = (Lisp_Object *) a1; | 5936 | Lisp_Object *msg = (Lisp_Object *) a1; |
| 5921 | 5937 | ||
| @@ -5998,7 +6014,7 @@ truncate_echo_area (nchars) | |||
| 5998 | { | 6014 | { |
| 5999 | struct frame *sf = SELECTED_FRAME (); | 6015 | struct frame *sf = SELECTED_FRAME (); |
| 6000 | if (FRAME_MESSAGE_BUF (sf)) | 6016 | if (FRAME_MESSAGE_BUF (sf)) |
| 6001 | with_echo_area_buffer (0, 0, truncate_message_1, nchars, 0, 0, 0); | 6017 | with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil, 0, 0); |
| 6002 | } | 6018 | } |
| 6003 | } | 6019 | } |
| 6004 | 6020 | ||
| @@ -6008,7 +6024,9 @@ truncate_echo_area (nchars) | |||
| 6008 | 6024 | ||
| 6009 | static int | 6025 | static int |
| 6010 | truncate_message_1 (nchars, a2, a3, a4) | 6026 | truncate_message_1 (nchars, a2, a3, a4) |
| 6011 | EMACS_INT nchars, a2, a3, a4; | 6027 | EMACS_INT nchars; |
| 6028 | Lisp_Object a2; | ||
| 6029 | EMACS_INT a3, a4; | ||
| 6012 | { | 6030 | { |
| 6013 | if (BEG + nchars < Z) | 6031 | if (BEG + nchars < Z) |
| 6014 | del_range (BEG + nchars, Z); | 6032 | del_range (BEG + nchars, Z); |
| @@ -6051,10 +6069,12 @@ set_message (s, string, nbytes, multibyte_p) | |||
| 6051 | 6069 | ||
| 6052 | static int | 6070 | static int |
| 6053 | set_message_1 (a1, a2, nbytes, multibyte_p) | 6071 | set_message_1 (a1, a2, nbytes, multibyte_p) |
| 6054 | EMACS_INT a1, a2, nbytes, multibyte_p; | 6072 | EMACS_INT a1; |
| 6073 | Lisp_Object a2; | ||
| 6074 | EMACS_INT nbytes, multibyte_p; | ||
| 6055 | { | 6075 | { |
| 6056 | char *s = (char *) a1; | 6076 | char *s = (char *) a1; |
| 6057 | Lisp_Object string = (Lisp_Object) a2; | 6077 | Lisp_Object string = a2; |
| 6058 | 6078 | ||
| 6059 | xassert (BEG == Z); | 6079 | xassert (BEG == Z); |
| 6060 | 6080 | ||