diff options
| author | Stefan Monnier | 2013-01-23 15:07:28 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-01-23 15:07:28 -0500 |
| commit | b09cca6ace3728ad8a93b3c0301520fa75e71586 (patch) | |
| tree | fa12508ec95ada37cf95445ecf91d8f7786dab7e /src | |
| parent | 54ab1c5acf892f07dd8121d4bbafe7601a54bcb5 (diff) | |
| download | emacs-b09cca6ace3728ad8a93b3c0301520fa75e71586.tar.gz emacs-b09cca6ace3728ad8a93b3c0301520fa75e71586.zip | |
* src/xdisp.c (message2, message2_nolog): Remove functions.
(message3, message3_nolog): Extract nbytes and multibyteness directly
from the string. Change all callers.
(message3_nolog): Don't set message_enable_multibyte since set_message
will reset it anyway.
(message1, message1_nolog): Use message3.
(vmessage): Use a stack allocated buffer rather than f->message_buf.
(with_echo_area_buffer): Remove last two arguments. Update all callers.
(set_message): Drop all but the second arg, which has to be a string.
(set_message_1): Simplify now that we know that a1 is NULL and the
second arg is a string.
* src/frame.h (struct frame): Remove `message_buf' field.
Use glyphs_initialized_p instead.
(FRAME_MESSAGE_BUF): Remove macro.
* src/w16select.c (Fw16_set_clipboard_data): Prefer message3 to message2.
* src/lisp.h (message2, message2_nolog): Remove declarations.
(message3, message3_nolog): Update declarations.
* src/keyboard.c (read_char_minibuf_menu_text)
(read_char_minibuf_menu_width): Remove vars.
(read_char_minibuf_menu_prompt): Rewrite the menu's construction so as
to correctly handle multibyte strings.
* src/frame.c (delete_frame): Don't free message_buf any more.
* src/editfns.c (message_text, message_length): Remove vars.
(Fmessage_box): Don't copy the Lisp string's bytes any longer.
* src/fileio.c (auto_save_error): Use message3 instead of message2.
* src/dispnew.c (adjust_frame_message_buffer): Remove function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 29 | ||||
| -rw-r--r-- | src/alloc.c | 14 | ||||
| -rw-r--r-- | src/callint.c | 50 | ||||
| -rw-r--r-- | src/dispnew.c | 22 | ||||
| -rw-r--r-- | src/editfns.c | 22 | ||||
| -rw-r--r-- | src/fileio.c | 12 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | src/frame.c | 5 | ||||
| -rw-r--r-- | src/frame.h | 10 | ||||
| -rw-r--r-- | src/keyboard.c | 74 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/w16select.c | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 302 |
13 files changed, 182 insertions, 372 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 644724f67b6..7a2ff184c0a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,32 @@ | |||
| 1 | 2013-01-23 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * xdisp.c (message2, message2_nolog): Remove functions. | ||
| 4 | (message3, message3_nolog): Extract nbytes and multibyteness directly | ||
| 5 | from the string. Change all callers. | ||
| 6 | (message3_nolog): Don't set message_enable_multibyte since set_message | ||
| 7 | will reset it anyway. | ||
| 8 | (message1, message1_nolog): Use message3. | ||
| 9 | (vmessage): Use a stack allocated buffer rather than f->message_buf. | ||
| 10 | (with_echo_area_buffer): Remove last two arguments. Update all callers. | ||
| 11 | (set_message): Drop all but the second arg, which has to be a string. | ||
| 12 | (set_message_1): Simplify now that we know that a1 is NULL and the | ||
| 13 | second arg is a string. | ||
| 14 | * frame.h (struct frame): Remove `message_buf' field. | ||
| 15 | Use glyphs_initialized_p instead. | ||
| 16 | (FRAME_MESSAGE_BUF): Remove macro. | ||
| 17 | * w16select.c (Fw16_set_clipboard_data): Prefer message3 to message2. | ||
| 18 | * lisp.h (message2, message2_nolog): Remove declarations. | ||
| 19 | (message3, message3_nolog): Update declarations. | ||
| 20 | * keyboard.c (read_char_minibuf_menu_text) | ||
| 21 | (read_char_minibuf_menu_width): Remove vars. | ||
| 22 | (read_char_minibuf_menu_prompt): Rewrite the menu's construction so as | ||
| 23 | to correctly handle multibyte strings. | ||
| 24 | * frame.c (delete_frame): Don't free message_buf any more. | ||
| 25 | * editfns.c (message_text, message_length): Remove vars. | ||
| 26 | (Fmessage_box): Don't copy the Lisp string's bytes any longer. | ||
| 27 | * fileio.c (auto_save_error): Use message3 instead of message2. | ||
| 28 | * dispnew.c (adjust_frame_message_buffer): Remove function. | ||
| 29 | |||
| 1 | 2013-01-23 Eli Zaretskii <eliz@gnu.org> | 30 | 2013-01-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 31 | ||
| 3 | * w32term.c (w32fullscreen_hook): Account correctly for the screen | 32 | * w32term.c (w32fullscreen_hook): Account correctly for the screen |
diff --git a/src/alloc.c b/src/alloc.c index a2e7282bb60..2624650ed2c 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <limits.h> /* For CHAR_BIT. */ | 26 | #include <limits.h> /* For CHAR_BIT. */ |
| 27 | 27 | ||
| 28 | #ifdef ENABLE_CHECKING | 28 | #ifdef ENABLE_CHECKING |
| 29 | #include <signal.h> /* For SIGABRT. */ | 29 | #include <signal.h> /* For SIGABRT. */ |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #ifdef HAVE_PTHREAD | 32 | #ifdef HAVE_PTHREAD |
| @@ -1684,7 +1684,7 @@ allocate_string_data (struct Lisp_String *s, | |||
| 1684 | b = lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP); | 1684 | b = lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP); |
| 1685 | 1685 | ||
| 1686 | #ifdef DOUG_LEA_MALLOC | 1686 | #ifdef DOUG_LEA_MALLOC |
| 1687 | /* Back to a reasonable maximum of mmap'ed areas. */ | 1687 | /* Back to a reasonable maximum of mmap'ed areas. */ |
| 1688 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); | 1688 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); |
| 1689 | #endif | 1689 | #endif |
| 1690 | 1690 | ||
| @@ -1901,7 +1901,7 @@ compact_small_strings (void) | |||
| 1901 | 1901 | ||
| 1902 | #ifdef GC_CHECK_STRING_BYTES | 1902 | #ifdef GC_CHECK_STRING_BYTES |
| 1903 | /* Check that the string size recorded in the string is the | 1903 | /* Check that the string size recorded in the string is the |
| 1904 | same as the one recorded in the sdata structure. */ | 1904 | same as the one recorded in the sdata structure. */ |
| 1905 | if (s && string_bytes (s) != SDATA_NBYTES (from)) | 1905 | if (s && string_bytes (s) != SDATA_NBYTES (from)) |
| 1906 | emacs_abort (); | 1906 | emacs_abort (); |
| 1907 | #endif /* GC_CHECK_STRING_BYTES */ | 1907 | #endif /* GC_CHECK_STRING_BYTES */ |
| @@ -6564,7 +6564,7 @@ die (const char *msg, const char *file, int line) | |||
| 6564 | } | 6564 | } |
| 6565 | #endif | 6565 | #endif |
| 6566 | 6566 | ||
| 6567 | /* Initialization */ | 6567 | /* Initialization. */ |
| 6568 | 6568 | ||
| 6569 | void | 6569 | void |
| 6570 | init_alloc_once (void) | 6570 | init_alloc_once (void) |
| @@ -6579,9 +6579,9 @@ init_alloc_once (void) | |||
| 6579 | #endif | 6579 | #endif |
| 6580 | 6580 | ||
| 6581 | #ifdef DOUG_LEA_MALLOC | 6581 | #ifdef DOUG_LEA_MALLOC |
| 6582 | mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */ | 6582 | mallopt (M_TRIM_THRESHOLD, 128 * 1024); /* Trim threshold. */ |
| 6583 | mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */ | 6583 | mallopt (M_MMAP_THRESHOLD, 64 * 1024); /* Mmap threshold. */ |
| 6584 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* max. number of mmap'ed areas */ | 6584 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* Max. number of mmap'ed areas. */ |
| 6585 | #endif | 6585 | #endif |
| 6586 | init_strings (); | 6586 | init_strings (); |
| 6587 | init_vectors (); | 6587 | init_vectors (); |
diff --git a/src/callint.c b/src/callint.c index cd303908f69..1a125d3e865 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -497,47 +497,47 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 497 | 497 | ||
| 498 | switch (*tem) | 498 | switch (*tem) |
| 499 | { | 499 | { |
| 500 | case 'a': /* Symbol defined as a function */ | 500 | case 'a': /* Symbol defined as a function. */ |
| 501 | visargs[i] = Fcompleting_read (callint_message, | 501 | visargs[i] = Fcompleting_read (callint_message, |
| 502 | Vobarray, Qfboundp, Qt, | 502 | Vobarray, Qfboundp, Qt, |
| 503 | Qnil, Qnil, Qnil, Qnil); | 503 | Qnil, Qnil, Qnil, Qnil); |
| 504 | /* Passing args[i] directly stimulates compiler bug */ | 504 | /* Passing args[i] directly stimulates compiler bug. */ |
| 505 | teml = visargs[i]; | 505 | teml = visargs[i]; |
| 506 | args[i] = Fintern (teml, Qnil); | 506 | args[i] = Fintern (teml, Qnil); |
| 507 | break; | 507 | break; |
| 508 | 508 | ||
| 509 | case 'b': /* Name of existing buffer */ | 509 | case 'b': /* Name of existing buffer. */ |
| 510 | args[i] = Fcurrent_buffer (); | 510 | args[i] = Fcurrent_buffer (); |
| 511 | if (EQ (selected_window, minibuf_window)) | 511 | if (EQ (selected_window, minibuf_window)) |
| 512 | args[i] = Fother_buffer (args[i], Qnil, Qnil); | 512 | args[i] = Fother_buffer (args[i], Qnil, Qnil); |
| 513 | args[i] = Fread_buffer (callint_message, args[i], Qt); | 513 | args[i] = Fread_buffer (callint_message, args[i], Qt); |
| 514 | break; | 514 | break; |
| 515 | 515 | ||
| 516 | case 'B': /* Name of buffer, possibly nonexistent */ | 516 | case 'B': /* Name of buffer, possibly nonexistent. */ |
| 517 | args[i] = Fread_buffer (callint_message, | 517 | args[i] = Fread_buffer (callint_message, |
| 518 | Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), | 518 | Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), |
| 519 | Qnil); | 519 | Qnil); |
| 520 | break; | 520 | break; |
| 521 | 521 | ||
| 522 | case 'c': /* Character */ | 522 | case 'c': /* Character. */ |
| 523 | /* Prompt in `minibuffer-prompt' face. */ | 523 | /* Prompt in `minibuffer-prompt' face. */ |
| 524 | Fput_text_property (make_number (0), | 524 | Fput_text_property (make_number (0), |
| 525 | make_number (SCHARS (callint_message)), | 525 | make_number (SCHARS (callint_message)), |
| 526 | Qface, Qminibuffer_prompt, callint_message); | 526 | Qface, Qminibuffer_prompt, callint_message); |
| 527 | args[i] = Fread_char (callint_message, Qnil, Qnil); | 527 | args[i] = Fread_char (callint_message, Qnil, Qnil); |
| 528 | message1_nolog ((char *) 0); | 528 | message1_nolog ((char *) 0); |
| 529 | /* Passing args[i] directly stimulates compiler bug */ | 529 | /* Passing args[i] directly stimulates compiler bug. */ |
| 530 | teml = args[i]; | 530 | teml = args[i]; |
| 531 | /* See bug#8479. */ | 531 | /* See bug#8479. */ |
| 532 | if (! CHARACTERP (teml)) error ("Non-character input-event"); | 532 | if (! CHARACTERP (teml)) error ("Non-character input-event"); |
| 533 | visargs[i] = Fchar_to_string (teml); | 533 | visargs[i] = Fchar_to_string (teml); |
| 534 | break; | 534 | break; |
| 535 | 535 | ||
| 536 | case 'C': /* Command: symbol with interactive function */ | 536 | case 'C': /* Command: symbol with interactive function. */ |
| 537 | visargs[i] = Fcompleting_read (callint_message, | 537 | visargs[i] = Fcompleting_read (callint_message, |
| 538 | Vobarray, Qcommandp, | 538 | Vobarray, Qcommandp, |
| 539 | Qt, Qnil, Qnil, Qnil, Qnil); | 539 | Qt, Qnil, Qnil, Qnil, Qnil); |
| 540 | /* Passing args[i] directly stimulates compiler bug */ | 540 | /* Passing args[i] directly stimulates compiler bug. */ |
| 541 | teml = visargs[i]; | 541 | teml = visargs[i]; |
| 542 | args[i] = Fintern (teml, Qnil); | 542 | args[i] = Fintern (teml, Qnil); |
| 543 | break; | 543 | break; |
| @@ -549,33 +549,33 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 549 | varies[i] = 1; | 549 | varies[i] = 1; |
| 550 | break; | 550 | break; |
| 551 | 551 | ||
| 552 | case 'D': /* Directory name. */ | 552 | case 'D': /* Directory name. */ |
| 553 | args[i] = Fread_file_name (callint_message, Qnil, | 553 | args[i] = Fread_file_name (callint_message, Qnil, |
| 554 | BVAR (current_buffer, directory), Qlambda, Qnil, | 554 | BVAR (current_buffer, directory), Qlambda, Qnil, |
| 555 | Qfile_directory_p); | 555 | Qfile_directory_p); |
| 556 | break; | 556 | break; |
| 557 | 557 | ||
| 558 | case 'f': /* Existing file name. */ | 558 | case 'f': /* Existing file name. */ |
| 559 | args[i] = Fread_file_name (callint_message, | 559 | args[i] = Fread_file_name (callint_message, |
| 560 | Qnil, Qnil, Qlambda, Qnil, Qnil); | 560 | Qnil, Qnil, Qlambda, Qnil, Qnil); |
| 561 | break; | 561 | break; |
| 562 | 562 | ||
| 563 | case 'F': /* Possibly nonexistent file name. */ | 563 | case 'F': /* Possibly nonexistent file name. */ |
| 564 | args[i] = Fread_file_name (callint_message, | 564 | args[i] = Fread_file_name (callint_message, |
| 565 | Qnil, Qnil, Qnil, Qnil, Qnil); | 565 | Qnil, Qnil, Qnil, Qnil, Qnil); |
| 566 | break; | 566 | break; |
| 567 | 567 | ||
| 568 | case 'G': /* Possibly nonexistent file name, | 568 | case 'G': /* Possibly nonexistent file name, |
| 569 | default to directory alone. */ | 569 | default to directory alone. */ |
| 570 | args[i] = Fread_file_name (callint_message, | 570 | args[i] = Fread_file_name (callint_message, |
| 571 | Qnil, Qnil, Qnil, empty_unibyte_string, Qnil); | 571 | Qnil, Qnil, Qnil, empty_unibyte_string, Qnil); |
| 572 | break; | 572 | break; |
| 573 | 573 | ||
| 574 | case 'i': /* Ignore an argument -- Does not do I/O */ | 574 | case 'i': /* Ignore an argument -- Does not do I/O. */ |
| 575 | varies[i] = -1; | 575 | varies[i] = -1; |
| 576 | break; | 576 | break; |
| 577 | 577 | ||
| 578 | case 'k': /* Key sequence. */ | 578 | case 'k': /* Key sequence. */ |
| 579 | { | 579 | { |
| 580 | ptrdiff_t speccount1 = SPECPDL_INDEX (); | 580 | ptrdiff_t speccount1 = SPECPDL_INDEX (); |
| 581 | specbind (Qcursor_in_echo_area, Qt); | 581 | specbind (Qcursor_in_echo_area, Qt); |
| @@ -607,7 +607,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 607 | } | 607 | } |
| 608 | break; | 608 | break; |
| 609 | 609 | ||
| 610 | case 'K': /* Key sequence to be defined. */ | 610 | case 'K': /* Key sequence to be defined. */ |
| 611 | { | 611 | { |
| 612 | ptrdiff_t speccount1 = SPECPDL_INDEX (); | 612 | ptrdiff_t speccount1 = SPECPDL_INDEX (); |
| 613 | specbind (Qcursor_in_echo_area, Qt); | 613 | specbind (Qcursor_in_echo_area, Qt); |
| @@ -639,7 +639,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 639 | } | 639 | } |
| 640 | break; | 640 | break; |
| 641 | 641 | ||
| 642 | case 'U': /* Up event from last k or K */ | 642 | case 'U': /* Up event from last k or K. */ |
| 643 | if (!NILP (up_event)) | 643 | if (!NILP (up_event)) |
| 644 | { | 644 | { |
| 645 | args[i] = Fmake_vector (make_number (1), up_event); | 645 | args[i] = Fmake_vector (make_number (1), up_event); |
| @@ -679,7 +679,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 679 | Qnil, Qnil, Qnil, Qt); | 679 | Qnil, Qnil, Qnil, Qt); |
| 680 | break; | 680 | break; |
| 681 | 681 | ||
| 682 | case 'N': /* Prefix arg as number, else number from minibuffer */ | 682 | case 'N': /* Prefix arg as number, else number from minibuffer. */ |
| 683 | if (!NILP (prefix_arg)) | 683 | if (!NILP (prefix_arg)) |
| 684 | goto have_prefix_arg; | 684 | goto have_prefix_arg; |
| 685 | case 'n': /* Read number from minibuffer. */ | 685 | case 'n': /* Read number from minibuffer. */ |
| @@ -714,14 +714,14 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 714 | varies[i] = -1; | 714 | varies[i] = -1; |
| 715 | break; | 715 | break; |
| 716 | 716 | ||
| 717 | case 'p': /* Prefix arg converted to number. No I/O. */ | 717 | case 'p': /* Prefix arg converted to number. No I/O. */ |
| 718 | have_prefix_arg: | 718 | have_prefix_arg: |
| 719 | args[i] = Fprefix_numeric_value (prefix_arg); | 719 | args[i] = Fprefix_numeric_value (prefix_arg); |
| 720 | /* visargs[i] = Qnil; */ | 720 | /* visargs[i] = Qnil; */ |
| 721 | varies[i] = -1; | 721 | varies[i] = -1; |
| 722 | break; | 722 | break; |
| 723 | 723 | ||
| 724 | case 'r': /* Region, point and mark as 2 args. */ | 724 | case 'r': /* Region, point and mark as 2 args. */ |
| 725 | check_mark (1); | 725 | check_mark (1); |
| 726 | set_marker_both (point_marker, Qnil, PT, PT_BYTE); | 726 | set_marker_both (point_marker, Qnil, PT, PT_BYTE); |
| 727 | /* visargs[i+1] = Qnil; */ | 727 | /* visargs[i+1] = Qnil; */ |
| @@ -742,29 +742,29 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 742 | case 'S': /* Any symbol. */ | 742 | case 'S': /* Any symbol. */ |
| 743 | visargs[i] = Fread_string (callint_message, | 743 | visargs[i] = Fread_string (callint_message, |
| 744 | Qnil, Qnil, Qnil, Qnil); | 744 | Qnil, Qnil, Qnil, Qnil); |
| 745 | /* Passing args[i] directly stimulates compiler bug */ | 745 | /* Passing args[i] directly stimulates compiler bug. */ |
| 746 | teml = visargs[i]; | 746 | teml = visargs[i]; |
| 747 | args[i] = Fintern (teml, Qnil); | 747 | args[i] = Fintern (teml, Qnil); |
| 748 | break; | 748 | break; |
| 749 | 749 | ||
| 750 | case 'v': /* Variable name: symbol that is | 750 | case 'v': /* Variable name: symbol that is |
| 751 | custom-variable-p. */ | 751 | custom-variable-p. */ |
| 752 | args[i] = Fread_variable (callint_message, Qnil); | 752 | args[i] = Fread_variable (callint_message, Qnil); |
| 753 | visargs[i] = last_minibuf_string; | 753 | visargs[i] = last_minibuf_string; |
| 754 | break; | 754 | break; |
| 755 | 755 | ||
| 756 | case 'x': /* Lisp expression read but not evaluated */ | 756 | case 'x': /* Lisp expression read but not evaluated. */ |
| 757 | args[i] = Fread_minibuffer (callint_message, Qnil); | 757 | args[i] = Fread_minibuffer (callint_message, Qnil); |
| 758 | visargs[i] = last_minibuf_string; | 758 | visargs[i] = last_minibuf_string; |
| 759 | break; | 759 | break; |
| 760 | 760 | ||
| 761 | case 'X': /* Lisp expression read and evaluated */ | 761 | case 'X': /* Lisp expression read and evaluated. */ |
| 762 | args[i] = Feval_minibuffer (callint_message, Qnil); | 762 | args[i] = Feval_minibuffer (callint_message, Qnil); |
| 763 | visargs[i] = last_minibuf_string; | 763 | visargs[i] = last_minibuf_string; |
| 764 | break; | 764 | break; |
| 765 | 765 | ||
| 766 | case 'Z': /* Coding-system symbol, or ignore the | 766 | case 'Z': /* Coding-system symbol, or ignore the |
| 767 | argument if no prefix */ | 767 | argument if no prefix. */ |
| 768 | if (NILP (prefix_arg)) | 768 | if (NILP (prefix_arg)) |
| 769 | { | 769 | { |
| 770 | args[i] = Qnil; | 770 | args[i] = Qnil; |
| @@ -778,7 +778,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 778 | } | 778 | } |
| 779 | break; | 779 | break; |
| 780 | 780 | ||
| 781 | case 'z': /* Coding-system symbol or nil */ | 781 | case 'z': /* Coding-system symbol or nil. */ |
| 782 | args[i] = Fread_coding_system (callint_message, Qnil); | 782 | args[i] = Fread_coding_system (callint_message, Qnil); |
| 783 | visargs[i] = last_minibuf_string; | 783 | visargs[i] = last_minibuf_string; |
| 784 | break; | 784 | break; |
diff --git a/src/dispnew.c b/src/dispnew.c index 0dba576e101..259d4c9b42c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -87,7 +87,6 @@ static void build_frame_matrix_from_window_tree (struct glyph_matrix *, | |||
| 87 | struct window *); | 87 | struct window *); |
| 88 | static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, | 88 | static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, |
| 89 | struct window *); | 89 | struct window *); |
| 90 | static void adjust_frame_message_buffer (struct frame *); | ||
| 91 | static void adjust_decode_mode_spec_buffer (struct frame *); | 90 | static void adjust_decode_mode_spec_buffer (struct frame *); |
| 92 | static void fill_up_glyph_row_with_spaces (struct glyph_row *); | 91 | static void fill_up_glyph_row_with_spaces (struct glyph_row *); |
| 93 | static void clear_window_matrices (struct window *, bool); | 92 | static void clear_window_matrices (struct window *, bool); |
| @@ -1857,9 +1856,7 @@ adjust_frame_glyphs (struct frame *f) | |||
| 1857 | else | 1856 | else |
| 1858 | adjust_frame_glyphs_for_frame_redisplay (f); | 1857 | adjust_frame_glyphs_for_frame_redisplay (f); |
| 1859 | 1858 | ||
| 1860 | /* Don't forget the message buffer and the buffer for | 1859 | /* Don't forget the buffer for decode_mode_spec. */ |
| 1861 | decode_mode_spec. */ | ||
| 1862 | adjust_frame_message_buffer (f); | ||
| 1863 | adjust_decode_mode_spec_buffer (f); | 1860 | adjust_decode_mode_spec_buffer (f); |
| 1864 | 1861 | ||
| 1865 | f->glyphs_initialized_p = 1; | 1862 | f->glyphs_initialized_p = 1; |
| @@ -2159,23 +2156,6 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) | |||
| 2159 | } | 2156 | } |
| 2160 | 2157 | ||
| 2161 | 2158 | ||
| 2162 | /* Adjust/ allocate message buffer of frame F. | ||
| 2163 | |||
| 2164 | Note that the message buffer is never freed. Since I could not | ||
| 2165 | find a free in 19.34, I assume that freeing it would be | ||
| 2166 | problematic in some way and don't do it either. | ||
| 2167 | |||
| 2168 | (Implementation note: It should be checked if we can free it | ||
| 2169 | eventually without causing trouble). */ | ||
| 2170 | |||
| 2171 | static void | ||
| 2172 | adjust_frame_message_buffer (struct frame *f) | ||
| 2173 | { | ||
| 2174 | FRAME_MESSAGE_BUF (f) = xrealloc (FRAME_MESSAGE_BUF (f), | ||
| 2175 | FRAME_MESSAGE_BUF_SIZE (f) + 1); | ||
| 2176 | } | ||
| 2177 | |||
| 2178 | |||
| 2179 | /* Re-allocate buffer for decode_mode_spec on frame F. */ | 2159 | /* Re-allocate buffer for decode_mode_spec on frame F. */ |
| 2180 | 2160 | ||
| 2181 | static void | 2161 | static void |
diff --git a/src/editfns.c b/src/editfns.c index 020285cf4ec..0f88a781b88 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3429,12 +3429,6 @@ usage: (save-restriction &rest BODY) */) | |||
| 3429 | return unbind_to (count, val); | 3429 | return unbind_to (count, val); |
| 3430 | } | 3430 | } |
| 3431 | 3431 | ||
| 3432 | /* Buffer for the most recent text displayed by Fmessage_box. */ | ||
| 3433 | static char *message_text; | ||
| 3434 | |||
| 3435 | /* Allocated length of that buffer. */ | ||
| 3436 | static ptrdiff_t message_length; | ||
| 3437 | |||
| 3438 | DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, | 3432 | DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, |
| 3439 | doc: /* Display a message at the bottom of the screen. | 3433 | doc: /* Display a message at the bottom of the screen. |
| 3440 | The message also goes into the `*Messages*' buffer, if `message-log-max' | 3434 | The message also goes into the `*Messages*' buffer, if `message-log-max' |
| @@ -3465,7 +3459,7 @@ usage: (message FORMAT-STRING &rest ARGS) */) | |||
| 3465 | { | 3459 | { |
| 3466 | register Lisp_Object val; | 3460 | register Lisp_Object val; |
| 3467 | val = Fformat (nargs, args); | 3461 | val = Fformat (nargs, args); |
| 3468 | message3 (val, SBYTES (val), STRING_MULTIBYTE (val)); | 3462 | message3 (val); |
| 3469 | return val; | 3463 | return val; |
| 3470 | } | 3464 | } |
| 3471 | } | 3465 | } |
| @@ -3489,8 +3483,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) | |||
| 3489 | } | 3483 | } |
| 3490 | else | 3484 | else |
| 3491 | { | 3485 | { |
| 3492 | register Lisp_Object val; | 3486 | Lisp_Object val = Fformat (nargs, args); |
| 3493 | val = Fformat (nargs, args); | ||
| 3494 | #ifdef HAVE_MENUS | 3487 | #ifdef HAVE_MENUS |
| 3495 | /* The MS-DOS frames support popup menus even though they are | 3488 | /* The MS-DOS frames support popup menus even though they are |
| 3496 | not FRAME_WINDOW_P. */ | 3489 | not FRAME_WINDOW_P. */ |
| @@ -3507,16 +3500,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) | |||
| 3507 | return val; | 3500 | return val; |
| 3508 | } | 3501 | } |
| 3509 | #endif /* HAVE_MENUS */ | 3502 | #endif /* HAVE_MENUS */ |
| 3510 | /* Copy the data so that it won't move when we GC. */ | 3503 | message3 (val); |
| 3511 | if (SBYTES (val) > message_length) | ||
| 3512 | { | ||
| 3513 | ptrdiff_t new_length = SBYTES (val) + 80; | ||
| 3514 | message_text = xrealloc (message_text, new_length); | ||
| 3515 | message_length = new_length; | ||
| 3516 | } | ||
| 3517 | memcpy (message_text, SDATA (val), SBYTES (val)); | ||
| 3518 | message2 (message_text, SBYTES (val), | ||
| 3519 | STRING_MULTIBYTE (val)); | ||
| 3520 | return val; | 3504 | return val; |
| 3521 | } | 3505 | } |
| 3522 | } | 3506 | } |
diff --git a/src/fileio.c b/src/fileio.c index a826ac1f94a..e788bebab61 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5444,10 +5444,8 @@ static Lisp_Object | |||
| 5444 | auto_save_error (Lisp_Object error_val) | 5444 | auto_save_error (Lisp_Object error_val) |
| 5445 | { | 5445 | { |
| 5446 | Lisp_Object args[3], msg; | 5446 | Lisp_Object args[3], msg; |
| 5447 | int i, nbytes; | 5447 | int i; |
| 5448 | struct gcpro gcpro1; | 5448 | struct gcpro gcpro1; |
| 5449 | char *msgbuf; | ||
| 5450 | USE_SAFE_ALLOCA; | ||
| 5451 | 5449 | ||
| 5452 | auto_save_error_occurred = 1; | 5450 | auto_save_error_occurred = 1; |
| 5453 | 5451 | ||
| @@ -5458,20 +5456,16 @@ auto_save_error (Lisp_Object error_val) | |||
| 5458 | args[2] = Ferror_message_string (error_val); | 5456 | args[2] = Ferror_message_string (error_val); |
| 5459 | msg = Fformat (3, args); | 5457 | msg = Fformat (3, args); |
| 5460 | GCPRO1 (msg); | 5458 | GCPRO1 (msg); |
| 5461 | nbytes = SBYTES (msg); | ||
| 5462 | msgbuf = SAFE_ALLOCA (nbytes); | ||
| 5463 | memcpy (msgbuf, SDATA (msg), nbytes); | ||
| 5464 | 5459 | ||
| 5465 | for (i = 0; i < 3; ++i) | 5460 | for (i = 0; i < 3; ++i) |
| 5466 | { | 5461 | { |
| 5467 | if (i == 0) | 5462 | if (i == 0) |
| 5468 | message2 (msgbuf, nbytes, STRING_MULTIBYTE (msg)); | 5463 | message3 (msg); |
| 5469 | else | 5464 | else |
| 5470 | message2_nolog (msgbuf, nbytes, STRING_MULTIBYTE (msg)); | 5465 | message3_nolog (msg); |
| 5471 | Fsleep_for (make_number (1), Qnil); | 5466 | Fsleep_for (make_number (1), Qnil); |
| 5472 | } | 5467 | } |
| 5473 | 5468 | ||
| 5474 | SAFE_FREE (); | ||
| 5475 | UNGCPRO; | 5469 | UNGCPRO; |
| 5476 | return Qnil; | 5470 | return Qnil; |
| 5477 | } | 5471 | } |
| @@ -2745,7 +2745,7 @@ ARGS are passed as extra arguments to the function. | |||
| 2745 | usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) | 2745 | usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) |
| 2746 | (ptrdiff_t nargs, Lisp_Object *args) | 2746 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2747 | { | 2747 | { |
| 2748 | /* This function can GC. */ | 2748 | /* This function can GC. */ |
| 2749 | Lisp_Object newargs[3]; | 2749 | Lisp_Object newargs[3]; |
| 2750 | struct gcpro gcpro1, gcpro2; | 2750 | struct gcpro gcpro1, gcpro2; |
| 2751 | Lisp_Object result; | 2751 | Lisp_Object result; |
diff --git a/src/frame.c b/src/frame.c index 514b338df5b..11886783e4c 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1251,7 +1251,6 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1251 | xfree (FRAME_DELETEN_COST (f)); | 1251 | xfree (FRAME_DELETEN_COST (f)); |
| 1252 | xfree (FRAME_INSERTN_COST (f)); | 1252 | xfree (FRAME_INSERTN_COST (f)); |
| 1253 | xfree (FRAME_DELETE_COST (f)); | 1253 | xfree (FRAME_DELETE_COST (f)); |
| 1254 | xfree (FRAME_MESSAGE_BUF (f)); | ||
| 1255 | 1254 | ||
| 1256 | /* Since some events are handled at the interrupt level, we may get | 1255 | /* Since some events are handled at the interrupt level, we may get |
| 1257 | an event for f at any time; if we zero out the frame's terminal | 1256 | an event for f at any time; if we zero out the frame's terminal |
| @@ -1266,10 +1265,10 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1266 | { | 1265 | { |
| 1267 | struct terminal *terminal = FRAME_TERMINAL (f); | 1266 | struct terminal *terminal = FRAME_TERMINAL (f); |
| 1268 | f->output_data.nothing = 0; | 1267 | f->output_data.nothing = 0; |
| 1269 | f->terminal = 0; /* Now the frame is dead. */ | 1268 | f->terminal = 0; /* Now the frame is dead. */ |
| 1270 | 1269 | ||
| 1271 | /* If needed, delete the terminal that this frame was on. | 1270 | /* If needed, delete the terminal that this frame was on. |
| 1272 | (This must be done after the frame is killed.) */ | 1271 | (This must be done after the frame is killed.) */ |
| 1273 | terminal->reference_count--; | 1272 | terminal->reference_count--; |
| 1274 | #ifdef USE_GTK | 1273 | #ifdef USE_GTK |
| 1275 | /* FIXME: Deleting the terminal crashes emacs because of a GTK | 1274 | /* FIXME: Deleting the terminal crashes emacs because of a GTK |
diff --git a/src/frame.h b/src/frame.h index ec535d4448f..c2821066c82 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 18 | 18 | ||
| 19 | /* Don't multiply include: dispextern.h includes macterm.h which | 19 | /* Don't multiply include: dispextern.h includes macterm.h which |
| 20 | includes frame.h some emacs source includes both dispextern.h and | 20 | includes frame.h some emacs source includes both dispextern.h and |
| 21 | frame.h */ | 21 | frame.h. */ |
| 22 | 22 | ||
| 23 | #ifndef EMACS_FRAME_H | 23 | #ifndef EMACS_FRAME_H |
| 24 | #define EMACS_FRAME_H | 24 | #define EMACS_FRAME_H |
| @@ -33,7 +33,7 @@ INLINE_HEADER_BEGIN | |||
| 33 | 33 | ||
| 34 | /* Miscellanea. */ | 34 | /* Miscellanea. */ |
| 35 | 35 | ||
| 36 | /* Nonzero means there is at least one garbaged frame. */ | 36 | /* Nonzero means there is at least one garbaged frame. */ |
| 37 | extern bool frame_garbaged; | 37 | extern bool frame_garbaged; |
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -200,7 +200,7 @@ struct frame | |||
| 200 | string's pointer (`name', above) because it might get relocated. */ | 200 | string's pointer (`name', above) because it might get relocated. */ |
| 201 | char *namebuf; | 201 | char *namebuf; |
| 202 | 202 | ||
| 203 | /* Glyph pool and matrix. */ | 203 | /* Glyph pool and matrix. */ |
| 204 | struct glyph_pool *current_pool; | 204 | struct glyph_pool *current_pool; |
| 205 | struct glyph_pool *desired_pool; | 205 | struct glyph_pool *desired_pool; |
| 206 | struct glyph_matrix *desired_matrix; | 206 | struct glyph_matrix *desired_matrix; |
| @@ -444,9 +444,6 @@ struct frame | |||
| 444 | /* Width of bar cursor (if we are using that) for blink-off state. */ | 444 | /* Width of bar cursor (if we are using that) for blink-off state. */ |
| 445 | int blink_off_cursor_width; | 445 | int blink_off_cursor_width; |
| 446 | 446 | ||
| 447 | /* Storage for messages to this frame. */ | ||
| 448 | char *message_buf; | ||
| 449 | |||
| 450 | /* Nonnegative if current redisplay should not do scroll computation | 447 | /* Nonnegative if current redisplay should not do scroll computation |
| 451 | for lines beyond a certain vpos. This is the vpos. */ | 448 | for lines beyond a certain vpos. This is the vpos. */ |
| 452 | int scroll_bottom_vpos; | 449 | int scroll_bottom_vpos; |
| @@ -751,7 +748,6 @@ typedef struct frame *FRAME_PTR; | |||
| 751 | #define FRAME_DELETE_COST(f) (f)->delete_line_cost | 748 | #define FRAME_DELETE_COST(f) (f)->delete_line_cost |
| 752 | #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost | 749 | #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost |
| 753 | #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost | 750 | #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost |
| 754 | #define FRAME_MESSAGE_BUF(f) (f)->message_buf | ||
| 755 | #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos | 751 | #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos |
| 756 | #define FRAME_FOCUS_FRAME(f) f->focus_frame | 752 | #define FRAME_FOCUS_FRAME(f) f->focus_frame |
| 757 | 753 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 7594a4f72fc..ca7be56e6ae 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -675,9 +675,8 @@ echo_now (void) | |||
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | echoing = 1; | 677 | echoing = 1; |
| 678 | message3_nolog (KVAR (current_kboard, echo_string), | 678 | /* FIXME: Use call (Qmessage) so it can be advised (e.g. emacspeak). */ |
| 679 | SBYTES (KVAR (current_kboard, echo_string)), | 679 | message3_nolog (KVAR (current_kboard, echo_string)); |
| 680 | STRING_MULTIBYTE (KVAR (current_kboard, echo_string))); | ||
| 681 | echoing = 0; | 680 | echoing = 0; |
| 682 | 681 | ||
| 683 | /* Record in what buffer we echoed, and from which kboard. */ | 682 | /* Record in what buffer we echoed, and from which kboard. */ |
| @@ -1429,7 +1428,7 @@ command_loop_1 (void) | |||
| 1429 | sit_for (Vminibuffer_message_timeout, 0, 2); | 1428 | sit_for (Vminibuffer_message_timeout, 0, 2); |
| 1430 | 1429 | ||
| 1431 | /* Clear the echo area. */ | 1430 | /* Clear the echo area. */ |
| 1432 | message2 (0, 0, 0); | 1431 | message1 (0); |
| 1433 | safe_run_hooks (Qecho_area_clear_hook); | 1432 | safe_run_hooks (Qecho_area_clear_hook); |
| 1434 | 1433 | ||
| 1435 | unbind_to (count, Qnil); | 1434 | unbind_to (count, Qnil); |
| @@ -8434,12 +8433,6 @@ read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 8434 | return Qnil ; | 8433 | return Qnil ; |
| 8435 | } | 8434 | } |
| 8436 | 8435 | ||
| 8437 | /* Buffer in use so far for the minibuf prompts for menu keymaps. | ||
| 8438 | We make this bigger when necessary, and never free it. */ | ||
| 8439 | static char *read_char_minibuf_menu_text; | ||
| 8440 | /* Size of that buffer. */ | ||
| 8441 | static ptrdiff_t read_char_minibuf_menu_width; | ||
| 8442 | |||
| 8443 | static Lisp_Object | 8436 | static Lisp_Object |
| 8444 | read_char_minibuf_menu_prompt (int commandflag, | 8437 | read_char_minibuf_menu_prompt (int commandflag, |
| 8445 | ptrdiff_t nmaps, Lisp_Object *maps) | 8438 | ptrdiff_t nmaps, Lisp_Object *maps) |
| @@ -8452,7 +8445,7 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8452 | ptrdiff_t idx = -1; | 8445 | ptrdiff_t idx = -1; |
| 8453 | bool nobindings = 1; | 8446 | bool nobindings = 1; |
| 8454 | Lisp_Object rest, vector; | 8447 | Lisp_Object rest, vector; |
| 8455 | char *menu; | 8448 | Lisp_Object prompt_strings = Qnil; |
| 8456 | 8449 | ||
| 8457 | vector = Qnil; | 8450 | vector = Qnil; |
| 8458 | name = Qnil; | 8451 | name = Qnil; |
| @@ -8472,24 +8465,13 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8472 | if (!STRINGP (name)) | 8465 | if (!STRINGP (name)) |
| 8473 | return Qnil; | 8466 | return Qnil; |
| 8474 | 8467 | ||
| 8475 | /* Make sure we have a big enough buffer for the menu text. */ | 8468 | #define PUSH_C_STR(str, listvar) \ |
| 8476 | width = max (width, SBYTES (name)); | 8469 | listvar = Fcons (make_unibyte_string (str, strlen (str)), listvar) |
| 8477 | if (STRING_BYTES_BOUND - 4 < width) | 8470 | |
| 8478 | memory_full (SIZE_MAX); | ||
| 8479 | if (width + 4 > read_char_minibuf_menu_width) | ||
| 8480 | { | ||
| 8481 | read_char_minibuf_menu_text | ||
| 8482 | = xrealloc (read_char_minibuf_menu_text, width + 4); | ||
| 8483 | read_char_minibuf_menu_width = width + 4; | ||
| 8484 | } | ||
| 8485 | menu = read_char_minibuf_menu_text; | ||
| 8486 | |||
| 8487 | /* Prompt string always starts with map's prompt, and a space. */ | 8471 | /* Prompt string always starts with map's prompt, and a space. */ |
| 8488 | strcpy (menu, SSDATA (name)); | 8472 | prompt_strings = Fcons (name, prompt_strings); |
| 8489 | nlength = SBYTES (name); | 8473 | PUSH_C_STR (": ", prompt_strings); |
| 8490 | menu[nlength++] = ':'; | 8474 | nlength = SCHARS (name) + 2; |
| 8491 | menu[nlength++] = ' '; | ||
| 8492 | menu[nlength] = 0; | ||
| 8493 | 8475 | ||
| 8494 | /* Start prompting at start of first map. */ | 8476 | /* Start prompting at start of first map. */ |
| 8495 | mapno = 0; | 8477 | mapno = 0; |
| @@ -8499,6 +8481,7 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8499 | while (1) | 8481 | while (1) |
| 8500 | { | 8482 | { |
| 8501 | bool notfirst = 0; | 8483 | bool notfirst = 0; |
| 8484 | Lisp_Object menu_strings = prompt_strings; | ||
| 8502 | ptrdiff_t i = nlength; | 8485 | ptrdiff_t i = nlength; |
| 8503 | Lisp_Object obj; | 8486 | Lisp_Object obj; |
| 8504 | Lisp_Object orig_defn_macro; | 8487 | Lisp_Object orig_defn_macro; |
| @@ -8508,6 +8491,8 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8508 | { | 8491 | { |
| 8509 | Lisp_Object elt; | 8492 | Lisp_Object elt; |
| 8510 | 8493 | ||
| 8494 | /* FIXME: Use map_keymap to handle new keymap formats. */ | ||
| 8495 | |||
| 8511 | /* If reached end of map, start at beginning of next map. */ | 8496 | /* If reached end of map, start at beginning of next map. */ |
| 8512 | if (NILP (rest)) | 8497 | if (NILP (rest)) |
| 8513 | { | 8498 | { |
| @@ -8603,7 +8588,7 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8603 | /* Punctuate between strings. */ | 8588 | /* Punctuate between strings. */ |
| 8604 | if (notfirst) | 8589 | if (notfirst) |
| 8605 | { | 8590 | { |
| 8606 | strcpy (menu + i, ", "); | 8591 | PUSH_C_STR (", ", menu_strings); |
| 8607 | i += 2; | 8592 | i += 2; |
| 8608 | } | 8593 | } |
| 8609 | notfirst = 1; | 8594 | notfirst = 1; |
| @@ -8615,23 +8600,28 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8615 | { | 8600 | { |
| 8616 | /* Add as much of string as fits. */ | 8601 | /* Add as much of string as fits. */ |
| 8617 | thiswidth = min (SCHARS (desc), width - i); | 8602 | thiswidth = min (SCHARS (desc), width - i); |
| 8618 | memcpy (menu + i, SDATA (desc), thiswidth); | 8603 | menu_strings |
| 8604 | = Fcons (Fsubstring (desc, make_number (0), | ||
| 8605 | make_number (thiswidth)), | ||
| 8606 | menu_strings); | ||
| 8619 | i += thiswidth; | 8607 | i += thiswidth; |
| 8620 | strcpy (menu + i, " = "); | 8608 | PUSH_C_STR (" = ", menu_strings); |
| 8621 | i += 3; | 8609 | i += 3; |
| 8622 | } | 8610 | } |
| 8623 | 8611 | ||
| 8624 | /* Add as much of string as fits. */ | 8612 | /* Add as much of string as fits. */ |
| 8625 | thiswidth = min (SCHARS (s), width - i); | 8613 | thiswidth = min (SCHARS (s), width - i); |
| 8626 | memcpy (menu + i, SDATA (s), thiswidth); | 8614 | menu_strings |
| 8615 | = Fcons (Fsubstring (s, make_number (0), | ||
| 8616 | make_number (thiswidth)), | ||
| 8617 | menu_strings); | ||
| 8627 | i += thiswidth; | 8618 | i += thiswidth; |
| 8628 | menu[i] = 0; | ||
| 8629 | } | 8619 | } |
| 8630 | else | 8620 | else |
| 8631 | { | 8621 | { |
| 8632 | /* If this element does not fit, end the line now, | 8622 | /* If this element does not fit, end the line now, |
| 8633 | and save the element for the next line. */ | 8623 | and save the element for the next line. */ |
| 8634 | strcpy (menu + i, "..."); | 8624 | PUSH_C_STR ("...", menu_strings); |
| 8635 | break; | 8625 | break; |
| 8636 | } | 8626 | } |
| 8637 | } | 8627 | } |
| @@ -8648,13 +8638,11 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8648 | } | 8638 | } |
| 8649 | 8639 | ||
| 8650 | /* Prompt with that and read response. */ | 8640 | /* Prompt with that and read response. */ |
| 8651 | message2_nolog (menu, strlen (menu), | 8641 | message3_nolog (apply1 (intern ("concat"), menu_strings)); |
| 8652 | ! NILP (BVAR (current_buffer, enable_multibyte_characters))); | ||
| 8653 | 8642 | ||
| 8654 | /* Make believe its not a keyboard macro in case the help char | 8643 | /* Make believe it's not a keyboard macro in case the help char |
| 8655 | is pressed. Help characters are not recorded because menu prompting | 8644 | is pressed. Help characters are not recorded because menu prompting |
| 8656 | is not used on replay. | 8645 | is not used on replay. */ |
| 8657 | */ | ||
| 8658 | orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); | 8646 | orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); |
| 8659 | kset_defining_kbd_macro (current_kboard, Qnil); | 8647 | kset_defining_kbd_macro (current_kboard, Qnil); |
| 8660 | do | 8648 | do |
| @@ -8662,9 +8650,7 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8662 | while (BUFFERP (obj)); | 8650 | while (BUFFERP (obj)); |
| 8663 | kset_defining_kbd_macro (current_kboard, orig_defn_macro); | 8651 | kset_defining_kbd_macro (current_kboard, orig_defn_macro); |
| 8664 | 8652 | ||
| 8665 | if (!INTEGERP (obj)) | 8653 | if (!INTEGERP (obj) || XINT (obj) == -2) |
| 8666 | return obj; | ||
| 8667 | else if (XINT (obj) == -2) | ||
| 8668 | return obj; | 8654 | return obj; |
| 8669 | 8655 | ||
| 8670 | if (! EQ (obj, menu_prompt_more_char) | 8656 | if (! EQ (obj, menu_prompt_more_char) |
| @@ -8675,7 +8661,7 @@ read_char_minibuf_menu_prompt (int commandflag, | |||
| 8675 | store_kbd_macro_char (obj); | 8661 | store_kbd_macro_char (obj); |
| 8676 | return obj; | 8662 | return obj; |
| 8677 | } | 8663 | } |
| 8678 | /* Help char - go round again */ | 8664 | /* Help char - go round again. */ |
| 8679 | } | 8665 | } |
| 8680 | } | 8666 | } |
| 8681 | 8667 | ||
| @@ -10091,7 +10077,7 @@ will read just one key sequence. */) | |||
| 10091 | cancel_hourglass (); | 10077 | cancel_hourglass (); |
| 10092 | #endif | 10078 | #endif |
| 10093 | 10079 | ||
| 10094 | i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), | 10080 | i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), |
| 10095 | prompt, ! NILP (dont_downcase_last), | 10081 | prompt, ! NILP (dont_downcase_last), |
| 10096 | ! NILP (can_return_switch_frame), 0); | 10082 | ! NILP (can_return_switch_frame), 0); |
| 10097 | 10083 | ||
diff --git a/src/lisp.h b/src/lisp.h index faf4b1b8edd..04cefc8fe66 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2948,10 +2948,8 @@ extern void clear_message (int, int); | |||
| 2948 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); | 2948 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2949 | extern void message1 (const char *); | 2949 | extern void message1 (const char *); |
| 2950 | extern void message1_nolog (const char *); | 2950 | extern void message1_nolog (const char *); |
| 2951 | extern void message2 (const char *, ptrdiff_t, int); | 2951 | extern void message3 (Lisp_Object); |
| 2952 | extern void message2_nolog (const char *, ptrdiff_t, int); | 2952 | extern void message3_nolog (Lisp_Object); |
| 2953 | extern void message3 (Lisp_Object, ptrdiff_t, int); | ||
| 2954 | extern void message3_nolog (Lisp_Object, ptrdiff_t, int); | ||
| 2955 | extern void message_dolog (const char *, ptrdiff_t, int, int); | 2953 | extern void message_dolog (const char *, ptrdiff_t, int, int); |
| 2956 | extern void message_with_string (const char *, Lisp_Object, int); | 2954 | extern void message_with_string (const char *, Lisp_Object, int); |
| 2957 | extern void message_log_maybe_newline (void); | 2955 | extern void message_log_maybe_newline (void); |
diff --git a/src/w16select.c b/src/w16select.c index c92276b1d29..3bcc663e565 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -532,13 +532,13 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 532 | switch (put_status) | 532 | switch (put_status) |
| 533 | { | 533 | { |
| 534 | case 1: | 534 | case 1: |
| 535 | message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); | 535 | message3 (make_unibyte_string (no_mem_msg, sizeof (no_mem_msg) - 1)); |
| 536 | break; | 536 | break; |
| 537 | case 2: | 537 | case 2: |
| 538 | message2 (binary_msg, sizeof (binary_msg) - 1, 0); | 538 | message3 (make_unibyte_string (binary_msg, sizeof (binary_msg) - 1)); |
| 539 | break; | 539 | break; |
| 540 | case 3: | 540 | case 3: |
| 541 | message2 (system_error_msg, sizeof (system_error_msg) - 1, 0); | 541 | message3 (make_unibyte_string (system_error_msg, sizeof (system_error_msg) - 1)); |
| 542 | break; | 542 | break; |
| 543 | } | 543 | } |
| 544 | sit_for (make_number (2), 0, 2); | 544 | sit_for (make_number (2), 0, 2); |
diff --git a/src/xdisp.c b/src/xdisp.c index d663e56acc0..ba4c5a71bc9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -840,17 +840,17 @@ static void ensure_echo_area_buffers (void); | |||
| 840 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); | 840 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); |
| 841 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); | 841 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); |
| 842 | static int with_echo_area_buffer (struct window *, int, | 842 | static int with_echo_area_buffer (struct window *, int, |
| 843 | int (*) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), | 843 | int (*) (ptrdiff_t, Lisp_Object), |
| 844 | ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 844 | ptrdiff_t, Lisp_Object); |
| 845 | static void clear_garbaged_frames (void); | 845 | static void clear_garbaged_frames (void); |
| 846 | static int current_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 846 | static int current_message_1 (ptrdiff_t, Lisp_Object); |
| 847 | static void pop_message (void); | 847 | static void pop_message (void); |
| 848 | static int truncate_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 848 | static int truncate_message_1 (ptrdiff_t, Lisp_Object); |
| 849 | static void set_message (const char *, Lisp_Object, ptrdiff_t, int); | 849 | static void set_message (Lisp_Object); |
| 850 | static int set_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 850 | static int set_message_1 (ptrdiff_t, Lisp_Object); |
| 851 | static int display_echo_area (struct window *); | 851 | static int display_echo_area (struct window *); |
| 852 | static int display_echo_area_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 852 | static int display_echo_area_1 (ptrdiff_t, Lisp_Object); |
| 853 | static int resize_mini_window_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); | 853 | static int resize_mini_window_1 (ptrdiff_t, Lisp_Object); |
| 854 | static Lisp_Object unwind_redisplay (Lisp_Object); | 854 | static Lisp_Object unwind_redisplay (Lisp_Object); |
| 855 | static int string_char_and_length (const unsigned char *, int *); | 855 | static int string_char_and_length (const unsigned char *, int *); |
| 856 | static struct text_pos display_prop_end (struct it *, Lisp_Object, | 856 | static struct text_pos display_prop_end (struct it *, Lisp_Object, |
| @@ -9567,7 +9567,7 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte) | |||
| 9567 | 9567 | ||
| 9568 | for (i = 0; i < len; i++) | 9568 | for (i = 0; i < len; i++) |
| 9569 | { | 9569 | { |
| 9570 | if (i >= 3 && p1[i-3] == '.' && p1[i-2] == '.' && p1[i-1] == '.') | 9570 | if (i >= 3 && p1[i - 3] == '.' && p1[i - 2] == '.' && p1[i - 1] == '.') |
| 9571 | seen_dots = 1; | 9571 | seen_dots = 1; |
| 9572 | if (p1[i] != p2[i]) | 9572 | if (p1[i] != p2[i]) |
| 9573 | return seen_dots; | 9573 | return seen_dots; |
| @@ -9580,88 +9580,13 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte) | |||
| 9580 | char *pend; | 9580 | char *pend; |
| 9581 | intmax_t n = strtoimax ((char *) p1, &pend, 10); | 9581 | intmax_t n = strtoimax ((char *) p1, &pend, 10); |
| 9582 | if (0 < n && n < INTMAX_MAX && strncmp (pend, " times]\n", 8) == 0) | 9582 | if (0 < n && n < INTMAX_MAX && strncmp (pend, " times]\n", 8) == 0) |
| 9583 | return n+1; | 9583 | return n + 1; |
| 9584 | } | 9584 | } |
| 9585 | return 0; | 9585 | return 0; |
| 9586 | } | 9586 | } |
| 9587 | 9587 | ||
| 9588 | 9588 | ||
| 9589 | /* Display an echo area message M with a specified length of NBYTES | 9589 | /* Display an echo area message M with a specified length of NBYTES |
| 9590 | bytes. The string may include null characters. If M is 0, clear | ||
| 9591 | out any existing message, and let the mini-buffer text show | ||
| 9592 | through. | ||
| 9593 | |||
| 9594 | This may GC, so the buffer M must NOT point to a Lisp string. */ | ||
| 9595 | |||
| 9596 | void | ||
| 9597 | message2 (const char *m, ptrdiff_t nbytes, int multibyte) | ||
| 9598 | { | ||
| 9599 | /* First flush out any partial line written with print. */ | ||
| 9600 | message_log_maybe_newline (); | ||
| 9601 | if (m) | ||
| 9602 | message_dolog (m, nbytes, 1, multibyte); | ||
| 9603 | message2_nolog (m, nbytes, multibyte); | ||
| 9604 | } | ||
| 9605 | |||
| 9606 | |||
| 9607 | /* The non-logging counterpart of message2. */ | ||
| 9608 | |||
| 9609 | void | ||
| 9610 | message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte) | ||
| 9611 | { | ||
| 9612 | struct frame *sf = SELECTED_FRAME (); | ||
| 9613 | message_enable_multibyte = multibyte; | ||
| 9614 | |||
| 9615 | if (FRAME_INITIAL_P (sf)) | ||
| 9616 | { | ||
| 9617 | if (noninteractive_need_newline) | ||
| 9618 | putc ('\n', stderr); | ||
| 9619 | noninteractive_need_newline = 0; | ||
| 9620 | if (m) | ||
| 9621 | fwrite (m, nbytes, 1, stderr); | ||
| 9622 | if (cursor_in_echo_area == 0) | ||
| 9623 | fprintf (stderr, "\n"); | ||
| 9624 | fflush (stderr); | ||
| 9625 | } | ||
| 9626 | /* A null message buffer means that the frame hasn't really been | ||
| 9627 | initialized yet. Error messages get reported properly by | ||
| 9628 | cmd_error, so this must be just an informative message; toss it. */ | ||
| 9629 | else if (INTERACTIVE | ||
| 9630 | && sf->glyphs_initialized_p | ||
| 9631 | && FRAME_MESSAGE_BUF (sf)) | ||
| 9632 | { | ||
| 9633 | Lisp_Object mini_window; | ||
| 9634 | struct frame *f; | ||
| 9635 | |||
| 9636 | /* Get the frame containing the mini-buffer | ||
| 9637 | that the selected frame is using. */ | ||
| 9638 | mini_window = FRAME_MINIBUF_WINDOW (sf); | ||
| 9639 | f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); | ||
| 9640 | |||
| 9641 | FRAME_SAMPLE_VISIBILITY (f); | ||
| 9642 | if (FRAME_VISIBLE_P (sf) | ||
| 9643 | && ! FRAME_VISIBLE_P (f)) | ||
| 9644 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (mini_window))); | ||
| 9645 | |||
| 9646 | if (m) | ||
| 9647 | { | ||
| 9648 | set_message (m, Qnil, nbytes, multibyte); | ||
| 9649 | if (minibuffer_auto_raise) | ||
| 9650 | Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window))); | ||
| 9651 | } | ||
| 9652 | else | ||
| 9653 | clear_message (1, 1); | ||
| 9654 | |||
| 9655 | do_pending_window_change (0); | ||
| 9656 | echo_area_display (1); | ||
| 9657 | do_pending_window_change (0); | ||
| 9658 | if (FRAME_TERMINAL (f)->frame_up_to_date_hook) | ||
| 9659 | (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); | ||
| 9660 | } | ||
| 9661 | } | ||
| 9662 | |||
| 9663 | |||
| 9664 | /* Display an echo area message M with a specified length of NBYTES | ||
| 9665 | bytes. The string may include null characters. If M is not a | 9590 | bytes. The string may include null characters. If M is not a |
| 9666 | string, clear out any existing message, and let the mini-buffer | 9591 | string, clear out any existing message, and let the mini-buffer |
| 9667 | text show through. | 9592 | text show through. |
| @@ -9669,7 +9594,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte) | |||
| 9669 | This function cancels echoing. */ | 9594 | This function cancels echoing. */ |
| 9670 | 9595 | ||
| 9671 | void | 9596 | void |
| 9672 | message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | 9597 | message3 (Lisp_Object m) |
| 9673 | { | 9598 | { |
| 9674 | struct gcpro gcpro1; | 9599 | struct gcpro gcpro1; |
| 9675 | 9600 | ||
| @@ -9681,13 +9606,15 @@ message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | |||
| 9681 | message_log_maybe_newline (); | 9606 | message_log_maybe_newline (); |
| 9682 | if (STRINGP (m)) | 9607 | if (STRINGP (m)) |
| 9683 | { | 9608 | { |
| 9609 | ptrdiff_t nbytes = SBYTES (m); | ||
| 9610 | int multibyte = STRING_MULTIBYTE (m); | ||
| 9684 | USE_SAFE_ALLOCA; | 9611 | USE_SAFE_ALLOCA; |
| 9685 | char *buffer = SAFE_ALLOCA (nbytes); | 9612 | char *buffer = SAFE_ALLOCA (nbytes); |
| 9686 | memcpy (buffer, SDATA (m), nbytes); | 9613 | memcpy (buffer, SDATA (m), nbytes); |
| 9687 | message_dolog (buffer, nbytes, 1, multibyte); | 9614 | message_dolog (buffer, nbytes, 1, multibyte); |
| 9688 | SAFE_FREE (); | 9615 | SAFE_FREE (); |
| 9689 | } | 9616 | } |
| 9690 | message3_nolog (m, nbytes, multibyte); | 9617 | message3_nolog (m); |
| 9691 | 9618 | ||
| 9692 | UNGCPRO; | 9619 | UNGCPRO; |
| 9693 | } | 9620 | } |
| @@ -9699,10 +9626,9 @@ message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | |||
| 9699 | and make this cancel echoing. */ | 9626 | and make this cancel echoing. */ |
| 9700 | 9627 | ||
| 9701 | void | 9628 | void |
| 9702 | message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | 9629 | message3_nolog (Lisp_Object m) |
| 9703 | { | 9630 | { |
| 9704 | struct frame *sf = SELECTED_FRAME (); | 9631 | struct frame *sf = SELECTED_FRAME (); |
| 9705 | message_enable_multibyte = multibyte; | ||
| 9706 | 9632 | ||
| 9707 | if (FRAME_INITIAL_P (sf)) | 9633 | if (FRAME_INITIAL_P (sf)) |
| 9708 | { | 9634 | { |
| @@ -9710,27 +9636,22 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | |||
| 9710 | putc ('\n', stderr); | 9636 | putc ('\n', stderr); |
| 9711 | noninteractive_need_newline = 0; | 9637 | noninteractive_need_newline = 0; |
| 9712 | if (STRINGP (m)) | 9638 | if (STRINGP (m)) |
| 9713 | fwrite (SDATA (m), nbytes, 1, stderr); | 9639 | fwrite (SDATA (m), SBYTES (m), 1, stderr); |
| 9714 | if (cursor_in_echo_area == 0) | 9640 | if (cursor_in_echo_area == 0) |
| 9715 | fprintf (stderr, "\n"); | 9641 | fprintf (stderr, "\n"); |
| 9716 | fflush (stderr); | 9642 | fflush (stderr); |
| 9717 | } | 9643 | } |
| 9718 | /* A null message buffer means that the frame hasn't really been | 9644 | /* Error messages get reported properly by cmd_error, so this must be just an |
| 9719 | initialized yet. Error messages get reported properly by | 9645 | informative message; if the frame hasn't really been initialized yet, just |
| 9720 | cmd_error, so this must be just an informative message; toss it. */ | 9646 | toss it. */ |
| 9721 | else if (INTERACTIVE | 9647 | else if (INTERACTIVE |
| 9722 | && sf->glyphs_initialized_p | 9648 | && sf->glyphs_initialized_p) |
| 9723 | && FRAME_MESSAGE_BUF (sf)) | ||
| 9724 | { | 9649 | { |
| 9725 | Lisp_Object mini_window; | ||
| 9726 | Lisp_Object frame; | ||
| 9727 | struct frame *f; | ||
| 9728 | |||
| 9729 | /* Get the frame containing the mini-buffer | 9650 | /* Get the frame containing the mini-buffer |
| 9730 | that the selected frame is using. */ | 9651 | that the selected frame is using. */ |
| 9731 | mini_window = FRAME_MINIBUF_WINDOW (sf); | 9652 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); |
| 9732 | frame = XWINDOW (mini_window)->frame; | 9653 | Lisp_Object frame = XWINDOW (mini_window)->frame; |
| 9733 | f = XFRAME (frame); | 9654 | struct frame *f = XFRAME (frame); |
| 9734 | 9655 | ||
| 9735 | FRAME_SAMPLE_VISIBILITY (f); | 9656 | FRAME_SAMPLE_VISIBILITY (f); |
| 9736 | if (FRAME_VISIBLE_P (sf) | 9657 | if (FRAME_VISIBLE_P (sf) |
| @@ -9739,7 +9660,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | |||
| 9739 | 9660 | ||
| 9740 | if (STRINGP (m) && SCHARS (m) > 0) | 9661 | if (STRINGP (m) && SCHARS (m) > 0) |
| 9741 | { | 9662 | { |
| 9742 | set_message (NULL, m, nbytes, multibyte); | 9663 | set_message (m); |
| 9743 | if (minibuffer_auto_raise) | 9664 | if (minibuffer_auto_raise) |
| 9744 | Fraise_frame (frame); | 9665 | Fraise_frame (frame); |
| 9745 | /* Assume we are not echoing. | 9666 | /* Assume we are not echoing. |
| @@ -9769,7 +9690,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) | |||
| 9769 | void | 9690 | void |
| 9770 | message1 (const char *m) | 9691 | message1 (const char *m) |
| 9771 | { | 9692 | { |
| 9772 | message2 (m, (m ? strlen (m) : 0), 0); | 9693 | message3 (m ? make_unibyte_string (m, strlen (m)) : Qnil); |
| 9773 | } | 9694 | } |
| 9774 | 9695 | ||
| 9775 | 9696 | ||
| @@ -9778,7 +9699,7 @@ message1 (const char *m) | |||
| 9778 | void | 9699 | void |
| 9779 | message1_nolog (const char *m) | 9700 | message1_nolog (const char *m) |
| 9780 | { | 9701 | { |
| 9781 | message2_nolog (m, (m ? strlen (m) : 0), 0); | 9702 | message3_nolog (m ? make_unibyte_string (m, strlen (m)) : Qnil); |
| 9782 | } | 9703 | } |
| 9783 | 9704 | ||
| 9784 | /* Display a message M which contains a single %s | 9705 | /* Display a message M which contains a single %s |
| @@ -9815,10 +9736,10 @@ message_with_string (const char *m, Lisp_Object string, int log) | |||
| 9815 | mini_window = FRAME_MINIBUF_WINDOW (sf); | 9736 | mini_window = FRAME_MINIBUF_WINDOW (sf); |
| 9816 | f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); | 9737 | f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); |
| 9817 | 9738 | ||
| 9818 | /* A null message buffer means that the frame hasn't really been | 9739 | /* Error messages get reported properly by cmd_error, so this must be |
| 9819 | initialized yet. Error messages get reported properly by | 9740 | just an informative message; if the frame hasn't really been |
| 9820 | cmd_error, so this must be just an informative message; toss it. */ | 9741 | initialized yet, just toss it. */ |
| 9821 | if (FRAME_MESSAGE_BUF (f)) | 9742 | if (f->glyphs_initialized_p) |
| 9822 | { | 9743 | { |
| 9823 | Lisp_Object args[2], msg; | 9744 | Lisp_Object args[2], msg; |
| 9824 | struct gcpro gcpro1, gcpro2; | 9745 | struct gcpro gcpro1, gcpro2; |
| @@ -9831,9 +9752,9 @@ message_with_string (const char *m, Lisp_Object string, int log) | |||
| 9831 | msg = Fformat (2, args); | 9752 | msg = Fformat (2, args); |
| 9832 | 9753 | ||
| 9833 | if (log) | 9754 | if (log) |
| 9834 | message3 (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); | 9755 | message3 (msg); |
| 9835 | else | 9756 | else |
| 9836 | message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); | 9757 | message3_nolog (msg); |
| 9837 | 9758 | ||
| 9838 | UNGCPRO; | 9759 | UNGCPRO; |
| 9839 | 9760 | ||
| @@ -9877,20 +9798,20 @@ vmessage (const char *m, va_list ap) | |||
| 9877 | mini_window = FRAME_MINIBUF_WINDOW (sf); | 9798 | mini_window = FRAME_MINIBUF_WINDOW (sf); |
| 9878 | f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); | 9799 | f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); |
| 9879 | 9800 | ||
| 9880 | /* A null message buffer means that the frame hasn't really been | 9801 | /* Error messages get reported properly by cmd_error, so this must be |
| 9881 | initialized yet. Error messages get reported properly by | 9802 | just an informative message; if the frame hasn't really been |
| 9882 | cmd_error, so this must be just an informative message; toss | 9803 | initialized yet, just toss it. */ |
| 9883 | it. */ | 9804 | if (f->glyphs_initialized_p) |
| 9884 | if (FRAME_MESSAGE_BUF (f)) | ||
| 9885 | { | 9805 | { |
| 9886 | if (m) | 9806 | if (m) |
| 9887 | { | 9807 | { |
| 9888 | ptrdiff_t len; | 9808 | ptrdiff_t len; |
| 9809 | ptrdiff_t maxsize = FRAME_MESSAGE_BUF_SIZE (f); | ||
| 9810 | char *message_buf = alloca (maxsize + 1); | ||
| 9889 | 9811 | ||
| 9890 | len = doprnt (FRAME_MESSAGE_BUF (f), | 9812 | len = doprnt (message_buf, maxsize, m, (char *)0, ap); |
| 9891 | FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); | ||
| 9892 | 9813 | ||
| 9893 | message2 (FRAME_MESSAGE_BUF (f), len, 1); | 9814 | message3 (make_string (message_buf, len)); |
| 9894 | } | 9815 | } |
| 9895 | else | 9816 | else |
| 9896 | message1 (0); | 9817 | message1 (0); |
| @@ -9941,8 +9862,7 @@ update_echo_area (void) | |||
| 9941 | { | 9862 | { |
| 9942 | Lisp_Object string; | 9863 | Lisp_Object string; |
| 9943 | string = Fcurrent_message (); | 9864 | string = Fcurrent_message (); |
| 9944 | message3 (string, SBYTES (string), | 9865 | message3 (string); |
| 9945 | !NILP (BVAR (current_buffer, enable_multibyte_characters))); | ||
| 9946 | } | 9866 | } |
| 9947 | } | 9867 | } |
| 9948 | 9868 | ||
| @@ -9978,7 +9898,7 @@ ensure_echo_area_buffers (void) | |||
| 9978 | } | 9898 | } |
| 9979 | 9899 | ||
| 9980 | 9900 | ||
| 9981 | /* Call FN with args A1..A4 with either the current or last displayed | 9901 | /* Call FN with args A1..A2 with either the current or last displayed |
| 9982 | echo_area_buffer as current buffer. | 9902 | echo_area_buffer as current buffer. |
| 9983 | 9903 | ||
| 9984 | WHICH zero means use the current message buffer | 9904 | WHICH zero means use the current message buffer |
| @@ -9996,8 +9916,8 @@ ensure_echo_area_buffers (void) | |||
| 9996 | 9916 | ||
| 9997 | static int | 9917 | static int |
| 9998 | with_echo_area_buffer (struct window *w, int which, | 9918 | with_echo_area_buffer (struct window *w, int which, |
| 9999 | int (*fn) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), | 9919 | int (*fn) (ptrdiff_t, Lisp_Object), |
| 10000 | ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) | 9920 | ptrdiff_t a1, Lisp_Object a2) |
| 10001 | { | 9921 | { |
| 10002 | Lisp_Object buffer; | 9922 | Lisp_Object buffer; |
| 10003 | int this_one, the_other, clear_buffer_p, rc; | 9923 | int this_one, the_other, clear_buffer_p, rc; |
| @@ -10070,7 +9990,7 @@ with_echo_area_buffer (struct window *w, int which, | |||
| 10070 | eassert (BEGV >= BEG); | 9990 | eassert (BEGV >= BEG); |
| 10071 | eassert (ZV <= Z && ZV >= BEGV); | 9991 | eassert (ZV <= Z && ZV >= BEGV); |
| 10072 | 9992 | ||
| 10073 | rc = fn (a1, a2, a3, a4); | 9993 | rc = fn (a1, a2); |
| 10074 | 9994 | ||
| 10075 | eassert (BEGV >= BEG); | 9995 | eassert (BEGV >= BEG); |
| 10076 | eassert (ZV <= Z && ZV >= BEGV); | 9996 | eassert (ZV <= Z && ZV >= BEGV); |
| @@ -10249,7 +10169,7 @@ display_echo_area (struct window *w) | |||
| 10249 | window_height_changed_p | 10169 | window_height_changed_p |
| 10250 | = with_echo_area_buffer (w, display_last_displayed_message_p, | 10170 | = with_echo_area_buffer (w, display_last_displayed_message_p, |
| 10251 | display_echo_area_1, | 10171 | display_echo_area_1, |
| 10252 | (intptr_t) w, Qnil, 0, 0); | 10172 | (intptr_t) w, Qnil); |
| 10253 | 10173 | ||
| 10254 | if (no_message_p) | 10174 | if (no_message_p) |
| 10255 | echo_area_buffer[i] = Qnil; | 10175 | echo_area_buffer[i] = Qnil; |
| @@ -10266,7 +10186,7 @@ display_echo_area (struct window *w) | |||
| 10266 | Value is non-zero if height of W was changed. */ | 10186 | Value is non-zero if height of W was changed. */ |
| 10267 | 10187 | ||
| 10268 | static int | 10188 | static int |
| 10269 | display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) | 10189 | display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2) |
| 10270 | { | 10190 | { |
| 10271 | intptr_t i1 = a1; | 10191 | intptr_t i1 = a1; |
| 10272 | struct window *w = (struct window *) i1; | 10192 | struct window *w = (struct window *) i1; |
| @@ -10311,8 +10231,7 @@ resize_echo_area_exactly (void) | |||
| 10311 | resize_exactly = Qnil; | 10231 | resize_exactly = Qnil; |
| 10312 | 10232 | ||
| 10313 | resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, | 10233 | resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, |
| 10314 | (intptr_t) w, resize_exactly, | 10234 | (intptr_t) w, resize_exactly); |
| 10315 | 0, 0); | ||
| 10316 | if (resized_p) | 10235 | if (resized_p) |
| 10317 | { | 10236 | { |
| 10318 | ++windows_or_buffers_changed; | 10237 | ++windows_or_buffers_changed; |
| @@ -10330,7 +10249,7 @@ resize_echo_area_exactly (void) | |||
| 10330 | resize_mini_window returns. */ | 10249 | resize_mini_window returns. */ |
| 10331 | 10250 | ||
| 10332 | static int | 10251 | static int |
| 10333 | resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t a4) | 10252 | resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly) |
| 10334 | { | 10253 | { |
| 10335 | intptr_t i1 = a1; | 10254 | intptr_t i1 = a1; |
| 10336 | return resize_mini_window ((struct window *) i1, !NILP (exactly)); | 10255 | return resize_mini_window ((struct window *) i1, !NILP (exactly)); |
| @@ -10499,7 +10418,7 @@ current_message (void) | |||
| 10499 | else | 10418 | else |
| 10500 | { | 10419 | { |
| 10501 | with_echo_area_buffer (0, 0, current_message_1, | 10420 | with_echo_area_buffer (0, 0, current_message_1, |
| 10502 | (intptr_t) &msg, Qnil, 0, 0); | 10421 | (intptr_t) &msg, Qnil); |
| 10503 | if (NILP (msg)) | 10422 | if (NILP (msg)) |
| 10504 | echo_area_buffer[0] = Qnil; | 10423 | echo_area_buffer[0] = Qnil; |
| 10505 | } | 10424 | } |
| @@ -10509,7 +10428,7 @@ current_message (void) | |||
| 10509 | 10428 | ||
| 10510 | 10429 | ||
| 10511 | static int | 10430 | static int |
| 10512 | current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) | 10431 | current_message_1 (ptrdiff_t a1, Lisp_Object a2) |
| 10513 | { | 10432 | { |
| 10514 | intptr_t i1 = a1; | 10433 | intptr_t i1 = a1; |
| 10515 | Lisp_Object *msg = (Lisp_Object *) i1; | 10434 | Lisp_Object *msg = (Lisp_Object *) i1; |
| @@ -10541,14 +10460,8 @@ push_message (void) | |||
| 10541 | void | 10460 | void |
| 10542 | restore_message (void) | 10461 | restore_message (void) |
| 10543 | { | 10462 | { |
| 10544 | Lisp_Object msg; | ||
| 10545 | |||
| 10546 | eassert (CONSP (Vmessage_stack)); | 10463 | eassert (CONSP (Vmessage_stack)); |
| 10547 | msg = XCAR (Vmessage_stack); | 10464 | message3_nolog (XCAR (Vmessage_stack)); |
| 10548 | if (STRINGP (msg)) | ||
| 10549 | message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); | ||
| 10550 | else | ||
| 10551 | message3_nolog (msg, 0, 0); | ||
| 10552 | } | 10465 | } |
| 10553 | 10466 | ||
| 10554 | 10467 | ||
| @@ -10591,16 +10504,16 @@ truncate_echo_area (ptrdiff_t nchars) | |||
| 10591 | { | 10504 | { |
| 10592 | if (nchars == 0) | 10505 | if (nchars == 0) |
| 10593 | echo_area_buffer[0] = Qnil; | 10506 | echo_area_buffer[0] = Qnil; |
| 10594 | /* A null message buffer means that the frame hasn't really been | ||
| 10595 | initialized yet. Error messages get reported properly by | ||
| 10596 | cmd_error, so this must be just an informative message; toss it. */ | ||
| 10597 | else if (!noninteractive | 10507 | else if (!noninteractive |
| 10598 | && INTERACTIVE | 10508 | && INTERACTIVE |
| 10599 | && !NILP (echo_area_buffer[0])) | 10509 | && !NILP (echo_area_buffer[0])) |
| 10600 | { | 10510 | { |
| 10601 | struct frame *sf = SELECTED_FRAME (); | 10511 | struct frame *sf = SELECTED_FRAME (); |
| 10602 | if (FRAME_MESSAGE_BUF (sf)) | 10512 | /* Error messages get reported properly by cmd_error, so this must be |
| 10603 | with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil, 0, 0); | 10513 | just an informative message; if the frame hasn't really been |
| 10514 | initialized yet, just toss it. */ | ||
| 10515 | if (sf->glyphs_initialized_p) | ||
| 10516 | with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil); | ||
| 10604 | } | 10517 | } |
| 10605 | } | 10518 | } |
| 10606 | 10519 | ||
| @@ -10609,7 +10522,7 @@ truncate_echo_area (ptrdiff_t nchars) | |||
| 10609 | message to at most NCHARS characters. */ | 10522 | message to at most NCHARS characters. */ |
| 10610 | 10523 | ||
| 10611 | static int | 10524 | static int |
| 10612 | truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) | 10525 | truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2) |
| 10613 | { | 10526 | { |
| 10614 | if (BEG + nchars < Z) | 10527 | if (BEG + nchars < Z) |
| 10615 | del_range (BEG + nchars, Z); | 10528 | del_range (BEG + nchars, Z); |
| @@ -10618,30 +10531,16 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4 | |||
| 10618 | return 0; | 10531 | return 0; |
| 10619 | } | 10532 | } |
| 10620 | 10533 | ||
| 10621 | /* Set the current message to a substring of S or STRING. | 10534 | /* Set the current message to STRING. */ |
| 10622 | |||
| 10623 | If STRING is a Lisp string, set the message to the first NBYTES | ||
| 10624 | bytes from STRING. NBYTES zero means use the whole string. If | ||
| 10625 | STRING is multibyte, the message will be displayed multibyte. | ||
| 10626 | |||
| 10627 | If S is not null, set the message to the first LEN bytes of S. LEN | ||
| 10628 | zero means use the whole string. MULTIBYTE_P non-zero means S is | ||
| 10629 | multibyte. Display the message multibyte in that case. | ||
| 10630 | |||
| 10631 | Doesn't GC, as with_echo_area_buffer binds Qinhibit_modification_hooks | ||
| 10632 | to t before calling set_message_1 (which calls insert). | ||
| 10633 | */ | ||
| 10634 | 10535 | ||
| 10635 | static void | 10536 | static void |
| 10636 | set_message (const char *s, Lisp_Object string, | 10537 | set_message (Lisp_Object string) |
| 10637 | ptrdiff_t nbytes, int multibyte_p) | ||
| 10638 | { | 10538 | { |
| 10639 | message_enable_multibyte | 10539 | eassert (STRINGP (string)); |
| 10640 | = ((s && multibyte_p) | ||
| 10641 | || (STRINGP (string) && STRING_MULTIBYTE (string))); | ||
| 10642 | 10540 | ||
| 10643 | with_echo_area_buffer (0, -1, set_message_1, | 10541 | message_enable_multibyte = STRING_MULTIBYTE (string); |
| 10644 | (intptr_t) s, string, nbytes, multibyte_p); | 10542 | |
| 10543 | with_echo_area_buffer (0, -1, set_message_1, 0, string); | ||
| 10645 | message_buf_print = 0; | 10544 | message_buf_print = 0; |
| 10646 | help_echo_showing_p = 0; | 10545 | help_echo_showing_p = 0; |
| 10647 | 10546 | ||
| @@ -10651,18 +10550,14 @@ set_message (const char *s, Lisp_Object string, | |||
| 10651 | } | 10550 | } |
| 10652 | 10551 | ||
| 10653 | 10552 | ||
| 10654 | /* Helper function for set_message. Arguments have the same meaning | 10553 | /* Helper function for set_message. First argument is ignored and second |
| 10655 | as there, with A1 corresponding to S and A2 corresponding to STRING | 10554 | argument has the same meaning as for set_message. |
| 10656 | This function is called with the echo area buffer being | 10555 | This function is called with the echo area buffer being current. */ |
| 10657 | current. */ | ||
| 10658 | 10556 | ||
| 10659 | static int | 10557 | static int |
| 10660 | set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multibyte_p) | 10558 | set_message_1 (ptrdiff_t a1, Lisp_Object string) |
| 10661 | { | 10559 | { |
| 10662 | intptr_t i1 = a1; | 10560 | eassert (STRINGP (string)); |
| 10663 | const char *s = (const char *) i1; | ||
| 10664 | const unsigned char *msg = (const unsigned char *) s; | ||
| 10665 | Lisp_Object string = a2; | ||
| 10666 | 10561 | ||
| 10667 | /* Change multibyteness of the echo buffer appropriately. */ | 10562 | /* Change multibyteness of the echo buffer appropriately. */ |
| 10668 | if (message_enable_multibyte | 10563 | if (message_enable_multibyte |
| @@ -10676,61 +10571,10 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby | |||
| 10676 | /* Insert new message at BEG. */ | 10571 | /* Insert new message at BEG. */ |
| 10677 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); | 10572 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); |
| 10678 | 10573 | ||
| 10679 | if (STRINGP (string)) | 10574 | /* This function takes care of single/multibyte conversion. |
| 10680 | { | 10575 | We just have to ensure that the echo area buffer has the right |
| 10681 | ptrdiff_t nchars; | 10576 | setting of enable_multibyte_characters. */ |
| 10682 | 10577 | insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 1); | |
| 10683 | if (nbytes == 0) | ||
| 10684 | nbytes = SBYTES (string); | ||
| 10685 | nchars = string_byte_to_char (string, nbytes); | ||
| 10686 | |||
| 10687 | /* This function takes care of single/multibyte conversion. We | ||
| 10688 | just have to ensure that the echo area buffer has the right | ||
| 10689 | setting of enable_multibyte_characters. */ | ||
| 10690 | insert_from_string (string, 0, 0, nchars, nbytes, 1); | ||
| 10691 | } | ||
| 10692 | else if (s) | ||
| 10693 | { | ||
| 10694 | if (nbytes == 0) | ||
| 10695 | nbytes = strlen (s); | ||
| 10696 | |||
| 10697 | if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 10698 | { | ||
| 10699 | /* Convert from multi-byte to single-byte. */ | ||
| 10700 | ptrdiff_t i; | ||
| 10701 | int c, n; | ||
| 10702 | char work[1]; | ||
| 10703 | |||
| 10704 | /* Convert a multibyte string to single-byte. */ | ||
| 10705 | for (i = 0; i < nbytes; i += n) | ||
| 10706 | { | ||
| 10707 | c = string_char_and_length (msg + i, &n); | ||
| 10708 | work[0] = (ASCII_CHAR_P (c) | ||
| 10709 | ? c | ||
| 10710 | : multibyte_char_to_unibyte (c)); | ||
| 10711 | insert_1_both (work, 1, 1, 1, 0, 0); | ||
| 10712 | } | ||
| 10713 | } | ||
| 10714 | else if (!multibyte_p | ||
| 10715 | && !NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 10716 | { | ||
| 10717 | /* Convert from single-byte to multi-byte. */ | ||
| 10718 | ptrdiff_t i; | ||
| 10719 | int c, n; | ||
| 10720 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | ||
| 10721 | |||
| 10722 | /* Convert a single-byte string to multibyte. */ | ||
| 10723 | for (i = 0; i < nbytes; i++) | ||
| 10724 | { | ||
| 10725 | c = msg[i]; | ||
| 10726 | MAKE_CHAR_MULTIBYTE (c); | ||
| 10727 | n = CHAR_STRING (c, str); | ||
| 10728 | insert_1_both ((char *) str, 1, n, 1, 0, 0); | ||
| 10729 | } | ||
| 10730 | } | ||
| 10731 | else | ||
| 10732 | insert_1 (s, nbytes, 1, 0, 0); | ||
| 10733 | } | ||
| 10734 | 10578 | ||
| 10735 | return 0; | 10579 | return 0; |
| 10736 | } | 10580 | } |