Mercurial > emacs
comparison src/xdisp.c @ 30413:d5335ebcf501
(with_echo_area_buffer): Take additional EMACS_INT
parameters instead of using int parameters. Expect FN to accept
EMACS_INT parameters.
(display_echo_area, resize_echo_area_axactly, current_message)
(truncate_echo_area, set_message_1): Call with_echo_area_buffer
with new argument list.
(resize_mini_window_1): New callback function.
(current_message_1, truncate_message_1, set_message_1): Change
parameter lists to the new format expected by
with_echo_area_buffer.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 24 Jul 2000 12:22:54 +0000 |
parents | a1f02a10e391 |
children | 92e758e908a2 |
comparison
equal
deleted
inserted
replaced
30412:527532050288 | 30413:d5335ebcf501 |
---|---|
627 static struct glyph_row *row_containing_pos P_ ((struct window *, int, | 627 static struct glyph_row *row_containing_pos P_ ((struct window *, int, |
628 struct glyph_row *, | 628 struct glyph_row *, |
629 struct glyph_row *)); | 629 struct glyph_row *)); |
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, | |
633 int (*) (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT), | |
634 EMACS_INT, EMACS_INT, EMACS_INT, | |
635 EMACS_INT)); | |
632 static void clear_garbaged_frames P_ ((void)); | 636 static void clear_garbaged_frames P_ ((void)); |
633 static int current_message_1 P_ ((Lisp_Object *)); | 637 static int current_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); |
634 static int truncate_message_1 P_ ((int)); | 638 static int truncate_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); |
635 static int set_message_1 P_ ((char *s, Lisp_Object, int, int)); | 639 static int set_message_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); |
636 static int display_echo_area P_ ((struct window *)); | 640 static int display_echo_area P_ ((struct window *)); |
637 static int display_echo_area_1 P_ ((struct window *)); | 641 static int display_echo_area_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); |
642 static int resize_mini_window_1 P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); | |
638 static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); | 643 static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); |
639 static int string_char_and_length P_ ((unsigned char *, int, int *)); | 644 static int string_char_and_length P_ ((unsigned char *, int, int *)); |
640 static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, | 645 static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, |
641 struct text_pos)); | 646 struct text_pos)); |
642 static int compute_window_start_on_continuation_line P_ ((struct window *)); | 647 static int compute_window_start_on_continuation_line P_ ((struct window *)); |
5439 XBUFFER (echo_buffer[i])->truncate_lines = Qnil; | 5444 XBUFFER (echo_buffer[i])->truncate_lines = Qnil; |
5440 } | 5445 } |
5441 } | 5446 } |
5442 | 5447 |
5443 | 5448 |
5444 /* Call FN with args A1..A5 with either the current or last displayed | 5449 /* Call FN with args A1..A4 with either the current or last displayed |
5445 echo_area_buffer as current buffer. | 5450 echo_area_buffer as current buffer. |
5446 | 5451 |
5447 WHICH zero means use the current message buffer | 5452 WHICH zero means use the current message buffer |
5448 echo_area_buffer[0]. If that is nil, choose a suitable buffer | 5453 echo_area_buffer[0]. If that is nil, choose a suitable buffer |
5449 from echo_buffer[] and clear it. | 5454 from echo_buffer[] and clear it. |
5456 choose a suitable buffer for echo_area_buffer[0], and clear it. | 5461 choose a suitable buffer for echo_area_buffer[0], and clear it. |
5457 | 5462 |
5458 Value is what FN returns. */ | 5463 Value is what FN returns. */ |
5459 | 5464 |
5460 static int | 5465 static int |
5461 with_echo_area_buffer (w, which, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) | 5466 with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) |
5462 struct window *w; | 5467 struct window *w; |
5463 int which; | 5468 int which; |
5464 int (*fn) (); | 5469 int (*fn) P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT)); |
5465 int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; | 5470 EMACS_INT a1, a2, a3, a4; |
5466 { | 5471 { |
5467 Lisp_Object buffer; | 5472 Lisp_Object buffer; |
5468 int this_one, the_other, clear_buffer_p, rc; | 5473 int this_one, the_other, clear_buffer_p, rc; |
5469 int count = specpdl_ptr - specpdl; | 5474 int count = specpdl_ptr - specpdl; |
5470 | 5475 |
5526 del_range (BEG, Z); | 5531 del_range (BEG, Z); |
5527 | 5532 |
5528 xassert (BEGV >= BEG); | 5533 xassert (BEGV >= BEG); |
5529 xassert (ZV <= Z && ZV >= BEGV); | 5534 xassert (ZV <= Z && ZV >= BEGV); |
5530 | 5535 |
5531 rc = fn (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); | 5536 rc = fn (a1, a2, a3, a4); |
5532 | 5537 |
5533 xassert (BEGV >= BEG); | 5538 xassert (BEGV >= BEG); |
5534 xassert (ZV <= Z && ZV >= BEGV); | 5539 xassert (ZV <= Z && ZV >= BEGV); |
5535 | 5540 |
5536 unbind_to (count, Qnil); | 5541 unbind_to (count, Qnil); |
5697 i = display_last_displayed_message_p ? 1 : 0; | 5702 i = display_last_displayed_message_p ? 1 : 0; |
5698 no_message_p = NILP (echo_area_buffer[i]); | 5703 no_message_p = NILP (echo_area_buffer[i]); |
5699 | 5704 |
5700 window_height_changed_p | 5705 window_height_changed_p |
5701 = with_echo_area_buffer (w, display_last_displayed_message_p, | 5706 = with_echo_area_buffer (w, display_last_displayed_message_p, |
5702 (int (*) ()) display_echo_area_1, w); | 5707 display_echo_area_1, |
5708 (EMACS_INT) w, 0, 0, 0); | |
5703 | 5709 |
5704 if (no_message_p) | 5710 if (no_message_p) |
5705 echo_area_buffer[i] = Qnil; | 5711 echo_area_buffer[i] = Qnil; |
5706 | 5712 |
5707 unbind_to (count, Qnil); | 5713 unbind_to (count, Qnil); |
5708 return window_height_changed_p; | 5714 return window_height_changed_p; |
5709 } | 5715 } |
5710 | 5716 |
5711 | 5717 |
5712 /* Helper for display_echo_area. Display the current buffer which | 5718 /* Helper for display_echo_area. Display the current buffer which |
5713 contains the current echo area message in window W, a mini-window. | 5719 contains the current echo area message in window W, a mini-window, |
5720 a pointer to which is passed in A1. A2..A4 are currently not used. | |
5714 Change the height of W so that all of the message is displayed. | 5721 Change the height of W so that all of the message is displayed. |
5715 Value is non-zero if height of W was changed. */ | 5722 Value is non-zero if height of W was changed. */ |
5716 | 5723 |
5717 static int | 5724 static int |
5718 display_echo_area_1 (w) | 5725 display_echo_area_1 (a1, a2, a3, a4) |
5719 struct window *w; | 5726 EMACS_INT a1, a2, a3, a4; |
5720 { | 5727 { |
5728 struct window *w = (struct window *) a1; | |
5721 Lisp_Object window; | 5729 Lisp_Object window; |
5722 struct text_pos start; | 5730 struct text_pos start; |
5723 int window_height_changed_p = 0; | 5731 int window_height_changed_p = 0; |
5724 | 5732 |
5725 /* Do this before displaying, so that we have a large enough glyph | 5733 /* Do this before displaying, so that we have a large enough glyph |
5746 && WINDOWP (echo_area_window)) | 5754 && WINDOWP (echo_area_window)) |
5747 { | 5755 { |
5748 struct window *w = XWINDOW (echo_area_window); | 5756 struct window *w = XWINDOW (echo_area_window); |
5749 int resized_p; | 5757 int resized_p; |
5750 | 5758 |
5751 resized_p = with_echo_area_buffer (w, 0, | 5759 resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, |
5752 (int (*) ()) resize_mini_window, | 5760 (EMACS_INT) w, 0, 0, 0); |
5753 w, 1); | |
5754 if (resized_p) | 5761 if (resized_p) |
5755 { | 5762 { |
5756 ++windows_or_buffers_changed; | 5763 ++windows_or_buffers_changed; |
5757 ++update_mode_lines; | 5764 ++update_mode_lines; |
5758 redisplay_internal (0); | 5765 redisplay_internal (0); |
5759 } | 5766 } |
5760 } | 5767 } |
5768 } | |
5769 | |
5770 | |
5771 /* Callback function for with_echo_area_buffer, when used from | |
5772 resize_echo_area_axactly. A1 contains a pointer to the window to | |
5773 resize, A2 to A4 are not used. Value is what resize_mini_window | |
5774 returns. */ | |
5775 | |
5776 static int | |
5777 resize_mini_window_1 (a1, a2, a3, a4) | |
5778 EMACS_INT a1, a2, a3, a4; | |
5779 { | |
5780 return resize_mini_window ((struct window *) a1, 1); | |
5761 } | 5781 } |
5762 | 5782 |
5763 | 5783 |
5764 /* Resize mini-window W to fit the size of its contents. EXACT:P | 5784 /* Resize mini-window W to fit the size of its contents. EXACT:P |
5765 means size the window exactly to the size needed. Otherwise, it's | 5785 means size the window exactly to the size needed. Otherwise, it's |
5864 | 5884 |
5865 if (NILP (echo_area_buffer[0])) | 5885 if (NILP (echo_area_buffer[0])) |
5866 msg = Qnil; | 5886 msg = Qnil; |
5867 else | 5887 else |
5868 { | 5888 { |
5869 with_echo_area_buffer (0, 0, (int (*) ()) current_message_1, &msg); | 5889 with_echo_area_buffer (0, 0, current_message_1, |
5890 (EMACS_INT) &msg, 0, 0, 0); | |
5870 if (NILP (msg)) | 5891 if (NILP (msg)) |
5871 echo_area_buffer[0] = Qnil; | 5892 echo_area_buffer[0] = Qnil; |
5872 } | 5893 } |
5873 | 5894 |
5874 return msg; | 5895 return msg; |
5875 } | 5896 } |
5876 | 5897 |
5877 | 5898 |
5878 static int | 5899 static int |
5879 current_message_1 (msg) | 5900 current_message_1 (a1, a2, a3, a4) |
5880 Lisp_Object *msg; | 5901 EMACS_INT a1, a2, a3, a4; |
5881 { | 5902 { |
5903 Lisp_Object *msg = (Lisp_Object *) a1; | |
5904 | |
5882 if (Z > BEG) | 5905 if (Z > BEG) |
5883 *msg = make_buffer_string (BEG, Z, 1); | 5906 *msg = make_buffer_string (BEG, Z, 1); |
5884 else | 5907 else |
5885 *msg = Qnil; | 5908 *msg = Qnil; |
5886 return 0; | 5909 return 0; |
5956 && INTERACTIVE | 5979 && INTERACTIVE |
5957 && !NILP (echo_area_buffer[0])) | 5980 && !NILP (echo_area_buffer[0])) |
5958 { | 5981 { |
5959 struct frame *sf = SELECTED_FRAME (); | 5982 struct frame *sf = SELECTED_FRAME (); |
5960 if (FRAME_MESSAGE_BUF (sf)) | 5983 if (FRAME_MESSAGE_BUF (sf)) |
5961 with_echo_area_buffer (0, 0, (int (*) ()) truncate_message_1, nchars); | 5984 with_echo_area_buffer (0, 0, truncate_message_1, nchars, 0, 0, 0); |
5962 } | 5985 } |
5963 } | 5986 } |
5964 | 5987 |
5965 | 5988 |
5966 /* Helper function for truncate_echo_area. Truncate the current | 5989 /* Helper function for truncate_echo_area. Truncate the current |
5967 message to at most NCHARS characters. */ | 5990 message to at most NCHARS characters. */ |
5968 | 5991 |
5969 static int | 5992 static int |
5970 truncate_message_1 (nchars) | 5993 truncate_message_1 (nchars, a2, a3, a4) |
5971 int nchars; | 5994 EMACS_INT nchars, a2, a3, a4; |
5972 { | 5995 { |
5973 if (BEG + nchars < Z) | 5996 if (BEG + nchars < Z) |
5974 del_range (BEG + nchars, Z); | 5997 del_range (BEG + nchars, Z); |
5975 if (Z == BEG) | 5998 if (Z == BEG) |
5976 echo_area_buffer[0] = Qnil; | 5999 echo_area_buffer[0] = Qnil; |
5996 { | 6019 { |
5997 message_enable_multibyte | 6020 message_enable_multibyte |
5998 = ((s && multibyte_p) | 6021 = ((s && multibyte_p) |
5999 || (STRINGP (string) && STRING_MULTIBYTE (string))); | 6022 || (STRINGP (string) && STRING_MULTIBYTE (string))); |
6000 | 6023 |
6001 with_echo_area_buffer (0, -1, (int (*) ()) set_message_1, | 6024 with_echo_area_buffer (0, -1, set_message_1, |
6002 s, string, nbytes, multibyte_p); | 6025 (EMACS_INT) s, string, nbytes, multibyte_p); |
6003 message_buf_print = 0; | 6026 message_buf_print = 0; |
6004 } | 6027 } |
6005 | 6028 |
6006 | 6029 |
6007 /* Helper function for set_message. Arguments have the same meaning | 6030 /* Helper function for set_message. Arguments have the same meaning |
6008 as there. This function is called with the echo area buffer being | 6031 as there, with A1 corresponding to S and A2 corresponding to STRING |
6032 This function is called with the echo area buffer being | |
6009 current. */ | 6033 current. */ |
6010 | 6034 |
6011 static int | 6035 static int |
6012 set_message_1 (s, string, nbytes, multibyte_p) | 6036 set_message_1 (a1, a2, nbytes, multibyte_p) |
6013 char *s; | 6037 EMACS_INT a1, a2, nbytes, multibyte_p; |
6014 Lisp_Object string; | 6038 { |
6015 int nbytes, multibyte_p; | 6039 char *s = (char *) a1; |
6016 { | 6040 Lisp_Object string = (Lisp_Object) a2; |
6041 | |
6017 xassert (BEG == Z); | 6042 xassert (BEG == Z); |
6018 | 6043 |
6019 /* Change multibyteness of the echo buffer appropriately. */ | 6044 /* Change multibyteness of the echo buffer appropriately. */ |
6020 if (message_enable_multibyte | 6045 if (message_enable_multibyte |
6021 != !NILP (current_buffer->enable_multibyte_characters)) | 6046 != !NILP (current_buffer->enable_multibyte_characters)) |