aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-03-03 07:48:46 +0000
committerMiles Bader2006-03-03 07:48:46 +0000
commitd2ad6275c8b11d33d6bbfa9359420d534aa641bc (patch)
tree5cf31f082f04af6e24b8d6907583ce257ec2d5ea /src
parentb2ed9e82ab8f37303692290f4e0d03ea61ee13f5 (diff)
parent719120eff4b070687d146d70133f5f73cc8fe5c4 (diff)
downloademacs-d2ad6275c8b11d33d6bbfa9359420d534aa641bc.tar.gz
emacs-d2ad6275c8b11d33d6bbfa9359420d534aa641bc.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-34
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 123-134) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 40-48) - Merge from emacs--devo--0 - Update from CVS - Munge arch explicit ids in etc/images to match Emacs
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog83
-rw-r--r--src/eval.c2
-rw-r--r--src/frame.h1
-rw-r--r--src/lisp.h9
-rw-r--r--src/lread.c87
-rw-r--r--src/search.c2
-rw-r--r--src/w32.c2
-rw-r--r--src/window.c43
-rw-r--r--src/xdisp.c99
-rw-r--r--src/xfns.c6
-rw-r--r--src/xselect.c45
-rw-r--r--src/xterm.c27
-rw-r--r--src/xterm.h4
13 files changed, 320 insertions, 90 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4176e2f29c8..6edf4d43587 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,8 +1,87 @@
12006-03-02 Kim F. Storm <storm@cua.dk>
2
3 * frame.h (struct frame): New member n_tool_bar_rows.
4
5 * xdisp.c: Minimize the unpleasent visual impact of the requirement
6 that non-toolkit tool-bars must occupy an integral number of screen
7 lines, by distributing the rows evenly over the tool-bar screen area.
8 (Vtool_bar_border): New variable.
9 (syms_of_xdisp): DEFVAR_LISP it.
10 (display_tool_bar_line): Add HEIGHT arg for desired row height. Make
11 tool-bar row the desired height. Use default face for border below
12 tool-bar.
13 (tool_bar_lines_needed): Add N_ROWS arg. Use it to return number of
14 actual tool-bar rows.
15 (redisplay_tool_bar): Calculate f->n_tool_bar_rows initially.
16 Adjust the height of the tool-bar rows to fill tool-bar screen area.
17 (redisplay_tool_bar): Calculate f->n_tool_bar_rows when tool-bar area
18 is resized.
19
202006-03-01 Luc Teirlinck <teirllm@auburn.edu>
21
22 * search.c (Fregexp_quote): Do not precede a literal `]' with two
23 backslashes to try to make clear that it has a literal meaning; it
24 does not do that. (It could close a character alternative
25 containing a backslash.)
26
272006-02-28 Chong Yidong <cyd@stupidchicken.com>
28
29 * xselect.c (x_catch_errors_unwind): New function.
30 (x_reply_selection_request): Put x_uncatch_errors in an unwind.
31 (Fx_get_atom_name): Call x_uncatch_errors earlier.
32
33 * window.c (Qscroll_up, Qscroll_down): New syms.
34 (window_scroll_pixel_based): Make preserve_y static to avoid
35 getting point stuck when scrolling 1 line.
36
372006-02-26 Chong Yidong <cyd@stupidchicken.com>
38
39 * xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary
40 argument.
41
42 * xterm.c: (x_load_font, x_term_init, XTmouse_position)
43 (handle_one_xevent, x_connection_closed, x_list_fonts): No arg for
44 x_uncatch_errors.
45
46 * xselect.c (x_own_selection, x_decline_selection_request)
47 (x_reply_selection_request, x_get_foreign_selection)
48 (Fx_get_atom_name, Fx_send_client_event): Likewise.
49
50 * xfns.c (x_real_positions, x_set_mouse_color, Fx_focus_frame):
51 Likewise.
52
532006-02-26 Luc Teirlinck <teirllm@auburn.edu>
54
55 * lread.c: Declare Vload_file_rep_suffixes instead of
56 deleted variable default_suffixes.
57 (Fget_load_suffixes): New function.
58 (Fload): Use Fget_load_suffixes and Vload_file_rep_suffixes.
59 No longer use deleted variable default_suffixes. Update docstring.
60 (syms_of_lread): defsubr Sget_load_suffixes.
61 Expand `load-suffixes' docstring.
62 Delete default_suffixes and DEFVAR_LISP the new variable
63 `load-file-rep-suffixes'.
64
65 * w32.c (check_windows_init_file): Use Fget_load_suffixes instead
66 of Vload_suffixes.
67
68 * lisp.h: EXFUN Fget_load_suffixes.
69 Extern Vload_file_rep_suffixes.
70
71 * eval.c (specpdl_ptr): Remove volatile qualifier for consistency
72 with lisp.h.
73
742006-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
75
76 * lisp.h (struct specbinding, specpdl_ptr): Remove the volatile
77 qualifier which was trying to avoid the bug that was fixed by
78 yesterday's changes to xterm.c.
79
12006-02-25 Chong Yidong <cyd@stupidchicken.com> 802006-02-25 Chong Yidong <cyd@stupidchicken.com>
2 81
3 * xterm.h (x_catch_errors) Return value changed to void. 82 * xterm.h (x_catch_errors) Return value changed to void.
4 (x_uncatch_errors): Unused count argument deleted. 83 (x_uncatch_errors): Delete unused count argument.
5 84
6 * xterm.c (x_catch_errors): Don't use record_unwind_protect, since 85 * xterm.c (x_catch_errors): Don't use record_unwind_protect, since
7 it can be called in a signal handler. 86 it can be called in a signal handler.
8 (x_catch_errors_unwind): Function deleted. 87 (x_catch_errors_unwind): Function deleted.
diff --git a/src/eval.c b/src/eval.c
index 06d53c907b4..a84948981f4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -117,7 +117,7 @@ struct specbinding *specpdl;
117 117
118/* Pointer to first unused element in specpdl. */ 118/* Pointer to first unused element in specpdl. */
119 119
120volatile struct specbinding *specpdl_ptr; 120struct specbinding *specpdl_ptr;
121 121
122/* Maximum size allowed for specpdl allocation */ 122/* Maximum size allowed for specpdl allocation */
123 123
diff --git a/src/frame.h b/src/frame.h
index 51530ee2dbf..a77e49ace73 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -222,6 +222,7 @@ struct frame
222 /* Margin at the top of the frame. Used to display the tool-bar. */ 222 /* Margin at the top of the frame. Used to display the tool-bar. */
223 int tool_bar_lines; 223 int tool_bar_lines;
224 224
225 int n_tool_bar_rows;
225 int n_tool_bar_items; 226 int n_tool_bar_items;
226 227
227 /* A buffer for decode_mode_line. */ 228 /* A buffer for decode_mode_line. */
diff --git a/src/lisp.h b/src/lisp.h
index 9cec643a078..d13400b8050 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1754,13 +1754,13 @@ typedef Lisp_Object (*specbinding_func) P_ ((Lisp_Object));
1754 1754
1755struct specbinding 1755struct specbinding
1756 { 1756 {
1757 volatile Lisp_Object symbol, old_value; 1757 Lisp_Object symbol, old_value;
1758 volatile specbinding_func func; 1758 specbinding_func func;
1759 Lisp_Object unused; /* Dividing by 16 is faster than by 12 */ 1759 Lisp_Object unused; /* Dividing by 16 is faster than by 12 */
1760 }; 1760 };
1761 1761
1762extern struct specbinding *specpdl; 1762extern struct specbinding *specpdl;
1763extern volatile struct specbinding *specpdl_ptr; 1763extern struct specbinding *specpdl_ptr;
1764extern int specpdl_size; 1764extern int specpdl_size;
1765 1765
1766extern EMACS_INT max_specpdl_size; 1766extern EMACS_INT max_specpdl_size;
@@ -2638,6 +2638,7 @@ EXFUN (Fread_from_string, 3);
2638EXFUN (Fintern, 2); 2638EXFUN (Fintern, 2);
2639EXFUN (Fintern_soft, 2); 2639EXFUN (Fintern_soft, 2);
2640EXFUN (Fload, 5); 2640EXFUN (Fload, 5);
2641EXFUN (Fget_load_suffixes, 0);
2641EXFUN (Fget_file_char, 0); 2642EXFUN (Fget_file_char, 0);
2642EXFUN (Fread_char, 2); 2643EXFUN (Fread_char, 2);
2643EXFUN (Fread_event, 2); 2644EXFUN (Fread_event, 2);
@@ -2649,7 +2650,7 @@ extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
2649#define LOADHIST_ATTACH(x) \ 2650#define LOADHIST_ATTACH(x) \
2650 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list) 2651 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
2651extern Lisp_Object Vcurrent_load_list; 2652extern Lisp_Object Vcurrent_load_list;
2652extern Lisp_Object Vload_history, Vload_suffixes; 2653extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
2653extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object, 2654extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
2654 Lisp_Object *, Lisp_Object)); 2655 Lisp_Object *, Lisp_Object));
2655extern int isfloat_string P_ ((char *)); 2656extern int isfloat_string P_ ((char *));
diff --git a/src/lread.c b/src/lread.c
index ef45f4663ea..e2f9d81d059 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -106,7 +106,7 @@ int load_in_progress;
106Lisp_Object Vsource_directory; 106Lisp_Object Vsource_directory;
107 107
108/* Search path and suffixes for files to be loaded. */ 108/* Search path and suffixes for files to be loaded. */
109Lisp_Object Vload_path, Vload_suffixes, default_suffixes; 109Lisp_Object Vload_path, Vload_suffixes, Vload_file_rep_suffixes;
110 110
111/* File name of user's init file. */ 111/* File name of user's init file. */
112Lisp_Object Vuser_init_file; 112Lisp_Object Vuser_init_file;
@@ -832,28 +832,64 @@ load_error_handler (data)
832 return Qnil; 832 return Qnil;
833} 833}
834 834
835DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
836 doc: /* Return the suffixes that `load' should try if a suffix is \
837required.
838This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */)
839 ()
840{
841 Lisp_Object lst = Qnil, suffixes = Vload_suffixes, suffix, ext;
842 while (CONSP (suffixes))
843 {
844 Lisp_Object exts = Vload_file_rep_suffixes;
845 suffix = XCAR (suffixes);
846 suffixes = XCDR (suffixes);
847 while (CONSP (exts))
848 {
849 ext = XCAR (exts);
850 exts = XCDR (exts);
851 lst = Fcons (concat2 (suffix, ext), lst);
852 }
853 }
854 return Fnreverse (lst);
855}
856
835DEFUN ("load", Fload, Sload, 1, 5, 0, 857DEFUN ("load", Fload, Sload, 1, 5, 0,
836 doc: /* Execute a file of Lisp code named FILE. 858 doc: /* Execute a file of Lisp code named FILE.
837First try FILE with `.elc' appended, then try with `.el', 859First try FILE with `.elc' appended, then try with `.el',
838 then try FILE unmodified (the exact suffixes are determined by 860then try FILE unmodified (the exact suffixes in the exact order are
839`load-suffixes'). Environment variable references in FILE 861determined by `load-suffixes'). Environment variable references in
840 are replaced with their values by calling `substitute-in-file-name'. 862FILE are replaced with their values by calling `substitute-in-file-name'.
841This function searches the directories in `load-path'. 863This function searches the directories in `load-path'.
864
842If optional second arg NOERROR is non-nil, 865If optional second arg NOERROR is non-nil,
843 report no error if FILE doesn't exist. 866report no error if FILE doesn't exist.
844Print messages at start and end of loading unless 867Print messages at start and end of loading unless
845 optional third arg NOMESSAGE is non-nil. 868optional third arg NOMESSAGE is non-nil.
846If optional fourth arg NOSUFFIX is non-nil, don't try adding 869If optional fourth arg NOSUFFIX is non-nil, don't try adding
847 suffixes `.elc' or `.el' to the specified name FILE. 870suffixes `.elc' or `.el' to the specified name FILE.
848If optional fifth arg MUST-SUFFIX is non-nil, insist on 871If optional fifth arg MUST-SUFFIX is non-nil, insist on
849 the suffix `.elc' or `.el'; don't accept just FILE unless 872the suffix `.elc' or `.el'; don't accept just FILE unless
850 it ends in one of those suffixes or includes a directory name. 873it ends in one of those suffixes or includes a directory name.
874
875If this function fails to find a file, it may look for different
876representations of that file before trying another file.
877It does so by adding the non-empty suffixes in `load-file-rep-suffixes'
878to the file name. Emacs uses this feature mainly to find compressed
879versions of files when Auto Compression mode is enabled.
880
881The exact suffixes that this function tries out, in the exact order,
882are given by the value of the variable `load-file-rep-suffixes' if
883NOSUFFIX is non-nil and by the return value of the function
884`get-load-suffixes' if MUST-SUFFIX is non-nil. If both NOSUFFIX and
885MUST-SUFFIX are nil, this function first tries out the latter suffixes
886and then the former.
851 887
852Loading a file records its definitions, and its `provide' and 888Loading a file records its definitions, and its `provide' and
853`require' calls, in an element of `load-history' whose 889`require' calls, in an element of `load-history' whose
854car is the file name loaded. See `load-history'. 890car is the file name loaded. See `load-history'.
855 891
856Return t if file exists. */) 892Return t if the file exists and loads successfully. */)
857 (file, noerror, nomessage, nosuffix, must_suffix) 893 (file, noerror, nomessage, nosuffix, must_suffix)
858 Lisp_Object file, noerror, nomessage, nosuffix, must_suffix; 894 Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
859{ 895{
@@ -930,9 +966,9 @@ Return t if file exists. */)
930 966
931 fd = openp (Vload_path, file, 967 fd = openp (Vload_path, file,
932 (!NILP (nosuffix) ? Qnil 968 (!NILP (nosuffix) ? Qnil
933 : !NILP (must_suffix) ? Vload_suffixes 969 : !NILP (must_suffix) ? Fget_load_suffixes ()
934 : Fappend (2, (tmp[0] = Vload_suffixes, 970 : Fappend (2, (tmp[0] = Fget_load_suffixes (),
935 tmp[1] = default_suffixes, 971 tmp[1] = Vload_file_rep_suffixes,
936 tmp))), 972 tmp))),
937 &found, Qnil); 973 &found, Qnil);
938 UNGCPRO; 974 UNGCPRO;
@@ -1303,7 +1339,7 @@ openp (path, str, suffixes, storeptr, predicate)
1303 fn = (char *) alloca (fn_size = 100 + want_size); 1339 fn = (char *) alloca (fn_size = 100 + want_size);
1304 1340
1305 /* Loop over suffixes. */ 1341 /* Loop over suffixes. */
1306 for (tail = NILP (suffixes) ? default_suffixes : suffixes; 1342 for (tail = NILP (suffixes) ? Fcons (build_string (""), Qnil) : suffixes;
1307 CONSP (tail); tail = XCDR (tail)) 1343 CONSP (tail); tail = XCDR (tail))
1308 { 1344 {
1309 int lsuffix = SBYTES (XCAR (tail)); 1345 int lsuffix = SBYTES (XCAR (tail));
@@ -3979,6 +4015,7 @@ syms_of_lread ()
3979 defsubr (&Sintern); 4015 defsubr (&Sintern);
3980 defsubr (&Sintern_soft); 4016 defsubr (&Sintern_soft);
3981 defsubr (&Sunintern); 4017 defsubr (&Sunintern);
4018 defsubr (&Sget_load_suffixes);
3982 defsubr (&Sload); 4019 defsubr (&Sload);
3983 defsubr (&Seval_buffer); 4020 defsubr (&Seval_buffer);
3984 defsubr (&Seval_region); 4021 defsubr (&Seval_region);
@@ -4040,13 +4077,27 @@ Initialized based on EMACSLOADPATH environment variable, if any,
4040otherwise to default specified by file `epaths.h' when Emacs was built. */); 4077otherwise to default specified by file `epaths.h' when Emacs was built. */);
4041 4078
4042 DEFVAR_LISP ("load-suffixes", &Vload_suffixes, 4079 DEFVAR_LISP ("load-suffixes", &Vload_suffixes,
4043 doc: /* *List of suffixes to try for files to load. 4080 doc: /* List of suffixes for (compiled or source) Emacs Lisp files.
4044This list should not include the empty string. */); 4081This list should not include the empty string.
4082`load' and related functions try to append these suffixes, in order,
4083to the specified file name if a Lisp suffix is allowed or required. */);
4045 Vload_suffixes = Fcons (build_string (".elc"), 4084 Vload_suffixes = Fcons (build_string (".elc"),
4046 Fcons (build_string (".el"), Qnil)); 4085 Fcons (build_string (".el"), Qnil));
4086 DEFVAR_LISP ("load-file-rep-suffixes", &Vload_file_rep_suffixes,
4087 doc: /* List of suffixes that indicate representations of \
4088the same file.
4089This list should normally start with the empty string.
4090
4091Enabling Auto Compression mode appends the suffixes in
4092`jka-compr-load-suffixes' to this list and disabling Auto Compression
4093mode removes them again. `load' and related functions use this list to
4094determine whether they should look for compressed versions of a file
4095and, if so, which suffixes they should try to append to the file name
4096in order to do so. However, if you want to customize which suffixes
4097the loading functions recognize as compression suffixes, you should
4098customize `jka-compr-load-suffixes' rather than the present variable. */);
4047 /* We don't use empty_string because it's not initialized yet. */ 4099 /* We don't use empty_string because it's not initialized yet. */
4048 default_suffixes = Fcons (build_string (""), Qnil); 4100 Vload_file_rep_suffixes = Fcons (build_string (""), Qnil);
4049 staticpro (&default_suffixes);
4050 4101
4051 DEFVAR_BOOL ("load-in-progress", &load_in_progress, 4102 DEFVAR_BOOL ("load-in-progress", &load_in_progress,
4052 doc: /* Non-nil iff inside of `load'. */); 4103 doc: /* Non-nil iff inside of `load'. */);
diff --git a/src/search.c b/src/search.c
index 239957e1552..dfde3280240 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3042,7 +3042,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
3042 3042
3043 for (; in != end; in++) 3043 for (; in != end; in++)
3044 { 3044 {
3045 if (*in == '[' || *in == ']' 3045 if (*in == '['
3046 || *in == '*' || *in == '.' || *in == '\\' 3046 || *in == '*' || *in == '.' || *in == '\\'
3047 || *in == '?' || *in == '+' 3047 || *in == '?' || *in == '+'
3048 || *in == '^' || *in == '$') 3048 || *in == '^' || *in == '$')
diff --git a/src/w32.c b/src/w32.c
index 799a3f6ad9b..71799befdbb 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3888,7 +3888,7 @@ check_windows_init_file ()
3888 objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH"))); 3888 objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH")));
3889 full_load_path = Fappend (2, objs); 3889 full_load_path = Fappend (2, objs);
3890 init_file = build_string ("term/w32-win"); 3890 init_file = build_string ("term/w32-win");
3891 fd = openp (full_load_path, init_file, Vload_suffixes, NULL, Qnil); 3891 fd = openp (full_load_path, init_file, Fget_load_suffixes (), NULL, Qnil);
3892 if (fd < 0) 3892 if (fd < 0)
3893 { 3893 {
3894 Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil); 3894 Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil);
diff --git a/src/window.c b/src/window.c
index e4c8d0612cb..3e94885a810 100644
--- a/src/window.c
+++ b/src/window.c
@@ -50,6 +50,7 @@ Boston, MA 02110-1301, USA. */
50 50
51 51
52Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 52Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
53Lisp_Object Qscroll_up, Qscroll_down;
53Lisp_Object Qwindow_size_fixed; 54Lisp_Object Qwindow_size_fixed;
54extern Lisp_Object Qleft_margin, Qright_margin; 55extern Lisp_Object Qleft_margin, Qright_margin;
55 56
@@ -4721,9 +4722,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4721 struct text_pos start; 4722 struct text_pos start;
4722 Lisp_Object tem; 4723 Lisp_Object tem;
4723 int this_scroll_margin; 4724 int this_scroll_margin;
4724 int preserve_y;
4725 /* True if we fiddled the window vscroll field without really scrolling. */ 4725 /* True if we fiddled the window vscroll field without really scrolling. */
4726 int vscrolled = 0; 4726 int vscrolled = 0;
4727 static int preserve_y = -1;
4727 4728
4728 SET_TEXT_POS_FROM_MARKER (start, w->start); 4729 SET_TEXT_POS_FROM_MARKER (start, w->start);
4729 4730
@@ -4787,9 +4788,18 @@ window_scroll_pixel_based (window, n, whole, noerror)
4787 point in the same window line as it is now, so get that line. */ 4788 point in the same window line as it is now, so get that line. */
4788 if (!NILP (Vscroll_preserve_screen_position)) 4789 if (!NILP (Vscroll_preserve_screen_position))
4789 { 4790 {
4790 start_display (&it, w, start); 4791 /* We preserve the goal pixel coordinate across consecutive
4791 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4792 calls to scroll-up or scroll-down. This avoids the
4792 preserve_y = it.current_y; 4793 possibility of point becoming "stuck" on a tall line when
4794 scrolling by one line. */
4795 if (preserve_y < 0
4796 || (current_kboard->Vlast_command != Qscroll_up
4797 && current_kboard->Vlast_command != Qscroll_down))
4798 {
4799 start_display (&it, w, start);
4800 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4801 preserve_y = it.current_y;
4802 }
4793 } 4803 }
4794 else 4804 else
4795 preserve_y = -1; 4805 preserve_y = -1;
@@ -4926,10 +4936,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4926 { 4936 {
4927 /* If we have a header line, take account of it. 4937 /* If we have a header line, take account of it.
4928 This is necessary because we set it.current_y to 0, above. */ 4938 This is necessary because we set it.current_y to 0, above. */
4929 if (WINDOW_WANTS_HEADER_LINE_P (w)) 4939 move_it_to (&it, -1, -1,
4930 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); 4940 preserve_y - (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0 ),
4931 4941 -1, MOVE_TO_Y);
4932 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4933 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4942 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4934 } 4943 }
4935 else 4944 else
@@ -4983,15 +4992,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4983 { 4992 {
4984 SET_TEXT_POS_FROM_MARKER (start, w->start); 4993 SET_TEXT_POS_FROM_MARKER (start, w->start);
4985 start_display (&it, w, start); 4994 start_display (&it, w, start);
4986#if 0 /* It's wrong to subtract this here 4995 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
4987 because we called start_display again 4996 here because we called start_display again and did not
4988 and did not alter it.current_y this time. */ 4997 alter it.current_y this time. */
4989
4990 /* If we have a header line, take account of it. */
4991 if (WINDOW_WANTS_HEADER_LINE_P (w))
4992 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4993#endif
4994
4995 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4998 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4996 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4999 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4997 } 5000 }
@@ -6988,6 +6991,12 @@ init_window ()
6988void 6991void
6989syms_of_window () 6992syms_of_window ()
6990{ 6993{
6994 Qscroll_up = intern ("scroll-up");
6995 staticpro (&Qscroll_up);
6996
6997 Qscroll_down = intern ("scroll-down");
6998 staticpro (&Qscroll_down);
6999
6991 Qwindow_size_fixed = intern ("window-size-fixed"); 7000 Qwindow_size_fixed = intern ("window-size-fixed");
6992 staticpro (&Qwindow_size_fixed); 7001 staticpro (&Qwindow_size_fixed);
6993 Fset (Qwindow_size_fixed, Qnil); 7002 Fset (Qwindow_size_fixed, Qnil);
diff --git a/src/xdisp.c b/src/xdisp.c
index 8c19b0976c8..7cdaf4f746c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -270,6 +270,12 @@ int auto_raise_tool_bar_buttons_p;
270 270
271int make_cursor_line_fully_visible_p; 271int make_cursor_line_fully_visible_p;
272 272
273/* Margin below tool bar in pixels. 0 or nil means no margin.
274 If value is `internal-border-width' or `border-width',
275 the corresponding frame parameter is used. */
276
277Lisp_Object Vtool_bar_border;
278
273/* Margin around tool bar buttons in pixels. */ 279/* Margin around tool bar buttons in pixels. */
274 280
275Lisp_Object Vtool_bar_button_margin; 281Lisp_Object Vtool_bar_button_margin;
@@ -855,7 +861,7 @@ static void store_mode_line_noprop_char P_ ((char));
855static int store_mode_line_noprop P_ ((const unsigned char *, int, int)); 861static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
856static void x_consider_frame_title P_ ((Lisp_Object)); 862static void x_consider_frame_title P_ ((Lisp_Object));
857static void handle_stop P_ ((struct it *)); 863static void handle_stop P_ ((struct it *));
858static int tool_bar_lines_needed P_ ((struct frame *)); 864static int tool_bar_lines_needed P_ ((struct frame *, int *));
859static int single_display_spec_intangible_p P_ ((Lisp_Object)); 865static int single_display_spec_intangible_p P_ ((Lisp_Object));
860static void ensure_echo_area_buffers P_ ((void)); 866static void ensure_echo_area_buffers P_ ((void));
861static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); 867static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
@@ -966,7 +972,7 @@ static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *,
966static void update_tool_bar P_ ((struct frame *, int)); 972static void update_tool_bar P_ ((struct frame *, int));
967static void build_desired_tool_bar_string P_ ((struct frame *f)); 973static void build_desired_tool_bar_string P_ ((struct frame *f));
968static int redisplay_tool_bar P_ ((struct frame *)); 974static int redisplay_tool_bar P_ ((struct frame *));
969static void display_tool_bar_line P_ ((struct it *)); 975static void display_tool_bar_line P_ ((struct it *, int));
970static void notice_overwritten_cursor P_ ((struct window *, 976static void notice_overwritten_cursor P_ ((struct window *,
971 enum glyph_row_area, 977 enum glyph_row_area,
972 int, int, int, int)); 978 int, int, int, int));
@@ -9530,11 +9536,17 @@ build_desired_tool_bar_string (f)
9530} 9536}
9531 9537
9532 9538
9533/* Display one line of the tool-bar of frame IT->f. */ 9539/* Display one line of the tool-bar of frame IT->f.
9540
9541 HEIGHT specifies the desired height of the tool-bar line.
9542 If the actual height of the glyph row is less than HEIGHT, the
9543 row's height is increased to HEIGHT, and the icons are centered
9544 vertically in the new height. */
9534 9545
9535static void 9546static void
9536display_tool_bar_line (it) 9547display_tool_bar_line (it, height)
9537 struct it *it; 9548 struct it *it;
9549 int height;
9538{ 9550{
9539 struct glyph_row *row = it->glyph_row; 9551 struct glyph_row *row = it->glyph_row;
9540 int max_x = it->last_visible_x; 9552 int max_x = it->last_visible_x;
@@ -9590,11 +9602,22 @@ display_tool_bar_line (it)
9590 out:; 9602 out:;
9591 9603
9592 row->displays_text_p = row->used[TEXT_AREA] != 0; 9604 row->displays_text_p = row->used[TEXT_AREA] != 0;
9605 /* Use default face for the border below the tool bar. */
9606 if (!row->displays_text_p)
9607 it->face_id = DEFAULT_FACE_ID;
9593 extend_face_to_end_of_line (it); 9608 extend_face_to_end_of_line (it);
9594 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; 9609 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
9595 last->right_box_line_p = 1; 9610 last->right_box_line_p = 1;
9596 if (last == row->glyphs[TEXT_AREA]) 9611 if (last == row->glyphs[TEXT_AREA])
9597 last->left_box_line_p = 1; 9612 last->left_box_line_p = 1;
9613
9614 /* Make line the desired height and center it vertically. */
9615 if ((height -= it->max_ascent + it->max_descent) > 0)
9616 {
9617 it->max_ascent += height / 2;
9618 it->max_descent += (height + 1) / 2;
9619 }
9620
9598 compute_line_metrics (it); 9621 compute_line_metrics (it);
9599 9622
9600 /* If line is empty, make it occupy the rest of the tool-bar. */ 9623 /* If line is empty, make it occupy the rest of the tool-bar. */
@@ -9618,11 +9641,13 @@ display_tool_bar_line (it)
9618 9641
9619 9642
9620/* Value is the number of screen lines needed to make all tool-bar 9643/* Value is the number of screen lines needed to make all tool-bar
9621 items of frame F visible. */ 9644 items of frame F visible. The number of actual rows needed is
9645 returned in *N_ROWS if non-NULL. */
9622 9646
9623static int 9647static int
9624tool_bar_lines_needed (f) 9648tool_bar_lines_needed (f, n_rows)
9625 struct frame *f; 9649 struct frame *f;
9650 int *n_rows;
9626{ 9651{
9627 struct window *w = XWINDOW (f->tool_bar_window); 9652 struct window *w = XWINDOW (f->tool_bar_window);
9628 struct it it; 9653 struct it it;
@@ -9638,9 +9663,12 @@ tool_bar_lines_needed (f)
9638 { 9663 {
9639 it.glyph_row = w->desired_matrix->rows; 9664 it.glyph_row = w->desired_matrix->rows;
9640 clear_glyph_row (it.glyph_row); 9665 clear_glyph_row (it.glyph_row);
9641 display_tool_bar_line (&it); 9666 display_tool_bar_line (&it, 0);
9642 } 9667 }
9643 9668
9669 if (n_rows)
9670 *n_rows = it.vpos;
9671
9644 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); 9672 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
9645} 9673}
9646 9674
@@ -9669,7 +9697,7 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
9669 if (f->n_tool_bar_items) 9697 if (f->n_tool_bar_items)
9670 { 9698 {
9671 build_desired_tool_bar_string (f); 9699 build_desired_tool_bar_string (f);
9672 nlines = tool_bar_lines_needed (f); 9700 nlines = tool_bar_lines_needed (f, NULL);
9673 } 9701 }
9674 } 9702 }
9675 9703
@@ -9714,9 +9742,50 @@ redisplay_tool_bar (f)
9714 build_desired_tool_bar_string (f); 9742 build_desired_tool_bar_string (f);
9715 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9743 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9716 9744
9745 if (f->n_tool_bar_rows == 0)
9746 {
9747 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9748 if (f->n_tool_bar_rows == 0)
9749 f->n_tool_bar_rows = -1;
9750 }
9751
9717 /* Display as many lines as needed to display all tool-bar items. */ 9752 /* Display as many lines as needed to display all tool-bar items. */
9718 while (it.current_y < it.last_visible_y) 9753
9719 display_tool_bar_line (&it); 9754 if (f->n_tool_bar_rows > 0)
9755 {
9756 int border, rows, height, extra;
9757
9758 if (INTEGERP (Vtool_bar_border))
9759 border = XINT (Vtool_bar_border);
9760 else if (EQ (Vtool_bar_border, Qinternal_border_width))
9761 border = FRAME_INTERNAL_BORDER_WIDTH (f);
9762 else if (EQ (Vtool_bar_border, Qborder_width))
9763 border = f->border_width;
9764 else
9765 border = 0;
9766 if (border < 0)
9767 border = 0;
9768
9769 rows = f->n_tool_bar_rows;
9770 height = (it.last_visible_y - border) / rows;
9771 extra = it.last_visible_y - border - height * rows;
9772
9773 while (it.current_y < it.last_visible_y)
9774 {
9775 int h = 0;
9776 if (extra > 0 && rows-- > 0)
9777 {
9778 h = (extra + rows - 1) / rows;
9779 extra -= h;
9780 }
9781 display_tool_bar_line (&it, height + h);
9782 }
9783 }
9784 else
9785 {
9786 while (it.current_y < it.last_visible_y)
9787 display_tool_bar_line (&it, 0);
9788 }
9720 9789
9721 /* It doesn't make much sense to try scrolling in the tool-bar 9790 /* It doesn't make much sense to try scrolling in the tool-bar
9722 window, so don't do it. */ 9791 window, so don't do it. */
@@ -9749,7 +9818,7 @@ redisplay_tool_bar (f)
9749 /* Resize windows as needed by changing the `tool-bar-lines' 9818 /* Resize windows as needed by changing the `tool-bar-lines'
9750 frame parameter. */ 9819 frame parameter. */
9751 if (change_height_p 9820 if (change_height_p
9752 && (nlines = tool_bar_lines_needed (f), 9821 && (nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows),
9753 nlines != WINDOW_TOTAL_LINES (w))) 9822 nlines != WINDOW_TOTAL_LINES (w)))
9754 { 9823 {
9755 extern Lisp_Object Qtool_bar_lines; 9824 extern Lisp_Object Qtool_bar_lines;
@@ -23817,6 +23886,14 @@ otherwise. */);
23817 doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); 23886 doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */);
23818 make_cursor_line_fully_visible_p = 1; 23887 make_cursor_line_fully_visible_p = 1;
23819 23888
23889 DEFVAR_LISP ("tool-bar-border", &Vtool_bar_border,
23890 doc: /* *Border below tool-bar in pixels.
23891If an integer, use it as the height of the border.
23892If it is one of `internal-border-width' or `border-width', use the
23893value of the corresponding frame parameter.
23894Otherwise, no border is added below the tool-bar. */);
23895 Vtool_bar_border = Qinternal_border_width;
23896
23820 DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin, 23897 DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin,
23821 doc: /* *Margin around tool-bar buttons in pixels. 23898 doc: /* *Margin around tool-bar buttons in pixels.
23822If an integer, use that for both horizontal and vertical margins. 23899If an integer, use that for both horizontal and vertical margins.
diff --git a/src/xfns.c b/src/xfns.c
index 2ad80fb95fa..bf4b29a005f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -667,7 +667,7 @@ x_real_positions (f, xptr, yptr)
667 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 667 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
668 } 668 }
669 669
670 x_uncatch_errors (FRAME_X_DISPLAY (f)); 670 x_uncatch_errors ();
671 671
672 UNBLOCK_INPUT; 672 UNBLOCK_INPUT;
673 673
@@ -1022,7 +1022,7 @@ x_set_mouse_color (f, arg, oldval)
1022 1022
1023 /* Check and report errors with the above calls. */ 1023 /* Check and report errors with the above calls. */
1024 x_check_errors (dpy, "can't set cursor shape: %s"); 1024 x_check_errors (dpy, "can't set cursor shape: %s");
1025 x_uncatch_errors (dpy); 1025 x_uncatch_errors ();
1026 1026
1027 { 1027 {
1028 XColor fore_color, back_color; 1028 XColor fore_color, back_color;
@@ -3427,7 +3427,7 @@ FRAME nil means use the selected frame. */)
3427 x_catch_errors (dpy); 3427 x_catch_errors (dpy);
3428 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3428 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3429 RevertToParent, CurrentTime); 3429 RevertToParent, CurrentTime);
3430 x_uncatch_errors (dpy); 3430 x_uncatch_errors ();
3431 UNBLOCK_INPUT; 3431 UNBLOCK_INPUT;
3432 3432
3433 return Qnil; 3433 return Qnil;
diff --git a/src/xselect.c b/src/xselect.c
index 6efa625543e..30739c74331 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -55,6 +55,7 @@ static void x_decline_selection_request P_ ((struct input_event *));
55static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object)); 55static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object));
56static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object)); 56static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object));
57static Lisp_Object some_frame_on_display P_ ((struct x_display_info *)); 57static Lisp_Object some_frame_on_display P_ ((struct x_display_info *));
58static Lisp_Object x_catch_errors_unwind P_ ((Lisp_Object));
58static void x_reply_selection_request P_ ((struct input_event *, int, 59static void x_reply_selection_request P_ ((struct input_event *, int,
59 unsigned char *, int, Atom)); 60 unsigned char *, int, Atom));
60static int waiting_for_other_props_on_window P_ ((Display *, Window)); 61static int waiting_for_other_props_on_window P_ ((Display *, Window));
@@ -410,7 +411,7 @@ x_own_selection (selection_name, selection_value)
410 x_catch_errors (display); 411 x_catch_errors (display);
411 XSetSelectionOwner (display, selection_atom, selecting_window, time); 412 XSetSelectionOwner (display, selection_atom, selecting_window, time);
412 x_check_errors (display, "Can't set selection: %s"); 413 x_check_errors (display, "Can't set selection: %s");
413 x_uncatch_errors (display); 414 x_uncatch_errors ();
414 UNBLOCK_INPUT; 415 UNBLOCK_INPUT;
415 416
416 /* Now update the local cache */ 417 /* Now update the local cache */
@@ -586,7 +587,7 @@ x_decline_selection_request (event)
586 x_catch_errors (reply.display); 587 x_catch_errors (reply.display);
587 XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply); 588 XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
588 XFlush (reply.display); 589 XFlush (reply.display);
589 x_uncatch_errors (reply.display); 590 x_uncatch_errors ();
590 UNBLOCK_INPUT; 591 UNBLOCK_INPUT;
591} 592}
592 593
@@ -611,6 +612,15 @@ x_selection_request_lisp_error (ignore)
611 x_decline_selection_request (x_selection_current_request); 612 x_decline_selection_request (x_selection_current_request);
612 return Qnil; 613 return Qnil;
613} 614}
615
616static Lisp_Object
617x_catch_errors_unwind (dummy)
618 Lisp_Object dummy;
619{
620 BLOCK_INPUT;
621 x_uncatch_errors ();
622 UNBLOCK_INPUT;
623}
614 624
615 625
616/* This stuff is so that INCR selections are reentrant (that is, so we can 626/* This stuff is so that INCR selections are reentrant (that is, so we can
@@ -703,8 +713,11 @@ x_reply_selection_request (event, format, data, size, type)
703 if (reply.property == None) 713 if (reply.property == None)
704 reply.property = reply.target; 714 reply.property = reply.target;
705 715
706 /* #### XChangeProperty can generate BadAlloc, and we must handle it! */
707 BLOCK_INPUT; 716 BLOCK_INPUT;
717 /* The protected block contains wait_for_property_change, which can
718 run random lisp code (process handlers) or signal. Therefore, we
719 put the x_uncatch_errors call in an unwind. */
720 record_unwind_protect (x_catch_errors_unwind, Qnil);
708 x_catch_errors (display); 721 x_catch_errors (display);
709 722
710#ifdef TRACE_SELECTION 723#ifdef TRACE_SELECTION
@@ -858,9 +871,8 @@ x_reply_selection_request (event, format, data, size, type)
858 UNBLOCK to enter the event loop and get possible errors delivered, 871 UNBLOCK to enter the event loop and get possible errors delivered,
859 and then BLOCK again because x_uncatch_errors requires it. */ 872 and then BLOCK again because x_uncatch_errors requires it. */
860 BLOCK_INPUT; 873 BLOCK_INPUT;
861 874 /* This calls x_uncatch_errors. */
862 unbind_to (count, Qnil); 875 unbind_to (count, Qnil);
863 x_uncatch_errors (display);
864 UNBLOCK_INPUT; 876 UNBLOCK_INPUT;
865} 877}
866 878
@@ -1370,7 +1382,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1370 Atom selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol); 1382 Atom selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol);
1371 Atom type_atom; 1383 Atom type_atom;
1372 int secs, usecs; 1384 int secs, usecs;
1373 int count; 1385 int count = SPECPDL_INDEX ();
1374 Lisp_Object frame; 1386 Lisp_Object frame;
1375 1387
1376 if (CONSP (target_type)) 1388 if (CONSP (target_type))
@@ -1392,6 +1404,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1392 1404
1393 BLOCK_INPUT; 1405 BLOCK_INPUT;
1394 1406
1407 /* The protected block contains wait_reading_process_output, which
1408 can run random lisp code (process handlers) or signal.
1409 Therefore, we put the x_uncatch_errors call in an unwind. */
1410 record_unwind_protect (x_catch_errors_unwind, Qnil);
1395 x_catch_errors (display); 1411 x_catch_errors (display);
1396 1412
1397 TRACE2 ("Get selection %s, type %s", 1413 TRACE2 ("Get selection %s, type %s",
@@ -1409,8 +1425,6 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1409 1425
1410 frame = some_frame_on_display (dpyinfo); 1426 frame = some_frame_on_display (dpyinfo);
1411 1427
1412 count = SPECPDL_INDEX ();
1413
1414 /* If the display no longer has frames, we can't expect 1428 /* If the display no longer has frames, we can't expect
1415 to get many more selection requests from it, so don't 1429 to get many more selection requests from it, so don't
1416 bother trying to queue them. */ 1430 bother trying to queue them. */
@@ -1432,9 +1446,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1432 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); 1446 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply)));
1433 1447
1434 BLOCK_INPUT; 1448 BLOCK_INPUT;
1449 if (x_had_errors_p (display))
1450 error ("Cannot get selection");
1451 /* This calls x_uncatch_errors. */
1435 unbind_to (count, Qnil); 1452 unbind_to (count, Qnil);
1436 x_check_errors (display, "Cannot get selection: %s");
1437 x_uncatch_errors (display);
1438 UNBLOCK_INPUT; 1453 UNBLOCK_INPUT;
1439 1454
1440 if (NILP (XCAR (reading_selection_reply))) 1455 if (NILP (XCAR (reading_selection_reply)))
@@ -2655,6 +2670,7 @@ If the value is 0 or the atom is not known, return the empty string. */)
2655 Lisp_Object ret = Qnil; 2670 Lisp_Object ret = Qnil;
2656 Display *dpy = FRAME_X_DISPLAY (f); 2671 Display *dpy = FRAME_X_DISPLAY (f);
2657 Atom atom; 2672 Atom atom;
2673 int had_errors;
2658 2674
2659 if (INTEGERP (value)) 2675 if (INTEGERP (value))
2660 atom = (Atom) XUINT (value); 2676 atom = (Atom) XUINT (value);
@@ -2667,14 +2683,13 @@ If the value is 0 or the atom is not known, return the empty string. */)
2667 2683
2668 BLOCK_INPUT; 2684 BLOCK_INPUT;
2669 x_catch_errors (dpy); 2685 x_catch_errors (dpy);
2670
2671 name = atom ? XGetAtomName (dpy, atom) : ""; 2686 name = atom ? XGetAtomName (dpy, atom) : "";
2687 had_errors = x_had_errors_p (dpy);
2688 x_uncatch_errors ();
2672 2689
2673 if (! x_had_errors_p (dpy)) 2690 if (!had_errors)
2674 ret = make_string (name, strlen (name)); 2691 ret = make_string (name, strlen (name));
2675 2692
2676 x_uncatch_errors (dpy);
2677
2678 if (atom && name) XFree (name); 2693 if (atom && name) XFree (name);
2679 if (NILP (ret)) ret = make_string ("", 0); 2694 if (NILP (ret)) ret = make_string ("", 0);
2680 2695
@@ -2849,7 +2864,7 @@ are ignored. */)
2849 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); 2864 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event);
2850 XFlush (dpyinfo->display); 2865 XFlush (dpyinfo->display);
2851 } 2866 }
2852 x_uncatch_errors (dpyinfo->display); 2867 x_uncatch_errors ();
2853 UNBLOCK_INPUT; 2868 UNBLOCK_INPUT;
2854 2869
2855 return Qnil; 2870 return Qnil;
diff --git a/src/xterm.c b/src/xterm.c
index ea12b4eba9f..1f497f1f738 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -326,7 +326,7 @@ void x_delete_display P_ ((struct x_display_info *));
326 326
327static int x_io_error_quitter P_ ((Display *)); 327static int x_io_error_quitter P_ ((Display *));
328void x_catch_errors P_ ((Display *)); 328void x_catch_errors P_ ((Display *));
329void x_uncatch_errors P_ ((Display *)); 329void x_uncatch_errors P_ ((void));
330void x_lower_frame P_ ((struct frame *)); 330void x_lower_frame P_ ((struct frame *));
331void x_scroll_bar_clear P_ ((struct frame *)); 331void x_scroll_bar_clear P_ ((struct frame *));
332int x_had_errors_p P_ ((Display *)); 332int x_had_errors_p P_ ((Display *));
@@ -3877,7 +3877,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3877 if (x_had_errors_p (FRAME_X_DISPLAY (*fp))) 3877 if (x_had_errors_p (FRAME_X_DISPLAY (*fp)))
3878 f1 = 0; 3878 f1 = 0;
3879 3879
3880 x_uncatch_errors (FRAME_X_DISPLAY (*fp)); 3880 x_uncatch_errors ();
3881 3881
3882 /* If not, is it one of our scroll bars? */ 3882 /* If not, is it one of our scroll bars? */
3883 if (! f1) 3883 if (! f1)
@@ -5803,7 +5803,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
5803 /* This is needed to detect the error 5803 /* This is needed to detect the error
5804 if there is an error. */ 5804 if there is an error. */
5805 XSync (d, False); 5805 XSync (d, False);
5806 x_uncatch_errors (d); 5806 x_uncatch_errors ();
5807 } 5807 }
5808 /* Not certain about handling scroll bars here */ 5808 /* Not certain about handling scroll bars here */
5809#endif /* 0 */ 5809#endif /* 0 */
@@ -7585,19 +7585,16 @@ x_catch_errors (dpy)
7585 DPY should be the display that was passed to x_catch_errors. */ 7585 DPY should be the display that was passed to x_catch_errors. */
7586 7586
7587void 7587void
7588x_uncatch_errors (dpy) 7588x_uncatch_errors ()
7589 Display *dpy;
7590{ 7589{
7591 struct x_error_message_stack *tmp; 7590 struct x_error_message_stack *tmp;
7592 7591
7593 eassert (x_error_message && dpy == x_error_message->dpy);
7594
7595 /* The display may have been closed before this function is called. 7592 /* The display may have been closed before this function is called.
7596 Check if it is still open before calling XSync. */ 7593 Check if it is still open before calling XSync. */
7597 if (x_display_info_for_display (dpy) != 0) 7594 if (x_display_info_for_display (x_error_message->dpy) != 0)
7598 { 7595 {
7599 BLOCK_INPUT; 7596 BLOCK_INPUT;
7600 XSync (dpy, False); 7597 XSync (x_error_message->dpy, False);
7601 UNBLOCK_INPUT; 7598 UNBLOCK_INPUT;
7602 } 7599 }
7603 7600
@@ -7622,7 +7619,7 @@ x_check_errors (dpy, format)
7622 { 7619 {
7623 char string[X_ERROR_MESSAGE_SIZE]; 7620 char string[X_ERROR_MESSAGE_SIZE];
7624 bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE); 7621 bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE);
7625 x_uncatch_errors (dpy); 7622 x_uncatch_errors ();
7626 error (format, string); 7623 error (format, string);
7627 } 7624 }
7628} 7625}
@@ -7782,7 +7779,7 @@ x_connection_closed (dpy, error_message)
7782 if (dpyinfo) 7779 if (dpyinfo)
7783 x_delete_display (dpyinfo); 7780 x_delete_display (dpyinfo);
7784 7781
7785 x_uncatch_errors (dpy); 7782 x_uncatch_errors ();
7786 7783
7787 if (x_display_list == 0) 7784 if (x_display_list == 0)
7788 { 7785 {
@@ -9525,7 +9522,7 @@ x_list_fonts (f, pattern, size, maxnames)
9525 } 9522 }
9526 } 9523 }
9527 9524
9528 x_uncatch_errors (dpy); 9525 x_uncatch_errors ();
9529 UNBLOCK_INPUT; 9526 UNBLOCK_INPUT;
9530 9527
9531 if (names) 9528 if (names)
@@ -9626,7 +9623,7 @@ x_list_fonts (f, pattern, size, maxnames)
9626 thisinfo = NULL; 9623 thisinfo = NULL;
9627 x_clear_errors (dpy); 9624 x_clear_errors (dpy);
9628 } 9625 }
9629 x_uncatch_errors (dpy); 9626 x_uncatch_errors ();
9630 UNBLOCK_INPUT; 9627 UNBLOCK_INPUT;
9631 9628
9632 if (thisinfo) 9629 if (thisinfo)
@@ -9829,7 +9826,7 @@ x_load_font (f, fontname, size)
9829 font = NULL; 9826 font = NULL;
9830 x_clear_errors (FRAME_X_DISPLAY (f)); 9827 x_clear_errors (FRAME_X_DISPLAY (f));
9831 } 9828 }
9832 x_uncatch_errors (FRAME_X_DISPLAY (f)); 9829 x_uncatch_errors ();
9833 UNBLOCK_INPUT; 9830 UNBLOCK_INPUT;
9834 if (!font) 9831 if (!font)
9835 return NULL; 9832 return NULL;
@@ -10769,7 +10766,7 @@ x_term_init (display_name, xrm_option, resource_name)
10769 abort (); 10766 abort ();
10770 if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) 10767 if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
10771 XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); 10768 XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
10772 x_uncatch_errors (dpy); 10769 x_uncatch_errors ();
10773 } 10770 }
10774#endif 10771#endif
10775#endif 10772#endif
diff --git a/src/xterm.h b/src/xterm.h
index b92a27979dd..ea79d91564f 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -963,7 +963,7 @@ void x_iconify_frame P_ ((struct frame *));
963void x_wm_set_size_hint P_ ((struct frame *, long, int)); 963void x_wm_set_size_hint P_ ((struct frame *, long, int));
964void x_catch_errors P_ ((Display *)); 964void x_catch_errors P_ ((Display *));
965int x_had_errors_p P_ ((Display *)); 965int x_had_errors_p P_ ((Display *));
966void x_uncatch_errors P_ ((Display *)); 966void x_uncatch_errors P_ ((void));
967void x_check_errors P_ ((Display *, char *)); 967void x_check_errors P_ ((Display *, char *));
968int x_text_icon P_ ((struct frame *, char *)); 968int x_text_icon P_ ((struct frame *, char *));
969int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 969int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
@@ -980,7 +980,7 @@ extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
980extern void x_catch_errors P_ ((Display *)); 980extern void x_catch_errors P_ ((Display *));
981extern void x_check_errors P_ ((Display *, char *)); 981extern void x_check_errors P_ ((Display *, char *));
982extern int x_had_errors_p P_ ((Display *)); 982extern int x_had_errors_p P_ ((Display *));
983extern void x_uncatch_errors P_ ((Display *)); 983extern void x_uncatch_errors P_ ((void));
984extern void x_set_window_size P_ ((struct frame *, int, int, int)); 984extern void x_set_window_size P_ ((struct frame *, int, int, int));
985extern void x_set_mouse_position P_ ((struct frame *, int, int)); 985extern void x_set_mouse_position P_ ((struct frame *, int, int));
986extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); 986extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));