aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2004-11-12 02:53:04 +0000
committerMiles Bader2004-11-12 02:53:04 +0000
commit8b7e837d9c3266e775142a4865845b3d2a8b60aa (patch)
treed1468612ab319b665728b9ebf94dbc0c0d4c20fc /src
parentd1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26 (diff)
parente22c7647c7ff33c846132f3d2877ac436b8b47e6 (diff)
downloademacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.tar.gz
emacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore1
-rw-r--r--src/ChangeLog252
-rw-r--r--src/Makefile.in14
-rw-r--r--src/callint.c15
-rw-r--r--src/config.in3
-rw-r--r--src/data.c4
-rw-r--r--src/doc.c78
-rw-r--r--src/dosfns.c6
-rw-r--r--src/editfns.c56
-rw-r--r--src/emacs.c23
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c48
-rw-r--r--src/fns.c9
-rw-r--r--src/fontset.c38
-rw-r--r--src/frame.c2
-rw-r--r--src/fringe.c7
-rw-r--r--src/gtkutil.c30
-rw-r--r--src/gtkutil.h4
-rw-r--r--src/intervals.h6
-rw-r--r--src/keyboard.c110
-rw-r--r--src/keyboard.h1
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h7
-rw-r--r--src/lread.c8
-rw-r--r--src/macros.c4
-rw-r--r--src/makefile.w32-in3
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c9
-rw-r--r--src/process.c20
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c71
-rw-r--r--src/xfaces.c26
-rw-r--r--src/xfns.c8
-rw-r--r--src/xmenu.c19
-rw-r--r--src/xselect.c189
-rw-r--r--src/xterm.c81
-rw-r--r--src/xterm.h7
37 files changed, 809 insertions, 364 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 406ff7cd5e2..48c78a4f3a6 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -17,3 +17,4 @@ obj
17prefix-args 17prefix-args
18stamp-oldxmenu 18stamp-oldxmenu
19temacs 19temacs
20buildobj.lst
diff --git a/src/ChangeLog b/src/ChangeLog
index e0ae2429fcd..5895b4b6564 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,233 @@
12004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keymap.c (Fkeymap_prompt): Accept symbol keymaps.
4
52004-11-09 Kim F. Storm <storm@cua.dk>
6
7 * xselect.c: Include <sys/types.h> and <unistd.h> (for getpid).
8 Fix various comments referring to XEvents instead of input events.
9 (x_queue_event): Fix format strings.
10 (x_stop_queuing_selection_requests): Likewise.
11
12 * xdisp.c (produce_image_glyph): Remove unused variable 'face_ascent'.
13 (pint2hrstr): Add extra braces to silence compiler.
14
15 * print.c (print_object): Fix format string.
16
17 * lread.c (read1): Fix next_char matching.
18
19 * lisp.h (Fdelete): Add EXFUN.
20 (replace_range_2): Add prototype.
21
22 * keyboard.c (read_avail_input): Remove unused variable 'discard'.
23
24 * intervals.h (NULL_INTERVAL_P): Add separate version when
25 ENABLE_CHECKING is not defined to silence compiler.
26 (compare_string_intervals): Add prototype.
27
28 * fringe.c (destroy_fringe_bitmap): Fix return type.
29 (Ffringe_bitmaps_at_pos): Remove unused var 'old_buffer'.
30
31 * emacs.c (Fdump_emacs): Fix format string.
32
33 * doc.c: Include <ctype.h>.
34 (Fsubstitute_command_keys): Remove unused variable 'firstkey'.
35
36 * data.c (store_symval_forwarding): Remove unused variables.
37
38 * callint.c (Fcall_interactively): Remove unused variable 'funcar'.
39
402004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
41
42 * Makefile.in (stamp-oldxmenu): If HAVE_GTK, don't add dependencies
43 to ${OLDXMENU}.
44
452004-11-09 Kim F. Storm <storm@cua.dk>
46
47 * process.c (Fmake_network_process): Remove kludge for interrupted
48 connects on BSD. If connect is interrupted, just close socket and
49 start over rather than sleeping and retry with same socket.
50
512004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
52
53 * .cvsignore: Add buildobj.lst.
54
55 * doc.c: New variable Vbuild_files.
56 (Fsnarf_documentation): If Vbuild_files is nil, populate it with
57 file names from buildobh.lst. Only attach docstrings from files
58 that are in Vbuild_files.
59 (syms_of_doc): Defvar Vbuild_files.
60
61 * Makefile.in (SOME_MACHINE_OBJECTS): Add fringe.o, image.o
62 and w32*.o.
63 (temacs${EXEEXT}): Generate buildobj.lst when temacs is linked.
64 (mostlyclean): rm buildobj.lst
65
66 * makefile.w32-in ($(TEMACS)): Generate buildobj.lst when temacs
67 is linked.
68
692004-11-09 Kim F. Storm <storm@cua.dk>
70
71 * fringe.c (update_window_fringes): Update fringe bitmaps if
72 cur and row ends_at_zv_p differs. If bitmaps of a row is updated,
73 also update previous row to get rid of misc. artifacts.
74
752004-11-08 Kim F. Storm <storm@cua.dk>
76
77 * xdisp.c (fast_find_position): Fix start pos if header line present.
78 (note_mouse_highlight): Clear mouse face if we move out of text area.
79
802004-11-08 Eli Zaretskii <eliz@gnu.org>
81
82 * editfns.c: Move #include "systime.h" before <sys/resource.h>.
83 Don't include <sys/time.h> explicitly.
84 Include <stdio.h> unconditionally, not just on MacOS.
85
862004-11-08 Kenichi Handa <handa@m17n.org>
87
88 * fontset.c (fontset_pattern_regexp): Cancel my previous change;
89 don't pay attention to '\' before '*'.
90 (fontset_pattern_regexp): Change the meaning of the second arg.
91 (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
92 (check_fontset_name): Try NAME as literal at first, and if it
93 failes, try NAME as pattern.
94
952004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
96
97 * emacs.c (Fdump_emacs): Only output warning on GNU/Linux.
98
992004-11-07 Andreas Schwab <schwab@suse.de>
100
101 * lisp.h: Declare Fmsdos_downcase_filename.
102 * dired.c: Don't declare Fmsdos_downcase_filename.
103 * fileio.c: Likewise.
104
1052004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
106
107 * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in
108 comparisons with integers instead of Lisp_Object address.
109 (Fmsdos_set_keyboard): Declare argument allkeys.
110
111 * msdos.c (IT_set_frame_parameters): Use EQ, not ==, for Lisp_Object:s.
112
113 * dired.c: extern declare Fmsdos_downcase_filename on MSDOS to avoid
114 int/Lisp_Object mixup.
115
116 * fileio.c: Ditto.
117
1182004-11-06 Steven Tamm <steventamm@mac.com>
119
120 * editfns.c: Need to include sys/time.h before resource.h on darwin.
121
1222004-11-06 Richard M. Stallman <rms@gnu.org>
123
124 * callint.c (Fcall_interactively): Avoid reusing EVENT for other data.
125
126 * xfaces.c (merge_named_face): GCPRO the face_name in the
127 named_merge_point struct that we make.
128 (merge_face_heights): Eliminate GCPRO arg. All callers changed.
129
130 * keyboard.c (command_loop_1): Change Vtransient_mark_mode
131 before deciding whether to inactivate mark.
132
1332004-11-06 Lars Brinkhoff <lars@nocrew.org>
134
135 * config.in: Regenerate (add HAVE_GETRUSAGE).
136 * editfns.c (Fget_internal_run_time): New function.
137 (syms_of_data): Defsubr it.
138 * fns.c (sxhash): As far as possible, merge calculation of
139 hash code for symbols and strings.
140
1412004-11-06 Eli Zaretskii <eliz@gnu.org>
142
143 * frame.c (syms_of_frame): Fix the example in the doc string.
144
1452004-11-06 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
146
147 * eval.c (Feval): Remove check for INPUT_BLOCKED_P.
148
149 * xmenu.c (popup_get_selection, create_and_show_popup_menu)
150 (create_and_show_dialog): Revert change from 2004-10-31.
151
1522004-11-05 Luc Teirlinck <teirllm@auburn.edu>
153
154 * macros.c (syms_of_macros) <defining-kbd-macro>: Doc fix.
155
1562004-11-05 Kim F. Storm <storm@cua.dk>
157
158 * print.c (print_object): Print Lisp_Misc_Save_Value objects.
159
160 * fileio.c (Ffile_modes): Doc fix.
161 (auto_save_1): Check for Ffile_modes nil value.
162
1632004-11-05 Kim F. Storm <storm@cua.dk>
164
165 * xselect.c (struct selection_event_queue, selection_queue)
166 (x_queue_selection_requests, x_queue_event)
167 (x_start_queuing_selection_requests)
168 (x_stop_queuing_selection_requests): Add new queue for selection
169 input events to replace previous XEvent queue in xterm.c.
170 (queue_selection_requests_unwind): Adapt to new queue.
171 (x_reply_selection_request): Adapt to new queue.
172 Unexpect wait_object in case of x errors (memory leak).
173 (x_handle_selection_request, x_handle_selection_clear): Make static.
174 (x_handle_selection_event): New function. May queue selection events.
175 (wait_for_property_change_unwind): Use save_value instead of cons.
176 Clear property_change_reply_object.
177 (wait_for_property_change): Abort if already waiting.
178 Use save_value instead of cons for unwind data.
179 (x_handle_property_notify): Skip events already arrived, but don't
180 free them, as "arrived" field is checked by wait_for_property_change,
181 and it will be freed by unwind or explicit unexpect_property_change.
182 (x_get_foreign_selection): Add to new queue.
183 (receive_incremental_selection): Don't unexpect wait_object when done
184 as it has already been freed by previous wait_for_property_change.
185
186 * xterm.h (x_start_queuing_selection_requests)
187 (x_stop_queuing_selection_requests, x_handle_selection_request)
188 (x_handle_selection_clear): Remove prototypes.
189 (x_handle_selection_event): Add prototype.
190
191 * xterm.c (handle_one_xevent): Don't queue X selection events
192 here, it may be too late if we start queuing after we have already
193 stored some selection events into the kbd buffer.
194 (struct selection_event_queue, queue, x_queue_selection_requests)
195 (x_queue_event, x_unqueue_events, x_start_queuing_selection_requests)
196 (x_stop_queuing_selection_requests): Remove/move to xselect.c.
197 (x_catch_errors_unwind): Block input around final XSync.
198
199 * keyboard.h (kbd_buffer_unget_event): Add prototype.
200
201 * keyboard.c (kbd_buffer_store_event_hold): Remove obsolete code.
202 (kbd_buffer_unget_event): New function.
203 (kbd_buffer_get_event, swallow_events): Combine SELECTION events
204 and use x_handle_selection_event.
205 (mark_kboards): Don't mark x and y of SELECTION_CLEAR_EVENT.
206
2072004-11-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
208
209 * xselect.c (TRACE3): New debug macro.
210 (x_reply_selection_request): Use it.
211 (receive_incremental_selection): In call to TRACE0, the name of
212 a symbol is in xname.
213
2142004-11-05 Kim F. Storm <storm@cua.dk>
215
216 * fontset.c (fontset_pattern_regexp): Use unsigned char.
217
2182004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
219
220 * fileio.c (Fnext_read_file_uses_dialog_p): New function.
221
222 * gtkutil.h: Declare use_old_gtk_file_dialog.
223
224 * gtkutil.c: Make use_old_gtk_file_dialog non-static.
225 (xg_initialize): Move DEFVAR_BOOL for use_old_gtk_file_dialog ...
226 * xfns.c (syms_of_xfns): ... to here.
227
228 * gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if
229 it doesn't start with /.
230
12004-11-04 Kenichi Handa <handa@m17n.org> 2312004-11-04 Kenichi Handa <handa@m17n.org>
2 232
3 * fontset.c (fontset_pattern_regexp): If '*' is preceded by '\', 233 * fontset.c (fontset_pattern_regexp): If '*' is preceded by '\',
@@ -67,20 +297,20 @@
67 297
68 * lisp.h: Fx_file_dialog takes 5 parameters. 298 * lisp.h: Fx_file_dialog takes 5 parameters.
69 299
70 * xfns.c (Fx_file_dialog): Both Motif and GTK version: Add 300 * xfns.c (Fx_file_dialog): Both Motif and GTK version:
71 parameter only_dir_p. 301 Add parameter only_dir_p.
72 In Motif version, don't put DEFAULT_FILENAME in filter part of the 302 In Motif version, don't put DEFAULT_FILENAME in filter part of the
73 dialog, just text field part. Do not add DEFAULT_FILENAME 303 dialog, just text field part. Do not add DEFAULT_FILENAME
74 to list of files if it isn't there. 304 to list of files if it isn't there.
75 In GTK version, pass only_dir_p parameter to xg_get_file_name. 305 In GTK version, pass only_dir_p parameter to xg_get_file_name.
76 306
77 * macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check 307 * macfns.c (Fx_file_dialog): Add parameter only_dir_p.
78 only_dir_p instead of comparing prompt to "Dired". When using 308 Check only_dir_p instead of comparing prompt to "Dired". When using
79 a save dialog, add option kNavDontConfirmReplacement, change title 309 a save dialog, add option kNavDontConfirmReplacement, change title
80 to "Enter name", change text for save button to "Ok". 310 to "Enter name", change text for save button to "Ok".
81 311
82 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check 312 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p.
83 only_dir_p instead of comparing prompt to "Dired". 313 Check only_dir_p instead of comparing prompt to "Dired".
84 314
85 * gtkutil.c (xg_get_file_with_chooser) 315 * gtkutil.c (xg_get_file_with_chooser)
86 (xg_get_file_with_selection): New functions, only defined ifdef 316 (xg_get_file_with_selection): New functions, only defined ifdef
@@ -97,8 +327,8 @@
97 327
982004-11-01 Kim F. Storm <storm@cua.dk> 3282004-11-01 Kim F. Storm <storm@cua.dk>
99 329
100 * process.c (connect_wait_mask, num_pending_connects): Only 330 * process.c (connect_wait_mask, num_pending_connects):
101 declare and use them if NON_BLOCKING_CONNECT is defined. 331 Only declare and use them if NON_BLOCKING_CONNECT is defined.
102 (init_process): Initialize them if NON_BLOCKING_CONNECT defined. 332 (init_process): Initialize them if NON_BLOCKING_CONNECT defined.
103 (IF_NON_BLOCKING_CONNECT): New helper macro. 333 (IF_NON_BLOCKING_CONNECT): New helper macro.
104 (wait_reading_process_output): Only declare and use local vars 334 (wait_reading_process_output): Only declare and use local vars
@@ -113,8 +343,8 @@
113 * xmenu.c: Add prototypes for forward function declarations. 343 * xmenu.c: Add prototypes for forward function declarations.
114 (popup_get_selection): Remove parameter do_timers, remove call to 344 (popup_get_selection): Remove parameter do_timers, remove call to
115 timer_check. 345 timer_check.
116 (create_and_show_popup_menu, create_and_show_dialog): Remove 346 (create_and_show_popup_menu, create_and_show_dialog):
117 parameter do_timers from call to popup_get_selection. 347 Remove parameter do_timers from call to popup_get_selection.
118 348
119 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to 349 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to
120 tool_bar_items and assign the result to f->tool_bar_items if 350 tool_bar_items and assign the result to f->tool_bar_items if
@@ -133,7 +363,7 @@
133 * macterm.c: allow user to assign key modifiers to the Mac Option 363 * macterm.c: allow user to assign key modifiers to the Mac Option
134 key via a 'mac-option-modifier' variable. 364 key via a 'mac-option-modifier' variable.
135 365
1362004-10-28 Stefan <monnier@iro.umontreal.ca> 3662004-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
137 367
138 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions): 368 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions):
139 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks. 369 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks.
diff --git a/src/Makefile.in b/src/Makefile.in
index 5d6112c8fec..40d7e2df53c 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -596,8 +596,10 @@ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
596 These go in the DOC file on all machines 596 These go in the DOC file on all machines
597 in case they are needed there. */ 597 in case they are needed there. */
598SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ 598SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
599 xterm.o xfns.o xmenu.o xselect.o xrdb.o \ 599 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
600 mac.o macterm.o macfns.o macmenu.o fontset.o 600 mac.o macterm.o macfns.o macmenu.o fontset.o \
601 w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
602 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
601 603
602 604
603#ifdef TERMINFO 605#ifdef TERMINFO
@@ -926,6 +928,7 @@ ${libsrc}make-docfile${EXEEXT}:
926#endif 928#endif
927 929
928temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} 930temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
931 echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
929 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ 932 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
930 -o temacs ${STARTFILES} ${obj} ${otherobj} \ 933 -o temacs ${STARTFILES} ${obj} ${otherobj} \
931 OBJECTS_MACHINE ${LIBES} 934 OBJECTS_MACHINE ${LIBES}
@@ -941,7 +944,7 @@ prefix-args${EXEEXT}: prefix-args.c $(config_h)
941#define OLDXMENU_OPTIONS 944#define OLDXMENU_OPTIONS
942#endif 945#endif
943 946
944#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) 947#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (HAVE_GTK)
945 948
946/* We use stamp-xmenu with these two deps 949/* We use stamp-xmenu with these two deps
947 to both ensure that lwlib gets remade based on its dependencies 950 to both ensure that lwlib gets remade based on its dependencies
@@ -997,12 +1000,12 @@ really-oldXMenu:
997 @true /* make -t should not create really-oldXMenu. */ 1000 @true /* make -t should not create really-oldXMenu. */
998.PHONY: really-oldXMenu 1001.PHONY: really-oldXMenu
999#endif /* not USE_X_TOOLKIT */ 1002#endif /* not USE_X_TOOLKIT */
1000#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1003#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1001 1004
1002/* We don\'t really need this, but satisfy the dependency. */ 1005/* We don\'t really need this, but satisfy the dependency. */
1003stamp-oldxmenu: 1006stamp-oldxmenu:
1004 touch stamp-oldxmenu 1007 touch stamp-oldxmenu
1005#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1008#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1006 1009
1007../config.status:: epaths.in 1010../config.status:: epaths.in
1008 @echo "The file epaths.h needs to be set up from epaths.in." 1011 @echo "The file epaths.h needs to be set up from epaths.in."
@@ -1266,6 +1269,7 @@ mostlyclean:
1266 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a 1269 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
1267 rm -f ../etc/DOC 1270 rm -f ../etc/DOC
1268 rm -f bootstrap-emacs${EXEEXT} 1271 rm -f bootstrap-emacs${EXEEXT}
1272 rm -f buildobj.lst
1269clean: mostlyclean 1273clean: mostlyclean
1270 rm -f emacs-*${EXEEXT} emacs${EXEEXT} 1274 rm -f emacs-*${EXEEXT} emacs${EXEEXT}
1271/**/# This is used in making a distribution. 1275/**/# This is used in making a distribution.
diff --git a/src/callint.c b/src/callint.c
index da88693cd78..bb71ad50f44 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -265,7 +265,6 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
265 Lisp_Object *args, *visargs; 265 Lisp_Object *args, *visargs;
266 unsigned char **argstrings; 266 unsigned char **argstrings;
267 Lisp_Object fun; 267 Lisp_Object fun;
268 Lisp_Object funcar;
269 Lisp_Object specs; 268 Lisp_Object specs;
270 Lisp_Object filter_specs; 269 Lisp_Object filter_specs;
271 Lisp_Object teml; 270 Lisp_Object teml;
@@ -451,25 +450,25 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
451 string++; 450 string++;
452 else if (*string == '@') 451 else if (*string == '@')
453 { 452 {
454 Lisp_Object event; 453 Lisp_Object event, tem;
455 454
456 event = (next_event < key_count 455 event = (next_event < key_count
457 ? XVECTOR (keys)->contents[next_event] 456 ? XVECTOR (keys)->contents[next_event]
458 : Qnil); 457 : Qnil);
459 if (EVENT_HAS_PARAMETERS (event) 458 if (EVENT_HAS_PARAMETERS (event)
460 && (event = XCDR (event), CONSP (event)) 459 && (tem = XCDR (event), CONSP (tem))
461 && (event = XCAR (event), CONSP (event)) 460 && (tem = XCAR (tem), CONSP (tem))
462 && (event = XCAR (event), WINDOWP (event))) 461 && (tem = XCAR (tem), WINDOWP (tem)))
463 { 462 {
464 if (MINI_WINDOW_P (XWINDOW (event)) 463 if (MINI_WINDOW_P (XWINDOW (tem))
465 && ! (minibuf_level > 0 && EQ (event, minibuf_window))) 464 && ! (minibuf_level > 0 && EQ (tem, minibuf_window)))
466 error ("Attempt to select inactive minibuffer window"); 465 error ("Attempt to select inactive minibuffer window");
467 466
468 /* If the current buffer wants to clean up, let it. */ 467 /* If the current buffer wants to clean up, let it. */
469 if (!NILP (Vmouse_leave_buffer_hook)) 468 if (!NILP (Vmouse_leave_buffer_hook))
470 call1 (Vrun_hooks, Qmouse_leave_buffer_hook); 469 call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
471 470
472 Fselect_window (event, Qnil); 471 Fselect_window (tem, Qnil);
473 } 472 }
474 string++; 473 string++;
475 } 474 }
diff --git a/src/config.in b/src/config.in
index 0fb9126b470..fe1adc39f9d 100644
--- a/src/config.in
+++ b/src/config.in
@@ -196,6 +196,9 @@ Boston, MA 02111-1307, USA. */
196/* Define to 1 if you have the `getpt' function. */ 196/* Define to 1 if you have the `getpt' function. */
197#undef HAVE_GETPT 197#undef HAVE_GETPT
198 198
199/* Define to 1 if you have the `getrusage' function. */
200#undef HAVE_GETRUSAGE
201
199/* Define to 1 if you have the `getsockname' function. */ 202/* Define to 1 if you have the `getsockname' function. */
200#undef HAVE_GETSOCKNAME 203#undef HAVE_GETSOCKNAME
201 204
diff --git a/src/data.c b/src/data.c
index 561a034b8fd..7f68cc864df 100644
--- a/src/data.c
+++ b/src/data.c
@@ -908,8 +908,6 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
908 register Lisp_Object valcontents, newval; 908 register Lisp_Object valcontents, newval;
909 struct buffer *buf; 909 struct buffer *buf;
910{ 910{
911 int offset;
912
913 switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) 911 switch (SWITCH_ENUM_CAST (XTYPE (valcontents)))
914 { 912 {
915 case Lisp_Misc: 913 case Lisp_Misc:
@@ -941,7 +939,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
941 - (char *) &buffer_defaults); 939 - (char *) &buffer_defaults);
942 int idx = PER_BUFFER_IDX (offset); 940 int idx = PER_BUFFER_IDX (offset);
943 941
944 Lisp_Object tail, buf; 942 Lisp_Object tail;
945 943
946 if (idx <= 0) 944 if (idx <= 0)
947 break; 945 break;
diff --git a/src/doc.c b/src/doc.c
index f722dd49b76..1bb78c0c376 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/ 26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/
27#include <ctype.h>
27 28
28#ifdef HAVE_FCNTL_H 29#ifdef HAVE_FCNTL_H
29#include <fcntl.h> 30#include <fcntl.h>
@@ -51,6 +52,9 @@ Lisp_Object Vdoc_file_name;
51 52
52Lisp_Object Qfunction_documentation; 53Lisp_Object Qfunction_documentation;
53 54
55/* A list of files used to build this Emacs binary. */
56static Lisp_Object Vbuild_files;
57
54extern Lisp_Object Voverriding_local_map; 58extern Lisp_Object Voverriding_local_map;
55 59
56/* For VMS versions with limited file name syntax, 60/* For VMS versions with limited file name syntax,
@@ -581,6 +585,7 @@ the same file name is found in the `doc-directory'. */)
581 register char *p, *end; 585 register char *p, *end;
582 Lisp_Object sym; 586 Lisp_Object sym;
583 char *name; 587 char *name;
588 int skip_file = 0;
584 589
585 CHECK_STRING (filename); 590 CHECK_STRING (filename);
586 591
@@ -618,6 +623,54 @@ the same file name is found in the `doc-directory'. */)
618#endif /* VMS4_4 */ 623#endif /* VMS4_4 */
619#endif /* VMS */ 624#endif /* VMS */
620 625
626 /* Vbuild_files is nil when temacs is run, and non-nil after that. */
627 if (NILP (Vbuild_files))
628 {
629 size_t cp_size = 0;
630 size_t to_read;
631 int nr_read;
632 char *cp = NULL;
633 char *beg, *end;
634
635 fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
636 if (fd < 0)
637 report_file_error ("Opening file buildobj.lst", Qnil);
638
639 filled = 0;
640 for (;;)
641 {
642 cp_size += 1024;
643 to_read = cp_size - 1 - filled;
644 cp = xrealloc (cp, cp_size);
645 nr_read = emacs_read (fd, &cp[filled], to_read);
646 filled += nr_read;
647 if (nr_read < to_read)
648 break;
649 }
650
651 emacs_close (fd);
652 cp[filled] = 0;
653
654 for (beg = cp; *beg; beg = end)
655 {
656 int len;
657
658 while (*beg && isspace (*beg)) ++beg;
659
660 for (end = beg; *end && ! isspace (*end); ++end)
661 if (*end == '/') beg = end+1; /* skip directory part */
662
663 len = end - beg;
664 if (len > 4 && end[-4] == '.' && end[-3] == 'o')
665 len -= 2; /* Just take .o if it ends in .obj */
666
667 if (len > 0)
668 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
669 }
670
671 xfree (cp);
672 }
673
621 fd = emacs_open (name, O_RDONLY, 0); 674 fd = emacs_open (name, O_RDONLY, 0);
622 if (fd < 0) 675 if (fd < 0)
623 report_file_error ("Opening doc string file", 676 report_file_error ("Opening doc string file",
@@ -640,10 +693,28 @@ the same file name is found in the `doc-directory'. */)
640 if (p != end) 693 if (p != end)
641 { 694 {
642 end = (char *) index (p, '\n'); 695 end = (char *) index (p, '\n');
696
697 /* See if this is a file name, and if it is a file in build-files. */
698 if (p[1] == 'S' && end - p > 4 && end[-2] == '.'
699 && (end[-1] == 'o' || end[-1] == 'c'))
700 {
701 int len = end - p - 2;
702 char *fromfile = alloca (len + 1);
703 strncpy (fromfile, &p[2], len);
704 fromfile[len] = 0;
705 if (fromfile[len-1] == 'c')
706 fromfile[len-1] = 'o';
707
708 if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil))
709 skip_file = 1;
710 else
711 skip_file = 0;
712 }
713
643 sym = oblookup (Vobarray, p + 2, 714 sym = oblookup (Vobarray, p + 2,
644 multibyte_chars_in_text (p + 2, end - p - 2), 715 multibyte_chars_in_text (p + 2, end - p - 2),
645 end - p - 2); 716 end - p - 2);
646 if (SYMBOLP (sym)) 717 if (! skip_file && SYMBOLP (sym))
647 { 718 {
648 /* Attach a docstring to a variable? */ 719 /* Attach a docstring to a variable? */
649 if (p[1] == 'V') 720 if (p[1] == 'V')
@@ -756,7 +827,6 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
756 } 827 }
757 else if (strp[0] == '\\' && strp[1] == '[') 828 else if (strp[0] == '\\' && strp[1] == '[')
758 { 829 {
759 Lisp_Object firstkey;
760 int start_idx; 830 int start_idx;
761 831
762 changed = 1; 832 changed = 1;
@@ -919,6 +989,10 @@ syms_of_doc ()
919 doc: /* Name of file containing documentation strings of built-in symbols. */); 989 doc: /* Name of file containing documentation strings of built-in symbols. */);
920 Vdoc_file_name = Qnil; 990 Vdoc_file_name = Qnil;
921 991
992 DEFVAR_LISP ("build-files", &Vbuild_files,
993 doc: /* A list of files used to build this Emacs binary. */);
994 Vbuild_files = Qnil;
995
922 defsubr (&Sdocumentation); 996 defsubr (&Sdocumentation);
923 defsubr (&Sdocumentation_property); 997 defsubr (&Sdocumentation_property);
924 defsubr (&Ssnarf_documentation); 998 defsubr (&Ssnarf_documentation);
diff --git a/src/dosfns.c b/src/dosfns.c
index a64dc31b234..3b3aac0efad 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -110,7 +110,7 @@ Return the updated VECTOR. */)
110 offs = (unsigned long) XINT (address); 110 offs = (unsigned long) XINT (address);
111 CHECK_VECTOR (vector); 111 CHECK_VECTOR (vector);
112 len = XVECTOR (vector)-> size; 112 len = XVECTOR (vector)-> size;
113 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) 113 if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
114 return Qnil; 114 return Qnil;
115 buf = alloca (len); 115 buf = alloca (len);
116 dosmemget (offs, len, buf); 116 dosmemget (offs, len, buf);
@@ -135,7 +135,7 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
135 offs = (unsigned long) XINT (address); 135 offs = (unsigned long) XINT (address);
136 CHECK_VECTOR (vector); 136 CHECK_VECTOR (vector);
137 len = XVECTOR (vector)-> size; 137 len = XVECTOR (vector)-> size;
138 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) 138 if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
139 return Qnil; 139 return Qnil;
140 buf = alloca (len); 140 buf = alloca (len);
141 141
@@ -155,7 +155,7 @@ If the optional argument ALLKEYS is non-nil, the keyboard is mapped for
155all keys; otherwise it is only used when the ALT key is pressed. 155all keys; otherwise it is only used when the ALT key is pressed.
156The current keyboard layout is available in dos-keyboard-code. */) 156The current keyboard layout is available in dos-keyboard-code. */)
157 (country_code, allkeys) 157 (country_code, allkeys)
158 Lisp_Object country_code; 158 Lisp_Object country_code, allkeys;
159{ 159{
160 CHECK_NUMBER (country_code); 160 CHECK_NUMBER (country_code);
161 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys))) 161 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
diff --git a/src/editfns.c b/src/editfns.c
index f6e3a4bb357..0917fadb500 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */
22 22
23#include <config.h> 23#include <config.h>
24#include <sys/types.h> 24#include <sys/types.h>
25#include <stdio.h>
25 26
26#ifdef VMS 27#ifdef VMS
27#include "vms-pwd.h" 28#include "vms-pwd.h"
@@ -33,10 +34,13 @@ Boston, MA 02111-1307, USA. */
33#include <unistd.h> 34#include <unistd.h>
34#endif 35#endif
35 36
36/* Without this, sprintf on Mac OS Classic will produce wrong 37/* systime.h includes <sys/time.h> which, on some systems, is required
37 result. */ 38 for <sys/resource.h>; thus systime.h must be included before
38#ifdef MAC_OS8 39 <sys/resource.h> */
39#include <stdio.h> 40#include "systime.h"
41
42#if defined HAVE_SYS_RESOURCE_H
43#include <sys/resource.h>
40#endif 44#endif
41 45
42#include <ctype.h> 46#include <ctype.h>
@@ -49,8 +53,6 @@ Boston, MA 02111-1307, USA. */
49#include "frame.h" 53#include "frame.h"
50#include "window.h" 54#include "window.h"
51 55
52#include "systime.h"
53
54#ifdef STDC_HEADERS 56#ifdef STDC_HEADERS
55#include <float.h> 57#include <float.h>
56#define MAX_10_EXP DBL_MAX_10_EXP 58#define MAX_10_EXP DBL_MAX_10_EXP
@@ -1370,6 +1372,47 @@ resolution finer than a second. */)
1370 1372
1371 return Flist (3, result); 1373 return Flist (3, result);
1372} 1374}
1375
1376DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time,
1377 0, 0, 0,
1378 doc: /* Return the current run time used by Emacs.
1379The time is returned as a list of three integers. The first has the
1380most significant 16 bits of the seconds, while the second has the
1381least significant 16 bits. The third integer gives the microsecond
1382count.
1383
1384On systems that can't determine the run time, get-internal-run-time
1385does the same thing as current-time. The microsecond count is zero on
1386systems that do not provide resolution finer than a second. */)
1387 ()
1388{
1389#ifdef HAVE_GETRUSAGE
1390 struct rusage usage;
1391 Lisp_Object result[3];
1392 int secs, usecs;
1393
1394 if (getrusage (RUSAGE_SELF, &usage) < 0)
1395 /* This shouldn't happen. What action is appropriate? */
1396 Fsignal (Qerror, Qnil);
1397
1398 /* Sum up user time and system time. */
1399 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
1400 usecs = usage.ru_utime.tv_usec + usage.ru_stime.tv_usec;
1401 if (usecs >= 1000000)
1402 {
1403 usecs -= 1000000;
1404 secs++;
1405 }
1406
1407 XSETINT (result[0], (secs >> 16) & 0xffff);
1408 XSETINT (result[1], (secs >> 0) & 0xffff);
1409 XSETINT (result[2], usecs);
1410
1411 return Flist (3, result);
1412#else
1413 return Fcurrent_time ();
1414#endif
1415}
1373 1416
1374 1417
1375int 1418int
@@ -4447,6 +4490,7 @@ functions if all the text being accessed has this property. */);
4447 defsubr (&Suser_full_name); 4490 defsubr (&Suser_full_name);
4448 defsubr (&Semacs_pid); 4491 defsubr (&Semacs_pid);
4449 defsubr (&Scurrent_time); 4492 defsubr (&Scurrent_time);
4493 defsubr (&Sget_internal_run_time);
4450 defsubr (&Sformat_time_string); 4494 defsubr (&Sformat_time_string);
4451 defsubr (&Sfloat_time); 4495 defsubr (&Sfloat_time);
4452 defsubr (&Sdecode_time); 4496 defsubr (&Sdecode_time);
diff --git a/src/emacs.c b/src/emacs.c
index 5e583137dae..16ae1129840 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1626,16 +1626,14 @@ main (argc, argv
1626 keys_of_minibuf (); 1626 keys_of_minibuf ();
1627 keys_of_window (); 1627 keys_of_window ();
1628 } 1628 }
1629 else 1629 else
1630 { 1630 {
1631 /* 1631 /* Initialization that must be done even if the global variable
1632 Initialization that must be done even if the global variable 1632 initialized is non zero. */
1633 initialized is non zero
1634 */
1635#ifdef HAVE_NTGUI 1633#ifdef HAVE_NTGUI
1636 globals_of_w32fns (); 1634 globals_of_w32fns ();
1637 globals_of_w32menu (); 1635 globals_of_w32menu ();
1638#endif /* end #ifdef HAVE_NTGUI */ 1636#endif /* HAVE_NTGUI */
1639 } 1637 }
1640 1638
1641 init_charset (); 1639 init_charset ();
@@ -2189,16 +2187,19 @@ You must run Emacs in batch mode in order to dump it. */)
2189 if (! noninteractive) 2187 if (! noninteractive)
2190 error ("Dumping Emacs works only in batch mode"); 2188 error ("Dumping Emacs works only in batch mode");
2191 2189
2190#ifdef __linux__
2192 if (heap_bss_diff > MAX_HEAP_BSS_DIFF) 2191 if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
2193 { 2192 {
2194 fprintf (stderr, "**************************************************\n"); 2193 fprintf (stderr, "**************************************************\n");
2195 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); 2194 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
2196 fprintf (stderr, "heap. This usually means that exec-shield or\n"); 2195 fprintf (stderr, "heap (%lu byte). This usually means that exec-shield\n",
2197 fprintf (stderr, "something similar is in effect. The dump may fail\n"); 2196 heap_bss_diff);
2198 fprintf (stderr, "because of this. See the section about exec-shield\n"); 2197 fprintf (stderr, "or something similar is in effect. The dump may\n");
2199 fprintf (stderr, "in etc/PROBLEMS for more information.\n"); 2198 fprintf (stderr, "fail because of this. See the section about \n");
2199 fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
2200 fprintf (stderr, "**************************************************\n"); 2200 fprintf (stderr, "**************************************************\n");
2201 } 2201 }
2202#endif /* __linux__ */
2202 2203
2203 /* Bind `command-line-processed' to nil before dumping, 2204 /* Bind `command-line-processed' to nil before dumping,
2204 so that the dumped Emacs will process its command line 2205 so that the dumped Emacs will process its command line
@@ -2287,7 +2288,7 @@ synchronize_locale (category, plocale, desired_locale)
2287 { 2288 {
2288 *plocale = desired_locale; 2289 *plocale = desired_locale;
2289 setlocale (category, (STRINGP (desired_locale) 2290 setlocale (category, (STRINGP (desired_locale)
2290 ? (char *)(SDATA (desired_locale)) 2291 ? (char *) SDATA (desired_locale)
2291 : "")); 2292 : ""));
2292 } 2293 }
2293} 2294}
diff --git a/src/eval.c b/src/eval.c
index 5fb35cee58b..d1d5d195762 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1996,7 +1996,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1996 struct backtrace backtrace; 1996 struct backtrace backtrace;
1997 struct gcpro gcpro1, gcpro2, gcpro3; 1997 struct gcpro gcpro1, gcpro2, gcpro3;
1998 1998
1999 if (handling_signal || INPUT_BLOCKED_P) 1999 if (handling_signal)
2000 abort (); 2000 abort ();
2001 2001
2002 if (SYMBOLP (form)) 2002 if (SYMBOLP (form))
diff --git a/src/fileio.c b/src/fileio.c
index 83c0866cf06..6f52f792a5b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3371,7 +3371,8 @@ This is the sort of file that holds an ordinary stream of data bytes. */)
3371} 3371}
3372 3372
3373DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, 3373DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
3374 doc: /* Return mode bits of file named FILENAME, as an integer. */) 3374 doc: /* Return mode bits of file named FILENAME, as an integer.
3375Return nil, if file does not exist or is not accessible. */)
3375 (filename) 3376 (filename)
3376 Lisp_Object filename; 3377 Lisp_Object filename;
3377{ 3378{
@@ -5628,17 +5629,21 @@ Lisp_Object
5628auto_save_1 () 5629auto_save_1 ()
5629{ 5630{
5630 struct stat st; 5631 struct stat st;
5632 Lisp_Object modes;
5633
5634 auto_save_mode_bits = 0666;
5631 5635
5632 /* Get visited file's mode to become the auto save file's mode. */ 5636 /* Get visited file's mode to become the auto save file's mode. */
5633 if (! NILP (current_buffer->filename) 5637 if (! NILP (current_buffer->filename))
5634 && stat (SDATA (current_buffer->filename), &st) >= 0) 5638 {
5635 /* But make sure we can overwrite it later! */ 5639 if (stat (SDATA (current_buffer->filename), &st) >= 0)
5636 auto_save_mode_bits = st.st_mode | 0600; 5640 /* But make sure we can overwrite it later! */
5637 else if (! NILP (current_buffer->filename)) 5641 auto_save_mode_bits = st.st_mode | 0600;
5638 /* Remote files don't cooperate with stat. */ 5642 else if ((modes = Ffile_modes (current_buffer->filename),
5639 auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600; 5643 INTEGERP (modes)))
5640 else 5644 /* Remote files don't cooperate with stat. */
5641 auto_save_mode_bits = 0666; 5645 auto_save_mode_bits = XINT (modes) | 0600;
5646 }
5642 5647
5643 return 5648 return
5644 Fwrite_region (Qnil, Qnil, 5649 Fwrite_region (Qnil, Qnil,
@@ -6090,6 +6095,23 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
6090 return Ffile_exists_p (string); 6095 return Ffile_exists_p (string);
6091} 6096}
6092 6097
6098DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p,
6099 Snext_read_file_uses_dialog_p, 0, 0, 0,
6100 doc: /* Return t if a call to `read-file-name' will use a dialog.
6101The return value is only relevant for a call to `read-file-name' that happens
6102before any other event (mouse or keypress) is handeled. */)
6103 ()
6104{
6105#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
6106 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
6107 && use_dialog_box
6108 && use_file_dialog
6109 && have_menus_p ())
6110 return Qt;
6111#endif
6112 return Qnil;
6113}
6114
6093DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, 6115DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0,
6094 doc: /* Read file name, prompting with PROMPT and completing in directory DIR. 6116 doc: /* Read file name, prompting with PROMPT and completing in directory DIR.
6095Value is not expanded---you must call `expand-file-name' yourself. 6117Value is not expanded---you must call `expand-file-name' yourself.
@@ -6222,10 +6244,7 @@ and `read-file-name-function'. */)
6222 GCPRO2 (insdef, default_filename); 6244 GCPRO2 (insdef, default_filename);
6223 6245
6224#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) 6246#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
6225 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 6247 if (! NILP (Fnext_read_file_uses_dialog_p ()))
6226 && use_dialog_box
6227 && use_file_dialog
6228 && have_menus_p ())
6229 { 6248 {
6230 /* If DIR contains a file name, split it. */ 6249 /* If DIR contains a file name, split it. */
6231 Lisp_Object file; 6250 Lisp_Object file;
@@ -6610,6 +6629,7 @@ a non-nil value. */);
6610 6629
6611 defsubr (&Sread_file_name_internal); 6630 defsubr (&Sread_file_name_internal);
6612 defsubr (&Sread_file_name); 6631 defsubr (&Sread_file_name);
6632 defsubr (&Snext_read_file_uses_dialog_p);
6613 6633
6614#ifdef unix 6634#ifdef unix
6615 defsubr (&Sunix_sync); 6635 defsubr (&Sunix_sync);
diff --git a/src/fns.c b/src/fns.c
index cfbcc83fe8d..442eb120b82 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4476,15 +4476,14 @@ sxhash (obj, depth)
4476 hash = XUINT (obj); 4476 hash = XUINT (obj);
4477 break; 4477 break;
4478 4478
4479 case Lisp_Symbol:
4480 hash = sxhash_string (SDATA (SYMBOL_NAME (obj)),
4481 SCHARS (SYMBOL_NAME (obj)));
4482 break;
4483
4484 case Lisp_Misc: 4479 case Lisp_Misc:
4485 hash = XUINT (obj); 4480 hash = XUINT (obj);
4486 break; 4481 break;
4487 4482
4483 case Lisp_Symbol:
4484 obj = SYMBOL_NAME (obj);
4485 /* Fall through. */
4486
4488 case Lisp_String: 4487 case Lisp_String:
4489 hash = sxhash_string (SDATA (obj), SCHARS (obj)); 4488 hash = sxhash_string (SDATA (obj), SCHARS (obj));
4490 break; 4489 break;
diff --git a/src/fontset.c b/src/fontset.c
index 52d3cc555c5..baa56ad3a6f 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1069,14 +1069,14 @@ fontset_pattern_regexp (pattern)
1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) 1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
1070 { 1070 {
1071 /* We must at first update the cached data. */ 1071 /* We must at first update the cached data. */
1072 char *regex, *p0, *p1; 1072 unsigned char *regex, *p0, *p1;
1073 int ndashes = 0, nstars = 0; 1073 int ndashes = 0, nstars = 0;
1074 1074
1075 for (p0 = SDATA (pattern); *p0; p0++) 1075 for (p0 = SDATA (pattern); *p0; p0++)
1076 { 1076 {
1077 if (*p0 == '-') 1077 if (*p0 == '-')
1078 ndashes++; 1078 ndashes++;
1079 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 1079 else if (*p0 == '*')
1080 nstars++; 1080 nstars++;
1081 } 1081 }
1082 1082
@@ -1084,14 +1084,14 @@ fontset_pattern_regexp (pattern)
1084 we convert "*" to "[^-]*" which is much faster in regular 1084 we convert "*" to "[^-]*" which is much faster in regular
1085 expression matching. */ 1085 expression matching. */
1086 if (ndashes < 14) 1086 if (ndashes < 14)
1087 p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1); 1087 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
1088 else 1088 else
1089 p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); 1089 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
1090 1090
1091 *p1++ = '^'; 1091 *p1++ = '^';
1092 for (p0 = (char *) SDATA (pattern); *p0; p0++) 1092 for (p0 = SDATA (pattern); *p0; p0++)
1093 { 1093 {
1094 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 1094 if (*p0 == '*')
1095 { 1095 {
1096 if (ndashes < 14) 1096 if (ndashes < 14)
1097 *p1++ = '.'; 1097 *p1++ = '.';
@@ -1115,31 +1115,35 @@ fontset_pattern_regexp (pattern)
1115} 1115}
1116 1116
1117/* Return ID of the base fontset named NAME. If there's no such 1117/* Return ID of the base fontset named NAME. If there's no such
1118 fontset, return -1. */ 1118 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
1119 0: pattern containing '*' and '?' as wildcards
1120 1: regular expression
1121 2: literal fontset name
1122*/
1119 1123
1120int 1124int
1121fs_query_fontset (name, regexpp) 1125fs_query_fontset (name, name_pattern)
1122 Lisp_Object name; 1126 Lisp_Object name;
1123 int regexpp; 1127 int name_pattern;
1124{ 1128{
1125 Lisp_Object tem; 1129 Lisp_Object tem;
1126 int i; 1130 int i;
1127 1131
1128 name = Fdowncase (name); 1132 name = Fdowncase (name);
1129 if (!regexpp) 1133 if (name_pattern != 1)
1130 { 1134 {
1131 tem = Frassoc (name, Vfontset_alias_alist); 1135 tem = Frassoc (name, Vfontset_alias_alist);
1132 if (NILP (tem)) 1136 if (NILP (tem))
1133 tem = Fassoc (name, Vfontset_alias_alist); 1137 tem = Fassoc (name, Vfontset_alias_alist);
1134 if (CONSP (tem) && STRINGP (XCAR (tem))) 1138 if (CONSP (tem) && STRINGP (XCAR (tem)))
1135 name = XCAR (tem); 1139 name = XCAR (tem);
1136 else 1140 else if (name_pattern == 0)
1137 { 1141 {
1138 tem = fontset_pattern_regexp (name); 1142 tem = fontset_pattern_regexp (name);
1139 if (STRINGP (tem)) 1143 if (STRINGP (tem))
1140 { 1144 {
1141 name = tem; 1145 name = tem;
1142 regexpp = 1; 1146 name_pattern = 1;
1143 } 1147 }
1144 } 1148 }
1145 } 1149 }
@@ -1154,7 +1158,7 @@ fs_query_fontset (name, regexpp)
1154 continue; 1158 continue;
1155 1159
1156 this_name = FONTSET_NAME (fontset); 1160 this_name = FONTSET_NAME (fontset);
1157 if (regexpp 1161 if (name_pattern == 1
1158 ? fast_string_match (name, this_name) >= 0 1162 ? fast_string_match (name, this_name) >= 0
1159 : !strcmp (SDATA (name), SDATA (this_name))) 1163 : !strcmp (SDATA (name), SDATA (this_name)))
1160 return i; 1164 return i;
@@ -1284,7 +1288,11 @@ check_fontset_name (name)
1284 return Vdefault_fontset; 1288 return Vdefault_fontset;
1285 1289
1286 CHECK_STRING (name); 1290 CHECK_STRING (name);
1287 id = fs_query_fontset (name, 0); 1291 /* First try NAME as literal. */
1292 id = fs_query_fontset (name, 2);
1293 if (id < 0)
1294 /* For backward compatibility, try again NAME as pattern. */
1295 id = fs_query_fontset (name, 0);
1288 if (id < 0) 1296 if (id < 0)
1289 error ("Fontset `%s' does not exist", SDATA (name)); 1297 error ("Fontset `%s' does not exist", SDATA (name));
1290 return FONTSET_FROM_ID (id); 1298 return FONTSET_FROM_ID (id);
diff --git a/src/frame.c b/src/frame.c
index d7da02db278..ea60297a282 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4037,7 +4037,7 @@ is a reasonable practice. See also the variable `x-resource-name'. */);
4037 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist, 4037 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
4038 doc: /* Alist of default values for frame creation. 4038 doc: /* Alist of default values for frame creation.
4039These may be set in your init file, like this: 4039These may be set in your init file, like this:
4040 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)) 4040 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)))
4041These override values given in window system configuration data, 4041These override values given in window system configuration data,
4042 including X Windows' defaults database. 4042 including X Windows' defaults database.
4043For values specific to the first Emacs frame, see `initial-frame-alist'. 4043For values specific to the first Emacs frame, see `initial-frame-alist'.
diff --git a/src/fringe.c b/src/fringe.c
index ef4c7631e05..3de55b405cc 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -930,6 +930,7 @@ update_window_fringes (w, force_p)
930 if (force_p 930 if (force_p
931 || row->y != cur->y 931 || row->y != cur->y
932 || row->visible_height != cur->visible_height 932 || row->visible_height != cur->visible_height
933 || row->ends_at_zv_p != cur->ends_at_zv_p
933 || left != cur->left_fringe_bitmap 934 || left != cur->left_fringe_bitmap
934 || right != cur->right_fringe_bitmap 935 || right != cur->right_fringe_bitmap
935 || left_face_id != cur->left_fringe_face_id 936 || left_face_id != cur->left_fringe_face_id
@@ -953,6 +954,9 @@ update_window_fringes (w, force_p)
953 row->right_fringe_bitmap = right; 954 row->right_fringe_bitmap = right;
954 row->left_fringe_face_id = left_face_id; 955 row->left_fringe_face_id = left_face_id;
955 row->right_fringe_face_id = right_face_id; 956 row->right_fringe_face_id = right_face_id;
957
958 if (rn > 0 && row->redraw_fringe_bitmaps_p)
959 row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1;
956 } 960 }
957 961
958 return redraw_p; 962 return redraw_p;
@@ -1056,7 +1060,7 @@ compute_fringe_widths (f, redraw)
1056 1060
1057/* Free resources used by a user-defined bitmap. */ 1061/* Free resources used by a user-defined bitmap. */
1058 1062
1059int 1063void
1060destroy_fringe_bitmap (n) 1064destroy_fringe_bitmap (n)
1061 int n; 1065 int n;
1062{ 1066{
@@ -1367,7 +1371,6 @@ Return nil if POS is not visible in WINDOW. */)
1367 Lisp_Object pos, window; 1371 Lisp_Object pos, window;
1368{ 1372{
1369 struct window *w; 1373 struct window *w;
1370 struct buffer *old_buffer = NULL;
1371 struct glyph_row *row; 1374 struct glyph_row *row;
1372 int textpos; 1375 int textpos;
1373 1376
diff --git a/src/gtkutil.c b/src/gtkutil.c
index e1331891140..f5f05709e48 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1131,7 +1131,7 @@ enum
1131}; 1131};
1132 1132
1133#ifdef HAVE_GTK_FILE_BOTH 1133#ifdef HAVE_GTK_FILE_BOTH
1134static int use_old_gtk_file_dialog; 1134int use_old_gtk_file_dialog;
1135#endif 1135#endif
1136 1136
1137 1137
@@ -1178,8 +1178,24 @@ xg_get_file_with_chooser (f, prompt, default_filename, mustmatch_p, only_dir_p)
1178 1178
1179 1179
1180 if (default_filename) 1180 if (default_filename)
1181 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), 1181 {
1182 default_filename); 1182 Lisp_Object file;
1183 struct gcpro gcpro1;
1184 GCPRO1 (file);
1185
1186 /* File chooser does not understand ~/... in the file name. It must be
1187 an absolute name starting with /. */
1188 if (default_filename[0] != '/')
1189 {
1190 file = Fexpand_file_name (build_string (default_filename), Qnil);
1191 default_filename = SDATA (file);
1192 }
1193
1194 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
1195 default_filename);
1196
1197 UNGCPRO;
1198 }
1183 1199
1184 gtk_widget_show (filewin); 1200 gtk_widget_show (filewin);
1185 1201
@@ -3538,14 +3554,6 @@ xg_initialize ()
3538 "gtk-key-theme-name", 3554 "gtk-key-theme-name",
3539 "Emacs", 3555 "Emacs",
3540 EMACS_CLASS); 3556 EMACS_CLASS);
3541
3542#ifdef HAVE_GTK_FILE_BOTH
3543 DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
3544 doc: /* *Non-nil means that the old GTK file selection dialog is used.
3545 If nil the new GTK file chooser is used instead. To turn off
3546 all file dialogs set the variable `use-file-dialog'. */);
3547 use_old_gtk_file_dialog = 0;
3548#endif
3549} 3557}
3550 3558
3551#endif /* USE_GTK */ 3559#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index b2e2c5f2fff..44e82885d7f 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -126,6 +126,10 @@ typedef struct _widget_value
126 struct _widget_value *free_list; 126 struct _widget_value *free_list;
127} widget_value; 127} widget_value;
128 128
129#ifdef HAVE_GTK_FILE_BOTH
130extern int use_old_gtk_file_dialog;
131#endif
132
129extern widget_value *malloc_widget_value P_ ((void)); 133extern widget_value *malloc_widget_value P_ ((void));
130extern void free_widget_value P_ ((widget_value *)); 134extern void free_widget_value P_ ((widget_value *));
131 135
diff --git a/src/intervals.h b/src/intervals.h
index a8b011f4d92..f55a68667f3 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -84,9 +84,14 @@ struct interval
84#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \ 84#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
85 || STRINGP ((Lisp_Object){(EMACS_INT)(i)})) 85 || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
86#endif 86#endif
87
88#ifdef ENABLE_CHECKING
87#define NULL_INTERVAL_P(i) \ 89#define NULL_INTERVAL_P(i) \
88 (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL) 90 (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
89/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */ 91/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */
92#else
93#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL)
94#endif
90 95
91/* True if this interval has no right child. */ 96/* True if this interval has no right child. */
92#define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL) 97#define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL)
@@ -289,6 +294,7 @@ extern INTERVAL balance_intervals P_ ((INTERVAL));
289extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *, 294extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *,
290 int, int)); 295 int, int));
291extern INTERVAL copy_intervals P_ ((INTERVAL, int, int)); 296extern INTERVAL copy_intervals P_ ((INTERVAL, int, int));
297extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object));
292extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object)); 298extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object));
293extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int)); 299extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int));
294extern void move_if_not_intangible P_ ((int)); 300extern void move_if_not_intangible P_ ((int));
diff --git a/src/keyboard.c b/src/keyboard.c
index 3360b11850e..c89a86eb80f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1840,6 +1840,14 @@ command_loop_1 ()
1840 1840
1841 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) 1841 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1842 { 1842 {
1843 /* Setting transient-mark-mode to `only' is a way of
1844 turning it on for just one command. */
1845
1846 if (EQ (Vtransient_mark_mode, Qidentity))
1847 Vtransient_mark_mode = Qnil;
1848 if (EQ (Vtransient_mark_mode, Qonly))
1849 Vtransient_mark_mode = Qidentity;
1850
1843 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) 1851 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
1844 { 1852 {
1845 /* We could also call `deactivate'mark'. */ 1853 /* We could also call `deactivate'mark'. */
@@ -1855,16 +1863,6 @@ command_loop_1 ()
1855 call1 (Vrun_hooks, intern ("activate-mark-hook")); 1863 call1 (Vrun_hooks, intern ("activate-mark-hook"));
1856 } 1864 }
1857 1865
1858 /* Setting transient-mark-mode to `only' is a way of
1859 turning it on for just one command. */
1860 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1861 {
1862 if (EQ (Vtransient_mark_mode, Qidentity))
1863 Vtransient_mark_mode = Qnil;
1864 if (EQ (Vtransient_mark_mode, Qonly))
1865 Vtransient_mark_mode = Qidentity;
1866 }
1867
1868 finalize: 1866 finalize:
1869 1867
1870 if (current_buffer == prev_buffer 1868 if (current_buffer == prev_buffer
@@ -3697,36 +3695,26 @@ kbd_buffer_store_event_hold (event, hold_quit)
3697 Discard the event if it would fill the last slot. */ 3695 Discard the event if it would fill the last slot. */
3698 if (kbd_fetch_ptr - 1 != kbd_store_ptr) 3696 if (kbd_fetch_ptr - 1 != kbd_store_ptr)
3699 { 3697 {
3698 *kbd_store_ptr = *event;
3699 ++kbd_store_ptr;
3700 }
3701}
3700 3702
3701#if 0 /* The SELECTION_REQUEST_EVENT case looks bogus, and it's error
3702 prone to assign individual members for other events, in case
3703 the input_event structure is changed. --2000-07-13, gerd. */
3704 struct input_event *sp = kbd_store_ptr;
3705 sp->kind = event->kind;
3706 if (event->kind == SELECTION_REQUEST_EVENT)
3707 {
3708 /* We must not use the ordinary copying code for this case,
3709 since `part' is an enum and copying it might not copy enough
3710 in this case. */
3711 bcopy (event, (char *) sp, sizeof (*event));
3712 }
3713 else
3714 3703
3715 { 3704/* Put an input event back in the head of the event queue. */
3716 sp->code = event->code;
3717 sp->part = event->part;
3718 sp->frame_or_window = event->frame_or_window;
3719 sp->arg = event->arg;
3720 sp->modifiers = event->modifiers;
3721 sp->x = event->x;
3722 sp->y = event->y;
3723 sp->timestamp = event->timestamp;
3724 }
3725#else
3726 *kbd_store_ptr = *event;
3727#endif
3728 3705
3729 ++kbd_store_ptr; 3706void
3707kbd_buffer_unget_event (event)
3708 register struct input_event *event;
3709{
3710 if (kbd_fetch_ptr == kbd_buffer)
3711 kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE;
3712
3713 /* Don't let the very last slot in the buffer become full, */
3714 if (kbd_fetch_ptr - 1 != kbd_store_ptr)
3715 {
3716 --kbd_fetch_ptr;
3717 *kbd_fetch_ptr = *event;
3730 } 3718 }
3731} 3719}
3732 3720
@@ -3941,7 +3929,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3941 /* These two kinds of events get special handling 3929 /* These two kinds of events get special handling
3942 and don't actually appear to the command loop. 3930 and don't actually appear to the command loop.
3943 We return nil for them. */ 3931 We return nil for them. */
3944 if (event->kind == SELECTION_REQUEST_EVENT) 3932 if (event->kind == SELECTION_REQUEST_EVENT
3933 || event->kind == SELECTION_CLEAR_EVENT)
3945 { 3934 {
3946#ifdef HAVE_X11 3935#ifdef HAVE_X11
3947 struct input_event copy; 3936 struct input_event copy;
@@ -3952,7 +3941,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3952 copy = *event; 3941 copy = *event;
3953 kbd_fetch_ptr = event + 1; 3942 kbd_fetch_ptr = event + 1;
3954 input_pending = readable_events (0); 3943 input_pending = readable_events (0);
3955 x_handle_selection_request (&copy); 3944 x_handle_selection_event (&copy);
3956#else 3945#else
3957 /* We're getting selection request events, but we don't have 3946 /* We're getting selection request events, but we don't have
3958 a window system. */ 3947 a window system. */
@@ -3960,22 +3949,6 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3960#endif 3949#endif
3961 } 3950 }
3962 3951
3963 else if (event->kind == SELECTION_CLEAR_EVENT)
3964 {
3965#ifdef HAVE_X11
3966 struct input_event copy;
3967
3968 /* Remove it from the buffer before processing it. */
3969 copy = *event;
3970 kbd_fetch_ptr = event + 1;
3971 input_pending = readable_events (0);
3972 x_handle_selection_clear (&copy);
3973#else
3974 /* We're getting selection request events, but we don't have
3975 a window system. */
3976 abort ();
3977#endif
3978 }
3979#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) 3952#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS)
3980 else if (event->kind == DELETE_WINDOW_EVENT) 3953 else if (event->kind == DELETE_WINDOW_EVENT)
3981 { 3954 {
@@ -4200,7 +4173,8 @@ swallow_events (do_display)
4200 4173
4201 /* These two kinds of events get special handling 4174 /* These two kinds of events get special handling
4202 and don't actually appear to the command loop. */ 4175 and don't actually appear to the command loop. */
4203 if (event->kind == SELECTION_REQUEST_EVENT) 4176 if (event->kind == SELECTION_REQUEST_EVENT
4177 || event->kind == SELECTION_CLEAR_EVENT)
4204 { 4178 {
4205#ifdef HAVE_X11 4179#ifdef HAVE_X11
4206 struct input_event copy; 4180 struct input_event copy;
@@ -4211,25 +4185,7 @@ swallow_events (do_display)
4211 copy = *event; 4185 copy = *event;
4212 kbd_fetch_ptr = event + 1; 4186 kbd_fetch_ptr = event + 1;
4213 input_pending = readable_events (0); 4187 input_pending = readable_events (0);
4214 x_handle_selection_request (&copy); 4188 x_handle_selection_event (&copy);
4215#else
4216 /* We're getting selection request events, but we don't have
4217 a window system. */
4218 abort ();
4219#endif
4220 }
4221
4222 else if (event->kind == SELECTION_CLEAR_EVENT)
4223 {
4224#ifdef HAVE_X11
4225 struct input_event copy;
4226
4227 /* Remove it from the buffer before processing it, */
4228 copy = *event;
4229
4230 kbd_fetch_ptr = event + 1;
4231 input_pending = readable_events (0);
4232 x_handle_selection_clear (&copy);
4233#else 4189#else
4234 /* We're getting selection request events, but we don't have 4190 /* We're getting selection request events, but we don't have
4235 a window system. */ 4191 a window system. */
@@ -6670,7 +6626,6 @@ read_avail_input (expected)
6670 6626
6671 if (read_socket_hook) 6627 if (read_socket_hook)
6672 { 6628 {
6673 int discard = 0;
6674 int nr; 6629 int nr;
6675 struct input_event hold_quit; 6630 struct input_event hold_quit;
6676 6631
@@ -11454,7 +11409,8 @@ mark_kboards ()
11454 { 11409 {
11455 if (event == kbd_buffer + KBD_BUFFER_SIZE) 11410 if (event == kbd_buffer + KBD_BUFFER_SIZE)
11456 event = kbd_buffer; 11411 event = kbd_buffer;
11457 if (event->kind != SELECTION_REQUEST_EVENT) 11412 if (event->kind != SELECTION_REQUEST_EVENT
11413 && event->kind != SELECTION_CLEAR_EVENT)
11458 { 11414 {
11459 mark_object (event->x); 11415 mark_object (event->x);
11460 mark_object (event->y); 11416 mark_object (event->y);
diff --git a/src/keyboard.h b/src/keyboard.h
index 08cb934d3fe..8df3a2452a7 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -330,6 +330,7 @@ extern int lucid_event_type_list_p P_ ((Lisp_Object));
330extern void kbd_buffer_store_event P_ ((struct input_event *)); 330extern void kbd_buffer_store_event P_ ((struct input_event *));
331extern void kbd_buffer_store_event_hold P_ ((struct input_event *, 331extern void kbd_buffer_store_event_hold P_ ((struct input_event *,
332 struct input_event *)); 332 struct input_event *));
333extern void kbd_buffer_unget_event P_ ((struct input_event *));
333#ifdef POLL_FOR_INPUT 334#ifdef POLL_FOR_INPUT
334extern void poll_for_input_1 P_ ((void)); 335extern void poll_for_input_1 P_ ((void));
335#endif 336#endif
diff --git a/src/keymap.c b/src/keymap.c
index 1711e7fbc36..1a86caff4c4 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -214,13 +214,13 @@ when reading a key-sequence to be looked-up in this keymap. */)
214 (map) 214 (map)
215 Lisp_Object map; 215 Lisp_Object map;
216{ 216{
217 map = get_keymap (map, 0, 0);
217 while (CONSP (map)) 218 while (CONSP (map))
218 { 219 {
219 register Lisp_Object tem; 220 Lisp_Object tem = XCAR (map);
220 tem = Fcar (map);
221 if (STRINGP (tem)) 221 if (STRINGP (tem))
222 return tem; 222 return tem;
223 map = Fcdr (map); 223 map = XCDR (map);
224 } 224 }
225 return Qnil; 225 return Qnil;
226} 226}
diff --git a/src/lisp.h b/src/lisp.h
index 19995c58f54..b49602c1303 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2302,6 +2302,7 @@ EXFUN (Felt, 2);
2302EXFUN (Fmember, 2); 2302EXFUN (Fmember, 2);
2303EXFUN (Frassq, 2); 2303EXFUN (Frassq, 2);
2304EXFUN (Fdelq, 2); 2304EXFUN (Fdelq, 2);
2305EXFUN (Fdelete, 2);
2305EXFUN (Fsort, 2); 2306EXFUN (Fsort, 2);
2306EXFUN (Freverse, 1); 2307EXFUN (Freverse, 1);
2307EXFUN (Fnreverse, 1); 2308EXFUN (Fnreverse, 1);
@@ -2386,6 +2387,7 @@ extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
2386extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); 2387extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
2387extern void adjust_after_insert P_ ((int, int, int, int, int)); 2388extern void adjust_after_insert P_ ((int, int, int, int, int));
2388extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); 2389extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
2390extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int));
2389extern void syms_of_insdel P_ ((void)); 2391extern void syms_of_insdel P_ ((void));
2390 2392
2391/* Defined in dispnew.c */ 2393/* Defined in dispnew.c */
@@ -3179,6 +3181,11 @@ extern void syms_of_xterm P_ ((void));
3179 3181
3180/* Defined in getloadavg.c */ 3182/* Defined in getloadavg.c */
3181extern int getloadavg P_ ((double [], int)); 3183extern int getloadavg P_ ((double [], int));
3184
3185#ifdef MSDOS
3186/* Defined in msdos.c */
3187EXFUN (Fmsdos_downcase_filename, 1);
3188#endif
3182 3189
3183/* Nonzero means Emacs has already been initialized. 3190/* Nonzero means Emacs has already been initialized.
3184 Used during startup to detect startup of dumped Emacs. */ 3191 Used during startup to detect startup of dumped Emacs. */
diff --git a/src/lread.c b/src/lread.c
index 0634a4c7c30..5e733f22a6d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2581,9 +2581,9 @@ read1 (readcharfun, pch, first_in_list)
2581 2581
2582 if (next_char <= 040 2582 if (next_char <= 040
2583 || (next_char < 0200 2583 || (next_char < 0200
2584 && index ("\"';([#?", next_char) 2584 && (index ("\"';([#?", next_char)
2585 || (!first_in_list && next_char == '`') 2585 || (!first_in_list && next_char == '`')
2586 || (new_backquote_flag && next_char == ','))) 2586 || (new_backquote_flag && next_char == ','))))
2587 { 2587 {
2588 *pch = c; 2588 *pch = c;
2589 return Qnil; 2589 return Qnil;
@@ -3819,7 +3819,7 @@ init_lread ()
3819 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is 3819 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3820 almost never correct, thereby causing a warning to be printed out that 3820 almost never correct, thereby causing a warning to be printed out that
3821 confuses users. Since PATH_LOADSEARCH is always overridden by the 3821 confuses users. Since PATH_LOADSEARCH is always overridden by the
3822 EMACSLOADPATH environment variable below, disable the warning on NT. 3822 EMACSLOADPATH environment variable below, disable the warning on NT.
3823 Also, when using the "self-contained" option for Carbon Emacs for MacOSX, 3823 Also, when using the "self-contained" option for Carbon Emacs for MacOSX,
3824 the "standard" paths may not exist and would be overridden by 3824 the "standard" paths may not exist and would be overridden by
3825 EMACSLOADPATH as on NT. Since this depends on how the executable 3825 EMACSLOADPATH as on NT. Since this depends on how the executable
diff --git a/src/macros.c b/src/macros.c
index d0219a3be04..09ae87b0a59 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -392,7 +392,9 @@ syms_of_macros ()
392 defsubr (&Sstore_kbd_macro_event); 392 defsubr (&Sstore_kbd_macro_event);
393 393
394 DEFVAR_KBOARD ("defining-kbd-macro", defining_kbd_macro, 394 DEFVAR_KBOARD ("defining-kbd-macro", defining_kbd_macro,
395 doc: /* Non-nil while a keyboard macro is being defined. Don't set this! */); 395 doc: /* Non-nil while a keyboard macro is being defined. Don't set this!
396The value is the symbol `append' while appending to the definition of
397an existing macro. */);
396 398
397 DEFVAR_LISP ("executing-macro", &Vexecuting_macro, 399 DEFVAR_LISP ("executing-macro", &Vexecuting_macro,
398 doc: /* Currently executing keyboard macro (string or vector); nil if none executing. */); 400 doc: /* Currently executing keyboard macro (string or vector); nil if none executing. */);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 5918e771399..bd8b3ba1e36 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -171,6 +171,9 @@ temacs: $(BLD) $(TEMACS)
171$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) 171$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES)
172 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 172 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
173 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 20 173 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 20
174 echo $(OBJ0) > $(BLD)/buildobj.lst
175 echo $(OBJ1) >> $(BLD)/buildobj.lst
176 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
174 177
175bootstrap: bootstrap-emacs 178bootstrap: bootstrap-emacs
176 179
diff --git a/src/msdos.c b/src/msdos.c
index 0020be310a6..f863984fac3 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2320,7 +2320,7 @@ IT_set_frame_parameters (f, alist)
2320 2320
2321 /* If we are creating a new frame, begin with the original screen colors 2321 /* If we are creating a new frame, begin with the original screen colors
2322 used for the initial frame. */ 2322 used for the initial frame. */
2323 if (alist == Vdefault_frame_alist 2323 if (EQ (alist, Vdefault_frame_alist)
2324 && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) 2324 && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1)
2325 { 2325 {
2326 FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; 2326 FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0];
diff --git a/src/print.c b/src/print.c
index 84625a89edd..3a21ef29560 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2183,6 +2183,15 @@ print_object (obj, printcharfun, escapeflag)
2183 PRINTCHAR ('>'); 2183 PRINTCHAR ('>');
2184 break; 2184 break;
2185 2185
2186 case Lisp_Misc_Save_Value:
2187 strout ("#<save_value ", -1, -1, printcharfun, 0);
2188 sprintf(buf, "ptr=0x%08lx int=%d",
2189 (unsigned long) XSAVE_VALUE (obj)->pointer,
2190 XSAVE_VALUE (obj)->integer);
2191 strout (buf, -1, -1, printcharfun, 0);
2192 PRINTCHAR ('>');
2193 break;
2194
2186 default: 2195 default:
2187 goto badtype; 2196 goto badtype;
2188 } 2197 }
diff --git a/src/process.c b/src/process.c
index 76967cd7ac2..699c99cdcb8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2723,7 +2723,6 @@ usage: (make-network-process &rest ARGS) */)
2723 int xerrno = 0; 2723 int xerrno = 0;
2724 int s = -1, outch, inch; 2724 int s = -1, outch, inch;
2725 struct gcpro gcpro1; 2725 struct gcpro gcpro1;
2726 int retry = 0;
2727 int count = SPECPDL_INDEX (); 2726 int count = SPECPDL_INDEX ();
2728 int count1; 2727 int count1;
2729 Lisp_Object QCaddress; /* one of QClocal or QCremote */ 2728 Lisp_Object QCaddress; /* one of QClocal or QCremote */
@@ -3024,6 +3023,8 @@ usage: (make-network-process &rest ARGS) */)
3024 { 3023 {
3025 int optn, optbits; 3024 int optn, optbits;
3026 3025
3026 retry_connect:
3027
3027 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); 3028 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
3028 if (s < 0) 3029 if (s < 0)
3029 { 3030 {
@@ -3102,8 +3103,6 @@ usage: (make-network-process &rest ARGS) */)
3102 break; 3103 break;
3103 } 3104 }
3104 3105
3105 retry_connect:
3106
3107 immediate_quit = 1; 3106 immediate_quit = 1;
3108 QUIT; 3107 QUIT;
3109 3108
@@ -3145,22 +3144,13 @@ usage: (make-network-process &rest ARGS) */)
3145 3144
3146 immediate_quit = 0; 3145 immediate_quit = 0;
3147 3146
3148 if (xerrno == EINTR)
3149 goto retry_connect;
3150 if (xerrno == EADDRINUSE && retry < 20)
3151 {
3152 /* A delay here is needed on some FreeBSD systems,
3153 and it is harmless, since this retrying takes time anyway
3154 and should be infrequent. */
3155 Fsleep_for (make_number (1), Qnil);
3156 retry++;
3157 goto retry_connect;
3158 }
3159
3160 /* Discard the unwind protect closing S. */ 3147 /* Discard the unwind protect closing S. */
3161 specpdl_ptr = specpdl + count1; 3148 specpdl_ptr = specpdl + count1;
3162 emacs_close (s); 3149 emacs_close (s);
3163 s = -1; 3150 s = -1;
3151
3152 if (xerrno == EINTR)
3153 goto retry_connect;
3164 } 3154 }
3165 3155
3166 if (s >= 0) 3156 if (s >= 0)
diff --git a/src/window.c b/src/window.c
index b6738457de4..976e2b505cf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -204,7 +204,7 @@ static int window_initialized;
204Lisp_Object Qwindow_configuration_change_hook; 204Lisp_Object Qwindow_configuration_change_hook;
205Lisp_Object Vwindow_configuration_change_hook; 205Lisp_Object Vwindow_configuration_change_hook;
206 206
207/* Nonzero means scroll commands try to put point 207/* Non-nil means scroll commands try to put point
208 at the same screen height as previously. */ 208 at the same screen height as previously. */
209 209
210Lisp_Object Vscroll_preserve_screen_position; 210Lisp_Object Vscroll_preserve_screen_position;
@@ -4523,7 +4523,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4523 start = it.current.pos; 4523 start = it.current.pos;
4524 } 4524 }
4525 4525
4526 /* If scroll_preserve_screen_position is non-zero, we try to set 4526 /* If scroll_preserve_screen_position is non-nil, we try to set
4527 point in the same window line as it is now, so get that line. */ 4527 point in the same window line as it is now, so get that line. */
4528 if (!NILP (Vscroll_preserve_screen_position)) 4528 if (!NILP (Vscroll_preserve_screen_position))
4529 { 4529 {
diff --git a/src/xdisp.c b/src/xdisp.c
index 22f870d16ef..5498bbcde00 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16142,27 +16142,31 @@ pint2hrstr (buf, width, d)
16142 { 16142 {
16143 tenths = remainder / 100; 16143 tenths = remainder / 100;
16144 if (50 <= remainder % 100) 16144 if (50 <= remainder % 100)
16145 if (tenths < 9) 16145 {
16146 tenths++; 16146 if (tenths < 9)
16147 else 16147 tenths++;
16148 { 16148 else
16149 quotient++; 16149 {
16150 if (quotient == 10) 16150 quotient++;
16151 tenths = -1; 16151 if (quotient == 10)
16152 else 16152 tenths = -1;
16153 tenths = 0; 16153 else
16154 } 16154 tenths = 0;
16155 }
16156 }
16155 } 16157 }
16156 else 16158 else
16157 if (500 <= remainder) 16159 if (500 <= remainder)
16158 if (quotient < 999) 16160 {
16159 quotient++; 16161 if (quotient < 999)
16160 else 16162 quotient++;
16161 { 16163 else
16162 quotient = 1; 16164 {
16163 exponent++; 16165 quotient = 1;
16164 tenths = 0; 16166 exponent++;
16165 } 16167 tenths = 0;
16168 }
16169 }
16166 } 16170 }
16167 16171
16168 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */ 16172 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */
@@ -18455,7 +18459,7 @@ produce_image_glyph (it)
18455{ 18459{
18456 struct image *img; 18460 struct image *img;
18457 struct face *face; 18461 struct face *face;
18458 int face_ascent, glyph_ascent; 18462 int glyph_ascent;
18459 struct glyph_slice slice; 18463 struct glyph_slice slice;
18460 18464
18461 xassert (it->what == IT_IMAGE); 18465 xassert (it->what == IT_IMAGE);
@@ -18538,7 +18542,7 @@ produce_image_glyph (it)
18538 18542
18539#if 0 /* this breaks image tiling */ 18543#if 0 /* this breaks image tiling */
18540 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ 18544 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
18541 face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); 18545 int face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
18542 if (face_ascent > it->ascent) 18546 if (face_ascent > it->ascent)
18543 it->ascent = it->phys_ascent = face_ascent; 18547 it->ascent = it->phys_ascent = face_ascent;
18544#endif 18548#endif
@@ -20558,19 +20562,20 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop)
20558 int past_end = 0; 20562 int past_end = 0;
20559 20563
20560 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 20564 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
20565 if (charpos < MATRIX_ROW_START_CHARPOS (first))
20566 {
20567 *x = first->x;
20568 *y = first->y;
20569 *hpos = 0;
20570 *vpos = MATRIX_ROW_VPOS (first, w->current_matrix);
20571 return 1;
20572 }
20573
20561 row = row_containing_pos (w, charpos, first, NULL, 0); 20574 row = row_containing_pos (w, charpos, first, NULL, 0);
20562 if (row == NULL) 20575 if (row == NULL)
20563 { 20576 {
20564 if (charpos < MATRIX_ROW_START_CHARPOS (first)) 20577 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20565 { 20578 past_end = 1;
20566 *x = *y = *hpos = *vpos = 0;
20567 return 1;
20568 }
20569 else
20570 {
20571 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20572 past_end = 1;
20573 }
20574 } 20579 }
20575 20580
20576 *x = row->x; 20581 *x = row->x;
@@ -21116,8 +21121,10 @@ note_mouse_highlight (f, x, y)
21116 /* Which window is that in? */ 21121 /* Which window is that in? */
21117 window = window_from_coordinates (f, x, y, &part, 0, 0, 1); 21122 window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
21118 21123
21119 /* If we were displaying active text in another window, clear that. */ 21124 /* If we were displaying active text in another window, clear that.
21120 if (! EQ (window, dpyinfo->mouse_face_window)) 21125 Also clear if we move out of text area in same window. */
21126 if (! EQ (window, dpyinfo->mouse_face_window)
21127 || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window)))
21121 clear_mouse_face (dpyinfo); 21128 clear_mouse_face (dpyinfo);
21122 21129
21123 /* Not on a window -> return. */ 21130 /* Not on a window -> return. */
diff --git a/src/xfaces.c b/src/xfaces.c
index 19369353f5e..fc2cd6b0af4 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3511,8 +3511,8 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p)
3511 call into lisp. */ 3511 call into lisp. */
3512 3512
3513Lisp_Object 3513Lisp_Object
3514merge_face_heights (from, to, invalid, gcpro) 3514merge_face_heights (from, to, invalid)
3515 Lisp_Object from, to, invalid, gcpro; 3515 Lisp_Object from, to, invalid;
3516{ 3516{
3517 Lisp_Object result = invalid; 3517 Lisp_Object result = invalid;
3518 3518
@@ -3537,16 +3537,11 @@ merge_face_heights (from, to, invalid, gcpro)
3537 /* Call function with current height as argument. 3537 /* Call function with current height as argument.
3538 From is the new height. */ 3538 From is the new height. */
3539 Lisp_Object args[2]; 3539 Lisp_Object args[2];
3540 struct gcpro gcpro1;
3541
3542 GCPRO1 (gcpro);
3543 3540
3544 args[0] = from; 3541 args[0] = from;
3545 args[1] = to; 3542 args[1] = to;
3546 result = safe_call (2, args); 3543 result = safe_call (2, args);
3547 3544
3548 UNGCPRO;
3549
3550 /* Ensure that if TO was absolute, so is the result. */ 3545 /* Ensure that if TO was absolute, so is the result. */
3551 if (INTEGERP (to) && !INTEGERP (result)) 3546 if (INTEGERP (to) && !INTEGERP (result))
3552 result = invalid; 3547 result = invalid;
@@ -3599,8 +3594,7 @@ merge_face_vectors (f, from, to, named_merge_points)
3599 if (!UNSPECIFIEDP (from[i])) 3594 if (!UNSPECIFIEDP (from[i]))
3600 { 3595 {
3601 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) 3596 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
3602 to[i] = merge_face_heights (from[i], to[i], to[i], 3597 to[i] = merge_face_heights (from[i], to[i], to[i]);
3603 named_merge_points);
3604 else 3598 else
3605 to[i] = from[i]; 3599 to[i] = from[i];
3606 } 3600 }
@@ -3627,11 +3621,16 @@ merge_named_face (f, face_name, to, named_merge_points)
3627 if (push_named_merge_point (&named_merge_point, 3621 if (push_named_merge_point (&named_merge_point,
3628 face_name, &named_merge_points)) 3622 face_name, &named_merge_points))
3629 { 3623 {
3624 struct gcpro gcpro1;
3630 Lisp_Object from[LFACE_VECTOR_SIZE]; 3625 Lisp_Object from[LFACE_VECTOR_SIZE];
3631 int ok = get_lface_attributes (f, face_name, from, 0); 3626 int ok = get_lface_attributes (f, face_name, from, 0);
3632 3627
3633 if (ok) 3628 if (ok)
3634 merge_face_vectors (f, from, to, named_merge_points); 3629 {
3630 GCPRO1 (named_merge_point.face_name);
3631 merge_face_vectors (f, from, to, named_merge_points);
3632 UNGCPRO;
3633 }
3635 3634
3636 return ok; 3635 return ok;
3637 } 3636 }
@@ -3722,8 +3721,7 @@ merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
3722 else if (EQ (keyword, QCheight)) 3721 else if (EQ (keyword, QCheight))
3723 { 3722 {
3724 Lisp_Object new_height = 3723 Lisp_Object new_height =
3725 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], 3724 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], Qnil);
3726 Qnil, Qnil);
3727 3725
3728 if (! NILP (new_height)) 3726 if (! NILP (new_height))
3729 to[LFACE_HEIGHT_INDEX] = new_height; 3727 to[LFACE_HEIGHT_INDEX] = new_height;
@@ -4110,7 +4108,7 @@ FRAME 0 means change the face on all frames, and change the default
4110 /* The default face must have an absolute size, 4108 /* The default face must have an absolute size,
4111 otherwise, we do a test merge with a random 4109 otherwise, we do a test merge with a random
4112 height to see if VALUE's ok. */ 4110 height to see if VALUE's ok. */
4113 : merge_face_heights (value, make_number (10), Qnil, Qnil)); 4111 : merge_face_heights (value, make_number (10), Qnil));
4114 4112
4115 if (!INTEGERP (test) || XINT (test) <= 0) 4113 if (!INTEGERP (test) || XINT (test) <= 0)
4116 signal_error ("Invalid face height", value); 4114 signal_error ("Invalid face height", value);
@@ -4824,7 +4822,7 @@ the result will be absolute, otherwise it will be relative. */)
4824 if (EQ (value1, Qunspecified)) 4822 if (EQ (value1, Qunspecified))
4825 return value2; 4823 return value2;
4826 else if (EQ (attribute, QCheight)) 4824 else if (EQ (attribute, QCheight))
4827 return merge_face_heights (value1, value2, value1, Qnil); 4825 return merge_face_heights (value1, value2, value1);
4828 else 4826 else
4829 return value1; 4827 return value1;
4830} 4828}
diff --git a/src/xfns.c b/src/xfns.c
index 8ddb29310df..46bce6536c8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5541,6 +5541,14 @@ Chinese, Japanese, and Korean. */);
5541 Fprovide (intern ("x-toolkit"), Qnil); 5541 Fprovide (intern ("x-toolkit"), Qnil);
5542 Fprovide (intern ("gtk"), Qnil); 5542 Fprovide (intern ("gtk"), Qnil);
5543 5543
5544#ifdef HAVE_GTK_FILE_BOTH
5545 DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
5546 doc: /* *Non-nil means that the old GTK file selection dialog is used.
5547If nil the new GTK file chooser is used instead. To turn off
5548all file dialogs set the variable `use-file-dialog'. */);
5549 use_old_gtk_file_dialog = 0;
5550#endif
5551
5544 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, 5552 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
5545 doc: /* Version info for GTK+. */); 5553 doc: /* Version info for GTK+. */);
5546 { 5554 {
diff --git a/src/xmenu.c b/src/xmenu.c
index 0da826e4cb0..f7e24e66838 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -115,7 +115,7 @@ extern XtAppContext Xt_app_con;
115 115
116static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); 116static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **));
117static void popup_get_selection P_ ((XEvent *, struct x_display_info *, 117static void popup_get_selection P_ ((XEvent *, struct x_display_info *,
118 LWLIB_ID, int)); 118 LWLIB_ID, int, int));
119 119
120/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ 120/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */
121 121
@@ -157,6 +157,8 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
157static void list_of_panes P_ ((Lisp_Object)); 157static void list_of_panes P_ ((Lisp_Object));
158static void list_of_items P_ ((Lisp_Object)); 158static void list_of_items P_ ((Lisp_Object));
159 159
160extern EMACS_TIME timer_check P_ ((int));
161
160 162
161/* This holds a Lisp vector that holds the results of decoding 163/* This holds a Lisp vector that holds the results of decoding
162 the keymaps or alist-of-alists that specify a menu. 164 the keymaps or alist-of-alists that specify a menu.
@@ -1120,7 +1122,6 @@ on the left of the dialog box and all following items on the right.
1120 popped down (deactivated). This is used for x-popup-menu 1122 popped down (deactivated). This is used for x-popup-menu
1121 and x-popup-dialog; it is not used for the menu bar. 1123 and x-popup-dialog; it is not used for the menu bar.
1122 1124
1123 If DO_TIMERS is nonzero, run timers.
1124 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. 1125 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed.
1125 1126
1126 NOTE: All calls to popup_get_selection should be protected 1127 NOTE: All calls to popup_get_selection should be protected
@@ -1128,17 +1129,22 @@ on the left of the dialog box and all following items on the right.
1128 1129
1129#ifdef USE_X_TOOLKIT 1130#ifdef USE_X_TOOLKIT
1130static void 1131static void
1131popup_get_selection (initial_event, dpyinfo, id, down_on_keypress) 1132popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1132 XEvent *initial_event; 1133 XEvent *initial_event;
1133 struct x_display_info *dpyinfo; 1134 struct x_display_info *dpyinfo;
1134 LWLIB_ID id; 1135 LWLIB_ID id;
1136 int do_timers;
1135 int down_on_keypress; 1137 int down_on_keypress;
1136{ 1138{
1137 XEvent event; 1139 XEvent event;
1138 1140
1139 while (popup_activated_flag) 1141 while (popup_activated_flag)
1140 { 1142 {
1141 if (initial_event) 1143 /* If we have no events to run, consider timers. */
1144 if (do_timers && !XtAppPending (Xt_app_con))
1145 timer_check (1);
1146
1147 if (initial_event)
1142 { 1148 {
1143 event = *initial_event; 1149 event = *initial_event;
1144 initial_event = 0; 1150 initial_event = 0;
@@ -2484,7 +2490,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2484 popup_activated_flag = 1; 2490 popup_activated_flag = 1;
2485 2491
2486 /* Process events that apply to the menu. */ 2492 /* Process events that apply to the menu. */
2487 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0); 2493 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0);
2488 2494
2489 /* fp turned off the following statement and wrote a comment 2495 /* fp turned off the following statement and wrote a comment
2490 that it is unnecessary--that the menu has already disappeared. 2496 that it is unnecessary--that the menu has already disappeared.
@@ -2878,7 +2884,8 @@ create_and_show_dialog (f, first_wv)
2878 Fcons (make_number (dialog_id >> (fact)), 2884 Fcons (make_number (dialog_id >> (fact)),
2879 make_number (dialog_id & ~(-1 << (fact))))); 2885 make_number (dialog_id & ~(-1 << (fact)))));
2880 2886
2881 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1); 2887 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f),
2888 dialog_id, 1, 1);
2882 2889
2883 unbind_to (count, Qnil); 2890 unbind_to (count, Qnil);
2884 } 2891 }
diff --git a/src/xselect.c b/src/xselect.c
index 35f4586b754..c89347be2cd 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -24,6 +24,14 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <config.h> 25#include <config.h>
26#include <stdio.h> /* termhooks.h needs this */ 26#include <stdio.h> /* termhooks.h needs this */
27
28#ifdef HAVE_SYS_TYPES_H
29#include <sys/types.h>
30#endif
31#ifdef HAVE_UNISTD_H
32#include <unistd.h>
33#endif
34
27#include "lisp.h" 35#include "lisp.h"
28#include "xterm.h" /* for all of the X includes */ 36#include "xterm.h" /* for all of the X includes */
29#include "dispextern.h" /* frame.h seems to want this */ 37#include "dispextern.h" /* frame.h seems to want this */
@@ -32,6 +40,7 @@ Boston, MA 02111-1307, USA. */
32#include "buffer.h" 40#include "buffer.h"
33#include "process.h" 41#include "process.h"
34#include "termhooks.h" 42#include "termhooks.h"
43#include "keyboard.h"
35 44
36#include <X11/Xproto.h> 45#include <X11/Xproto.h>
37 46
@@ -85,10 +94,13 @@ static void initialize_cut_buffers P_ ((Display *, Window));
85 fprintf (stderr, "%d: " fmt "\n", getpid (), a0) 94 fprintf (stderr, "%d: " fmt "\n", getpid (), a0)
86#define TRACE2(fmt, a0, a1) \ 95#define TRACE2(fmt, a0, a1) \
87 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1) 96 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1)
97#define TRACE3(fmt, a0, a1, a2) \
98 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1, a2)
88#else 99#else
89#define TRACE0(fmt) (void) 0 100#define TRACE0(fmt) (void) 0
90#define TRACE1(fmt, a0) (void) 0 101#define TRACE1(fmt, a0) (void) 0
91#define TRACE2(fmt, a0, a1) (void) 0 102#define TRACE2(fmt, a0, a1) (void) 0
103#define TRACE3(fmt, a0, a1) (void) 0
92#endif 104#endif
93 105
94 106
@@ -168,6 +180,89 @@ static void lisp_data_to_selection_data ();
168static Lisp_Object selection_data_to_lisp_data (); 180static Lisp_Object selection_data_to_lisp_data ();
169static Lisp_Object x_get_window_property_as_lisp_data (); 181static Lisp_Object x_get_window_property_as_lisp_data ();
170 182
183
184
185/* Define a queue to save up SELECTION_REQUEST_EVENT events for later
186 handling. */
187
188struct selection_event_queue
189 {
190 struct input_event event;
191 struct selection_event_queue *next;
192 };
193
194static struct selection_event_queue *selection_queue;
195
196/* Nonzero means queue up SELECTION_REQUEST_EVENT events. */
197
198static int x_queue_selection_requests;
199
200/* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */
201
202static void
203x_queue_event (event)
204 struct input_event *event;
205{
206 struct selection_event_queue *queue_tmp;
207
208 /* Don't queue repeated requests.
209 This only happens for large requests which uses the incremental protocol. */
210 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
211 {
212 if (!bcmp (&queue_tmp->event, event, sizeof (*event)))
213 {
214 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
215 x_decline_selection_request (event);
216 return;
217 }
218 }
219
220 queue_tmp
221 = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
222
223 if (queue_tmp != NULL)
224 {
225 TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
226 queue_tmp->event = *event;
227 queue_tmp->next = selection_queue;
228 selection_queue = queue_tmp;
229 }
230}
231
232/* Start queuing SELECTION_REQUEST_EVENT events. */
233
234static void
235x_start_queuing_selection_requests ()
236{
237 if (x_queue_selection_requests)
238 abort ();
239
240 x_queue_selection_requests++;
241 TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests);
242}
243
244/* Stop queuing SELECTION_REQUEST_EVENT events. */
245
246static void
247x_stop_queuing_selection_requests ()
248{
249 TRACE1 ("x_stop_queuing_selection_requests %d", x_queue_selection_requests);
250 --x_queue_selection_requests;
251
252 /* Take all the queued events and put them back
253 so that they get processed afresh. */
254
255 while (selection_queue != NULL)
256 {
257 struct selection_event_queue *queue_tmp = selection_queue;
258 TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
259 kbd_buffer_unget_event (&queue_tmp->event);
260 selection_queue = queue_tmp->next;
261 xfree ((char *)queue_tmp);
262 }
263}
264
265
171/* This converts a Lisp symbol to a server Atom, avoiding a server 266/* This converts a Lisp symbol to a server Atom, avoiding a server
172 roundtrip whenever possible. */ 267 roundtrip whenever possible. */
173 268
@@ -557,13 +652,10 @@ static struct prop_location *property_change_reply_object;
557static struct prop_location *property_change_wait_list; 652static struct prop_location *property_change_wait_list;
558 653
559static Lisp_Object 654static Lisp_Object
560queue_selection_requests_unwind (frame) 655queue_selection_requests_unwind (tem)
561 Lisp_Object frame; 656 Lisp_Object tem;
562{ 657{
563 FRAME_PTR f = XFRAME (frame); 658 x_stop_queuing_selection_requests ();
564
565 if (! NILP (frame))
566 x_stop_queuing_selection_requests (FRAME_X_DISPLAY (f));
567 return Qnil; 659 return Qnil;
568} 660}
569 661
@@ -623,6 +715,17 @@ x_reply_selection_request (event, format, data, size, type)
623 BLOCK_INPUT; 715 BLOCK_INPUT;
624 count = x_catch_errors (display); 716 count = x_catch_errors (display);
625 717
718#ifdef TRACE_SELECTION
719 {
720 static int cnt;
721 char *sel = XGetAtomName (display, reply.selection);
722 char *tgt = XGetAtomName (display, reply.target);
723 TRACE3 ("%s, target %s (%d)", sel, tgt, ++cnt);
724 if (sel) XFree (sel);
725 if (tgt) XFree (tgt);
726 }
727#endif /* TRACE_SELECTION */
728
626 /* Store the data on the requested property. 729 /* Store the data on the requested property.
627 If the selection is large, only store the first N bytes of it. 730 If the selection is large, only store the first N bytes of it.
628 */ 731 */
@@ -650,10 +753,10 @@ x_reply_selection_request (event, format, data, size, type)
650 bother trying to queue them. */ 753 bother trying to queue them. */
651 if (!NILP (frame)) 754 if (!NILP (frame))
652 { 755 {
653 x_start_queuing_selection_requests (display); 756 x_start_queuing_selection_requests ();
654 757
655 record_unwind_protect (queue_selection_requests_unwind, 758 record_unwind_protect (queue_selection_requests_unwind,
656 frame); 759 Qnil);
657 } 760 }
658 761
659 if (x_window_to_frame (dpyinfo, window)) /* #### debug */ 762 if (x_window_to_frame (dpyinfo, window)) /* #### debug */
@@ -687,6 +790,8 @@ x_reply_selection_request (event, format, data, size, type)
687 XGetAtomName (display, reply.property)); 790 XGetAtomName (display, reply.property));
688 wait_for_property_change (wait_object); 791 wait_for_property_change (wait_object);
689 } 792 }
793 else
794 unexpect_property_change (wait_object);
690 795
691 TRACE0 ("Got ACK"); 796 TRACE0 ("Got ACK");
692 while (bytes_remaining) 797 while (bytes_remaining)
@@ -760,7 +865,7 @@ x_reply_selection_request (event, format, data, size, type)
760/* Handle a SelectionRequest event EVENT. 865/* Handle a SelectionRequest event EVENT.
761 This is called from keyboard.c when such an event is found in the queue. */ 866 This is called from keyboard.c when such an event is found in the queue. */
762 867
763void 868static void
764x_handle_selection_request (event) 869x_handle_selection_request (event)
765 struct input_event *event; 870 struct input_event *event;
766{ 871{
@@ -775,6 +880,10 @@ x_handle_selection_request (event)
775 struct x_display_info *dpyinfo 880 struct x_display_info *dpyinfo
776 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event)); 881 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event));
777 882
883 TRACE2 ("x_handle_selection_request, from=0x%08lx time=%lu",
884 (unsigned long) SELECTION_EVENT_REQUESTOR (event),
885 (unsigned long) SELECTION_EVENT_TIME (event));
886
778 local_selection_data = Qnil; 887 local_selection_data = Qnil;
779 target_symbol = Qnil; 888 target_symbol = Qnil;
780 converted_selection = Qnil; 889 converted_selection = Qnil;
@@ -869,7 +978,7 @@ x_handle_selection_request (event)
869 client cleared out our previously asserted selection. 978 client cleared out our previously asserted selection.
870 This is called from keyboard.c when such an event is found in the queue. */ 979 This is called from keyboard.c when such an event is found in the queue. */
871 980
872void 981static void
873x_handle_selection_clear (event) 982x_handle_selection_clear (event)
874 struct input_event *event; 983 struct input_event *event;
875{ 984{
@@ -882,6 +991,8 @@ x_handle_selection_clear (event)
882 struct x_display_info *dpyinfo = x_display_info_for_display (display); 991 struct x_display_info *dpyinfo = x_display_info_for_display (display);
883 struct x_display_info *t_dpyinfo; 992 struct x_display_info *t_dpyinfo;
884 993
994 TRACE0 ("x_handle_selection_clear");
995
885 /* If the new selection owner is also Emacs, 996 /* If the new selection owner is also Emacs,
886 don't clear the new selection. */ 997 don't clear the new selection. */
887 BLOCK_INPUT; 998 BLOCK_INPUT;
@@ -950,6 +1061,24 @@ x_handle_selection_clear (event)
950 } 1061 }
951} 1062}
952 1063
1064void
1065x_handle_selection_event (event)
1066 struct input_event *event;
1067{
1068 TRACE0 ("x_handle_selection_event");
1069
1070 if (event->kind == SELECTION_REQUEST_EVENT)
1071 {
1072 if (x_queue_selection_requests)
1073 x_queue_event (event);
1074 else
1075 x_handle_selection_request (event);
1076 }
1077 else
1078 x_handle_selection_clear (event);
1079}
1080
1081
953/* Clear all selections that were made from frame F. 1082/* Clear all selections that were made from frame F.
954 We do this when about to delete a frame. */ 1083 We do this when about to delete a frame. */
955 1084
@@ -1080,12 +1209,14 @@ unexpect_property_change (location)
1080/* Remove the property change expectation element for IDENTIFIER. */ 1209/* Remove the property change expectation element for IDENTIFIER. */
1081 1210
1082static Lisp_Object 1211static Lisp_Object
1083wait_for_property_change_unwind (identifierval) 1212wait_for_property_change_unwind (loc)
1084 Lisp_Object identifierval; 1213 Lisp_Object loc;
1085{ 1214{
1086 unexpect_property_change ((struct prop_location *) 1215 struct prop_location *location = XSAVE_VALUE (loc)->pointer;
1087 (XFASTINT (XCAR (identifierval)) << 16 1216
1088 | XFASTINT (XCDR (identifierval)))); 1217 unexpect_property_change (location);
1218 if (location == property_change_reply_object)
1219 property_change_reply_object = 0;
1089 return Qnil; 1220 return Qnil;
1090} 1221}
1091 1222
@@ -1098,18 +1229,17 @@ wait_for_property_change (location)
1098{ 1229{
1099 int secs, usecs; 1230 int secs, usecs;
1100 int count = SPECPDL_INDEX (); 1231 int count = SPECPDL_INDEX ();
1101 Lisp_Object tem;
1102 1232
1103 tem = Fcons (Qnil, Qnil); 1233 if (property_change_reply_object)
1104 XSETCARFASTINT (tem, (EMACS_UINT)location >> 16); 1234 abort ();
1105 XSETCDRFASTINT (tem, (EMACS_UINT)location & 0xffff);
1106 1235
1107 /* Make sure to do unexpect_property_change if we quit or err. */ 1236 /* Make sure to do unexpect_property_change if we quit or err. */
1108 record_unwind_protect (wait_for_property_change_unwind, tem); 1237 record_unwind_protect (wait_for_property_change_unwind,
1238 make_save_value (location, 0));
1109 1239
1110 XSETCAR (property_change_reply, Qnil); 1240 XSETCAR (property_change_reply, Qnil);
1111
1112 property_change_reply_object = location; 1241 property_change_reply_object = location;
1242
1113 /* If the event we are waiting for arrives beyond here, it will set 1243 /* If the event we are waiting for arrives beyond here, it will set
1114 property_change_reply, because property_change_reply_object says so. */ 1244 property_change_reply, because property_change_reply_object says so. */
1115 if (! location->arrived) 1245 if (! location->arrived)
@@ -1140,7 +1270,8 @@ x_handle_property_notify (event)
1140 1270
1141 while (rest) 1271 while (rest)
1142 { 1272 {
1143 if (rest->property == event->atom 1273 if (!rest->arrived
1274 && rest->property == event->atom
1144 && rest->window == event->window 1275 && rest->window == event->window
1145 && rest->display == event->display 1276 && rest->display == event->display
1146 && rest->desired_state == event->state) 1277 && rest->desired_state == event->state)
@@ -1156,11 +1287,6 @@ x_handle_property_notify (event)
1156 if (rest == property_change_reply_object) 1287 if (rest == property_change_reply_object)
1157 XSETCAR (property_change_reply, Qt); 1288 XSETCAR (property_change_reply, Qt);
1158 1289
1159 if (prev)
1160 prev->next = rest->next;
1161 else
1162 property_change_wait_list = rest->next;
1163 xfree (rest);
1164 return; 1290 return;
1165 } 1291 }
1166 1292
@@ -1286,10 +1412,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1286 bother trying to queue them. */ 1412 bother trying to queue them. */
1287 if (!NILP (frame)) 1413 if (!NILP (frame))
1288 { 1414 {
1289 x_start_queuing_selection_requests (display); 1415 x_start_queuing_selection_requests ();
1290 1416
1291 record_unwind_protect (queue_selection_requests_unwind, 1417 record_unwind_protect (queue_selection_requests_unwind,
1292 frame); 1418 Qnil);
1293 } 1419 }
1294 UNBLOCK_INPUT; 1420 UNBLOCK_INPUT;
1295 1421
@@ -1445,10 +1571,10 @@ receive_incremental_selection (display, window, property, target_type,
1445 BLOCK_INPUT; 1571 BLOCK_INPUT;
1446 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); 1572 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask);
1447 TRACE1 (" Delete property %s", 1573 TRACE1 (" Delete property %s",
1448 XSYMBOL (x_atom_to_symbol (display, property))->name->data); 1574 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
1449 XDeleteProperty (display, window, property); 1575 XDeleteProperty (display, window, property);
1450 TRACE1 (" Expect new value of property %s", 1576 TRACE1 (" Expect new value of property %s",
1451 XSYMBOL (x_atom_to_symbol (display, property))->name->data); 1577 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
1452 wait_object = expect_property_change (display, window, property, 1578 wait_object = expect_property_change (display, window, property,
1453 PropertyNewValue); 1579 PropertyNewValue);
1454 XFlush (display); 1580 XFlush (display);
@@ -1478,7 +1604,6 @@ receive_incremental_selection (display, window, property, target_type,
1478 1604
1479 if (! waiting_for_other_props_on_window (display, window)) 1605 if (! waiting_for_other_props_on_window (display, window))
1480 XSelectInput (display, window, STANDARD_EVENT_SET); 1606 XSelectInput (display, window, STANDARD_EVENT_SET);
1481 unexpect_property_change (wait_object);
1482 /* Use xfree, not XFree, because x_get_window_property 1607 /* Use xfree, not XFree, because x_get_window_property
1483 calls xmalloc itself. */ 1608 calls xmalloc itself. */
1484 if (tmp_data) xfree (tmp_data); 1609 if (tmp_data) xfree (tmp_data);
diff --git a/src/xterm.c b/src/xterm.c
index 9b5d768b2af..c8c5d6e95c4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5581,73 +5581,6 @@ x_scroll_bar_clear (f)
5581} 5581}
5582 5582
5583 5583
5584/* Define a queue to save up SelectionRequest events for later handling. */
5585
5586struct selection_event_queue
5587 {
5588 XEvent event;
5589 struct selection_event_queue *next;
5590 };
5591
5592static struct selection_event_queue *queue;
5593
5594/* Nonzero means queue up certain events--don't process them yet. */
5595
5596static int x_queue_selection_requests;
5597
5598/* Queue up an X event *EVENT, to be processed later. */
5599
5600static void
5601x_queue_event (f, event)
5602 FRAME_PTR f;
5603 XEvent *event;
5604{
5605 struct selection_event_queue *queue_tmp
5606 = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
5607
5608 if (queue_tmp != NULL)
5609 {
5610 queue_tmp->event = *event;
5611 queue_tmp->next = queue;
5612 queue = queue_tmp;
5613 }
5614}
5615
5616/* Take all the queued events and put them back
5617 so that they get processed afresh. */
5618
5619static void
5620x_unqueue_events (display)
5621 Display *display;
5622{
5623 while (queue != NULL)
5624 {
5625 struct selection_event_queue *queue_tmp = queue;
5626 XPutBackEvent (display, &queue_tmp->event);
5627 queue = queue_tmp->next;
5628 xfree ((char *)queue_tmp);
5629 }
5630}
5631
5632/* Start queuing SelectionRequest events. */
5633
5634void
5635x_start_queuing_selection_requests (display)
5636 Display *display;
5637{
5638 x_queue_selection_requests++;
5639}
5640
5641/* Stop queuing SelectionRequest events. */
5642
5643void
5644x_stop_queuing_selection_requests (display)
5645 Display *display;
5646{
5647 x_queue_selection_requests--;
5648 x_unqueue_events (display);
5649}
5650
5651/* The main X event-reading loop - XTread_socket. */ 5584/* The main X event-reading loop - XTread_socket. */
5652 5585
5653#if 0 5586#if 0
@@ -6025,11 +5958,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6025 if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner)) 5958 if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner))
6026 goto OTHER; 5959 goto OTHER;
6027#endif /* USE_X_TOOLKIT */ 5960#endif /* USE_X_TOOLKIT */
6028 if (x_queue_selection_requests) 5961 {
6029 x_queue_event (x_window_to_frame (dpyinfo, event.xselectionrequest.owner),
6030 &event);
6031 else
6032 {
6033 XSelectionRequestEvent *eventp 5962 XSelectionRequestEvent *eventp
6034 = (XSelectionRequestEvent *) &event; 5963 = (XSelectionRequestEvent *) &event;
6035 5964
@@ -6041,7 +5970,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6041 SELECTION_EVENT_PROPERTY (&inev) = eventp->property; 5970 SELECTION_EVENT_PROPERTY (&inev) = eventp->property;
6042 SELECTION_EVENT_TIME (&inev) = eventp->time; 5971 SELECTION_EVENT_TIME (&inev) = eventp->time;
6043 inev.frame_or_window = Qnil; 5972 inev.frame_or_window = Qnil;
6044 } 5973 }
6045 break; 5974 break;
6046 5975
6047 case PropertyNotify: 5976 case PropertyNotify:
@@ -7626,7 +7555,11 @@ x_catch_errors_unwind (old_val)
7626 /* The display may have been closed before this function is called. 7555 /* The display may have been closed before this function is called.
7627 Check if it is still open before calling XSync. */ 7556 Check if it is still open before calling XSync. */
7628 if (x_display_info_for_display (dpy) != 0) 7557 if (x_display_info_for_display (dpy) != 0)
7629 XSync (dpy, False); 7558 {
7559 BLOCK_INPUT;
7560 XSync (dpy, False);
7561 UNBLOCK_INPUT;
7562 }
7630 7563
7631 x_error_message_string = XCDR (old_val); 7564 x_error_message_string = XCDR (old_val);
7632 return Qnil; 7565 return Qnil;
diff --git a/src/xterm.h b/src/xterm.h
index 4e38ac18e3d..ffd7e31f297 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -52,7 +52,7 @@ typedef GtkWidget *xt_or_gtk_widget;
52#undef XSync 52#undef XSync
53#define XSync(d, b) do { gdk_window_process_all_updates (); \ 53#define XSync(d, b) do { gdk_window_process_all_updates (); \
54 XSync (d, b); } while (0) 54 XSync (d, b); } while (0)
55 55
56 56
57#endif /* USE_GTK */ 57#endif /* USE_GTK */
58 58
@@ -976,8 +976,6 @@ int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *));
976 976
977extern void cancel_mouse_face P_ ((struct frame *)); 977extern void cancel_mouse_face P_ ((struct frame *));
978extern void x_scroll_bar_clear P_ ((struct frame *)); 978extern void x_scroll_bar_clear P_ ((struct frame *));
979extern void x_start_queuing_selection_requests P_ ((Display *));
980extern void x_stop_queuing_selection_requests P_ ((Display *));
981extern int x_text_icon P_ ((struct frame *, char *)); 979extern int x_text_icon P_ ((struct frame *, char *));
982extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 980extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
983extern int x_catch_errors P_ ((Display *)); 981extern int x_catch_errors P_ ((Display *));
@@ -1013,8 +1011,7 @@ extern int x_dispatch_event P_ ((XEvent *, Display *));
1013 1011
1014extern void x_handle_property_notify P_ ((XPropertyEvent *)); 1012extern void x_handle_property_notify P_ ((XPropertyEvent *));
1015extern void x_handle_selection_notify P_ ((XSelectionEvent *)); 1013extern void x_handle_selection_notify P_ ((XSelectionEvent *));
1016extern void x_handle_selection_request P_ ((struct input_event *)); 1014extern void x_handle_selection_event P_ ((struct input_event *));
1017extern void x_handle_selection_clear P_ ((struct input_event *));
1018extern void x_clear_frame_selections P_ ((struct frame *)); 1015extern void x_clear_frame_selections P_ ((struct frame *));
1019 1016
1020extern int x_handle_dnd_message P_ ((struct frame *, 1017extern int x_handle_dnd_message P_ ((struct frame *,