aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-01-24 00:03:29 +0100
committerJoakim Verona2013-01-24 00:03:29 +0100
commite4963dc9795ed5a3eb60e73943b9d799107e0f13 (patch)
tree29372c728b8468e618623bb660cda24848f10063
parent6f0e40ae28faeba85872002eb848debb6bfcb2f5 (diff)
parentb09cca6ace3728ad8a93b3c0301520fa75e71586 (diff)
downloademacs-e4963dc9795ed5a3eb60e73943b9d799107e0f13.tar.gz
emacs-e4963dc9795ed5a3eb60e73943b9d799107e0f13.zip
auto upstream
-rw-r--r--ChangeLog5
-rw-r--r--lib/unistd.in.h20
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/mh-e/ChangeLog6
-rw-r--r--lisp/mh-e/mh-acros.el2
-rw-r--r--lisp/mh-e/mh-search.el2
-rw-r--r--lisp/mh-e/mh-xface.el2
-rw-r--r--lisp/paren.el30
-rw-r--r--lisp/play/gametree.el2
-rw-r--r--src/ChangeLog39
-rw-r--r--src/alloc.c14
-rw-r--r--src/callint.c50
-rw-r--r--src/dispnew.c22
-rw-r--r--src/editfns.c22
-rw-r--r--src/fileio.c12
-rw-r--r--src/fns.c2
-rw-r--r--src/frame.c5
-rw-r--r--src/frame.h10
-rw-r--r--src/insdel.c7
-rw-r--r--src/keyboard.c74
-rw-r--r--src/lisp.h6
-rw-r--r--src/w16select.c6
-rw-r--r--src/w32term.c21
-rw-r--r--src/xdisp.c302
24 files changed, 254 insertions, 417 deletions
diff --git a/ChangeLog b/ChangeLog
index 02a0453b9ec..15b32524026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12013-01-23 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, incorporating:
4 2013-01-16 unistd: port to recent mingw
5
12013-01-19 Glenn Morris <rgm@gnu.org> 62013-01-19 Glenn Morris <rgm@gnu.org>
2 7
3 * Makefile.in (install-arch-indep): Put back a chmod that was 8 * Makefile.in (install-arch-indep): Put back a chmod that was
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index f011b71d5f5..a870fe7b4a3 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -14,29 +14,13 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16 16
17#ifndef _@GUARD_PREFIX@_UNISTD_H
18
17#if __GNUC__ >= 3 19#if __GNUC__ >= 3
18@PRAGMA_SYSTEM_HEADER@ 20@PRAGMA_SYSTEM_HEADER@
19#endif 21#endif
20@PRAGMA_COLUMNS@ 22@PRAGMA_COLUMNS@
21 23
22/* Special invocation convention:
23 - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
24 but we need to ensure that both the system <unistd.h> and <winsock2.h>
25 are completely included before we replace gethostname. */
26#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
27 && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
28/* <unistd.h> is being indirectly included for the first time from
29 <winsock2.h>; avoid declaring any overrides. */
30# if @HAVE_UNISTD_H@
31# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
32# else
33# error unexpected; report this to bug-gnulib@gnu.org
34# endif
35# define _GL_WINSOCK2_H_WITNESS
36
37/* Normal invocation. */
38#elif !defined _@GUARD_PREFIX@_UNISTD_H
39
40/* The include_next requires a split double-inclusion guard. */ 24/* The include_next requires a split double-inclusion guard. */
41#if @HAVE_UNISTD_H@ 25#if @HAVE_UNISTD_H@
42# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ 26# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8ab64694aad..d783443f528 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-01-23 Bastien Guerry <bzg@gnu.org>
2
3 * paren.el (show-paren-function): Make sure an overlay exists
4 before trying to delete it. Also use `pos' as a position only
5 when it is an integer.
6
72013-01-23 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * play/gametree.el (gametree-break-line-here): Use point-marker.
10
12013-01-22 Michael Albinus <michael.albinus@gmx.de> 112013-01-22 Michael Albinus <michael.albinus@gmx.de>
2 12
3 * net/tramp-cmds.el (tramp-bug, tramp-append-tramp-buffers): Mark 13 * net/tramp-cmds.el (tramp-bug, tramp-append-tramp-buffers): Mark
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 8f81182b52d..0854010e60f 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,9 @@
12013-01-23 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * mh-acros.el (mh-do-at-event-location): Use point-marker.
4 * mh-search.el (mh-index-create-imenu-index): Likewise.
5 * mh-xface.el (mh-x-image-url-display): Likewise.
6
12012-11-25 Bill Wohler <wohler@newt.com> 72012-11-25 Bill Wohler <wohler@newt.com>
2 8
3 Release MH-E version 8.4. 9 Release MH-E version 8.4.
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index 9f7fc0df68b..7d6279e4eca 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -233,7 +233,7 @@ preserved."
233 (,original-window (selected-window)) 233 (,original-window (selected-window))
234 (,original-position (progn 234 (,original-position (progn
235 (set-buffer (window-buffer ,event-window)) 235 (set-buffer (window-buffer ,event-window))
236 (set-marker (make-marker) (point)))) 236 (point-marker)))
237 (,modified-flag (buffer-modified-p)) 237 (,modified-flag (buffer-modified-p))
238 (buffer-read-only nil)) 238 (buffer-read-only nil))
239 (unwind-protect (progn 239 (unwind-protect (progn
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index a8860263531..d31d0ca495a 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -1434,7 +1434,7 @@ being the list of messages originally from that folder."
1434 (beginning-of-line) 1434 (beginning-of-line)
1435 (push (cons (buffer-substring-no-properties 1435 (push (cons (buffer-substring-no-properties
1436 (point) (mh-line-end-position)) 1436 (point) (mh-line-end-position))
1437 (set-marker (make-marker) (point))) 1437 (point-marker))
1438 alist))) 1438 alist)))
1439 (setq imenu--index-alist (nreverse alist))))) 1439 (setq imenu--index-alist (nreverse alist)))))
1440 1440
diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el
index 7582158fefd..4340373f5c4 100644
--- a/lisp/mh-e/mh-xface.el
+++ b/lisp/mh-e/mh-xface.el
@@ -323,7 +323,7 @@ elements of the list are nil."
323If the URL isn't present in the cache then it is fetched with wget." 323If the URL isn't present in the cache then it is fetched with wget."
324 (let* ((cache-filename (mh-x-image-url-cache-canonicalize url)) 324 (let* ((cache-filename (mh-x-image-url-cache-canonicalize url))
325 (state (mh-x-image-get-download-state cache-filename)) 325 (state (mh-x-image-get-download-state cache-filename))
326 (marker (set-marker (make-marker) (point)))) 326 (marker (point-marker)))
327 (set (make-local-variable 'mh-x-image-marker) marker) 327 (set (make-local-variable 'mh-x-image-marker) marker)
328 (cond ((not (mh-x-image-url-sane-p url))) 328 (cond ((not (mh-x-image-url-sane-p url)))
329 ((eq state 'ok) 329 ((eq state 'ok)
diff --git a/lisp/paren.el b/lisp/paren.el
index b87c8bde89a..bf2238d4907 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -243,23 +243,23 @@ matching parenthesis is highlighted in `show-paren-style' after
243 ;; 243 ;;
244 ;; Turn on highlighting for the matching paren, if found. 244 ;; Turn on highlighting for the matching paren, if found.
245 ;; If it's an unmatched paren, turn off any such highlighting. 245 ;; If it's an unmatched paren, turn off any such highlighting.
246 (unless (integerp pos) 246 (if (not (integerp pos))
247 (delete-overlay show-paren-overlay)) 247 (when show-paren-overlay (delete-overlay show-paren-overlay))
248 (let ((to (if (or (eq show-paren-style 'expression) 248 (let ((to (if (or (eq show-paren-style 'expression)
249 (and (eq show-paren-style 'mixed)
250 (not (pos-visible-in-window-p pos))))
251 (point)
252 pos))
253 (from (if (or (eq show-paren-style 'expression)
254 (and (eq show-paren-style 'mixed) 249 (and (eq show-paren-style 'mixed)
255 (not (pos-visible-in-window-p pos)))) 250 (not (pos-visible-in-window-p pos))))
256 pos 251 (point)
257 (save-excursion 252 pos))
258 (goto-char pos) 253 (from (if (or (eq show-paren-style 'expression)
259 (- (point) dir))))) 254 (and (eq show-paren-style 'mixed)
260 (if show-paren-overlay 255 (not (pos-visible-in-window-p pos))))
261 (move-overlay show-paren-overlay from to (current-buffer)) 256 pos
262 (setq show-paren-overlay (make-overlay from to nil t)))) 257 (save-excursion
258 (goto-char pos)
259 (- (point) dir)))))
260 (if show-paren-overlay
261 (move-overlay show-paren-overlay from to (current-buffer))
262 (setq show-paren-overlay (make-overlay from to nil t)))))
263 ;; 263 ;;
264 ;; Always set the overlay face, since it varies. 264 ;; Always set the overlay face, since it varies.
265 (overlay-put show-paren-overlay 'priority show-paren-priority) 265 (overlay-put show-paren-overlay 'priority show-paren-priority)
diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el
index 5cd39d535c8..3daf9d5f784 100644
--- a/lisp/play/gametree.el
+++ b/lisp/play/gametree.el
@@ -435,7 +435,7 @@ only work of Black's moves are explicitly numbered, for instance
435 gametree-half-ply-regexp)) limit)) 435 gametree-half-ply-regexp)) limit))
436 (goto-char (match-beginning 0)))) 436 (goto-char (match-beginning 0))))
437 (gametree-transpose-following-leaves) 437 (gametree-transpose-following-leaves)
438 (let* ((pt (set-marker (make-marker) (point))) 438 (let* ((pt (point-marker))
439 (plys (gametree-current-branch-ply)) 439 (plys (gametree-current-branch-ply))
440 (depth (gametree-current-branch-depth)) 440 (depth (gametree-current-branch-depth))
441 (old-depth depth)) 441 (old-depth depth))
diff --git a/src/ChangeLog b/src/ChangeLog
index 7dc7b25f85a..7a2ff184c0a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,42 @@
12013-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
302013-01-23 Eli Zaretskii <eliz@gnu.org>
31
32 * w32term.c (w32fullscreen_hook): Account correctly for the screen
33 real estate used for the tool bar and the menu bar.
34
352013-01-23 Dmitry Antipov <dmantipov@yandex.ru>
36
37 * insdel.c (prepare_to_modify_buffer): Force redisplay if
38 hidden buffer is prepared to modification (Bug#13164).
39
12013-01-22 Dmitry Antipov <dmantipov@yandex.ru> 402013-01-22 Dmitry Antipov <dmantipov@yandex.ru>
2 41
3 * window.h (struct window): Change window_end_valid member from 42 * window.h (struct window): Change window_end_valid member from
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
6569void 6569void
6570init_alloc_once (void) 6570init_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 32ac606b84e..a680ca0e03a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -90,7 +90,6 @@ static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
90 struct window *); 90 struct window *);
91static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, 91static void build_frame_matrix_from_leaf_window (struct glyph_matrix *,
92 struct window *); 92 struct window *);
93static void adjust_frame_message_buffer (struct frame *);
94static void adjust_decode_mode_spec_buffer (struct frame *); 93static void adjust_decode_mode_spec_buffer (struct frame *);
95static void fill_up_glyph_row_with_spaces (struct glyph_row *); 94static void fill_up_glyph_row_with_spaces (struct glyph_row *);
96static void clear_window_matrices (struct window *, bool); 95static void clear_window_matrices (struct window *, bool);
@@ -1859,9 +1858,7 @@ adjust_frame_glyphs (struct frame *f)
1859 else 1858 else
1860 adjust_frame_glyphs_for_frame_redisplay (f); 1859 adjust_frame_glyphs_for_frame_redisplay (f);
1861 1860
1862 /* Don't forget the message buffer and the buffer for 1861 /* Don't forget the buffer for decode_mode_spec. */
1863 decode_mode_spec. */
1864 adjust_frame_message_buffer (f);
1865 adjust_decode_mode_spec_buffer (f); 1862 adjust_decode_mode_spec_buffer (f);
1866 1863
1867 f->glyphs_initialized_p = 1; 1864 f->glyphs_initialized_p = 1;
@@ -2161,23 +2158,6 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2161} 2158}
2162 2159
2163 2160
2164/* Adjust/ allocate message buffer of frame F.
2165
2166 Note that the message buffer is never freed. Since I could not
2167 find a free in 19.34, I assume that freeing it would be
2168 problematic in some way and don't do it either.
2169
2170 (Implementation note: It should be checked if we can free it
2171 eventually without causing trouble). */
2172
2173static void
2174adjust_frame_message_buffer (struct frame *f)
2175{
2176 FRAME_MESSAGE_BUF (f) = xrealloc (FRAME_MESSAGE_BUF (f),
2177 FRAME_MESSAGE_BUF_SIZE (f) + 1);
2178}
2179
2180
2181/* Re-allocate buffer for decode_mode_spec on frame F. */ 2161/* Re-allocate buffer for decode_mode_spec on frame F. */
2182 2162
2183static void 2163static 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. */
3433static char *message_text;
3434
3435/* Allocated length of that buffer. */
3436static ptrdiff_t message_length;
3437
3438DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, 3432DEFUN ("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.
3440The message also goes into the `*Messages*' buffer, if `message-log-max' 3434The 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
5444auto_save_error (Lisp_Object error_val) 5444auto_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}
diff --git a/src/fns.c b/src/fns.c
index e066d3cbb8f..860d295d5a0 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2745,7 +2745,7 @@ ARGS are passed as extra arguments to the function.
2745usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) 2745usage: (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. */
37extern bool frame_garbaged; 37extern 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/insdel.c b/src/insdel.c
index 303247816ca..98dd97bdd08 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1804,9 +1804,12 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1804 Fbarf_if_buffer_read_only (); 1804 Fbarf_if_buffer_read_only ();
1805 1805
1806 /* If we're modifying the buffer other than shown in a selected window, 1806 /* If we're modifying the buffer other than shown in a selected window,
1807 let redisplay consider other windows if this buffer is visible. */ 1807 let redisplay consider other windows if this buffer is visible or
1808 hidden (although hidden buffers have zero window counts, their state
1809 may affect the display too, e.g. via mode lines of other buffers). */
1808 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer 1810 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer
1809 && buffer_window_count (current_buffer)) 1811 && (buffer_window_count (current_buffer)
1812 || BUFFER_HIDDEN_P (current_buffer)))
1810 ++windows_or_buffers_changed; 1813 ++windows_or_buffers_changed;
1811 1814
1812 if (buffer_intervals (current_buffer)) 1815 if (buffer_intervals (current_buffer))
diff --git a/src/keyboard.c b/src/keyboard.c
index baa69a089b3..f5728009cf7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -678,9 +678,8 @@ echo_now (void)
678 } 678 }
679 679
680 echoing = 1; 680 echoing = 1;
681 message3_nolog (KVAR (current_kboard, echo_string), 681 /* FIXME: Use call (Qmessage) so it can be advised (e.g. emacspeak). */
682 SBYTES (KVAR (current_kboard, echo_string)), 682 message3_nolog (KVAR (current_kboard, echo_string));
683 STRING_MULTIBYTE (KVAR (current_kboard, echo_string)));
684 echoing = 0; 683 echoing = 0;
685 684
686 /* Record in what buffer we echoed, and from which kboard. */ 685 /* Record in what buffer we echoed, and from which kboard. */
@@ -1432,7 +1431,7 @@ command_loop_1 (void)
1432 sit_for (Vminibuffer_message_timeout, 0, 2); 1431 sit_for (Vminibuffer_message_timeout, 0, 2);
1433 1432
1434 /* Clear the echo area. */ 1433 /* Clear the echo area. */
1435 message2 (0, 0, 0); 1434 message1 (0);
1436 safe_run_hooks (Qecho_area_clear_hook); 1435 safe_run_hooks (Qecho_area_clear_hook);
1437 1436
1438 unbind_to (count, Qnil); 1437 unbind_to (count, Qnil);
@@ -8453,12 +8452,6 @@ read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
8453 return Qnil ; 8452 return Qnil ;
8454} 8453}
8455 8454
8456/* Buffer in use so far for the minibuf prompts for menu keymaps.
8457 We make this bigger when necessary, and never free it. */
8458static char *read_char_minibuf_menu_text;
8459/* Size of that buffer. */
8460static ptrdiff_t read_char_minibuf_menu_width;
8461
8462static Lisp_Object 8455static Lisp_Object
8463read_char_minibuf_menu_prompt (int commandflag, 8456read_char_minibuf_menu_prompt (int commandflag,
8464 ptrdiff_t nmaps, Lisp_Object *maps) 8457 ptrdiff_t nmaps, Lisp_Object *maps)
@@ -8471,7 +8464,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8471 ptrdiff_t idx = -1; 8464 ptrdiff_t idx = -1;
8472 bool nobindings = 1; 8465 bool nobindings = 1;
8473 Lisp_Object rest, vector; 8466 Lisp_Object rest, vector;
8474 char *menu; 8467 Lisp_Object prompt_strings = Qnil;
8475 8468
8476 vector = Qnil; 8469 vector = Qnil;
8477 name = Qnil; 8470 name = Qnil;
@@ -8491,24 +8484,13 @@ read_char_minibuf_menu_prompt (int commandflag,
8491 if (!STRINGP (name)) 8484 if (!STRINGP (name))
8492 return Qnil; 8485 return Qnil;
8493 8486
8494 /* Make sure we have a big enough buffer for the menu text. */ 8487#define PUSH_C_STR(str, listvar) \
8495 width = max (width, SBYTES (name)); 8488 listvar = Fcons (make_unibyte_string (str, strlen (str)), listvar)
8496 if (STRING_BYTES_BOUND - 4 < width) 8489
8497 memory_full (SIZE_MAX);
8498 if (width + 4 > read_char_minibuf_menu_width)
8499 {
8500 read_char_minibuf_menu_text
8501 = xrealloc (read_char_minibuf_menu_text, width + 4);
8502 read_char_minibuf_menu_width = width + 4;
8503 }
8504 menu = read_char_minibuf_menu_text;
8505
8506 /* Prompt string always starts with map's prompt, and a space. */ 8490 /* Prompt string always starts with map's prompt, and a space. */
8507 strcpy (menu, SSDATA (name)); 8491 prompt_strings = Fcons (name, prompt_strings);
8508 nlength = SBYTES (name); 8492 PUSH_C_STR (": ", prompt_strings);
8509 menu[nlength++] = ':'; 8493 nlength = SCHARS (name) + 2;
8510 menu[nlength++] = ' ';
8511 menu[nlength] = 0;
8512 8494
8513 /* Start prompting at start of first map. */ 8495 /* Start prompting at start of first map. */
8514 mapno = 0; 8496 mapno = 0;
@@ -8518,6 +8500,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8518 while (1) 8500 while (1)
8519 { 8501 {
8520 bool notfirst = 0; 8502 bool notfirst = 0;
8503 Lisp_Object menu_strings = prompt_strings;
8521 ptrdiff_t i = nlength; 8504 ptrdiff_t i = nlength;
8522 Lisp_Object obj; 8505 Lisp_Object obj;
8523 Lisp_Object orig_defn_macro; 8506 Lisp_Object orig_defn_macro;
@@ -8527,6 +8510,8 @@ read_char_minibuf_menu_prompt (int commandflag,
8527 { 8510 {
8528 Lisp_Object elt; 8511 Lisp_Object elt;
8529 8512
8513 /* FIXME: Use map_keymap to handle new keymap formats. */
8514
8530 /* If reached end of map, start at beginning of next map. */ 8515 /* If reached end of map, start at beginning of next map. */
8531 if (NILP (rest)) 8516 if (NILP (rest))
8532 { 8517 {
@@ -8622,7 +8607,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8622 /* Punctuate between strings. */ 8607 /* Punctuate between strings. */
8623 if (notfirst) 8608 if (notfirst)
8624 { 8609 {
8625 strcpy (menu + i, ", "); 8610 PUSH_C_STR (", ", menu_strings);
8626 i += 2; 8611 i += 2;
8627 } 8612 }
8628 notfirst = 1; 8613 notfirst = 1;
@@ -8634,23 +8619,28 @@ read_char_minibuf_menu_prompt (int commandflag,
8634 { 8619 {
8635 /* Add as much of string as fits. */ 8620 /* Add as much of string as fits. */
8636 thiswidth = min (SCHARS (desc), width - i); 8621 thiswidth = min (SCHARS (desc), width - i);
8637 memcpy (menu + i, SDATA (desc), thiswidth); 8622 menu_strings
8623 = Fcons (Fsubstring (desc, make_number (0),
8624 make_number (thiswidth)),
8625 menu_strings);
8638 i += thiswidth; 8626 i += thiswidth;
8639 strcpy (menu + i, " = "); 8627 PUSH_C_STR (" = ", menu_strings);
8640 i += 3; 8628 i += 3;
8641 } 8629 }
8642 8630
8643 /* Add as much of string as fits. */ 8631 /* Add as much of string as fits. */
8644 thiswidth = min (SCHARS (s), width - i); 8632 thiswidth = min (SCHARS (s), width - i);
8645 memcpy (menu + i, SDATA (s), thiswidth); 8633 menu_strings
8634 = Fcons (Fsubstring (s, make_number (0),
8635 make_number (thiswidth)),
8636 menu_strings);
8646 i += thiswidth; 8637 i += thiswidth;
8647 menu[i] = 0;
8648 } 8638 }
8649 else 8639 else
8650 { 8640 {
8651 /* If this element does not fit, end the line now, 8641 /* If this element does not fit, end the line now,
8652 and save the element for the next line. */ 8642 and save the element for the next line. */
8653 strcpy (menu + i, "..."); 8643 PUSH_C_STR ("...", menu_strings);
8654 break; 8644 break;
8655 } 8645 }
8656 } 8646 }
@@ -8667,13 +8657,11 @@ read_char_minibuf_menu_prompt (int commandflag,
8667 } 8657 }
8668 8658
8669 /* Prompt with that and read response. */ 8659 /* Prompt with that and read response. */
8670 message2_nolog (menu, strlen (menu), 8660 message3_nolog (apply1 (intern ("concat"), menu_strings));
8671 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
8672 8661
8673 /* Make believe its not a keyboard macro in case the help char 8662 /* Make believe it's not a keyboard macro in case the help char
8674 is pressed. Help characters are not recorded because menu prompting 8663 is pressed. Help characters are not recorded because menu prompting
8675 is not used on replay. 8664 is not used on replay. */
8676 */
8677 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); 8665 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
8678 kset_defining_kbd_macro (current_kboard, Qnil); 8666 kset_defining_kbd_macro (current_kboard, Qnil);
8679 do 8667 do
@@ -8681,9 +8669,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8681 while (BUFFERP (obj)); 8669 while (BUFFERP (obj));
8682 kset_defining_kbd_macro (current_kboard, orig_defn_macro); 8670 kset_defining_kbd_macro (current_kboard, orig_defn_macro);
8683 8671
8684 if (!INTEGERP (obj)) 8672 if (!INTEGERP (obj) || XINT (obj) == -2)
8685 return obj;
8686 else if (XINT (obj) == -2)
8687 return obj; 8673 return obj;
8688 8674
8689 if (! EQ (obj, menu_prompt_more_char) 8675 if (! EQ (obj, menu_prompt_more_char)
@@ -8694,7 +8680,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8694 store_kbd_macro_char (obj); 8680 store_kbd_macro_char (obj);
8695 return obj; 8681 return obj;
8696 } 8682 }
8697 /* Help char - go round again */ 8683 /* Help char - go round again. */
8698 } 8684 }
8699} 8685}
8700 8686
@@ -10110,7 +10096,7 @@ will read just one key sequence. */)
10110 cancel_hourglass (); 10096 cancel_hourglass ();
10111#endif 10097#endif
10112 10098
10113 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), 10099 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])),
10114 prompt, ! NILP (dont_downcase_last), 10100 prompt, ! NILP (dont_downcase_last),
10115 ! NILP (can_return_switch_frame), 0); 10101 ! NILP (can_return_switch_frame), 0);
10116 10102
diff --git a/src/lisp.h b/src/lisp.h
index ca5fa6c3454..718c970006c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2953,10 +2953,8 @@ extern void clear_message (int, int);
2953extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); 2953extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
2954extern void message1 (const char *); 2954extern void message1 (const char *);
2955extern void message1_nolog (const char *); 2955extern void message1_nolog (const char *);
2956extern void message2 (const char *, ptrdiff_t, int); 2956extern void message3 (Lisp_Object);
2957extern void message2_nolog (const char *, ptrdiff_t, int); 2957extern void message3_nolog (Lisp_Object);
2958extern void message3 (Lisp_Object, ptrdiff_t, int);
2959extern void message3_nolog (Lisp_Object, ptrdiff_t, int);
2960extern void message_dolog (const char *, ptrdiff_t, int, int); 2958extern void message_dolog (const char *, ptrdiff_t, int, int);
2961extern void message_with_string (const char *, Lisp_Object, int); 2959extern void message_with_string (const char *, Lisp_Object, int);
2962extern void message_log_maybe_newline (void); 2960extern 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/w32term.c b/src/w32term.c
index 16c7bd415a5..0cb2effcda1 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5674,24 +5674,33 @@ w32fullscreen_hook (FRAME_PTR f)
5674 5674
5675 switch (f->want_fullscreen) 5675 switch (f->want_fullscreen)
5676 { 5676 {
5677 /* No difference between these two when there is no WM */
5678 case FULLSCREEN_MAXIMIZED: 5677 case FULLSCREEN_MAXIMIZED:
5679 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, 0xf030, 0); 5678 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
5680 break; 5679 break;
5681 case FULLSCREEN_BOTH: 5680 case FULLSCREEN_BOTH:
5682 height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) - 2; 5681 height =
5683 width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width); 5682 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
5683 - XINT (Ftool_bar_lines_needed (selected_frame))
5684 + (NILP (Vmenu_bar_mode) ? 1 : 0);
5685 width =
5686 FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
5687 - FRAME_SCROLL_BAR_COLS (f);
5684 left_pos = workarea_rect.left; 5688 left_pos = workarea_rect.left;
5685 top_pos = workarea_rect.top; 5689 top_pos = workarea_rect.top;
5686 break; 5690 break;
5687 case FULLSCREEN_WIDTH: 5691 case FULLSCREEN_WIDTH:
5688 width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width); 5692 width =
5693 FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
5694 - FRAME_SCROLL_BAR_COLS (f);
5689 if (normal_height > 0) 5695 if (normal_height > 0)
5690 height = normal_height; 5696 height = normal_height;
5691 left_pos = workarea_rect.left; 5697 left_pos = workarea_rect.left;
5692 break; 5698 break;
5693 case FULLSCREEN_HEIGHT: 5699 case FULLSCREEN_HEIGHT:
5694 height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) - 2; 5700 height =
5701 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
5702 - XINT (Ftool_bar_lines_needed (selected_frame))
5703 + (NILP (Vmenu_bar_mode) ? 1 : 0);
5695 if (normal_width > 0) 5704 if (normal_width > 0)
5696 width = normal_width; 5705 width = normal_width;
5697 top_pos = workarea_rect.top; 5706 top_pos = workarea_rect.top;
diff --git a/src/xdisp.c b/src/xdisp.c
index 12efe3c5396..c550a7db02c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -842,17 +842,17 @@ static void ensure_echo_area_buffers (void);
842static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); 842static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object);
843static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); 843static Lisp_Object with_echo_area_buffer_unwind_data (struct window *);
844static int with_echo_area_buffer (struct window *, int, 844static int with_echo_area_buffer (struct window *, int,
845 int (*) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), 845 int (*) (ptrdiff_t, Lisp_Object),
846 ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 846 ptrdiff_t, Lisp_Object);
847static void clear_garbaged_frames (void); 847static void clear_garbaged_frames (void);
848static int current_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 848static int current_message_1 (ptrdiff_t, Lisp_Object);
849static void pop_message (void); 849static void pop_message (void);
850static int truncate_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 850static int truncate_message_1 (ptrdiff_t, Lisp_Object);
851static void set_message (const char *, Lisp_Object, ptrdiff_t, int); 851static void set_message (Lisp_Object);
852static int set_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 852static int set_message_1 (ptrdiff_t, Lisp_Object);
853static int display_echo_area (struct window *); 853static int display_echo_area (struct window *);
854static int display_echo_area_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 854static int display_echo_area_1 (ptrdiff_t, Lisp_Object);
855static int resize_mini_window_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); 855static int resize_mini_window_1 (ptrdiff_t, Lisp_Object);
856static Lisp_Object unwind_redisplay (Lisp_Object); 856static Lisp_Object unwind_redisplay (Lisp_Object);
857static int string_char_and_length (const unsigned char *, int *); 857static int string_char_and_length (const unsigned char *, int *);
858static struct text_pos display_prop_end (struct it *, Lisp_Object, 858static struct text_pos display_prop_end (struct it *, Lisp_Object,
@@ -9621,7 +9621,7 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte)
9621 9621
9622 for (i = 0; i < len; i++) 9622 for (i = 0; i < len; i++)
9623 { 9623 {
9624 if (i >= 3 && p1[i-3] == '.' && p1[i-2] == '.' && p1[i-1] == '.') 9624 if (i >= 3 && p1[i - 3] == '.' && p1[i - 2] == '.' && p1[i - 1] == '.')
9625 seen_dots = 1; 9625 seen_dots = 1;
9626 if (p1[i] != p2[i]) 9626 if (p1[i] != p2[i])
9627 return seen_dots; 9627 return seen_dots;
@@ -9634,88 +9634,13 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte)
9634 char *pend; 9634 char *pend;
9635 intmax_t n = strtoimax ((char *) p1, &pend, 10); 9635 intmax_t n = strtoimax ((char *) p1, &pend, 10);
9636 if (0 < n && n < INTMAX_MAX && strncmp (pend, " times]\n", 8) == 0) 9636 if (0 < n && n < INTMAX_MAX && strncmp (pend, " times]\n", 8) == 0)
9637 return n+1; 9637 return n + 1;
9638 } 9638 }
9639 return 0; 9639 return 0;
9640} 9640}
9641 9641
9642 9642
9643/* Display an echo area message M with a specified length of NBYTES 9643/* Display an echo area message M with a specified length of NBYTES
9644 bytes. The string may include null characters. If M is 0, clear
9645 out any existing message, and let the mini-buffer text show
9646 through.
9647
9648 This may GC, so the buffer M must NOT point to a Lisp string. */
9649
9650void
9651message2 (const char *m, ptrdiff_t nbytes, int multibyte)
9652{
9653 /* First flush out any partial line written with print. */
9654 message_log_maybe_newline ();
9655 if (m)
9656 message_dolog (m, nbytes, 1, multibyte);
9657 message2_nolog (m, nbytes, multibyte);
9658}
9659
9660
9661/* The non-logging counterpart of message2. */
9662
9663void
9664message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
9665{
9666 struct frame *sf = SELECTED_FRAME ();
9667 message_enable_multibyte = multibyte;
9668
9669 if (FRAME_INITIAL_P (sf))
9670 {
9671 if (noninteractive_need_newline)
9672 putc ('\n', stderr);
9673 noninteractive_need_newline = 0;
9674 if (m)
9675 fwrite (m, nbytes, 1, stderr);
9676 if (cursor_in_echo_area == 0)
9677 fprintf (stderr, "\n");
9678 fflush (stderr);
9679 }
9680 /* A null message buffer means that the frame hasn't really been
9681 initialized yet. Error messages get reported properly by
9682 cmd_error, so this must be just an informative message; toss it. */
9683 else if (INTERACTIVE
9684 && sf->glyphs_initialized_p
9685 && FRAME_MESSAGE_BUF (sf))
9686 {
9687 Lisp_Object mini_window;
9688 struct frame *f;
9689
9690 /* Get the frame containing the mini-buffer
9691 that the selected frame is using. */
9692 mini_window = FRAME_MINIBUF_WINDOW (sf);
9693 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
9694
9695 FRAME_SAMPLE_VISIBILITY (f);
9696 if (FRAME_VISIBLE_P (sf)
9697 && ! FRAME_VISIBLE_P (f))
9698 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (mini_window)));
9699
9700 if (m)
9701 {
9702 set_message (m, Qnil, nbytes, multibyte);
9703 if (minibuffer_auto_raise)
9704 Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window)));
9705 }
9706 else
9707 clear_message (1, 1);
9708
9709 do_pending_window_change (0);
9710 echo_area_display (1);
9711 do_pending_window_change (0);
9712 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
9713 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
9714 }
9715}
9716
9717
9718/* Display an echo area message M with a specified length of NBYTES
9719 bytes. The string may include null characters. If M is not a 9644 bytes. The string may include null characters. If M is not a
9720 string, clear out any existing message, and let the mini-buffer 9645 string, clear out any existing message, and let the mini-buffer
9721 text show through. 9646 text show through.
@@ -9723,7 +9648,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
9723 This function cancels echoing. */ 9648 This function cancels echoing. */
9724 9649
9725void 9650void
9726message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte) 9651message3 (Lisp_Object m)
9727{ 9652{
9728 struct gcpro gcpro1; 9653 struct gcpro gcpro1;
9729 9654
@@ -9735,13 +9660,15 @@ message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9735 message_log_maybe_newline (); 9660 message_log_maybe_newline ();
9736 if (STRINGP (m)) 9661 if (STRINGP (m))
9737 { 9662 {
9663 ptrdiff_t nbytes = SBYTES (m);
9664 int multibyte = STRING_MULTIBYTE (m);
9738 USE_SAFE_ALLOCA; 9665 USE_SAFE_ALLOCA;
9739 char *buffer = SAFE_ALLOCA (nbytes); 9666 char *buffer = SAFE_ALLOCA (nbytes);
9740 memcpy (buffer, SDATA (m), nbytes); 9667 memcpy (buffer, SDATA (m), nbytes);
9741 message_dolog (buffer, nbytes, 1, multibyte); 9668 message_dolog (buffer, nbytes, 1, multibyte);
9742 SAFE_FREE (); 9669 SAFE_FREE ();
9743 } 9670 }
9744 message3_nolog (m, nbytes, multibyte); 9671 message3_nolog (m);
9745 9672
9746 UNGCPRO; 9673 UNGCPRO;
9747} 9674}
@@ -9753,10 +9680,9 @@ message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9753 and make this cancel echoing. */ 9680 and make this cancel echoing. */
9754 9681
9755void 9682void
9756message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) 9683message3_nolog (Lisp_Object m)
9757{ 9684{
9758 struct frame *sf = SELECTED_FRAME (); 9685 struct frame *sf = SELECTED_FRAME ();
9759 message_enable_multibyte = multibyte;
9760 9686
9761 if (FRAME_INITIAL_P (sf)) 9687 if (FRAME_INITIAL_P (sf))
9762 { 9688 {
@@ -9764,27 +9690,22 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9764 putc ('\n', stderr); 9690 putc ('\n', stderr);
9765 noninteractive_need_newline = 0; 9691 noninteractive_need_newline = 0;
9766 if (STRINGP (m)) 9692 if (STRINGP (m))
9767 fwrite (SDATA (m), nbytes, 1, stderr); 9693 fwrite (SDATA (m), SBYTES (m), 1, stderr);
9768 if (cursor_in_echo_area == 0) 9694 if (cursor_in_echo_area == 0)
9769 fprintf (stderr, "\n"); 9695 fprintf (stderr, "\n");
9770 fflush (stderr); 9696 fflush (stderr);
9771 } 9697 }
9772 /* A null message buffer means that the frame hasn't really been 9698 /* Error messages get reported properly by cmd_error, so this must be just an
9773 initialized yet. Error messages get reported properly by 9699 informative message; if the frame hasn't really been initialized yet, just
9774 cmd_error, so this must be just an informative message; toss it. */ 9700 toss it. */
9775 else if (INTERACTIVE 9701 else if (INTERACTIVE
9776 && sf->glyphs_initialized_p 9702 && sf->glyphs_initialized_p)
9777 && FRAME_MESSAGE_BUF (sf))
9778 { 9703 {
9779 Lisp_Object mini_window;
9780 Lisp_Object frame;
9781 struct frame *f;
9782
9783 /* Get the frame containing the mini-buffer 9704 /* Get the frame containing the mini-buffer
9784 that the selected frame is using. */ 9705 that the selected frame is using. */
9785 mini_window = FRAME_MINIBUF_WINDOW (sf); 9706 Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
9786 frame = XWINDOW (mini_window)->frame; 9707 Lisp_Object frame = XWINDOW (mini_window)->frame;
9787 f = XFRAME (frame); 9708 struct frame *f = XFRAME (frame);
9788 9709
9789 FRAME_SAMPLE_VISIBILITY (f); 9710 FRAME_SAMPLE_VISIBILITY (f);
9790 if (FRAME_VISIBLE_P (sf) 9711 if (FRAME_VISIBLE_P (sf)
@@ -9793,7 +9714,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9793 9714
9794 if (STRINGP (m) && SCHARS (m) > 0) 9715 if (STRINGP (m) && SCHARS (m) > 0)
9795 { 9716 {
9796 set_message (NULL, m, nbytes, multibyte); 9717 set_message (m);
9797 if (minibuffer_auto_raise) 9718 if (minibuffer_auto_raise)
9798 Fraise_frame (frame); 9719 Fraise_frame (frame);
9799 /* Assume we are not echoing. 9720 /* Assume we are not echoing.
@@ -9823,7 +9744,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9823void 9744void
9824message1 (const char *m) 9745message1 (const char *m)
9825{ 9746{
9826 message2 (m, (m ? strlen (m) : 0), 0); 9747 message3 (m ? make_unibyte_string (m, strlen (m)) : Qnil);
9827} 9748}
9828 9749
9829 9750
@@ -9832,7 +9753,7 @@ message1 (const char *m)
9832void 9753void
9833message1_nolog (const char *m) 9754message1_nolog (const char *m)
9834{ 9755{
9835 message2_nolog (m, (m ? strlen (m) : 0), 0); 9756 message3_nolog (m ? make_unibyte_string (m, strlen (m)) : Qnil);
9836} 9757}
9837 9758
9838/* Display a message M which contains a single %s 9759/* Display a message M which contains a single %s
@@ -9869,10 +9790,10 @@ message_with_string (const char *m, Lisp_Object string, int log)
9869 mini_window = FRAME_MINIBUF_WINDOW (sf); 9790 mini_window = FRAME_MINIBUF_WINDOW (sf);
9870 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); 9791 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
9871 9792
9872 /* A null message buffer means that the frame hasn't really been 9793 /* Error messages get reported properly by cmd_error, so this must be
9873 initialized yet. Error messages get reported properly by 9794 just an informative message; if the frame hasn't really been
9874 cmd_error, so this must be just an informative message; toss it. */ 9795 initialized yet, just toss it. */
9875 if (FRAME_MESSAGE_BUF (f)) 9796 if (f->glyphs_initialized_p)
9876 { 9797 {
9877 Lisp_Object args[2], msg; 9798 Lisp_Object args[2], msg;
9878 struct gcpro gcpro1, gcpro2; 9799 struct gcpro gcpro1, gcpro2;
@@ -9885,9 +9806,9 @@ message_with_string (const char *m, Lisp_Object string, int log)
9885 msg = Fformat (2, args); 9806 msg = Fformat (2, args);
9886 9807
9887 if (log) 9808 if (log)
9888 message3 (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); 9809 message3 (msg);
9889 else 9810 else
9890 message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); 9811 message3_nolog (msg);
9891 9812
9892 UNGCPRO; 9813 UNGCPRO;
9893 9814
@@ -9931,20 +9852,20 @@ vmessage (const char *m, va_list ap)
9931 mini_window = FRAME_MINIBUF_WINDOW (sf); 9852 mini_window = FRAME_MINIBUF_WINDOW (sf);
9932 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); 9853 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
9933 9854
9934 /* A null message buffer means that the frame hasn't really been 9855 /* Error messages get reported properly by cmd_error, so this must be
9935 initialized yet. Error messages get reported properly by 9856 just an informative message; if the frame hasn't really been
9936 cmd_error, so this must be just an informative message; toss 9857 initialized yet, just toss it. */
9937 it. */ 9858 if (f->glyphs_initialized_p)
9938 if (FRAME_MESSAGE_BUF (f))
9939 { 9859 {
9940 if (m) 9860 if (m)
9941 { 9861 {
9942 ptrdiff_t len; 9862 ptrdiff_t len;
9863 ptrdiff_t maxsize = FRAME_MESSAGE_BUF_SIZE (f);
9864 char *message_buf = alloca (maxsize + 1);
9943 9865
9944 len = doprnt (FRAME_MESSAGE_BUF (f), 9866 len = doprnt (message_buf, maxsize, m, (char *)0, ap);
9945 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
9946 9867
9947 message2 (FRAME_MESSAGE_BUF (f), len, 1); 9868 message3 (make_string (message_buf, len));
9948 } 9869 }
9949 else 9870 else
9950 message1 (0); 9871 message1 (0);
@@ -9995,8 +9916,7 @@ update_echo_area (void)
9995 { 9916 {
9996 Lisp_Object string; 9917 Lisp_Object string;
9997 string = Fcurrent_message (); 9918 string = Fcurrent_message ();
9998 message3 (string, SBYTES (string), 9919 message3 (string);
9999 !NILP (BVAR (current_buffer, enable_multibyte_characters)));
10000 } 9920 }
10001} 9921}
10002 9922
@@ -10032,7 +9952,7 @@ ensure_echo_area_buffers (void)
10032} 9952}
10033 9953
10034 9954
10035/* Call FN with args A1..A4 with either the current or last displayed 9955/* Call FN with args A1..A2 with either the current or last displayed
10036 echo_area_buffer as current buffer. 9956 echo_area_buffer as current buffer.
10037 9957
10038 WHICH zero means use the current message buffer 9958 WHICH zero means use the current message buffer
@@ -10050,8 +9970,8 @@ ensure_echo_area_buffers (void)
10050 9970
10051static int 9971static int
10052with_echo_area_buffer (struct window *w, int which, 9972with_echo_area_buffer (struct window *w, int which,
10053 int (*fn) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), 9973 int (*fn) (ptrdiff_t, Lisp_Object),
10054 ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) 9974 ptrdiff_t a1, Lisp_Object a2)
10055{ 9975{
10056 Lisp_Object buffer; 9976 Lisp_Object buffer;
10057 int this_one, the_other, clear_buffer_p, rc; 9977 int this_one, the_other, clear_buffer_p, rc;
@@ -10124,7 +10044,7 @@ with_echo_area_buffer (struct window *w, int which,
10124 eassert (BEGV >= BEG); 10044 eassert (BEGV >= BEG);
10125 eassert (ZV <= Z && ZV >= BEGV); 10045 eassert (ZV <= Z && ZV >= BEGV);
10126 10046
10127 rc = fn (a1, a2, a3, a4); 10047 rc = fn (a1, a2);
10128 10048
10129 eassert (BEGV >= BEG); 10049 eassert (BEGV >= BEG);
10130 eassert (ZV <= Z && ZV >= BEGV); 10050 eassert (ZV <= Z && ZV >= BEGV);
@@ -10303,7 +10223,7 @@ display_echo_area (struct window *w)
10303 window_height_changed_p 10223 window_height_changed_p
10304 = with_echo_area_buffer (w, display_last_displayed_message_p, 10224 = with_echo_area_buffer (w, display_last_displayed_message_p,
10305 display_echo_area_1, 10225 display_echo_area_1,
10306 (intptr_t) w, Qnil, 0, 0); 10226 (intptr_t) w, Qnil);
10307 10227
10308 if (no_message_p) 10228 if (no_message_p)
10309 echo_area_buffer[i] = Qnil; 10229 echo_area_buffer[i] = Qnil;
@@ -10320,7 +10240,7 @@ display_echo_area (struct window *w)
10320 Value is non-zero if height of W was changed. */ 10240 Value is non-zero if height of W was changed. */
10321 10241
10322static int 10242static int
10323display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) 10243display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2)
10324{ 10244{
10325 intptr_t i1 = a1; 10245 intptr_t i1 = a1;
10326 struct window *w = (struct window *) i1; 10246 struct window *w = (struct window *) i1;
@@ -10365,8 +10285,7 @@ resize_echo_area_exactly (void)
10365 resize_exactly = Qnil; 10285 resize_exactly = Qnil;
10366 10286
10367 resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, 10287 resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1,
10368 (intptr_t) w, resize_exactly, 10288 (intptr_t) w, resize_exactly);
10369 0, 0);
10370 if (resized_p) 10289 if (resized_p)
10371 { 10290 {
10372 ++windows_or_buffers_changed; 10291 ++windows_or_buffers_changed;
@@ -10384,7 +10303,7 @@ resize_echo_area_exactly (void)
10384 resize_mini_window returns. */ 10303 resize_mini_window returns. */
10385 10304
10386static int 10305static int
10387resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t a4) 10306resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly)
10388{ 10307{
10389 intptr_t i1 = a1; 10308 intptr_t i1 = a1;
10390 return resize_mini_window ((struct window *) i1, !NILP (exactly)); 10309 return resize_mini_window ((struct window *) i1, !NILP (exactly));
@@ -10553,7 +10472,7 @@ current_message (void)
10553 else 10472 else
10554 { 10473 {
10555 with_echo_area_buffer (0, 0, current_message_1, 10474 with_echo_area_buffer (0, 0, current_message_1,
10556 (intptr_t) &msg, Qnil, 0, 0); 10475 (intptr_t) &msg, Qnil);
10557 if (NILP (msg)) 10476 if (NILP (msg))
10558 echo_area_buffer[0] = Qnil; 10477 echo_area_buffer[0] = Qnil;
10559 } 10478 }
@@ -10563,7 +10482,7 @@ current_message (void)
10563 10482
10564 10483
10565static int 10484static int
10566current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) 10485current_message_1 (ptrdiff_t a1, Lisp_Object a2)
10567{ 10486{
10568 intptr_t i1 = a1; 10487 intptr_t i1 = a1;
10569 Lisp_Object *msg = (Lisp_Object *) i1; 10488 Lisp_Object *msg = (Lisp_Object *) i1;
@@ -10595,14 +10514,8 @@ push_message (void)
10595void 10514void
10596restore_message (void) 10515restore_message (void)
10597{ 10516{
10598 Lisp_Object msg;
10599
10600 eassert (CONSP (Vmessage_stack)); 10517 eassert (CONSP (Vmessage_stack));
10601 msg = XCAR (Vmessage_stack); 10518 message3_nolog (XCAR (Vmessage_stack));
10602 if (STRINGP (msg))
10603 message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg));
10604 else
10605 message3_nolog (msg, 0, 0);
10606} 10519}
10607 10520
10608 10521
@@ -10645,16 +10558,16 @@ truncate_echo_area (ptrdiff_t nchars)
10645{ 10558{
10646 if (nchars == 0) 10559 if (nchars == 0)
10647 echo_area_buffer[0] = Qnil; 10560 echo_area_buffer[0] = Qnil;
10648 /* A null message buffer means that the frame hasn't really been
10649 initialized yet. Error messages get reported properly by
10650 cmd_error, so this must be just an informative message; toss it. */
10651 else if (!noninteractive 10561 else if (!noninteractive
10652 && INTERACTIVE 10562 && INTERACTIVE
10653 && !NILP (echo_area_buffer[0])) 10563 && !NILP (echo_area_buffer[0]))
10654 { 10564 {
10655 struct frame *sf = SELECTED_FRAME (); 10565 struct frame *sf = SELECTED_FRAME ();
10656 if (FRAME_MESSAGE_BUF (sf)) 10566 /* Error messages get reported properly by cmd_error, so this must be
10657 with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil, 0, 0); 10567 just an informative message; if the frame hasn't really been
10568 initialized yet, just toss it. */
10569 if (sf->glyphs_initialized_p)
10570 with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil);
10658 } 10571 }
10659} 10572}
10660 10573
@@ -10663,7 +10576,7 @@ truncate_echo_area (ptrdiff_t nchars)
10663 message to at most NCHARS characters. */ 10576 message to at most NCHARS characters. */
10664 10577
10665static int 10578static int
10666truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) 10579truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2)
10667{ 10580{
10668 if (BEG + nchars < Z) 10581 if (BEG + nchars < Z)
10669 del_range (BEG + nchars, Z); 10582 del_range (BEG + nchars, Z);
@@ -10672,30 +10585,16 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4
10672 return 0; 10585 return 0;
10673} 10586}
10674 10587
10675/* Set the current message to a substring of S or STRING. 10588/* Set the current message to STRING. */
10676
10677 If STRING is a Lisp string, set the message to the first NBYTES
10678 bytes from STRING. NBYTES zero means use the whole string. If
10679 STRING is multibyte, the message will be displayed multibyte.
10680
10681 If S is not null, set the message to the first LEN bytes of S. LEN
10682 zero means use the whole string. MULTIBYTE_P non-zero means S is
10683 multibyte. Display the message multibyte in that case.
10684
10685 Doesn't GC, as with_echo_area_buffer binds Qinhibit_modification_hooks
10686 to t before calling set_message_1 (which calls insert).
10687 */
10688 10589
10689static void 10590static void
10690set_message (const char *s, Lisp_Object string, 10591set_message (Lisp_Object string)
10691 ptrdiff_t nbytes, int multibyte_p)
10692{ 10592{
10693 message_enable_multibyte 10593 eassert (STRINGP (string));
10694 = ((s && multibyte_p)
10695 || (STRINGP (string) && STRING_MULTIBYTE (string)));
10696 10594
10697 with_echo_area_buffer (0, -1, set_message_1, 10595 message_enable_multibyte = STRING_MULTIBYTE (string);
10698 (intptr_t) s, string, nbytes, multibyte_p); 10596
10597 with_echo_area_buffer (0, -1, set_message_1, 0, string);
10699 message_buf_print = 0; 10598 message_buf_print = 0;
10700 help_echo_showing_p = 0; 10599 help_echo_showing_p = 0;
10701 10600
@@ -10705,18 +10604,14 @@ set_message (const char *s, Lisp_Object string,
10705} 10604}
10706 10605
10707 10606
10708/* Helper function for set_message. Arguments have the same meaning 10607/* Helper function for set_message. First argument is ignored and second
10709 as there, with A1 corresponding to S and A2 corresponding to STRING 10608 argument has the same meaning as for set_message.
10710 This function is called with the echo area buffer being 10609 This function is called with the echo area buffer being current. */
10711 current. */
10712 10610
10713static int 10611static int
10714set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multibyte_p) 10612set_message_1 (ptrdiff_t a1, Lisp_Object string)
10715{ 10613{
10716 intptr_t i1 = a1; 10614 eassert (STRINGP (string));
10717 const char *s = (const char *) i1;
10718 const unsigned char *msg = (const unsigned char *) s;
10719 Lisp_Object string = a2;
10720 10615
10721 /* Change multibyteness of the echo buffer appropriately. */ 10616 /* Change multibyteness of the echo buffer appropriately. */
10722 if (message_enable_multibyte 10617 if (message_enable_multibyte
@@ -10730,61 +10625,10 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby
10730 /* Insert new message at BEG. */ 10625 /* Insert new message at BEG. */
10731 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 10626 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
10732 10627
10733 if (STRINGP (string)) 10628 /* This function takes care of single/multibyte conversion.
10734 { 10629 We just have to ensure that the echo area buffer has the right
10735 ptrdiff_t nchars; 10630 setting of enable_multibyte_characters. */
10736 10631 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 1);
10737 if (nbytes == 0)
10738 nbytes = SBYTES (string);
10739 nchars = string_byte_to_char (string, nbytes);
10740
10741 /* This function takes care of single/multibyte conversion. We
10742 just have to ensure that the echo area buffer has the right
10743 setting of enable_multibyte_characters. */
10744 insert_from_string (string, 0, 0, nchars, nbytes, 1);
10745 }
10746 else if (s)
10747 {
10748 if (nbytes == 0)
10749 nbytes = strlen (s);
10750
10751 if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters)))
10752 {
10753 /* Convert from multi-byte to single-byte. */
10754 ptrdiff_t i;
10755 int c, n;
10756 char work[1];
10757
10758 /* Convert a multibyte string to single-byte. */
10759 for (i = 0; i < nbytes; i += n)
10760 {
10761 c = string_char_and_length (msg + i, &n);
10762 work[0] = (ASCII_CHAR_P (c)
10763 ? c
10764 : multibyte_char_to_unibyte (c));
10765 insert_1_both (work, 1, 1, 1, 0, 0);
10766 }
10767 }
10768 else if (!multibyte_p
10769 && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
10770 {
10771 /* Convert from single-byte to multi-byte. */
10772 ptrdiff_t i;
10773 int c, n;
10774 unsigned char str[MAX_MULTIBYTE_LENGTH];
10775
10776 /* Convert a single-byte string to multibyte. */
10777 for (i = 0; i < nbytes; i++)
10778 {
10779 c = msg[i];
10780 MAKE_CHAR_MULTIBYTE (c);
10781 n = CHAR_STRING (c, str);
10782 insert_1_both ((char *) str, 1, n, 1, 0, 0);
10783 }
10784 }
10785 else
10786 insert_1 (s, nbytes, 1, 0, 0);
10787 }
10788 10632
10789 return 0; 10633 return 0;
10790} 10634}