aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2011-12-28 11:34:15 +0100
committerJoakim Verona2011-12-28 11:34:15 +0100
commit2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f (patch)
tree034e65ef002631d0aba8fc1a41e9984fc557e630 /src
parentbb29f044aa967831cd664c54eba0de0c701436ce (diff)
parentd23ab8e8726ecb7e3554644857b4a58e5f7408f1 (diff)
downloademacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.tar.gz
emacs-2f74c36bf173b5ad01f99e0d1b31b9b8fa5c8f2f.zip
upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog283
-rw-r--r--src/ChangeLog.108
-rw-r--r--src/ChangeLog.116
-rw-r--r--src/ChangeLog.28
-rw-r--r--src/ChangeLog.72
-rw-r--r--src/ChangeLog.88
-rw-r--r--src/alloc.c2
-rw-r--r--src/callint.c11
-rw-r--r--src/ccl.c6
-rw-r--r--src/charset.c2
-rw-r--r--src/charset.h4
-rw-r--r--src/cm.h4
-rw-r--r--src/coding.c192
-rw-r--r--src/coding.h2
-rw-r--r--src/data.c2
-rw-r--r--src/dbusbind.c2
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs.c17
-rw-r--r--src/emacsgtkfixed.c2
-rw-r--r--src/emacsgtkfixed.h2
-rw-r--r--src/eval.c14
-rw-r--r--src/fileio.c20
-rw-r--r--src/font.c8
-rw-r--r--src/font.h6
-rw-r--r--src/fontset.c4
-rw-r--r--src/frame.c2
-rw-r--r--src/ftfont.c9
-rw-r--r--src/ftxfont.c9
-rw-r--r--src/image.c33
-rw-r--r--src/keyboard.c56
-rw-r--r--src/lastfile.c3
-rw-r--r--src/lisp.h15
-rw-r--r--src/lread.c28
-rw-r--r--src/minibuf.c34
-rw-r--r--src/nsfns.m62
-rw-r--r--src/nsfont.m30
-rw-r--r--src/nsmenu.m46
-rw-r--r--src/nsselect.m168
-rw-r--r--src/nsterm.h2
-rw-r--r--src/nsterm.m44
-rw-r--r--src/print.c2
-rw-r--r--src/process.c5
-rw-r--r--src/regex.c2
-rw-r--r--src/regex.h4
-rw-r--r--src/region-cache.c4
-rw-r--r--src/region-cache.h4
-rw-r--r--src/s/gnu-linux.h2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/termhooks.h4
-rw-r--r--src/textprop.c4
-rw-r--r--src/unexelf.c12
-rw-r--r--src/w16select.c9
-rw-r--r--src/w32.c18
-rw-r--r--src/w32fns.c10
-rw-r--r--src/w32font.c2
-rw-r--r--src/w32select.c7
-rw-r--r--src/w32term.c6
-rw-r--r--src/w32term.h2
-rw-r--r--src/window.c19
-rw-r--r--src/window.h2
-rw-r--r--src/xdisp.c23
-rw-r--r--src/xfns.c10
-rw-r--r--src/xftfont.c2
-rw-r--r--src/xmenu.c23
-rw-r--r--src/xselect.c10
-rw-r--r--src/xterm.c12
-rw-r--r--src/xterm.h2
67 files changed, 952 insertions, 408 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6a13bd87264..f10e2955164 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,264 @@
12011-12-28 Kenichi Handa <handa@m17n.org>
2
3 * coding.c (Fdefine_coding_system_internal): Make an utf-8 base
4 coding-system ASCII compatible only when it does not produce BOM
5 on encoding (Bug#10383).
6
72011-12-26 Jan Djärv <jan.h.d@swipnet.se>
8
9 * xmenu.c (x_menu_wait_for_event): Use xg_select for Gtk3 so menus
10 can scroll.
11 (create_and_show_popup_menu): Always use menu_position_func for
12 Gtk3 (Bug#10361).
13
142011-12-24 Andreas Schwab <schwab@linux-m68k.org>
15
16 * callint.c (Fcall_interactively): Don't truncate prompt string.
17
182011-12-23 Eli Zaretskii <eliz@gnu.org>
19
20 * xdisp.c (handle_invisible_prop): Handle correctly an invisible
21 property that ends at ZV, so that the bidi iteration could be
22 resumed from there (after widening). (Bug#10360)
23
242011-12-22 Jan Djärv <jan.h.d@swipnet.se>
25
26 * nsfont.m (ns_spec_to_descriptor): Do not autorelease fdesc.
27
282011-12-21 Jan Djärv <jan.h.d@swipnet.se>
29
30 * nsterm.m (x_free_frame_resources): Release
31 f->output_data.ns->miniimage
32 (ns_index_color): Fix indentation. Do not retain
33 color_table->colors[i].
34
35 * nsmenu.m (ns_update_menubar): Call free_menubar_widget_value_tree
36 before returning.
37
38 * nsfns.m (x_set_background_color): Assign return value from
39 ns_index_color to face-background instead of NSColor*.
40 (ns_implicitly_set_icon_type): Fix indentation.
41 Change assignment in for loop to comparison.
42
43 * emacs.c (ns_pool): New variable.
44 (main): Assign ns_pool.
45 (Fkill_emacs): Call ns_release_autorelease_pool.
46
47 * nsfont.m (ns_spec_to_descriptor): Fix indentation,
48 autorelease fdesc, release fdAttrs and tdict.
49 (ns_get_covering_families): Release charset.
50 (ns_findfonts): Release NSFontDescriptor created with new.
51 (ns_uni_to_glyphs): Fix indentation.
52 (setString): Release attrStr before assigning new value.
53
542011-12-18 Jan Djärv <jan.h.d@swipnet.se>
55
56 * nsmenu.m (NSMenuDidBeginTrackingNotification): Declare if OSX < 10.5
57 and NS_IMPL_COCOA.
58 (trackingNotification): Surround with ifdef NS_IMPL_COCOA.
59 (syms_of_nsmenu): Set trackingMenu to 1 if not NS_IMPL_COCOA.
60
612011-12-18 David Reitter <reitter@cmu.edu>
62
63 * nsterm.m (ns_term_init): Subscribe for notifications
64 NSMenuDidBeginTrackingNotification and NSMenuDidEndTrackingNotification
65 to method trackingNotification in EmacsMenu.
66
67 * nsmenu.m (trackingMenu): New variable.
68 (trackingNotification): New method (from Aquamacs).
69 (menuNeedsUpdate): Expand comment and return if trackingMenu is 0,
70 from Aquamacs (Bug#7030).
71
722011-12-18 Jan Djärv <jan.h.d@swipnet.se>
73
74 * nsselect.m (CUT_BUFFER_SUPPORT): Remove define.
75 (symbol_to_nsstring): Fix indentation.
76 (ns_symbol_to_pb): New function.
77 (Fns_get_selection_internal): Renamed from Fns_get_cut_buffer_internal.
78 (Fns_rotate_cut_buffers_internal): Removed.
79 (Fns_store_selection_internal): Renamed from
80 Fns_store_cut_buffer_internal.
81 (ns_get_foreign_selection, Fx_own_selection_internal)
82 (Fx_disown_selection_internal, Fx_selection_exists_p)
83 (Fns_get_selection_internal, Fns_store_selection_internal): Use
84 ns_symbol_to_pb and check if return value is nil.
85 (syms_of_nsselect): Remove ifdef CUT_BUFFER_SUPPORT. Remove
86 defsubr Sns_rotate_cut_buffers_internal. Sns_get_cut_buffer_internal
87 renamed to Sns_get_selection_internal, Sns_store_cut_buffer_internal
88 renamed to Sns_store_selection_internal.
89 (ns_handle_selection_request): Move code to Fx_own_selection_internal
90 and remove this function.
91 (ns_handle_selection_clear): Remove, never used.
92 (Fx_own_selection_internal): Move code from ns_handle_selection_request
93 here.
94
952011-12-17 Ken Brown <kbrown@cornell.edu>
96
97 * fileio.c (check_writable) [CYGWIN]: Return non-zero if UID or
98 GID is unknown (Bug#10257).
99
1002011-12-17 Paul Eggert <eggert@cs.ucla.edu>
101
102 * s/gnu-linux.h: Fix mark_memory typo (Bug#10286).
103 (GC_MARK_SECONDARY_STACK): Omit removed 3rd arg to mark_memory,
104 which caused a build failure on GNU/Linux IA-64. This problem was
105 introduced by my 2011-10-07 patch.
106
1072011-12-15 Juri Linkov <juri@jurta.org>
108
109 * image.c (imagemagick_error): New function. (Bug#10112)
110 (imagemagick_load_image): Comment out `MagickSetResolution' call.
111 Use `imagemagick_error' where ImageMagick functions return
112 `MagickFalse'.
113 (Fimagemagick_types): Add `Fnreverse' to return the list in the
114 proper order.
115
1162011-12-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
117
118 * xftfont.c (xftfont_draw): Use the font metrics of s->font to
119 fill background (Bug#8992).
120
1212011-12-13 Martin Rudalics <rudalics@gmx.at>
122
123 * window.c (Vwindow_combination_resize)
124 (Vwindow_combination_limit): Use t instead of non-nil in
125 doc-strings.
126 (Vrecenter_redisplay): Add first sentence of doc-string on
127 separate line.
128 (Frecenter): Fix doc-string typo.
129
1302011-12-11 Kenichi Handa <handa@m17n.org>
131
132 * coding.c (Funencodable_char_position): Pay attention to the
133 buffer text relocation (Bug#9389).
134
1352011-12-10 Jan Djärv <jan.h.d@swipnet.se>
136
137 * xterm.c (x_term_init): Move call to gdk_window_add_filter before
138 gtk_init (Bug#10100).
139
1402011-12-10 Eli Zaretskii <eliz@gnu.org>
141
142 * xdisp.c (RECORD_MAX_MIN_POS): Use IT->cmp_it.charpos only if
143 IT->string is nil. (Bug#10263)
144
1452011-12-10 Jan Djärv <jan.h.d@swipnet.se>
146
147 * nsterm.h (x_free_frame_resources): Declare.
148
149 * nsfns.m (ns_get_defaults_value): New function (Bug#10103).
150 (Fns_get_resource, x_get_string_resource): Call ns_get_defaults_value.
151
152 * nsterm.h (ns_get_defaults_value): Declare.
153
154 * nsterm.m (ns_default): Call ns_get_defaults_value.
155
1562011-12-09 Eli Zaretskii <eliz@gnu.org>
157
158 * xdisp.c (try_scrolling): Don't set scroll_down_p if dy is zero.
159 (Bug#10170)
160
1612011-12-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
162
163 * unexelf.c (unexec) [NS_IMPL_GNUSTEP]: Take account of the case
164 that where the value of an _OBJC_* symbol points to is in the .bss
165 section (Bug#10240).
166
1672011-12-08 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change)
168
169 * coding.c (encode_coding_ccl): Check (charbuf < charbuf_end)
170 after the loop to call ccl_driver at least once (Bug#8619).
171
1722011-12-08 Kenichi Handa <handa@m17n.org>
173
174 * ftfont.c (get_adstyle_property): Fix previous change
175 (Bug#10233).
176
1772011-12-07 Juanma Barranquero <lekktu@gmail.com>
178
179 * w32.c (init_environment): If no_site_lisp, remove site-lisp
180 dirs from the default value of EMACSLOADPATH (bug#10208).
181
1822011-12-07 Glenn Morris <rgm@gnu.org>
183
184 * lread.c (init_lread): If no_site_lisp, exclude site-lisp/ in
185 installation and source directories as well. (Bug#10208)
186
1872011-12-06 Chong Yidong <cyd@gnu.org>
188
189 * minibuf.c (Fread_from_minibuffer): Doc fix (Bug#10228).
190
1912011-12-06 Glenn Morris <rgm@gnu.org>
192
193 * process.c (start_process_unwind): Treat any pid <= 0, except -2,
194 as an error, not just -1. (Bug#10217)
195
1962011-12-05 Chong Yidong <cyd@gnu.org>
197
198 * keyboard.c (process_special_events): New function.
199 (swallow_events, Finput_pending_p): Use it (Bug#10195).
200
2012011-12-05 Paul Eggert <eggert@cs.ucla.edu>
202
203 * coding.c (encode_designation_at_bol): Don't use uninitialized
204 local variable (Bug#9318).
205
2062011-12-05 Kenichi Handa <handa@m17n.org>
207
208 * ftfont.c (get_adstyle_property): If the font is not BDF nor PCF,
209 return Qnil (Bug#8046, Bug#10193).
210
2112011-12-05 Kenichi Handa <handa@m17n.org>
212
213 * coding.c (encode_designation_at_bol): New args charbuf_end and
214 dst. Return the number of produced bytes. Callers changed.
215 (coding_set_source): Return how many bytes coding->source was
216 relocated.
217 (coding_set_destination): Return how many bytes
218 coding->destination was relocated.
219 (CODING_DECODE_CHAR, CODING_ENCODE_CHAR, CODING_CHAR_CHARSET)
220 (CODING_CHAR_CHARSET_P): Adjusted for the avove changes.
221
2222011-12-05 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change)
223
224 * coding.c (CODING_CHAR_CHARSET_P): New macro.
225 (encode_coding_emacs_mule, encode_coding_iso_2022): Use the above
226 macro (Bug#9318).
227
2282011-12-05 Andreas Schwab <schwab@linux-m68k.org>
229
230 The following changes are to fix Bug#9318.
231
232 * coding.c (CODING_ENCODE_CHAR, CODING_CHAR_CHARSET): New macros.
233 (encode_coding_emacs_mule, ENCODE_ISO_CHARACTER)
234 (encode_coding_iso_2022, encode_coding_sjis)
235 (encode_coding_big5, encode_coding_charset): Use the above macros.
236
2372011-12-05 Juanma Barranquero <lekktu@gmail.com>
238
239 * lisp.h (process_quit_flag): Fix external declaration.
240
2412011-12-04 Stefan Monnier <monnier@iro.umontreal.ca>
242
243 Don't macro-inline non-performance-critical code.
244 * eval.c (process_quit_flag): New function.
245 * lisp.h (QUIT): Use it.
246
2472011-12-04 Jan Djärv <jan.h.d@swipnet.se>
248
249 * nsfns.m (get_geometry_from_preferences): New function.
250 (Fx_create_frame): Call get_geometry_from_preferences (Bug#10103).
251
2522011-12-04 Andreas Schwab <schwab@linux-m68k.org>
253
254 * emacs.c (Qkill_emacs): Define.
255 (syms_of_emacs): Initialize it.
256 * keyboard.c (interrupt_signal): Don't call Fkill_emacs here, set
257 Qquit_flag to `kill-emacs' instead.
258 (quit_throw_to_read_char): Add parameter `from_signal'.
259 All callers changed. Call Fkill_emacs if requested and safe.
260 * lisp.h (QUIT): Call Fkill_emacs if requested.
261
12011-12-03 Jan Djärv <jan.h.d@swipnet.se> 2622011-12-03 Jan Djärv <jan.h.d@swipnet.se>
2 263
3 * widget.c (update_wm_hints): Return if wmshell is null. 264 * widget.c (update_wm_hints): Return if wmshell is null.
@@ -58,7 +319,7 @@
58 319
59 * xterm.c (handle_one_xevent): Only set async_visible and friends 320 * xterm.c (handle_one_xevent): Only set async_visible and friends
60 if net_wm_state_hidden_seen is non-zero (Bug#10002) 321 if net_wm_state_hidden_seen is non-zero (Bug#10002)
61 (get_current_wm_state): Set net_wm_state_hidden_seen to 1 if 322 (get_current_wm_state): Set net_wm_state_hidden_seen to 1 if
62 _NET_WM_STATE_HIDDEN is in NET_WM_STATE. 323 _NET_WM_STATE_HIDDEN is in NET_WM_STATE.
63 324
642011-11-28 Paul Eggert <eggert@cs.ucla.edu> 3252011-11-28 Paul Eggert <eggert@cs.ucla.edu>
@@ -95,8 +356,8 @@
95 356
962011-11-27 Jan Djärv <jan.h.d@swipnet.se> 3572011-11-27 Jan Djärv <jan.h.d@swipnet.se>
97 358
98 * gtkutil.c (xg_create_frame_widgets): Call 359 * gtkutil.c (xg_create_frame_widgets):
99 gtk_window_set_has_resize_grip (FALSE) if that function is 360 Call gtk_window_set_has_resize_grip (FALSE) if that function is
100 present with Gtk+ 2.0. 361 present with Gtk+ 2.0.
101 362
1022011-11-26 Paul Eggert <eggert@cs.ucla.edu> 3632011-11-26 Paul Eggert <eggert@cs.ucla.edu>
@@ -303,8 +564,8 @@
303 * xdisp.c (display_line): Move the call to 564 * xdisp.c (display_line): Move the call to
304 highlight_trailing_whitespace before the call to 565 highlight_trailing_whitespace before the call to
305 compute_line_metrics, since the latter needs to see the final 566 compute_line_metrics, since the latter needs to see the final
306 faces of all the glyphs to compute ROW's hash value. Fixes 567 faces of all the glyphs to compute ROW's hash value.
307 assertion violations in row_equal_p. (Bug#10035) 568 Fixes assertion violations in row_equal_p. (Bug#10035)
308 569
3092011-11-14 Juanma Barranquero <lekktu@gmail.com> 5702011-11-14 Juanma Barranquero <lekktu@gmail.com>
310 571
@@ -388,8 +649,8 @@
3882011-11-08 Chong Yidong <cyd@gnu.org> 6492011-11-08 Chong Yidong <cyd@gnu.org>
389 650
390 * window.c (Fwindow_left_column, Fwindow_top_line): Doc fix. 651 * window.c (Fwindow_left_column, Fwindow_top_line): Doc fix.
391 (Fwindow_body_height, Fwindow_body_width): Move from Lisp. Signal 652 (Fwindow_body_height, Fwindow_body_width): Move from Lisp.
392 an error if not a live window. 653 Signal an error if not a live window.
393 (Fwindow_total_width, Fwindow_total_height): Move from Lisp. 654 (Fwindow_total_width, Fwindow_total_height): Move from Lisp.
394 (Fwindow_total_size, Fwindow_body_size): Move to Lisp. 655 (Fwindow_total_size, Fwindow_body_size): Move to Lisp.
395 656
@@ -521,8 +782,8 @@
521 (x_destroy_window): Move code to x_free_frame_resources. 782 (x_destroy_window): Move code to x_free_frame_resources.
522 783
523 * xfns.c (unwind_create_frame): Fix comment. 784 * xfns.c (unwind_create_frame): Fix comment.
524 (Fx_create_frame, x_create_tip_frame): Move 785 (Fx_create_frame, x_create_tip_frame):
525 terminal->reference_count++ just before making the frame 786 Move terminal->reference_count++ just before making the frame
526 official. Move initialization of image_cache_refcount and 787 official. Move initialization of image_cache_refcount and
527 dpyinfo_refcount before calling init_frame_faces (Bug#9943). 788 dpyinfo_refcount before calling init_frame_faces (Bug#9943).
528 789
@@ -592,8 +853,8 @@
592 * xdisp.c (mouse_face_from_buffer_pos): Fix a typo in a comment. 853 * xdisp.c (mouse_face_from_buffer_pos): Fix a typo in a comment.
593 Don't stop backward scan on the continuation glyph, even though 854 Don't stop backward scan on the continuation glyph, even though
594 its CHARPOS is positive. 855 its CHARPOS is positive.
595 (mouse_face_from_buffer_pos, note_mouse_highlight): Rename 856 (mouse_face_from_buffer_pos, note_mouse_highlight):
596 cover_string to disp_string. 857 Rename cover_string to disp_string.
597 858
5982011-11-01 Martin Rudalics <rudalics@gmx.at> 8592011-11-01 Martin Rudalics <rudalics@gmx.at>
599 860
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index 7d2f48a03ea..53f7a016654 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -516,7 +516,7 @@
516 * w32fns.c (current_popup_menu): Use from w32menu.c. 516 * w32fns.c (current_popup_menu): Use from w32menu.c.
517 (w32_wnd_proc) <WM_EXITMENULOOP, WM_TIMER>: Use menubar_active 517 (w32_wnd_proc) <WM_EXITMENULOOP, WM_TIMER>: Use menubar_active
518 and current_popup_menu to determine whether a menubar menu has 518 and current_popup_menu to determine whether a menubar menu has
519 been cancelled. 519 been canceled.
520 520
521 * w32term.h (w32_output): Remove menu_command_in_progress. 521 * w32term.h (w32_output): Remove menu_command_in_progress.
522 522
@@ -15816,14 +15816,14 @@
15816 Add prototypes. 15816 Add prototypes.
15817 15817
15818 * macterm.c (mac_draw_bitmap): Add overlay_p arg. 15818 * macterm.c (mac_draw_bitmap): Add overlay_p arg.
15819 (x_draw_fringe_bitmap): Handle overlayed fringe bitmaps; 15819 (x_draw_fringe_bitmap): Handle overlaid fringe bitmaps;
15820 thanks to YAMAMOTO Mitsuharu for advice on how to do this. 15820 thanks to YAMAMOTO Mitsuharu for advice on how to do this.
15821 Use cursor color for displaying cursor in fringe. 15821 Use cursor color for displaying cursor in fringe.
15822 (x_redisplay_interface): Add null handlers for 15822 (x_redisplay_interface): Add null handlers for
15823 define_fringe_bitmap and destroy_fringe_bitmap functions. 15823 define_fringe_bitmap and destroy_fringe_bitmap functions.
15824 15824
15825 * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from 15825 * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from
15826 xterm.c to handle overlayed fringe bitmaps and to use cursor color 15826 xterm.c to handle overlaid fringe bitmaps and to use cursor color
15827 for displaying cursor in fringe. 15827 for displaying cursor in fringe.
15828 (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32 15828 (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32
15829 specific functions to define and destroy fringe bitmaps in fringe_bmp. 15829 specific functions to define and destroy fringe bitmaps in fringe_bmp.
@@ -15849,7 +15849,7 @@
15849 (display_line): Handle cursor in fringe at eob. 15849 (display_line): Handle cursor in fringe at eob.
15850 (display_line): Set row user fringe bitmaps from iterator. 15850 (display_line): Set row user fringe bitmaps from iterator.
15851 15851
15852 * xterm.c (x_draw_fringe_bitmap): Handle overlayed fringe bitmaps. 15852 * xterm.c (x_draw_fringe_bitmap): Handle overlaid fringe bitmaps.
15853 Use cursor color for displaying cursor in fringe. 15853 Use cursor color for displaying cursor in fringe.
15854 (x_redisplay_interface): Add null handlers for 15854 (x_redisplay_interface): Add null handlers for
15855 define_fringe_bitmap and destroy_fringe_bitmap functions. 15855 define_fringe_bitmap and destroy_fringe_bitmap functions.
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index 7c46dea675c..78639ef0c2b 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -12897,7 +12897,7 @@
12897 * font.c (font_update_drivers): Sanity fallback to avoid disabling 12897 * font.c (font_update_drivers): Sanity fallback to avoid disabling
12898 all drivers. 12898 all drivers.
12899 12899
12900 * nsterm.m (-windowDidResize:): Avoid inf-loop under GNUStep. 12900 * nsterm.m (-windowDidResize:): Avoid inf-loop under GNUstep.
12901 12901
129022009-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 129022009-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
12903 12903
@@ -23182,7 +23182,7 @@
23182 * font.c (font_prop_validate_symbol, font_prop_validate_style) 23182 * font.c (font_prop_validate_symbol, font_prop_validate_style)
23183 (font_prop_validate_non_neg, font_prop_validate_spacing): 23183 (font_prop_validate_non_neg, font_prop_validate_spacing):
23184 Delete argument prop_index. 23184 Delete argument prop_index.
23185 (font_property_table): Change arguments to validater. Change Callers. 23185 (font_property_table): Change arguments to validator. Change Callers.
23186 (font_lispy_object): Delete. 23186 (font_lispy_object): Delete.
23187 (font_at): Use font_find_object instead fo font_lispy_object. 23187 (font_at): Use font_find_object instead fo font_lispy_object.
23188 23188
@@ -30657,7 +30657,7 @@
30657 (display_buffer): Do not set split_height_threshold to twice the 30657 (display_buffer): Do not set split_height_threshold to twice the
30658 value of window_min_height to avoid changing the value of a 30658 value of window_min_height to avoid changing the value of a
30659 customizable variable. Rather explicitly check whether the 30659 customizable variable. Rather explicitly check whether the
30660 height of the window that shall be splitted is at least as large 30660 height of the window that shall be split is at least as large
30661 as split_height_threshold. 30661 as split_height_threshold.
30662 (Fwindow_full_width_p): New defun. 30662 (Fwindow_full_width_p): New defun.
30663 (syms_of_window): Defsubr it. 30663 (syms_of_window): Defsubr it.
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index 62e3de22b09..d3be0064610 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -1811,7 +1811,7 @@
18111987-03-13 Richard M. Stallman (rms@prep) 18111987-03-13 Richard M. Stallman (rms@prep)
1812 1812
1813 * sysdep.c: Don't redefine TCSETAW if already defined. 1813 * sysdep.c: Don't redefine TCSETAW if already defined.
1814 (Cancelled by change on March 17). 1814 (Canceled by change on March 17).
1815 1815
1816 * sunfns.c: New file containing interface to Sun windows. 1816 * sunfns.c: New file containing interface to Sun windows.
1817 This is enabled by the switch HAVE_SUN_WINDOWS. 1817 This is enabled by the switch HAVE_SUN_WINDOWS.
@@ -2254,7 +2254,7 @@
2254 Initialize save_color. 2254 Initialize save_color.
2255 2255
2256 * fileio.c, search.c, sysdep.c, filelock.c, editfns.c, process.c: 2256 * fileio.c, search.c, sysdep.c, filelock.c, editfns.c, process.c:
2257 Delete/replace unused/conditionalised variables 2257 Delete/replace unused/conditionalized variables
2258 2258
22591987-01-15 Richard M. Stallman (rms@prep) 22591987-01-15 Richard M. Stallman (rms@prep)
2260 2260
@@ -2632,7 +2632,7 @@
2632 * fns.c: Fding requires an arg; pass Qnil. 2632 * fns.c: Fding requires an arg; pass Qnil.
2633 2633
2634 * m-alliant.h: define TEXT_START as 0x1000. 2634 * m-alliant.h: define TEXT_START as 0x1000.
2635 Don't define LIBS_STANDARD; the default (sharable) library 2635 Don't define LIBS_STANDARD; the default (shareable) library
2636 is said to work now. 2636 is said to work now.
2637 2637
2638 * alloc.c (mark_object): Now pass address of slot being marked. 2638 * alloc.c (mark_object): Now pass address of slot being marked.
@@ -4220,7 +4220,7 @@
4220 Increase PURESIZE again (sigh) 4220 Increase PURESIZE again (sigh)
4221 4221
4222 * unexec.c (write_segment): 4222 * unexec.c (write_segment):
4223 Kludgey coercions ("(int)") to get this line to compile: 4223 Kludgy coercions ("(int)") to get this line to compile:
4224 nwrite = (((int) ptr + 128) & ~127) - (int) ptr; 4224 nwrite = (((int) ptr + 128) & ~127) - (int) ptr;
4225 Also changed incorrect ~128 to ~127. 4225 Also changed incorrect ~128 to ~127.
4226 4226
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index fc97acdeb1e..bb18f684242 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -3968,7 +3968,7 @@
3968 3968
39691998-01-12 Kenichi Handa <handa@etl.go.jp> 39691998-01-12 Kenichi Handa <handa@etl.go.jp>
3970 3970
3971 * minibuf.c (Fminibuffer_complete_word): Fix a bug of refering 3971 * minibuf.c (Fminibuffer_complete_word): Fix a bug of referring
3972 `i'. We must refer `i_byte' instead. 3972 `i'. We must refer `i_byte' instead.
3973 3973
3974 * insdel.c (insert_from_string_1): Decrement GAP_SIZE by 3974 * insdel.c (insert_from_string_1): Decrement GAP_SIZE by
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index 2f3ee45a1ac..6973717a7d7 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -4027,7 +4027,7 @@
4027 * dispextern.h (struct glyph_row): Flag internal_border_p removed. 4027 * dispextern.h (struct glyph_row): Flag internal_border_p removed.
4028 4028
4029 * xfns.c (x_create_tip_frame): Don't set bitmapIcon resource 4029 * xfns.c (x_create_tip_frame): Don't set bitmapIcon resource
4030 because this will try to access a nonexisting widget. 4030 because this will try to access a nonexistent widget.
4031 4031
40321999-07-26 Markus Rost <rost@gnu.org> 40321999-07-26 Markus Rost <rost@gnu.org>
4033 4033
@@ -11485,7 +11485,7 @@
11485 Substitute homedir by `~' also in default_filename. 11485 Substitute homedir by `~' also in default_filename.
11486 11486
11487 * xdisp.c (try_window_id): Fix computation of tab_offset when 11487 * xdisp.c (try_window_id): Fix computation of tab_offset when
11488 backing up over a character that is splitted across lines. 11488 backing up over a character that is split across lines.
11489 11489
114901999-05-08 Kenichi HANDA <handa@etl.go.jp> 114901999-05-08 Kenichi HANDA <handa@etl.go.jp>
11491 11491
@@ -12583,7 +12583,7 @@
12583 quit_char is typed, in order to break out of potential deadlocks. 12583 quit_char is typed, in order to break out of potential deadlocks.
12584 (cancel_all_deferred_msgs): New function. 12584 (cancel_all_deferred_msgs): New function.
12585 (complete_deferred_msg): Don't abort if msg not found; may have 12585 (complete_deferred_msg): Don't abort if msg not found; may have
12586 been cancelled. 12586 been canceled.
12587 (Fw32_reconstruct_hot_key): Use pre-interned symbols. 12587 (Fw32_reconstruct_hot_key): Use pre-interned symbols.
12588 (Fw32_send_sys_command): Wait for system command to 12588 (Fw32_send_sys_command): Wait for system command to
12589 complete before returning. 12589 complete before returning.
@@ -13701,7 +13701,7 @@
13701 * ccl.c (CCL_WRITE_CHAR): Don't use bcopy. 13701 * ccl.c (CCL_WRITE_CHAR): Don't use bcopy.
13702 (ccl_driver): If BUFFER-MAGNIFICATION of the CCL program is 0, 13702 (ccl_driver): If BUFFER-MAGNIFICATION of the CCL program is 0,
13703 cause error if the program is going to output some bytes. When 13703 cause error if the program is going to output some bytes. When
13704 outputing a string to notify an error, check the case that 13704 outputting a string to notify an error, check the case that
13705 DST_BYTES is zero. 13705 DST_BYTES is zero.
13706 13706
13707 * coding.h (CODING_FINISH_INTERRUPT): New macro. 13707 * coding.h (CODING_FINISH_INTERRUPT): New macro.
diff --git a/src/alloc.c b/src/alloc.c
index 96d63f53cf9..6f70976c345 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6399,7 +6399,7 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
6399 Vgc_cons_percentage = make_float (0.1); 6399 Vgc_cons_percentage = make_float (0.1);
6400 6400
6401 DEFVAR_INT ("pure-bytes-used", pure_bytes_used, 6401 DEFVAR_INT ("pure-bytes-used", pure_bytes_used,
6402 doc: /* Number of bytes of sharable Lisp data allocated so far. */); 6402 doc: /* Number of bytes of shareable Lisp data allocated so far. */);
6403 6403
6404 DEFVAR_INT ("cons-cells-consed", cons_cells_consed, 6404 DEFVAR_INT ("cons-cells-consed", cons_cells_consed,
6405 doc: /* Number of cons cells that have been consed so far. */); 6405 doc: /* Number of cons cells that have been consed so far. */);
diff --git a/src/callint.c b/src/callint.c
index 80e24f6c8ee..25a4713e270 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -274,8 +274,6 @@ invoke it. If KEYS is omitted or nil, the return value of
274 274
275 ptrdiff_t i, nargs; 275 ptrdiff_t i, nargs;
276 int foo; 276 int foo;
277 char prompt1[100];
278 char *tem1;
279 int arg_from_tty = 0; 277 int arg_from_tty = 0;
280 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 278 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
281 int key_count; 279 int key_count;
@@ -491,13 +489,8 @@ invoke it. If KEYS is omitted or nil, the return value of
491 tem = string; 489 tem = string;
492 for (i = 1; *tem; i++) 490 for (i = 1; *tem; i++)
493 { 491 {
494 strncpy (prompt1, tem + 1, sizeof prompt1 - 1); 492 visargs[0] = make_string (tem + 1, strcspn (tem + 1, "\n"));
495 prompt1[sizeof prompt1 - 1] = 0; 493 if (strchr (SSDATA (visargs[0]), '%'))
496 tem1 = strchr (prompt1, '\n');
497 if (tem1) *tem1 = 0;
498
499 visargs[0] = build_string (prompt1);
500 if (strchr (prompt1, '%'))
501 callint_message = Fformat (i, visargs); 494 callint_message = Fformat (i, visargs);
502 else 495 else
503 callint_message = visargs[0]; 496 callint_message = visargs[0];
diff --git a/src/ccl.c b/src/ccl.c
index b7228a4d1cd..65a6dcfcb85 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -210,8 +210,8 @@ static Lisp_Object Vccl_program_table;
210#define CCL_WriteArrayReadJump 0x0B /* Write an array element, read, and jump: 210#define CCL_WriteArrayReadJump 0x0B /* Write an array element, read, and jump:
211 1:A--D--D--R--E--S--S-rrrXXXXX 211 1:A--D--D--R--E--S--S-rrrXXXXX
212 2:LENGTH 212 2:LENGTH
213 3:ELEMENET[0] 213 3:ELEMENT[0]
214 4:ELEMENET[1] 214 4:ELEMENT[1]
215 ... 215 ...
216 N:A--D--D--R--E--S--S-rrrYYYYY 216 N:A--D--D--R--E--S--S-rrrYYYYY
217 ------------------------------ 217 ------------------------------
@@ -552,7 +552,7 @@ static Lisp_Object Vccl_program_table;
552 But, when VALm is mapped to VALn and VALn is not a number, the 552 But, when VALm is mapped to VALn and VALn is not a number, the
553 mapping proceed as below: 553 mapping proceed as below:
554 554
555 If VALn is nil, the lastest map is ignored and the mapping of VALm 555 If VALn is nil, the last map is ignored and the mapping of VALm
556 proceed to the next map. 556 proceed to the next map.
557 557
558 In VALn is t, VALm is reverted to reg[rrr] and the mapping of VALm 558 In VALn is t, VALm is reverted to reg[rrr] and the mapping of VALm
diff --git a/src/charset.c b/src/charset.c
index 3c15f1bee54..49fc7288069 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1660,7 +1660,7 @@ maybe_unify_char (int c, Lisp_Object val)
1660} 1660}
1661 1661
1662 1662
1663/* Return a character correponding to the code-point CODE of 1663/* Return a character corresponding to the code-point CODE of
1664 CHARSET. */ 1664 CHARSET. */
1665 1665
1666int 1666int
diff --git a/src/charset.h b/src/charset.h
index fc35d6bb991..5ca83130b77 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -238,7 +238,7 @@ struct charset
238 int unified_p; 238 int unified_p;
239}; 239};
240 240
241/* Hash table of charset symbols vs. the correponding attribute 241/* Hash table of charset symbols vs. the corresponding attribute
242 vectors. */ 242 vectors. */
243extern Lisp_Object Vcharset_hash_table; 243extern Lisp_Object Vcharset_hash_table;
244 244
@@ -389,7 +389,7 @@ extern Lisp_Object Vchar_charset_set;
389#endif 389#endif
390 390
391 391
392/* Return a character correponding to the code-point CODE of CHARSET. 392/* Return a character corresponding to the code-point CODE of CHARSET.
393 Try some optimization before calling decode_char. */ 393 Try some optimization before calling decode_char. */
394 394
395#define DECODE_CHAR(charset, code) \ 395#define DECODE_CHAR(charset, code) \
diff --git a/src/cm.h b/src/cm.h
index dbf0820b94c..a8c7e0d7c4b 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -16,7 +16,7 @@ GNU General Public License for more details.
16You should have received a copy of the GNU General Public License 16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19/* Holds the minimum and maximum costs for the parametrized capabilities. */ 19/* Holds the minimum and maximum costs for the parameterized capabilities. */
20struct parmcap 20struct parmcap
21 { 21 {
22 int mincost, maxcost; 22 int mincost, maxcost;
@@ -79,7 +79,7 @@ struct cm
79 struct parmcap cc_multiright; /* multiple right (RI) */ 79 struct parmcap cc_multiright; /* multiple right (RI) */
80#endif 80#endif
81 81
82 /* Costs for the non-parametrized capabilities */ 82 /* Costs for the non-parameterized capabilities */
83 int cc_up; /* cost for up */ 83 int cc_up; /* cost for up */
84 int cc_down; /* etc. */ 84 int cc_down; /* etc. */
85 int cc_left; 85 int cc_left;
diff --git a/src/coding.c b/src/coding.c
index 79908e9b29b..2db5385c932 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -847,16 +847,16 @@ static int encode_coding_ccl (struct coding_system *);
847static void decode_coding_raw_text (struct coding_system *); 847static void decode_coding_raw_text (struct coding_system *);
848static int encode_coding_raw_text (struct coding_system *); 848static int encode_coding_raw_text (struct coding_system *);
849 849
850static void coding_set_source (struct coding_system *); 850static EMACS_INT coding_set_source (struct coding_system *);
851static void coding_set_destination (struct coding_system *); 851static EMACS_INT coding_set_destination (struct coding_system *);
852static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT); 852static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT);
853static void coding_alloc_by_making_gap (struct coding_system *, 853static void coding_alloc_by_making_gap (struct coding_system *,
854 EMACS_INT, EMACS_INT); 854 EMACS_INT, EMACS_INT);
855static unsigned char *alloc_destination (struct coding_system *, 855static unsigned char *alloc_destination (struct coding_system *,
856 EMACS_INT, unsigned char *); 856 EMACS_INT, unsigned char *);
857static void setup_iso_safe_charsets (Lisp_Object); 857static void setup_iso_safe_charsets (Lisp_Object);
858static unsigned char *encode_designation_at_bol (struct coding_system *, 858static int encode_designation_at_bol (struct coding_system *,
859 int *, unsigned char *); 859 int *, int *, unsigned char *);
860static int detect_eol (const unsigned char *, 860static int detect_eol (const unsigned char *,
861 EMACS_INT, enum coding_category); 861 EMACS_INT, enum coding_category);
862static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); 862static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
@@ -915,27 +915,68 @@ record_conversion_result (struct coding_system *coding,
915 } 915 }
916} 916}
917 917
918/* This wrapper macro is used to preserve validity of pointers into 918/* These wrapper macros are used to preserve validity of pointers into
919 buffer text across calls to decode_char, which could cause 919 buffer text across calls to decode_char, encode_char, etc, which
920 relocation of buffers if it loads a charset map, because loading a 920 could cause relocation of buffers if it loads a charset map,
921 charset map allocates large structures. */ 921 because loading a charset map allocates large structures. */
922
922#define CODING_DECODE_CHAR(coding, src, src_base, src_end, charset, code, c) \ 923#define CODING_DECODE_CHAR(coding, src, src_base, src_end, charset, code, c) \
923 do { \ 924 do { \
925 EMACS_INT offset; \
926 \
924 charset_map_loaded = 0; \ 927 charset_map_loaded = 0; \
925 c = DECODE_CHAR (charset, code); \ 928 c = DECODE_CHAR (charset, code); \
926 if (charset_map_loaded) \ 929 if (charset_map_loaded \
930 && (offset = coding_set_source (coding))) \
927 { \ 931 { \
928 const unsigned char *orig = coding->source; \
929 EMACS_INT offset; \
930 \
931 coding_set_source (coding); \
932 offset = coding->source - orig; \
933 src += offset; \ 932 src += offset; \
934 src_base += offset; \ 933 src_base += offset; \
935 src_end += offset; \ 934 src_end += offset; \
936 } \ 935 } \
937 } while (0) 936 } while (0)
938 937
938#define CODING_ENCODE_CHAR(coding, dst, dst_end, charset, c, code) \
939 do { \
940 EMACS_INT offset; \
941 \
942 charset_map_loaded = 0; \
943 code = ENCODE_CHAR (charset, c); \
944 if (charset_map_loaded \
945 && (offset = coding_set_destination (coding))) \
946 { \
947 dst += offset; \
948 dst_end += offset; \
949 } \
950 } while (0)
951
952#define CODING_CHAR_CHARSET(coding, dst, dst_end, c, charset_list, code_return, charset) \
953 do { \
954 EMACS_INT offset; \
955 \
956 charset_map_loaded = 0; \
957 charset = char_charset (c, charset_list, code_return); \
958 if (charset_map_loaded \
959 && (offset = coding_set_destination (coding))) \
960 { \
961 dst += offset; \
962 dst_end += offset; \
963 } \
964 } while (0)
965
966#define CODING_CHAR_CHARSET_P(coding, dst, dst_end, c, charset, result) \
967 do { \
968 EMACS_INT offset; \
969 \
970 charset_map_loaded = 0; \
971 result = CHAR_CHARSET_P (c, charset); \
972 if (charset_map_loaded \
973 && (offset = coding_set_destination (coding))) \
974 { \
975 dst += offset; \
976 dst_end += offset; \
977 } \
978 } while (0)
979
939 980
940/* If there are at least BYTES length of room at dst, allocate memory 981/* If there are at least BYTES length of room at dst, allocate memory
941 for coding->destination and update dst and dst_end. We don't have 982 for coding->destination and update dst and dst_end. We don't have
@@ -1015,9 +1056,14 @@ record_conversion_result (struct coding_system *coding,
1015 | ((p)[-1] & 0x3F)))) 1056 | ((p)[-1] & 0x3F))))
1016 1057
1017 1058
1018static void 1059/* Update coding->source from coding->src_object, and return how many
1060 bytes coding->source was changed. */
1061
1062static EMACS_INT
1019coding_set_source (struct coding_system *coding) 1063coding_set_source (struct coding_system *coding)
1020{ 1064{
1065 const unsigned char *orig = coding->source;
1066
1021 if (BUFFERP (coding->src_object)) 1067 if (BUFFERP (coding->src_object))
1022 { 1068 {
1023 struct buffer *buf = XBUFFER (coding->src_object); 1069 struct buffer *buf = XBUFFER (coding->src_object);
@@ -1036,11 +1082,18 @@ coding_set_source (struct coding_system *coding)
1036 /* Otherwise, the source is C string and is never relocated 1082 /* Otherwise, the source is C string and is never relocated
1037 automatically. Thus we don't have to update anything. */ 1083 automatically. Thus we don't have to update anything. */
1038 } 1084 }
1085 return coding->source - orig;
1039} 1086}
1040 1087
1041static void 1088
1089/* Update coding->destination from coding->dst_object, and return how
1090 many bytes coding->destination was changed. */
1091
1092static EMACS_INT
1042coding_set_destination (struct coding_system *coding) 1093coding_set_destination (struct coding_system *coding)
1043{ 1094{
1095 const unsigned char *orig = coding->destination;
1096
1044 if (BUFFERP (coding->dst_object)) 1097 if (BUFFERP (coding->dst_object))
1045 { 1098 {
1046 if (BUFFERP (coding->src_object) && coding->src_pos < 0) 1099 if (BUFFERP (coding->src_object) && coding->src_pos < 0)
@@ -1065,6 +1118,7 @@ coding_set_destination (struct coding_system *coding)
1065 /* Otherwise, the destination is C string and is never relocated 1118 /* Otherwise, the destination is C string and is never relocated
1066 automatically. Thus we don't have to update anything. */ 1119 automatically. Thus we don't have to update anything. */
1067 } 1120 }
1121 return coding->destination - orig;
1068} 1122}
1069 1123
1070 1124
@@ -2650,14 +2704,19 @@ encode_coding_emacs_mule (struct coding_system *coding)
2650 2704
2651 if (preferred_charset_id >= 0) 2705 if (preferred_charset_id >= 0)
2652 { 2706 {
2707 int result;
2708
2653 charset = CHARSET_FROM_ID (preferred_charset_id); 2709 charset = CHARSET_FROM_ID (preferred_charset_id);
2654 if (CHAR_CHARSET_P (c, charset)) 2710 CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
2711 if (result)
2655 code = ENCODE_CHAR (charset, c); 2712 code = ENCODE_CHAR (charset, c);
2656 else 2713 else
2657 charset = char_charset (c, charset_list, &code); 2714 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
2715 &code, charset);
2658 } 2716 }
2659 else 2717 else
2660 charset = char_charset (c, charset_list, &code); 2718 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
2719 &code, charset);
2661 if (! charset) 2720 if (! charset)
2662 { 2721 {
2663 c = coding->default_char; 2722 c = coding->default_char;
@@ -2666,7 +2725,8 @@ encode_coding_emacs_mule (struct coding_system *coding)
2666 EMIT_ONE_ASCII_BYTE (c); 2725 EMIT_ONE_ASCII_BYTE (c);
2667 continue; 2726 continue;
2668 } 2727 }
2669 charset = char_charset (c, charset_list, &code); 2728 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
2729 &code, charset);
2670 } 2730 }
2671 dimension = CHARSET_DIMENSION (charset); 2731 dimension = CHARSET_DIMENSION (charset);
2672 emacs_mule_id = CHARSET_EMACS_MULE_ID (charset); 2732 emacs_mule_id = CHARSET_EMACS_MULE_ID (charset);
@@ -4185,7 +4245,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
4185 4245
4186#define ENCODE_ISO_CHARACTER(charset, c) \ 4246#define ENCODE_ISO_CHARACTER(charset, c) \
4187 do { \ 4247 do { \
4188 int code = ENCODE_CHAR ((charset), (c)); \ 4248 int code; \
4249 CODING_ENCODE_CHAR (coding, dst, dst_end, (charset), (c), code); \
4189 \ 4250 \
4190 if (CHARSET_DIMENSION (charset) == 1) \ 4251 if (CHARSET_DIMENSION (charset) == 1) \
4191 ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \ 4252 ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \
@@ -4283,15 +4344,19 @@ encode_invocation_designation (struct charset *charset,
4283 4344
4284 4345
4285/* Produce designation sequences of charsets in the line started from 4346/* Produce designation sequences of charsets in the line started from
4286 SRC to a place pointed by DST, and return updated DST. 4347 CHARBUF to a place pointed by DST, and return the number of
4348 produced bytes. DST should not directly point a buffer text area
4349 which may be relocated by char_charset call.
4287 4350
4288 If the current block ends before any end-of-line, we may fail to 4351 If the current block ends before any end-of-line, we may fail to
4289 find all the necessary designations. */ 4352 find all the necessary designations. */
4290 4353
4291static unsigned char * 4354static int
4292encode_designation_at_bol (struct coding_system *coding, int *charbuf, 4355encode_designation_at_bol (struct coding_system *coding,
4356 int *charbuf, int *charbuf_end,
4293 unsigned char *dst) 4357 unsigned char *dst)
4294{ 4358{
4359 unsigned char *orig = dst;
4295 struct charset *charset; 4360 struct charset *charset;
4296 /* Table of charsets to be designated to each graphic register. */ 4361 /* Table of charsets to be designated to each graphic register. */
4297 int r[4]; 4362 int r[4];
@@ -4309,7 +4374,7 @@ encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4309 for (reg = 0; reg < 4; reg++) 4374 for (reg = 0; reg < 4; reg++)
4310 r[reg] = -1; 4375 r[reg] = -1;
4311 4376
4312 while (found < 4) 4377 while (charbuf < charbuf_end && found < 4)
4313 { 4378 {
4314 int id; 4379 int id;
4315 4380
@@ -4334,7 +4399,7 @@ encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4334 ENCODE_DESIGNATION (CHARSET_FROM_ID (r[reg]), reg, coding); 4399 ENCODE_DESIGNATION (CHARSET_FROM_ID (r[reg]), reg, coding);
4335 } 4400 }
4336 4401
4337 return dst; 4402 return dst - orig;
4338} 4403}
4339 4404
4340/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ 4405/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */
@@ -4378,13 +4443,26 @@ encode_coding_iso_2022 (struct coding_system *coding)
4378 4443
4379 if (bol_designation) 4444 if (bol_designation)
4380 { 4445 {
4381 unsigned char *dst_prev = dst;
4382
4383 /* We have to produce designation sequences if any now. */ 4446 /* We have to produce designation sequences if any now. */
4384 dst = encode_designation_at_bol (coding, charbuf, dst); 4447 unsigned char desig_buf[16];
4385 bol_designation = 0; 4448 int nbytes;
4449 EMACS_INT offset;
4450
4451 charset_map_loaded = 0;
4452 nbytes = encode_designation_at_bol (coding, charbuf, charbuf_end,
4453 desig_buf);
4454 if (charset_map_loaded
4455 && (offset = coding_set_destination (coding)))
4456 {
4457 dst += offset;
4458 dst_end += offset;
4459 }
4460 memcpy (dst, desig_buf, nbytes);
4461 dst += nbytes;
4386 /* We are sure that designation sequences are all ASCII bytes. */ 4462 /* We are sure that designation sequences are all ASCII bytes. */
4387 produced_chars += dst - dst_prev; 4463 produced_chars += nbytes;
4464 bol_designation = 0;
4465 ASSURE_DESTINATION (safe_room);
4388 } 4466 }
4389 4467
4390 c = *charbuf++; 4468 c = *charbuf++;
@@ -4455,12 +4533,17 @@ encode_coding_iso_2022 (struct coding_system *coding)
4455 4533
4456 if (preferred_charset_id >= 0) 4534 if (preferred_charset_id >= 0)
4457 { 4535 {
4536 int result;
4537
4458 charset = CHARSET_FROM_ID (preferred_charset_id); 4538 charset = CHARSET_FROM_ID (preferred_charset_id);
4459 if (! CHAR_CHARSET_P (c, charset)) 4539 CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
4460 charset = char_charset (c, charset_list, NULL); 4540 if (! result)
4541 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
4542 NULL, charset);
4461 } 4543 }
4462 else 4544 else
4463 charset = char_charset (c, charset_list, NULL); 4545 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
4546 NULL, charset);
4464 if (!charset) 4547 if (!charset)
4465 { 4548 {
4466 if (coding->mode & CODING_MODE_SAFE_ENCODING) 4549 if (coding->mode & CODING_MODE_SAFE_ENCODING)
@@ -4471,7 +4554,8 @@ encode_coding_iso_2022 (struct coding_system *coding)
4471 else 4554 else
4472 { 4555 {
4473 c = coding->default_char; 4556 c = coding->default_char;
4474 charset = char_charset (c, charset_list, NULL); 4557 CODING_CHAR_CHARSET (coding, dst, dst_end, c,
4558 charset_list, NULL, charset);
4475 } 4559 }
4476 } 4560 }
4477 ENCODE_ISO_CHARACTER (charset, c); 4561 ENCODE_ISO_CHARACTER (charset, c);
@@ -4897,7 +4981,9 @@ encode_coding_sjis (struct coding_system *coding)
4897 else 4981 else
4898 { 4982 {
4899 unsigned code; 4983 unsigned code;
4900 struct charset *charset = char_charset (c, charset_list, &code); 4984 struct charset *charset;
4985 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
4986 &code, charset);
4901 4987
4902 if (!charset) 4988 if (!charset)
4903 { 4989 {
@@ -4909,7 +4995,8 @@ encode_coding_sjis (struct coding_system *coding)
4909 else 4995 else
4910 { 4996 {
4911 c = coding->default_char; 4997 c = coding->default_char;
4912 charset = char_charset (c, charset_list, &code); 4998 CODING_CHAR_CHARSET (coding, dst, dst_end, c,
4999 charset_list, &code, charset);
4913 } 5000 }
4914 } 5001 }
4915 if (code == CHARSET_INVALID_CODE (charset)) 5002 if (code == CHARSET_INVALID_CODE (charset))
@@ -4984,7 +5071,9 @@ encode_coding_big5 (struct coding_system *coding)
4984 else 5071 else
4985 { 5072 {
4986 unsigned code; 5073 unsigned code;
4987 struct charset *charset = char_charset (c, charset_list, &code); 5074 struct charset *charset;
5075 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
5076 &code, charset);
4988 5077
4989 if (! charset) 5078 if (! charset)
4990 { 5079 {
@@ -4996,7 +5085,8 @@ encode_coding_big5 (struct coding_system *coding)
4996 else 5085 else
4997 { 5086 {
4998 c = coding->default_char; 5087 c = coding->default_char;
4999 charset = char_charset (c, charset_list, &code); 5088 CODING_CHAR_CHARSET (coding, dst, dst_end, c,
5089 charset_list, &code, charset);
5000 } 5090 }
5001 } 5091 }
5002 if (code == CHARSET_INVALID_CODE (charset)) 5092 if (code == CHARSET_INVALID_CODE (charset))
@@ -5154,7 +5244,7 @@ encode_coding_ccl (struct coding_system *coding)
5154 && coding->mode & CODING_MODE_LAST_BLOCK) 5244 && coding->mode & CODING_MODE_LAST_BLOCK)
5155 ccl->last_block = 1; 5245 ccl->last_block = 1;
5156 5246
5157 while (charbuf < charbuf_end) 5247 do
5158 { 5248 {
5159 ccl_driver (ccl, charbuf, destination_charbuf, 5249 ccl_driver (ccl, charbuf, destination_charbuf,
5160 charbuf_end - charbuf, 1024, charset_list); 5250 charbuf_end - charbuf, 1024, charset_list);
@@ -5176,6 +5266,7 @@ encode_coding_ccl (struct coding_system *coding)
5176 || ccl->status == CCL_STAT_INVALID_CMD) 5266 || ccl->status == CCL_STAT_INVALID_CMD)
5177 break; 5267 break;
5178 } 5268 }
5269 while (charbuf < charbuf_end);
5179 5270
5180 switch (ccl->status) 5271 switch (ccl->status)
5181 { 5272 {
@@ -5572,7 +5663,9 @@ encode_coding_charset (struct coding_system *coding)
5572 } 5663 }
5573 else 5664 else
5574 { 5665 {
5575 charset = char_charset (c, charset_list, &code); 5666 CODING_CHAR_CHARSET (coding, dst, dst_end, c, charset_list,
5667 &code, charset);
5668
5576 if (charset) 5669 if (charset)
5577 { 5670 {
5578 if (CHARSET_DIMENSION (charset) == 1) 5671 if (CHARSET_DIMENSION (charset) == 1)
@@ -8663,6 +8756,7 @@ to the string. */)
8663 } 8756 }
8664 8757
8665 positions = Qnil; 8758 positions = Qnil;
8759 charset_map_loaded = 0;
8666 while (1) 8760 while (1)
8667 { 8761 {
8668 int c; 8762 int c;
@@ -8690,6 +8784,16 @@ to the string. */)
8690 } 8784 }
8691 8785
8692 from++; 8786 from++;
8787 if (charset_map_loaded && NILP (string))
8788 {
8789 p = CHAR_POS_ADDR (from);
8790 pend = CHAR_POS_ADDR (to);
8791 if (from < GPT && to >= GPT)
8792 stop = GPT_ADDR;
8793 else
8794 stop = pend;
8795 charset_map_loaded = 0;
8796 }
8693 } 8797 }
8694 8798
8695 return (NILP (count) ? Fcar (positions) : Fnreverse (positions)); 8799 return (NILP (count) ? Fcar (positions) : Fnreverse (positions));
@@ -9208,7 +9312,7 @@ frame's terminal device. */)
9208 = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); 9312 = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
9209 Lisp_Object coding_system = CODING_ID_NAME (terminal_coding->id); 9313 Lisp_Object coding_system = CODING_ID_NAME (terminal_coding->id);
9210 9314
9211 /* For backward compatibility, return nil if it is `undecided'. */ 9315 /* For backward compatibility, return nil if it is `undecided'. */
9212 return (! EQ (coding_system, Qundecided) ? coding_system : Qnil); 9316 return (! EQ (coding_system, Qundecided) ? coding_system : Qnil);
9213} 9317}
9214 9318
@@ -9895,8 +9999,6 @@ usage: (define-coding-system-internal ...) */)
9895 { 9999 {
9896 Lisp_Object bom; 10000 Lisp_Object bom;
9897 10001
9898 CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
9899
9900 if (nargs < coding_arg_utf8_max) 10002 if (nargs < coding_arg_utf8_max)
9901 goto short_args; 10003 goto short_args;
9902 10004
@@ -9910,6 +10012,8 @@ usage: (define-coding-system-internal ...) */)
9910 CHECK_CODING_SYSTEM (val); 10012 CHECK_CODING_SYSTEM (val);
9911 } 10013 }
9912 ASET (attrs, coding_attr_utf_bom, bom); 10014 ASET (attrs, coding_attr_utf_bom, bom);
10015 if (NILP (bom))
10016 CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
9913 10017
9914 category = (CONSP (bom) ? coding_category_utf_8_auto 10018 category = (CONSP (bom) ? coding_category_utf_8_auto
9915 : NILP (bom) ? coding_category_utf_8_nosig 10019 : NILP (bom) ? coding_category_utf_8_nosig
diff --git a/src/coding.h b/src/coding.h
index 2621928adc3..b694e6c6b6e 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -457,7 +457,7 @@ struct coding_system
457 /* Number of error source data found in a decoding routine. */ 457 /* Number of error source data found in a decoding routine. */
458 int errors; 458 int errors;
459 459
460 /* Store the positions of error source data. */ 460 /* Store the positions of error source data. */
461 EMACS_INT *error_positions; 461 EMACS_INT *error_positions;
462 462
463 /* Finish status of code conversion. */ 463 /* Finish status of code conversion. */
diff --git a/src/data.c b/src/data.c
index e8d2b43198f..0ebb17a2e01 100644
--- a/src/data.c
+++ b/src/data.c
@@ -839,7 +839,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
839 839
840 case Lisp_Fwd_Kboard_Obj: 840 case Lisp_Fwd_Kboard_Obj:
841 /* We used to simply use current_kboard here, but from Lisp 841 /* We used to simply use current_kboard here, but from Lisp
842 code, it's value is often unexpected. It seems nicer to 842 code, its value is often unexpected. It seems nicer to
843 allow constructions like this to work as intuitively expected: 843 allow constructions like this to work as intuitively expected:
844 844
845 (with-selected-frame frame 845 (with-selected-frame frame
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7984be3564b..c5448ee5e7a 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -968,7 +968,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
968 connection = xd_initialize (bus, TRUE); 968 connection = xd_initialize (bus, TRUE);
969 969
970 /* Add the watch functions. We pass also the bus as data, in order 970 /* Add the watch functions. We pass also the bus as data, in order
971 to distinguish between the busses in xd_remove_watch. */ 971 to distinguish between the buses in xd_remove_watch. */
972 if (!dbus_connection_set_watch_functions (connection, 972 if (!dbus_connection_set_watch_functions (connection,
973 xd_add_watch, 973 xd_add_watch,
974 xd_remove_watch, 974 xd_remove_watch,
diff --git a/src/editfns.c b/src/editfns.c
index 83cd4bd5535..7077f40e51c 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3870,7 +3870,7 @@ usage: (format STRING &rest OBJECTS) */)
3870 enum 3870 enum
3871 { 3871 {
3872 /* Maximum precision for a %f conversion such that the 3872 /* Maximum precision for a %f conversion such that the
3873 trailing output digit might be nonzero. Any precisions 3873 trailing output digit might be nonzero. Any precision
3874 larger than this will not yield useful information. */ 3874 larger than this will not yield useful information. */
3875 USEFUL_PRECISION_MAX = 3875 USEFUL_PRECISION_MAX =
3876 ((1 - DBL_MIN_EXP) 3876 ((1 - DBL_MIN_EXP)
diff --git a/src/emacs.c b/src/emacs.c
index 8a24b04fc2b..6f6338cefec 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -157,6 +157,8 @@ Lisp_Object Qfile_name_handler_alist;
157 157
158Lisp_Object Qrisky_local_variable; 158Lisp_Object Qrisky_local_variable;
159 159
160Lisp_Object Qkill_emacs;
161
160/* If non-zero, Emacs should not attempt to use a window-specific code, 162/* If non-zero, Emacs should not attempt to use a window-specific code,
161 but instead should use the virtual terminal under which it was started. */ 163 but instead should use the virtual terminal under which it was started. */
162int inhibit_window_system; 164int inhibit_window_system;
@@ -322,6 +324,12 @@ static void (*fatal_error_signal_hook) (void);
322pthread_t main_thread; 324pthread_t main_thread;
323#endif 325#endif
324 326
327#ifdef HAVE_NS
328/* NS autrelease pool, for memory management. */
329static void *ns_pool;
330#endif
331
332
325 333
326/* Handle bus errors, invalid instruction, etc. */ 334/* Handle bus errors, invalid instruction, etc. */
327#ifndef FLOAT_CATCH_SIGILL 335#ifndef FLOAT_CATCH_SIGILL
@@ -952,7 +960,7 @@ main (int argc, char **argv)
952 } 960 }
953 961
954 /* Command line option --no-windows is deprecated and thus not mentioned 962 /* Command line option --no-windows is deprecated and thus not mentioned
955 in the manual and usage informations. */ 963 in the manual and usage information. */
956 if (argmatch (argv, argc, "-nw", "--no-window-system", 6, NULL, &skip_args) 964 if (argmatch (argv, argc, "-nw", "--no-window-system", 6, NULL, &skip_args)
957 || argmatch (argv, argc, "-nw", "--no-windows", 6, NULL, &skip_args)) 965 || argmatch (argv, argc, "-nw", "--no-windows", 6, NULL, &skip_args))
958 inhibit_window_system = 1; 966 inhibit_window_system = 1;
@@ -1319,7 +1327,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1319 = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args); 1327 = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args);
1320 1328
1321#ifdef HAVE_NS 1329#ifdef HAVE_NS
1322 ns_alloc_autorelease_pool (); 1330 ns_pool = ns_alloc_autorelease_pool ();
1323 if (!noninteractive) 1331 if (!noninteractive)
1324 { 1332 {
1325#ifdef NS_IMPL_COCOA 1333#ifdef NS_IMPL_COCOA
@@ -2019,6 +2027,10 @@ all of which are called before Emacs is actually killed. */)
2019 2027
2020 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil); 2028 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
2021 2029
2030#ifdef HAVE_NS
2031 ns_release_autorelease_pool (ns_pool);
2032#endif
2033
2022 /* If we have an auto-save list file, 2034 /* If we have an auto-save list file,
2023 kill it because we are exiting Emacs deliberately (not crashing). 2035 kill it because we are exiting Emacs deliberately (not crashing).
2024 Do it after shut_down_emacs, which does an auto-save. */ 2036 Do it after shut_down_emacs, which does an auto-save. */
@@ -2400,6 +2412,7 @@ syms_of_emacs (void)
2400{ 2412{
2401 DEFSYM (Qfile_name_handler_alist, "file-name-handler-alist"); 2413 DEFSYM (Qfile_name_handler_alist, "file-name-handler-alist");
2402 DEFSYM (Qrisky_local_variable, "risky-local-variable"); 2414 DEFSYM (Qrisky_local_variable, "risky-local-variable");
2415 DEFSYM (Qkill_emacs, "kill-emacs");
2403 2416
2404#ifndef CANNOT_DUMP 2417#ifndef CANNOT_DUMP
2405 defsubr (&Sdump_emacs); 2418 defsubr (&Sdump_emacs);
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 8cde68d8303..b8d3fea66e8 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -1,4 +1,4 @@
1/* A Gtk Widget that inherits GtkFixed, but can be shrinked. 1/* A Gtk Widget that inherits GtkFixed, but can be shrunk.
2This file is only use when compiling with Gtk+ 3. 2This file is only use when compiling with Gtk+ 3.
3 3
4Copyright (C) 2011 Free Software Foundation, Inc. 4Copyright (C) 2011 Free Software Foundation, Inc.
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
index dbac136bd7f..c70e9a3efe3 100644
--- a/src/emacsgtkfixed.h
+++ b/src/emacsgtkfixed.h
@@ -1,4 +1,4 @@
1/* A Gtk Widget that inherits GtkFixed, but can be shrinked. 1/* A Gtk Widget that inherits GtkFixed, but can be shrunk.
2This file is only use when compiling with Gtk+ 3. 2This file is only use when compiling with Gtk+ 3.
3 3
4Copyright (C) 2011 Free Software Foundation, Inc. 4Copyright (C) 2011 Free Software Foundation, Inc.
diff --git a/src/eval.c b/src/eval.c
index 32b9d366fc3..079c7ecb6c2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1629,6 +1629,18 @@ static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object);
1629static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, 1629static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
1630 Lisp_Object data); 1630 Lisp_Object data);
1631 1631
1632void
1633process_quit_flag (void)
1634{
1635 Lisp_Object flag = Vquit_flag;
1636 Vquit_flag = Qnil;
1637 if (EQ (flag, Qkill_emacs))
1638 Fkill_emacs (Qnil);
1639 if (EQ (Vthrow_on_input, flag))
1640 Fthrow (Vthrow_on_input, Qt);
1641 Fsignal (Qquit, Qnil);
1642}
1643
1632DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, 1644DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0,
1633 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. 1645 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA.
1634This function does not return. 1646This function does not return.
@@ -3733,7 +3745,7 @@ When lexical binding is not being used, this variable is nil.
3733A value of `(t)' indicates an empty environment, otherwise it is an 3745A value of `(t)' indicates an empty environment, otherwise it is an
3734alist of active lexical bindings. */); 3746alist of active lexical bindings. */);
3735 Vinternal_interpreter_environment = Qnil; 3747 Vinternal_interpreter_environment = Qnil;
3736 /* Don't export this variable to Elisp, so noone can mess with it 3748 /* Don't export this variable to Elisp, so no one can mess with it
3737 (Just imagine if someone makes it buffer-local). */ 3749 (Just imagine if someone makes it buffer-local). */
3738 Funintern (Qinternal_interpreter_environment, Qnil); 3750 Funintern (Qinternal_interpreter_environment, Qnil);
3739 3751
diff --git a/src/fileio.c b/src/fileio.c
index c0f6c1d2e8e..3306085491e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2416,15 +2416,27 @@ check_writable (const char *filename)
2416 return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); 2416 return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode));
2417#else /* not MSDOS */ 2417#else /* not MSDOS */
2418#ifdef HAVE_EUIDACCESS 2418#ifdef HAVE_EUIDACCESS
2419 return (euidaccess (filename, 2) >= 0); 2419 int res = (euidaccess (filename, 2) >= 0);
2420#else 2420#ifdef CYGWIN
2421 /* euidaccess may have returned failure because Cygwin couldn't
2422 determine the file's UID or GID; if so, we return success. */
2423 if (!res)
2424 {
2425 struct stat st;
2426 if (stat (filename, &st) < 0)
2427 return 0;
2428 res = (st.st_uid == -1 || st.st_gid == -1);
2429 }
2430#endif /* CYGWIN */
2431 return res;
2432#else /* not HAVE_EUIDACCESS */
2421 /* Access isn't quite right because it uses the real uid 2433 /* Access isn't quite right because it uses the real uid
2422 and we really want to test with the effective uid. 2434 and we really want to test with the effective uid.
2423 But Unix doesn't give us a right way to do it. 2435 But Unix doesn't give us a right way to do it.
2424 Opening with O_WRONLY could work for an ordinary file, 2436 Opening with O_WRONLY could work for an ordinary file,
2425 but would lose for directories. */ 2437 but would lose for directories. */
2426 return (access (filename, 2) >= 0); 2438 return (access (filename, 2) >= 0);
2427#endif 2439#endif /* not HAVE_EUIDACCESS */
2428#endif /* not MSDOS */ 2440#endif /* not MSDOS */
2429} 2441}
2430 2442
@@ -4186,7 +4198,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4186 /* If REPLACE is non-nil and we succeeded in not replacing the 4198 /* If REPLACE is non-nil and we succeeded in not replacing the
4187 beginning or end of the buffer text with the file's contents, 4199 beginning or end of the buffer text with the file's contents,
4188 call format-decode with `point' positioned at the beginning 4200 call format-decode with `point' positioned at the beginning
4189 of the buffer and `inserted' equalling the number of 4201 of the buffer and `inserted' equaling the number of
4190 characters in the buffer. Otherwise, format-decode might 4202 characters in the buffer. Otherwise, format-decode might
4191 fail to correctly analyze the beginning or end of the buffer. 4203 fail to correctly analyze the beginning or end of the buffer.
4192 Hence we temporarily save `point' and `inserted' here and 4204 Hence we temporarily save `point' and `inserted' here and
diff --git a/src/font.c b/src/font.c
index 35f5703e32e..6ab65281a48 100644
--- a/src/font.c
+++ b/src/font.c
@@ -614,7 +614,7 @@ static const struct
614 /* Function to validate PROP's value VAL, or NULL if any value is 614 /* Function to validate PROP's value VAL, or NULL if any value is
615 ok. The value is VAL or its regularized value if VAL is valid, 615 ok. The value is VAL or its regularized value if VAL is valid,
616 and Qerror if not. */ 616 and Qerror if not. */
617 Lisp_Object (*validater) (Lisp_Object prop, Lisp_Object val); 617 Lisp_Object (*validator) (Lisp_Object prop, Lisp_Object val);
618} font_property_table[] = 618} font_property_table[] =
619 { { &QCtype, font_prop_validate_symbol }, 619 { { &QCtype, font_prop_validate_symbol },
620 { &QCfoundry, font_prop_validate_symbol }, 620 { &QCfoundry, font_prop_validate_symbol },
@@ -672,7 +672,7 @@ font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val)
672 if (idx < 0) 672 if (idx < 0)
673 return val; 673 return val;
674 } 674 }
675 validated = (font_property_table[idx].validater) (prop, val); 675 validated = (font_property_table[idx].validator) (prop, val);
676 if (EQ (validated, Qerror)) 676 if (EQ (validated, Qerror))
677 signal_error ("invalid font property", Fcons (prop, val)); 677 signal_error ("invalid font property", Fcons (prop, val));
678 return validated; 678 return validated;
@@ -825,7 +825,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
825 range_mask = (range_mask << 1) | 1; 825 range_mask = (range_mask << 1) | 1;
826 826
827 /* The triplet RANGE_FROM, RANGE_TO, and RANGE_MASK is a 827 /* The triplet RANGE_FROM, RANGE_TO, and RANGE_MASK is a
828 position-based retriction for FIELD[I]. */ 828 position-based restriction for FIELD[I]. */
829 for (i = 0, range_from = 0, range_to = 14 - n; i < n; 829 for (i = 0, range_from = 0, range_to = 14 - n; i < n;
830 i++, range_from++, range_to++, range_mask <<= 1) 830 i++, range_from++, range_to++, range_mask <<= 1)
831 { 831 {
@@ -842,7 +842,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
842 else 842 else
843 { 843 {
844 /* The triplet FROM, TO, and MASK is a value-based 844 /* The triplet FROM, TO, and MASK is a value-based
845 retriction for FIELD[I]. */ 845 restriction for FIELD[I]. */
846 int from, to; 846 int from, to;
847 unsigned mask; 847 unsigned mask;
848 848
diff --git a/src/font.h b/src/font.h
index 42fc050b670..b6c1acf4a30 100644
--- a/src/font.h
+++ b/src/font.h
@@ -621,7 +621,7 @@ struct font_driver
621 /* Optional. 621 /* Optional.
622 Get coordinates of the INDEXth anchor point of the glyph whose 622 Get coordinates of the INDEXth anchor point of the glyph whose
623 code is CODE. Store the coordinates in *X and *Y. Return 0 if 623 code is CODE. Store the coordinates in *X and *Y. Return 0 if
624 the operations was successfull. Otherwise return -1. */ 624 the operations was successful. Otherwise return -1. */
625 int (*anchor_point) (struct font *font, unsigned code, int index, 625 int (*anchor_point) (struct font *font, unsigned code, int index,
626 int *x, int *y); 626 int *x, int *y);
627 627
@@ -705,7 +705,7 @@ struct font_driver
705 705
706 706
707/* Chain of font drivers. There's one global font driver list 707/* Chain of font drivers. There's one global font driver list
708 (font_driver_list in font.c). In addition, each frame has it's own 708 (font_driver_list in font.c). In addition, each frame has its own
709 font driver list at FRAME_PTR->font_driver_list. */ 709 font driver list at FRAME_PTR->font_driver_list. */
710 710
711struct font_driver_list 711struct font_driver_list
@@ -721,7 +721,7 @@ struct font_driver_list
721 721
722 722
723/* Chain of arbitrary data specific to each font driver. Each frame 723/* Chain of arbitrary data specific to each font driver. Each frame
724 has it's own font data list at FRAME_PTR->font_data_list. */ 724 has its own font data list at FRAME_PTR->font_data_list. */
725 725
726struct font_data_list 726struct font_data_list
727{ 727{
diff --git a/src/fontset.c b/src/fontset.c
index 7592521cc7d..281ac92f82d 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -166,7 +166,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
166 These structures are hidden from the other codes than this file. 166 These structures are hidden from the other codes than this file.
167 The other codes handle fontsets only by their ID numbers. They 167 The other codes handle fontsets only by their ID numbers. They
168 usually use the variable name `fontset' for IDs. But, in this 168 usually use the variable name `fontset' for IDs. But, in this
169 file, we always use varialbe name `id' for IDs, and name `fontset' 169 file, we always use variable name `id' for IDs, and name `fontset'
170 for an actual fontset object, i.e., char-table. 170 for an actual fontset object, i.e., char-table.
171 171
172*/ 172*/
@@ -643,7 +643,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
643 if (font_has_char (f, font_object, c)) 643 if (font_has_char (f, font_object, c))
644 goto found; 644 goto found;
645 645
646 /* Find a font already opened, maching with the current spec, 646 /* Find a font already opened, matching with the current spec,
647 and supporting C. */ 647 and supporting C. */
648 font_def = RFONT_DEF_FONT_DEF (rfont_def); 648 font_def = RFONT_DEF_FONT_DEF (rfont_def);
649 for (; found_index + 1 < ASIZE (vec); found_index++) 649 for (; found_index + 1 < ASIZE (vec); found_index++)
diff --git a/src/frame.c b/src/frame.c
index 039ed6543cb..bd97c5f18c7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1929,7 +1929,7 @@ request a switch to FOCUS-FRAME, and `last-event-frame' will be
1929FOCUS-FRAME after reading an event typed at FRAME. 1929FOCUS-FRAME after reading an event typed at FRAME.
1930 1930
1931If FOCUS-FRAME is omitted or nil, any existing redirection is 1931If FOCUS-FRAME is omitted or nil, any existing redirection is
1932cancelled, and the frame again receives its own keystrokes. 1932canceled, and the frame again receives its own keystrokes.
1933 1933
1934Focus redirection is useful for temporarily redirecting keystrokes to 1934Focus redirection is useful for temporarily redirecting keystrokes to
1935a surrogate minibuffer frame when a frame doesn't have its own 1935a surrogate minibuffer frame when a frame doesn't have its own
diff --git a/src/ftfont.c b/src/ftfont.c
index c48346b0147..dbb2ce2745e 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -164,6 +164,13 @@ get_adstyle_property (FcPattern *p)
164 char *str, *end; 164 char *str, *end;
165 Lisp_Object adstyle; 165 Lisp_Object adstyle;
166 166
167#ifdef FC_FONTFORMAT
168 if ((FcPatternGetString (p, FC_FONTFORMAT, 0, &fcstr) == FcResultMatch)
169 && xstrcasecmp ((char *) fcstr, "bdf") != 0
170 && xstrcasecmp ((char *) fcstr, "pcf") != 0)
171 /* Not a BDF nor PCF font. */
172 return Qnil;
173#endif
167 if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch) 174 if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch)
168 return Qnil; 175 return Qnil;
169 str = (char *) fcstr; 176 str = (char *) fcstr;
@@ -953,7 +960,7 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
953 /* Need fix because this finds any fonts. */ 960 /* Need fix because this finds any fonts. */
954 if (fontset->nfont == 0 && ! NILP (family)) 961 if (fontset->nfont == 0 && ! NILP (family))
955 { 962 {
956 /* Try maching with configuration. For instance, the 963 /* Try matching with configuration. For instance, the
957 configuration may specify "Nimbus Mono L" as an alias of 964 configuration may specify "Nimbus Mono L" as an alias of
958 "Courier". */ 965 "Courier". */
959 FcPattern *pat = FcPatternBuild (0, FC_FAMILY, FcTypeString, 966 FcPattern *pat = FcPatternBuild (0, FC_FAMILY, FcTypeString,
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 608cfd8d44d..e04e802a3db 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -48,8 +48,8 @@ static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long);
48static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, 48static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *,
49 unsigned, int, int, XPoint *, int, int *, 49 unsigned, int, int, XPoint *, int, int *,
50 int); 50 int);
51static void ftxfont_draw_backgrond (FRAME_PTR, struct font *, GC, 51static void ftxfont_draw_background (FRAME_PTR, struct font *, GC,
52 int, int, int); 52 int, int, int);
53 53
54struct ftxfont_frame_data 54struct ftxfont_frame_data
55{ 55{
@@ -219,7 +219,8 @@ ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsign
219} 219}
220 220
221static void 221static void
222ftxfont_draw_backgrond (FRAME_PTR f, struct font *font, GC gc, int x, int y, int width) 222ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
223 int width)
223{ 224{
224 XGCValues xgcv; 225 XGCValues xgcv;
225 226
@@ -296,7 +297,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b
296 297
297 BLOCK_INPUT; 298 BLOCK_INPUT;
298 if (with_background) 299 if (with_background)
299 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width); 300 ftxfont_draw_background (f, font, s->gc, x, y, s->width);
300 code = alloca (sizeof (unsigned) * len); 301 code = alloca (sizeof (unsigned) * len);
301 for (i = 0; i < len; i++) 302 for (i = 0; i < len; i++)
302 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) 303 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
diff --git a/src/image.c b/src/image.c
index 81907d8e580..3d189a5504b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7564,6 +7564,22 @@ extern WandExport void PixelGetMagickColor (const PixelWand *,
7564 MagickPixelPacket *); 7564 MagickPixelPacket *);
7565#endif 7565#endif
7566 7566
7567/* Log ImageMagick error message.
7568 Useful when a ImageMagick function returns the status `MagickFalse'. */
7569
7570static void
7571imagemagick_error (MagickWand *wand)
7572{
7573 char *description;
7574 ExceptionType severity;
7575
7576 description = MagickGetException (wand, &severity);
7577 image_error ("ImageMagick error: %s",
7578 make_string (description, strlen (description)),
7579 Qnil);
7580 description = (char *) MagickRelinquishMemory (description);
7581}
7582
7567/* Helper function for imagemagick_load, which does the actual loading 7583/* Helper function for imagemagick_load, which does the actual loading
7568 given contents and size, apart from frame and image structures, 7584 given contents and size, apart from frame and image structures,
7569 passed from imagemagick_load. Uses librimagemagick to do most of 7585 passed from imagemagick_load. Uses librimagemagick to do most of
@@ -7618,6 +7634,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7618 image = image_spec_value (img->spec, QCindex, NULL); 7634 image = image_spec_value (img->spec, QCindex, NULL);
7619 ino = INTEGERP (image) ? XFASTINT (image) : 0; 7635 ino = INTEGERP (image) ? XFASTINT (image) : 0;
7620 ping_wand = NewMagickWand (); 7636 ping_wand = NewMagickWand ();
7637 /* MagickSetResolution (ping_wand, 2, 2); (Bug#10112) */
7621 7638
7622 if (filename != NULL) 7639 if (filename != NULL)
7623 { 7640 {
@@ -7628,7 +7645,12 @@ imagemagick_load_image (struct frame *f, struct image *img,
7628 status = MagickPingImageBlob (ping_wand, contents, size); 7645 status = MagickPingImageBlob (ping_wand, contents, size);
7629 } 7646 }
7630 7647
7631 MagickSetResolution (ping_wand, 2, 2); 7648 if (status == MagickFalse)
7649 {
7650 imagemagick_error (ping_wand);
7651 DestroyMagickWand (ping_wand);
7652 return 0;
7653 }
7632 7654
7633 if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand))) 7655 if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand)))
7634 { 7656 {
@@ -7669,7 +7691,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
7669 { 7691 {
7670 image_wand = NewMagickWand (); 7692 image_wand = NewMagickWand ();
7671 if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse) 7693 if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse)
7672 goto imagemagick_error; 7694 {
7695 imagemagick_error (image_wand);
7696 goto imagemagick_error;
7697 }
7673 } 7698 }
7674 7699
7675 /* If width and/or height is set in the display spec assume we want 7700 /* If width and/or height is set in the display spec assume we want
@@ -7697,6 +7722,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7697 if (status == MagickFalse) 7722 if (status == MagickFalse)
7698 { 7723 {
7699 image_error ("Imagemagick scale failed", Qnil, Qnil); 7724 image_error ("Imagemagick scale failed", Qnil, Qnil);
7725 imagemagick_error (image_wand);
7700 goto imagemagick_error; 7726 goto imagemagick_error;
7701 } 7727 }
7702 } 7728 }
@@ -7751,6 +7777,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7751 if (status == MagickFalse) 7777 if (status == MagickFalse)
7752 { 7778 {
7753 image_error ("Imagemagick image rotate failed", Qnil, Qnil); 7779 image_error ("Imagemagick image rotate failed", Qnil, Qnil);
7780 imagemagick_error (image_wand);
7754 goto imagemagick_error; 7781 goto imagemagick_error;
7755 } 7782 }
7756 } 7783 }
@@ -7975,7 +8002,7 @@ recognize as images, such as C. See `imagemagick-types-inhibit'. */)
7975 Qimagemagicktype = intern (imtypes[i]); 8002 Qimagemagicktype = intern (imtypes[i]);
7976 typelist = Fcons (Qimagemagicktype, typelist); 8003 typelist = Fcons (Qimagemagicktype, typelist);
7977 } 8004 }
7978 return typelist; 8005 return Fnreverse (typelist);
7979} 8006}
7980 8007
7981#endif /* defined (HAVE_IMAGEMAGICK) */ 8008#endif /* defined (HAVE_IMAGEMAGICK) */
diff --git a/src/keyboard.c b/src/keyboard.c
index 656634b8d31..7873dca3a0e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -467,7 +467,8 @@ static void input_available_signal (int signo);
467static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object, 467static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object,
468 Lisp_Object); 468 Lisp_Object);
469static void handle_interrupt (void); 469static void handle_interrupt (void);
470static void quit_throw_to_read_char (void) NO_RETURN; 470static void quit_throw_to_read_char (int) NO_RETURN;
471static void process_special_events (void);
471static void timer_start_idle (void); 472static void timer_start_idle (void);
472static void timer_stop_idle (void); 473static void timer_stop_idle (void);
473static void timer_resume_idle (void); 474static void timer_resume_idle (void);
@@ -656,7 +657,7 @@ echo_now (void)
656 echo_kboard = current_kboard; 657 echo_kboard = current_kboard;
657 658
658 if (waiting_for_input && !NILP (Vquit_flag)) 659 if (waiting_for_input && !NILP (Vquit_flag))
659 quit_throw_to_read_char (); 660 quit_throw_to_read_char (0);
660} 661}
661 662
662/* Turn off echoing, for the start of a new command. */ 663/* Turn off echoing, for the start of a new command. */
@@ -3820,7 +3821,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3820 /* If the quit flag is set, then read_char will return 3821 /* If the quit flag is set, then read_char will return
3821 quit_char, so that counts as "available input." */ 3822 quit_char, so that counts as "available input." */
3822 if (!NILP (Vquit_flag)) 3823 if (!NILP (Vquit_flag))
3823 quit_throw_to_read_char (); 3824 quit_throw_to_read_char (0);
3824 3825
3825 /* One way or another, wait until input is available; then, if 3826 /* One way or another, wait until input is available; then, if
3826 interrupt handlers have not read it, read it now. */ 3827 interrupt handlers have not read it, read it now. */
@@ -4155,14 +4156,12 @@ kbd_buffer_get_event (KBOARD **kbp,
4155 return (obj); 4156 return (obj);
4156} 4157}
4157 4158
4158/* Process any events that are not user-visible, 4159/* Process any non-user-visible events (currently X selection events),
4159 then return, without reading any user-visible events. */ 4160 without reading any user-visible events. */
4160 4161
4161void 4162static void
4162swallow_events (int do_display) 4163process_special_events (void)
4163{ 4164{
4164 int old_timers_run;
4165
4166 while (kbd_fetch_ptr != kbd_store_ptr) 4165 while (kbd_fetch_ptr != kbd_store_ptr)
4167 { 4166 {
4168 struct input_event *event; 4167 struct input_event *event;
@@ -4197,6 +4196,17 @@ swallow_events (int do_display)
4197 else 4196 else
4198 break; 4197 break;
4199 } 4198 }
4199}
4200
4201/* Process any events that are not user-visible, run timer events that
4202 are ripe, and return, without reading any user-visible events. */
4203
4204void
4205swallow_events (int do_display)
4206{
4207 int old_timers_run;
4208
4209 process_special_events ();
4200 4210
4201 old_timers_run = timers_run; 4211 old_timers_run = timers_run;
4202 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 4212 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
@@ -10538,6 +10548,9 @@ if there is a doubt, the value is t. */)
10538 || !NILP (Vunread_input_method_events)) 10548 || !NILP (Vunread_input_method_events))
10539 return (Qt); 10549 return (Qt);
10540 10550
10551 /* Process non-user-visible events (Bug#10195). */
10552 process_special_events ();
10553
10541 get_input_pending (&input_pending, 10554 get_input_pending (&input_pending,
10542 READABLE_EVENTS_DO_TIMERS_NOW 10555 READABLE_EVENTS_DO_TIMERS_NOW
10543 | READABLE_EVENTS_FILTER_EVENTS); 10556 | READABLE_EVENTS_FILTER_EVENTS);
@@ -10840,7 +10853,7 @@ set_waiting_for_input (struct timeval *time_to_clear)
10840 /* If handle_interrupt was called before and buffered a C-g, 10853 /* If handle_interrupt was called before and buffered a C-g,
10841 make it run again now, to avoid timing error. */ 10854 make it run again now, to avoid timing error. */
10842 if (!NILP (Vquit_flag)) 10855 if (!NILP (Vquit_flag))
10843 quit_throw_to_read_char (); 10856 quit_throw_to_read_char (0);
10844} 10857}
10845 10858
10846void 10859void
@@ -10855,7 +10868,7 @@ clear_waiting_for_input (void)
10855 10868
10856 If we have a frame on the controlling tty, we assume that the 10869 If we have a frame on the controlling tty, we assume that the
10857 SIGINT was generated by C-g, so we call handle_interrupt. 10870 SIGINT was generated by C-g, so we call handle_interrupt.
10858 Otherwise, the handler kills Emacs. */ 10871 Otherwise, tell QUIT to kill Emacs. */
10859 10872
10860static void 10873static void
10861interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10874interrupt_signal (int signalnum) /* If we don't have an argument, some */
@@ -10872,12 +10885,10 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10872 if (!terminal) 10885 if (!terminal)
10873 { 10886 {
10874 /* If there are no frames there, let's pretend that we are a 10887 /* If there are no frames there, let's pretend that we are a
10875 well-behaving UN*X program and quit. We cannot do that while 10888 well-behaving UN*X program and quit. We must not call Lisp
10876 GC is in progress, though. */ 10889 in a signal handler, so tell QUIT to exit when it is
10877 if (!gc_in_progress && !waiting_for_input) 10890 safe. */
10878 Fkill_emacs (Qnil); 10891 Vquit_flag = Qkill_emacs;
10879 else
10880 Vquit_flag = Qt;
10881 } 10892 }
10882 else 10893 else
10883 { 10894 {
@@ -11026,15 +11037,20 @@ handle_interrupt (void)
11026 separate event loop thread like W32. */ 11037 separate event loop thread like W32. */
11027#ifndef HAVE_NS 11038#ifndef HAVE_NS
11028 if (waiting_for_input && !echoing) 11039 if (waiting_for_input && !echoing)
11029 quit_throw_to_read_char (); 11040 quit_throw_to_read_char (1);
11030#endif 11041#endif
11031} 11042}
11032 11043
11033/* Handle a C-g by making read_char return C-g. */ 11044/* Handle a C-g by making read_char return C-g. */
11034 11045
11035static void 11046static void
11036quit_throw_to_read_char (void) 11047quit_throw_to_read_char (int from_signal)
11037{ 11048{
11049 /* When not called from a signal handler it is safe to call
11050 Lisp. */
11051 if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
11052 Fkill_emacs (Qnil);
11053
11038 sigfree (); 11054 sigfree ();
11039 /* Prevent another signal from doing this before we finish. */ 11055 /* Prevent another signal from doing this before we finish. */
11040 clear_waiting_for_input (); 11056 clear_waiting_for_input ();
@@ -12265,7 +12281,7 @@ text in the region before modifying the buffer. The next
12265 DEFVAR_LISP ("debug-on-event", 12281 DEFVAR_LISP ("debug-on-event",
12266 Vdebug_on_event, 12282 Vdebug_on_event,
12267 doc: /* Enter debugger on this event. When Emacs 12283 doc: /* Enter debugger on this event. When Emacs
12268receives the special event specifed by this variable, it will try to 12284receives the special event specified by this variable, it will try to
12269break into the debugger as soon as possible instead of processing the 12285break into the debugger as soon as possible instead of processing the
12270event normally through `special-event-map'. 12286event normally through `special-event-map'.
12271 12287
diff --git a/src/lastfile.c b/src/lastfile.c
index d348e4ebb07..ab07e748930 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -23,7 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 23
24 The files of Emacs are written so as to have no initialized 24 The files of Emacs are written so as to have no initialized
25 data that can ever need to be altered except at the first startup. 25 data that can ever need to be altered except at the first startup.
26 This is so that those words can be dumped as sharable text. 26 This is so that those words can be dumped as shareable text.
27 27
28 It is not possible to exercise such control over library files. 28 It is not possible to exercise such control over library files.
29 So it is necessary to refrain from making their data areas shared. 29 So it is necessary to refrain from making their data areas shared.
@@ -47,4 +47,3 @@ char my_endbss[1];
47 of the bss area used by Emacs. */ 47 of the bss area used by Emacs. */
48static char _my_endbss[1]; 48static char _my_endbss[1];
49char * my_endbss_static = _my_endbss; 49char * my_endbss_static = _my_endbss;
50
diff --git a/src/lisp.h b/src/lisp.h
index 6b19396111c..036f1b13330 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2132,7 +2132,10 @@ extern char *stack_bottom;
2132 Exception: if you set immediate_quit to nonzero, 2132 Exception: if you set immediate_quit to nonzero,
2133 then the handler that responds to the C-g does the quit itself. 2133 then the handler that responds to the C-g does the quit itself.
2134 This is a good thing to do around a loop that has no side effects 2134 This is a good thing to do around a loop that has no side effects
2135 and (in particular) cannot call arbitrary Lisp code. */ 2135 and (in particular) cannot call arbitrary Lisp code.
2136
2137 If quit-flag is set to `kill-emacs' the SIGINT handler has received
2138 a request to exit Emacs when it is safe to do. */
2136 2139
2137#ifdef SYNC_INPUT 2140#ifdef SYNC_INPUT
2138extern void process_pending_signals (void); 2141extern void process_pending_signals (void);
@@ -2144,16 +2147,11 @@ extern int pending_signals;
2144#define ELSE_PENDING_SIGNALS 2147#define ELSE_PENDING_SIGNALS
2145#endif /* not SYNC_INPUT */ 2148#endif /* not SYNC_INPUT */
2146 2149
2150extern void process_quit_flag (void);
2147#define QUIT \ 2151#define QUIT \
2148 do { \ 2152 do { \
2149 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \ 2153 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
2150 { \ 2154 process_quit_flag (); \
2151 Lisp_Object flag = Vquit_flag; \
2152 Vquit_flag = Qnil; \
2153 if (EQ (Vthrow_on_input, flag)) \
2154 Fthrow (Vthrow_on_input, Qt); \
2155 Fsignal (Qquit, Qnil); \
2156 } \
2157 ELSE_PENDING_SIGNALS \ 2155 ELSE_PENDING_SIGNALS \
2158 } while (0) 2156 } while (0)
2159 2157
@@ -3295,6 +3293,7 @@ extern Lisp_Object Qfile_name_handler_alist;
3295#ifdef FLOAT_CATCH_SIGILL 3293#ifdef FLOAT_CATCH_SIGILL
3296extern void fatal_error_signal (int); 3294extern void fatal_error_signal (int);
3297#endif 3295#endif
3296extern Lisp_Object Qkill_emacs;
3298EXFUN (Fkill_emacs, 1) NO_RETURN; 3297EXFUN (Fkill_emacs, 1) NO_RETURN;
3299#if HAVE_SETLOCALE 3298#if HAVE_SETLOCALE
3300void fixup_locale (void); 3299void fixup_locale (void);
diff --git a/src/lread.c b/src/lread.c
index cdbd09d2f89..7c0b0475786 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2822,7 +2822,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2822 So we now use the same heuristic as for backquote: old-style 2822 So we now use the same heuristic as for backquote: old-style
2823 unquotes are only recognized when first on a list, and when 2823 unquotes are only recognized when first on a list, and when
2824 followed by a space. 2824 followed by a space.
2825 Because it's more difficult to peak 2 chars ahead, a new-style 2825 Because it's more difficult to peek 2 chars ahead, a new-style
2826 ,@ can still not be used outside of a `, unless it's in the middle 2826 ,@ can still not be used outside of a `, unless it's in the middle
2827 of a list. */ 2827 of a list. */
2828 if (new_backquote_flag 2828 if (new_backquote_flag
@@ -4180,13 +4180,16 @@ init_lread (void)
4180 } 4180 }
4181 4181
4182 /* Add site-lisp under the installation dir, if it exists. */ 4182 /* Add site-lisp under the installation dir, if it exists. */
4183 tem = Fexpand_file_name (build_string ("site-lisp"), 4183 if (!no_site_lisp)
4184 Vinstallation_directory);
4185 tem1 = Ffile_exists_p (tem);
4186 if (!NILP (tem1))
4187 { 4184 {
4188 if (NILP (Fmember (tem, Vload_path))) 4185 tem = Fexpand_file_name (build_string ("site-lisp"),
4189 Vload_path = Fcons (tem, Vload_path); 4186 Vinstallation_directory);
4187 tem1 = Ffile_exists_p (tem);
4188 if (!NILP (tem1))
4189 {
4190 if (NILP (Fmember (tem, Vload_path)))
4191 Vload_path = Fcons (tem, Vload_path);
4192 }
4190 } 4193 }
4191 4194
4192 /* If Emacs was not built in the source directory, 4195 /* If Emacs was not built in the source directory,
@@ -4222,11 +4225,14 @@ init_lread (void)
4222 if (NILP (Fmember (tem, Vload_path))) 4225 if (NILP (Fmember (tem, Vload_path)))
4223 Vload_path = Fcons (tem, Vload_path); 4226 Vload_path = Fcons (tem, Vload_path);
4224 4227
4225 tem = Fexpand_file_name (build_string ("site-lisp"), 4228 if (!no_site_lisp)
4226 Vsource_directory); 4229 {
4230 tem = Fexpand_file_name (build_string ("site-lisp"),
4231 Vsource_directory);
4227 4232
4228 if (NILP (Fmember (tem, Vload_path))) 4233 if (NILP (Fmember (tem, Vload_path)))
4229 Vload_path = Fcons (tem, Vload_path); 4234 Vload_path = Fcons (tem, Vload_path);
4235 }
4230 } 4236 }
4231 } 4237 }
4232 if (!NILP (sitelisp) && !no_site_lisp) 4238 if (!NILP (sitelisp) && !no_site_lisp)
diff --git a/src/minibuf.c b/src/minibuf.c
index 7ece5764203..ad5625e9ee9 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -905,26 +905,36 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer,
905The optional second arg INITIAL-CONTENTS is an obsolete alternative to 905The optional second arg INITIAL-CONTENTS is an obsolete alternative to
906 DEFAULT-VALUE. It normally should be nil in new code, except when 906 DEFAULT-VALUE. It normally should be nil in new code, except when
907 HIST is a cons. It is discussed in more detail below. 907 HIST is a cons. It is discussed in more detail below.
908
908Third arg KEYMAP is a keymap to use whilst reading; 909Third arg KEYMAP is a keymap to use whilst reading;
909 if omitted or nil, the default is `minibuffer-local-map'. 910 if omitted or nil, the default is `minibuffer-local-map'.
910If fourth arg READ is non-nil, then interpret the result as a Lisp object 911
912If fourth arg READ is non-nil, interpret the result as a Lisp object
911 and return that object: 913 and return that object:
912 in other words, do `(car (read-from-string INPUT-STRING))' 914 in other words, do `(car (read-from-string INPUT-STRING))'
915
913Fifth arg HIST, if non-nil, specifies a history list and optionally 916Fifth arg HIST, if non-nil, specifies a history list and optionally
914 the initial position in the list. It can be a symbol, which is the 917 the initial position in the list. It can be a symbol, which is the
915 history list variable to use, or it can be a cons cell 918 history list variable to use, or a cons cell (HISTVAR . HISTPOS).
916 (HISTVAR . HISTPOS). In that case, HISTVAR is the history list variable 919 In that case, HISTVAR is the history list variable to use, and
917 to use, and HISTPOS is the initial position for use by the minibuffer 920 HISTPOS is the initial position for use by the minibuffer history
918 history commands. For consistency, you should also specify that 921 commands. For consistency, you should also specify that element of
919 element of the history as the value of INITIAL-CONTENTS. Positions 922 the history as the value of INITIAL-CONTENTS. Positions are counted
920 are counted starting from 1 at the beginning of the list. 923 starting from 1 at the beginning of the list.
921Sixth arg DEFAULT-VALUE is a default value or list of default values. 924
922 If non-nil, it is available via history commands. If READ is 925Sixth arg DEFAULT-VALUE, if non-nil, should be a string, which is used
923 non-nil, it is also the default to `read' if the user enters empty 926 as the default to `read' if READ is non-nil and the user enters
924 input. If READ is non-nil, `read-from-minibuffer' does NOT return 927 empty input. But if READ is nil, this function does _not_ return
925 DEFAULT-VALUE for empty input! It returns the empty string. 928 DEFAULT-VALUE for empty input! Instead, it returns the empty string.
929
930 Whatever the value of READ, DEFAULT-VALUE is made available via the
931 minibuffer history commands. DEFAULT-VALUE can also be a list of
932 strings, in which case all the strings are available in the history,
933 and the first string is the default to `read' if READ is non-nil.
934
926Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits 935Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
927 the current input method and the setting of `enable-multibyte-characters'. 936 the current input method and the setting of `enable-multibyte-characters'.
937
928If the variable `minibuffer-allow-text-properties' is non-nil, 938If the variable `minibuffer-allow-text-properties' is non-nil,
929 then the string which is returned includes whatever text properties 939 then the string which is returned includes whatever text properties
930 were present in the minibuffer. Otherwise the value has no text properties. 940 were present in the minibuffer. Otherwise the value has no text properties.
diff --git a/src/nsfns.m b/src/nsfns.m
index 280fee0b27b..e41b77e242a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -394,9 +394,8 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
394 if (face) 394 if (face)
395 { 395 {
396 col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f); 396 col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f);
397 face->background 397 face->background = ns_index_color
398 = (EMACS_UINT) [[col colorWithAlphaComponent: alpha] retain]; 398 ([col colorWithAlphaComponent: alpha], f);
399 [col release];
400 399
401 update_face_from_frame_parameter (f, Qbackground_color, arg); 400 update_face_from_frame_parameter (f, Qbackground_color, arg);
402 } 401 }
@@ -770,7 +769,7 @@ ns_implicitly_set_icon_type (struct frame *f)
770{ 769{
771 Lisp_Object tem; 770 Lisp_Object tem;
772 EmacsView *view = FRAME_NS_VIEW (f); 771 EmacsView *view = FRAME_NS_VIEW (f);
773 id image =nil; 772 id image = nil;
774 Lisp_Object chain, elt; 773 Lisp_Object chain, elt;
775 NSAutoreleasePool *pool; 774 NSAutoreleasePool *pool;
776 BOOL setMini = YES; 775 BOOL setMini = YES;
@@ -797,7 +796,7 @@ ns_implicitly_set_icon_type (struct frame *f)
797 } 796 }
798 797
799 for (chain = Vns_icon_type_alist; 798 for (chain = Vns_icon_type_alist;
800 (image = nil) && CONSP (chain); 799 image == nil && CONSP (chain);
801 chain = XCDR (chain)) 800 chain = XCDR (chain))
802 { 801 {
803 elt = XCAR (chain); 802 elt = XCAR (chain);
@@ -1076,7 +1075,41 @@ unwind_create_frame (Lisp_Object frame)
1076 return Qnil; 1075 return Qnil;
1077} 1076}
1078 1077
1078/*
1079 * Read geometry related parameters from preferences if not in PARMS.
1080 * Returns the union of parms and any preferences read.
1081 */
1079 1082
1083static Lisp_Object
1084get_geometry_from_preferences (struct ns_display_info *dpyinfo,
1085 Lisp_Object parms)
1086{
1087 struct {
1088 const char *val;
1089 const char *cls;
1090 Lisp_Object tem;
1091 } r[] = {
1092 { "width", "Width", Qwidth },
1093 { "height", "Height", Qheight },
1094 { "left", "Left", Qleft },
1095 { "top", "Top", Qtop },
1096 };
1097
1098 int i;
1099 for (i = 0; i < sizeof (r)/sizeof (r[0]); ++i)
1100 {
1101 if (NILP (Fassq (r[i].tem, parms)))
1102 {
1103 Lisp_Object value
1104 = x_get_arg (dpyinfo, parms, r[i].tem, r[i].val, r[i].cls,
1105 RES_TYPE_NUMBER);
1106 if (! EQ (value, Qunbound))
1107 parms = Fcons (Fcons (r[i].tem, value), parms);
1108 }
1109 }
1110
1111 return parms;
1112}
1080 1113
1081/* ========================================================================== 1114/* ==========================================================================
1082 1115
@@ -1285,6 +1318,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1285 x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", 1318 x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
1286 RES_TYPE_STRING); 1319 RES_TYPE_STRING);
1287 1320
1321 parms = get_geometry_from_preferences (dpyinfo, parms);
1288 window_prompting = x_figure_window_size (f, parms, 1); 1322 window_prompting = x_figure_window_size (f, parms, 1);
1289 1323
1290 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 1324 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
@@ -1511,6 +1545,17 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
1511 return ret ? fname : Qnil; 1545 return ret ? fname : Qnil;
1512} 1546}
1513 1547
1548const char *
1549ns_get_defaults_value (const char *key)
1550{
1551 NSObject *obj = [[NSUserDefaults standardUserDefaults]
1552 objectForKey: [NSString stringWithUTF8String: key]];
1553
1554 if (!obj) return NULL;
1555
1556 return [[NSString stringWithFormat: @"%@", obj] UTF8String];
1557}
1558
1514 1559
1515DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0, 1560DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0,
1516 doc: /* Return the value of the property NAME of OWNER from the defaults database. 1561 doc: /* Return the value of the property NAME of OWNER from the defaults database.
@@ -1525,9 +1570,7 @@ If OWNER is nil, Emacs is assumed. */)
1525 CHECK_STRING (name); 1570 CHECK_STRING (name);
1526/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */ 1571/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */
1527 1572
1528 value =[[[NSUserDefaults standardUserDefaults] 1573 value = ns_get_defaults_value (SDATA (name));
1529 objectForKey: [NSString stringWithUTF8String: SDATA (name)]]
1530 UTF8String];
1531 1574
1532 if (value) 1575 if (value)
1533 return build_string (value); 1576 return build_string (value);
@@ -2182,8 +2225,7 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class)
2182 /* --quick was passed, so this is a no-op. */ 2225 /* --quick was passed, so this is a no-op. */
2183 return NULL; 2226 return NULL;
2184 2227
2185 res = [[[NSUserDefaults standardUserDefaults] objectForKey: 2228 res = ns_get_defaults_value (toCheck);
2186 [NSString stringWithUTF8String: toCheck]] UTF8String];
2187 return !res ? NULL : 2229 return !res ? NULL :
2188 (!strncasecmp (res, "YES", 3) ? "true" : 2230 (!strncasecmp (res, "YES", 3) ? "true" :
2189 (!strncasecmp (res, "NO", 2) ? "false" : res)); 2231 (!strncasecmp (res, "NO", 2) ? "false" : res));
diff --git a/src/nsfont.m b/src/nsfont.m
index 7d691ced6e1..eb57f5e5953 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -126,8 +126,8 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait)
126/* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang 126/* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang
127 to NSFont descriptor. Information under extra only needed for matching. */ 127 to NSFont descriptor. Information under extra only needed for matching. */
128#define STYLE_REF 100 128#define STYLE_REF 100
129static NSFontDescriptor 129static NSFontDescriptor *
130*ns_spec_to_descriptor(Lisp_Object font_spec) 130ns_spec_to_descriptor (Lisp_Object font_spec)
131{ 131{
132 NSFontDescriptor *fdesc; 132 NSFontDescriptor *fdesc;
133 NSMutableDictionary *fdAttrs = [NSMutableDictionary new]; 133 NSMutableDictionary *fdAttrs = [NSMutableDictionary new];
@@ -152,8 +152,13 @@ static NSFontDescriptor
152 [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; 152 [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute];
153 153
154 fdesc = [NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs]; 154 fdesc = [NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs];
155 if (family != nil) 155 if (family != nil)
156 {
156 fdesc = [fdesc fontDescriptorWithFamily: family]; 157 fdesc = [fdesc fontDescriptorWithFamily: family];
158 }
159
160 [fdAttrs release];
161 [tdict release];
157 return fdesc; 162 return fdesc;
158} 163}
159 164
@@ -469,6 +474,7 @@ static NSSet
469 if ([families count] > 0 || pct < 0.05) 474 if ([families count] > 0 || pct < 0.05)
470 break; 475 break;
471 } 476 }
477 [charset release];
472 } 478 }
473#ifdef NS_IMPL_COCOA 479#ifdef NS_IMPL_COCOA
474 if ([families count] == 0) 480 if ([families count] == 0)
@@ -536,12 +542,14 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
536 family = [fdesc objectForKey: NSFontFamilyAttribute]; 542 family = [fdesc objectForKey: NSFontFamilyAttribute];
537 if (family != nil && !foundItal && XINT (Flength (list)) > 0) 543 if (family != nil && !foundItal && XINT (Flength (list)) > 0)
538 { 544 {
539 NSFontDescriptor *sDesc = [[[NSFontDescriptor new] 545 NSFontDescriptor *s1 = [NSFontDescriptor new];
540 fontDescriptorWithSymbolicTraits: NSFontItalicTrait] 546 NSFontDescriptor *sDesc
541 fontDescriptorWithFamily: family]; 547 = [[s1 fontDescriptorWithSymbolicTraits: NSFontItalicTrait]
548 fontDescriptorWithFamily: family];
542 list = Fcons (ns_descriptor_to_entity (sDesc, 549 list = Fcons (ns_descriptor_to_entity (sDesc,
543 AREF (font_spec, FONT_EXTRA_INDEX), 550 AREF (font_spec, FONT_EXTRA_INDEX),
544 "synthItal"), list); 551 "synthItal"), list);
552 [s1 release];
545 } 553 }
546 554
547 /* Return something if was a match and nothing found. */ 555 /* Return something if was a match and nothing found. */
@@ -630,7 +638,7 @@ nsfont_list (Lisp_Object frame, Lisp_Object font_spec)
630} 638}
631 639
632 640
633/* Return a font entity most closely maching with FONT_SPEC on 641/* Return a font entity most closely matching with FONT_SPEC on
634 FRAME. The closeness is determined by the font backend, thus 642 FRAME. The closeness is determined by the font backend, thus
635 `face-font-selection-order' is ignored here. 643 `face-font-selection-order' is ignored here.
636 Properties to be considered are same as for list(). */ 644 Properties to be considered are same as for list(). */
@@ -1293,7 +1301,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1293 abort (); 1301 abort ();
1294 1302
1295 /* create a string containing all Unicode characters in this block */ 1303 /* create a string containing all Unicode characters in this block */
1296 for (idx = block<<8, i =0; i<0x100; idx++, i++) 1304 for (idx = block<<8, i = 0; i < 0x100; idx++, i++)
1297 if (idx < 0xD800 || idx > 0xDFFF) 1305 if (idx < 0xD800 || idx > 0xDFFF)
1298 unichars[i] = idx; 1306 unichars[i] = idx;
1299 else 1307 else
@@ -1309,7 +1317,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1309 NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; 1317 NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator];
1310 /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ 1318 /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */
1311 unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; 1319 unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs];
1312 NSUInteger gInd =0, cInd =0; 1320 NSUInteger gInd = 0, cInd = 0;
1313 1321
1314 [glyphStorage setString: allChars font: font_info->nsfont]; 1322 [glyphStorage setString: allChars font: font_info->nsfont];
1315 [glyphGenerator generateGlyphsForGlyphStorage: glyphStorage 1323 [glyphGenerator generateGlyphsForGlyphStorage: glyphStorage
@@ -1317,7 +1325,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1317 glyphIndex: &gInd characterIndex: &cInd]; 1325 glyphIndex: &gInd characterIndex: &cInd];
1318#endif 1326#endif
1319 glyphs = font_info->glyphs[block]; 1327 glyphs = font_info->glyphs[block];
1320 for (i =0; i<0x100; i++, glyphs++) 1328 for (i = 0; i < 0x100; i++, glyphs++)
1321 { 1329 {
1322#ifdef NS_IMPL_GNUSTEP 1330#ifdef NS_IMPL_GNUSTEP
1323 g = unichars[i]; 1331 g = unichars[i];
@@ -1425,6 +1433,8 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1425- (void) setString: (NSString *)str font: (NSFont *)font 1433- (void) setString: (NSString *)str font: (NSFont *)font
1426{ 1434{
1427 [dict setObject: font forKey: NSFontAttributeName]; 1435 [dict setObject: font forKey: NSFontAttributeName];
1436 if (attrStr != nil)
1437 [attrStr release];
1428 attrStr = [[NSAttributedString alloc] initWithString: str attributes: dict]; 1438 attrStr = [[NSAttributedString alloc] initWithString: str attributes: dict];
1429 maxChar = [str length]; 1439 maxChar = [str length];
1430 maxGlyph = 0; 1440 maxGlyph = 0;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 951282910ac..94c6b6a6198 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -74,6 +74,10 @@ EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
74static int popup_activated_flag; 74static int popup_activated_flag;
75static NSModalSession popupSession; 75static NSModalSession popupSession;
76 76
77/* Nonzero means we are tracking and updating menus. */
78static int trackingMenu;
79
80
77/* NOTE: toolbar implementation is at end, 81/* NOTE: toolbar implementation is at end,
78 following complete menu implementation. */ 82 following complete menu implementation. */
79 83
@@ -400,6 +404,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
400 items = FRAME_MENU_BAR_ITEMS (f); 404 items = FRAME_MENU_BAR_ITEMS (f);
401 if (NILP (items)) 405 if (NILP (items))
402 { 406 {
407 free_menubar_widget_value_tree (first_wv);
403 [pool release]; 408 [pool release];
404 UNBLOCK_INPUT; 409 UNBLOCK_INPUT;
405 return; 410 return;
@@ -427,6 +432,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
427 432
428 if (i == n) 433 if (i == n)
429 { 434 {
435 free_menubar_widget_value_tree (first_wv);
430 [pool release]; 436 [pool release];
431 UNBLOCK_INPUT; 437 UNBLOCK_INPUT;
432 return; 438 return;
@@ -543,21 +549,44 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p)
543 frame = f; 549 frame = f;
544} 550}
545 551
552#ifdef NS_IMPL_COCOA
553#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
554extern NSString *NSMenuDidBeginTrackingNotification;
555#endif
556#endif
557
558#ifdef NS_IMPL_COCOA
559-(void)trackingNotification:(NSNotification *)notification
560{
561 /* Update menu in menuNeedsUpdate only while tracking menus. */
562 trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification
563 ? 1 : 0);
564}
565#endif
546 566
547/* delegate method called when a submenu is being opened: run a 'deep' call 567/* delegate method called when a submenu is being opened: run a 'deep' call
548 to set_frame_menubar */ 568 to set_frame_menubar */
549- (void)menuNeedsUpdate: (NSMenu *)menu 569- (void)menuNeedsUpdate: (NSMenu *)menu
550{ 570{
551 NSEvent *event;
552 if (!FRAME_LIVE_P (frame)) 571 if (!FRAME_LIVE_P (frame))
553 return; 572 return;
554 event = [[FRAME_NS_VIEW (frame) window] currentEvent]; 573
555 /* HACK: Cocoa/Carbon will request update on every keystroke 574 /* Cocoa/Carbon will request update on every keystroke
556 via IsMenuKeyEvent -> CheckMenusForKeyEvent. These are not needed 575 via IsMenuKeyEvent -> CheckMenusForKeyEvent. These are not needed
557 since key equivalents are handled through emacs. 576 since key equivalents are handled through emacs.
558 On Leopard, even keystroke events generate SystemDefined events, but 577 On Leopard, even keystroke events generate SystemDefined event.
559 their subtype is 8. */ 578 Third-party applications that enhance mouse / trackpad
560 if ([event type] != NSSystemDefined || [event subtype] == 8 579 interaction, or also VNC/Remote Desktop will send events
580 of type AppDefined rather than SysDefined.
581 Menus will fail to show up if they haven't been initialized.
582 AppDefined events may lack timing data.
583
584 Thus, we rely on the didBeginTrackingNotification notification
585 as above to indicate the need for updates.
586 From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the
587 key press case, NSMenuPropertyItemImage (e.g.) won't be set.
588 */
589 if (trackingMenu == 0
561 /* Also, don't try this if from an event picked up asynchronously, 590 /* Also, don't try this if from an event picked up asynchronously,
562 as lots of lisp evaluation happens in ns_update_menubar. */ 591 as lots of lisp evaluation happens in ns_update_menubar. */
563 || handling_signal != 0) 592 || handling_signal != 0)
@@ -1795,6 +1824,11 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
1795void 1824void
1796syms_of_nsmenu (void) 1825syms_of_nsmenu (void)
1797{ 1826{
1827#ifndef NS_IMPL_COCOA
1828 /* Don't know how to keep track of this in Next/Open/Gnustep. Always
1829 update menus there. */
1830 trackingMenu = 1;
1831#endif
1798 defsubr (&Sx_popup_dialog); 1832 defsubr (&Sx_popup_dialog);
1799 defsubr (&Sns_reset_menu); 1833 defsubr (&Sns_reset_menu);
1800 defsubr (&Smenu_or_popup_active_p); 1834 defsubr (&Smenu_or_popup_active_p);
diff --git a/src/nsselect.m b/src/nsselect.m
index 867cf3252e5..928eb8652dc 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -35,8 +35,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
35#include "termhooks.h" 35#include "termhooks.h"
36#include "keyboard.h" 36#include "keyboard.h"
37 37
38#define CUT_BUFFER_SUPPORT
39
40Lisp_Object QCLIPBOARD, QSECONDARY, QTEXT, QFILE_NAME; 38Lisp_Object QCLIPBOARD, QSECONDARY, QTEXT, QFILE_NAME;
41 39
42static Lisp_Object Vselection_alist; 40static Lisp_Object Vselection_alist;
@@ -60,13 +58,18 @@ static NSString *
60symbol_to_nsstring (Lisp_Object sym) 58symbol_to_nsstring (Lisp_Object sym)
61{ 59{
62 CHECK_SYMBOL (sym); 60 CHECK_SYMBOL (sym);
63 if (EQ (sym, QCLIPBOARD)) return NSGeneralPboard; 61 if (EQ (sym, QCLIPBOARD)) return NSGeneralPboard;
64 if (EQ (sym, QPRIMARY)) return NXPrimaryPboard; 62 if (EQ (sym, QPRIMARY)) return NXPrimaryPboard;
65 if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; 63 if (EQ (sym, QSECONDARY)) return NXSecondaryPboard;
66 if (EQ (sym, QTEXT)) return NSStringPboardType; 64 if (EQ (sym, QTEXT)) return NSStringPboardType;
67 return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)]; 65 return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)];
68} 66}
69 67
68static NSPasteboard *
69ns_symbol_to_pb (Lisp_Object symbol)
70{
71 return [NSPasteboard pasteboardWithName: symbol_to_nsstring (symbol)];
72}
70 73
71static Lisp_Object 74static Lisp_Object
72ns_string_to_symbol (NSString *t) 75ns_string_to_symbol (NSString *t)
@@ -230,70 +233,11 @@ static Lisp_Object
230ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target) 233ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target)
231{ 234{
232 id pb; 235 id pb;
233 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (symbol)]; 236 pb = ns_symbol_to_pb (symbol);
234 return ns_string_from_pasteboard (pb); 237 return pb != nil ? ns_string_from_pasteboard (pb) : Qnil;
235}
236
237
238static void
239ns_handle_selection_request (struct input_event *event)
240{
241 // FIXME: BIG UGLY HACK!!!
242 id pb = (id)*(EMACS_INT*)&(event->x);
243 NSString *type = (NSString *)*(EMACS_INT*)&(event->y);
244 Lisp_Object selection_name, selection_data, target_symbol, data;
245 Lisp_Object successful_p, rest;
246
247 selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]);
248 target_symbol = ns_string_to_symbol (type);
249 selection_data = assq_no_quit (selection_name, Vselection_alist);
250 successful_p = Qnil;
251
252 if (!NILP (selection_data))
253 {
254 data = ns_get_local_selection (selection_name, target_symbol);
255 if (!NILP (data))
256 {
257 if (STRINGP (data))
258 ns_string_to_pasteboard_internal (pb, data, type);
259 successful_p = Qt;
260 }
261 }
262
263 if (!EQ (Vns_sent_selection_hooks, Qunbound))
264 {
265 for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
266 call3 (Fcar (rest), selection_name, target_symbol, successful_p);
267 }
268} 238}
269 239
270 240
271static void
272ns_handle_selection_clear (struct input_event *event)
273{
274 id pb = (id)*(EMACS_INT*)&(event->x);
275 Lisp_Object selection_name, selection_data, rest;
276
277 selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]);
278 selection_data = assq_no_quit (selection_name, Vselection_alist);
279 if (NILP (selection_data)) return;
280
281 if (EQ (selection_data, Fcar (Vselection_alist)))
282 Vselection_alist = Fcdr (Vselection_alist);
283 else
284 {
285 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest))
286 if (EQ (selection_data, Fcar (Fcdr (rest))))
287 Fsetcdr (rest, Fcdr (Fcdr (rest)));
288 }
289
290 if (!EQ (Vns_lost_selection_hooks, Qunbound))
291 {
292 for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest))
293 call1 (Fcar (rest), selection_name);
294 }
295}
296
297 241
298 242
299/* ========================================================================== 243/* ==========================================================================
@@ -401,29 +345,44 @@ anything that the functions on `selection-converter-alist' know about. */)
401{ 345{
402 id pb; 346 id pb;
403 Lisp_Object old_value, new_value; 347 Lisp_Object old_value, new_value;
348 NSString *type;
349 Lisp_Object successful_p = Qnil, rest;
350 Lisp_Object target_symbol, data;
351
404 352
405 check_ns (); 353 check_ns ();
406 CHECK_SYMBOL (selection_name); 354 CHECK_SYMBOL (selection_name);
407 if (NILP (selection_value)) 355 if (NILP (selection_value))
408 error ("selection-value may not be nil."); 356 error ("selection-value may not be nil.");
409 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; 357 pb = ns_symbol_to_pb (selection_name);
358 if (pb == nil) return Qnil;
359
410 ns_declare_pasteboard (pb); 360 ns_declare_pasteboard (pb);
411 old_value = assq_no_quit (selection_name, Vselection_alist); 361 old_value = assq_no_quit (selection_name, Vselection_alist);
412 new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); 362 new_value = Fcons (selection_name, Fcons (selection_value, Qnil));
363
413 if (NILP (old_value)) 364 if (NILP (old_value))
414 Vselection_alist = Fcons (new_value, Vselection_alist); 365 Vselection_alist = Fcons (new_value, Vselection_alist);
415 else 366 else
416 Fsetcdr (old_value, Fcdr (new_value)); 367 Fsetcdr (old_value, Fcdr (new_value));
417 /* XXX An evil hack, but a necessary one I fear XXX */ 368
418 { 369 /* We only support copy of text. */
419 struct input_event ev; 370 type = NSStringPboardType;
420 ev.kind = SELECTION_REQUEST_EVENT; 371 target_symbol = ns_string_to_symbol (type);
421 ev.modifiers = 0; 372 data = ns_get_local_selection (selection_name, target_symbol);
422 ev.code = 0; 373 if (!NILP (data))
423 *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!! 374 {
424 *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType; 375 if (STRINGP (data))
425 ns_handle_selection_request (&ev); 376 ns_string_to_pasteboard_internal (pb, data, type);
426 } 377 successful_p = Qt;
378 }
379
380 if (!EQ (Vns_sent_selection_hooks, Qunbound))
381 {
382 for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
383 call3 (Fcar (rest), selection_name, target_symbol, successful_p);
384 }
385
427 return selection_value; 386 return selection_value;
428} 387}
429 388
@@ -438,8 +397,8 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
438 CHECK_SYMBOL (selection_name); 397 CHECK_SYMBOL (selection_name);
439 if (NILP (assq_no_quit (selection_name, Vselection_alist))) return Qnil; 398 if (NILP (assq_no_quit (selection_name, Vselection_alist))) return Qnil;
440 399
441 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; 400 pb = ns_symbol_to_pb (selection_name);
442 ns_undeclare_pasteboard (pb); 401 if (pb != nil) ns_undeclare_pasteboard (pb);
443 return Qt; 402 return Qt;
444} 403}
445 404
@@ -460,8 +419,10 @@ and t is the same as `SECONDARY'.) */)
460 CHECK_SYMBOL (selection); 419 CHECK_SYMBOL (selection);
461 if (EQ (selection, Qnil)) selection = QPRIMARY; 420 if (EQ (selection, Qnil)) selection = QPRIMARY;
462 if (EQ (selection, Qt)) selection = QSECONDARY; 421 if (EQ (selection, Qt)) selection = QSECONDARY;
463 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection)]; 422 pb = ns_symbol_to_pb (selection);
464 types =[pb types]; 423 if (pb == nil) return Qnil;
424
425 types = [pb types];
465 return ([types count] == 0) ? Qnil : Qt; 426 return ([types count] == 0) ? Qnil : Qt;
466} 427}
467 428
@@ -511,45 +472,31 @@ TYPE is the type of data desired, typically `STRING'. */)
511} 472}
512 473
513 474
514#ifdef CUT_BUFFER_SUPPORT 475DEFUN ("ns-get-selection-internal", Fns_get_selection_internal,
515DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal, 476 Sns_get_selection_internal, 1, 1, 0,
516 Sns_get_cut_buffer_internal, 1, 1, 0, 477 doc: /* Returns the value of SELECTION as a string.
517 doc: /* Returns the value of the named cut buffer. */) 478SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. */)
518 (Lisp_Object buffer) 479 (Lisp_Object selection)
519{ 480{
520 id pb; 481 id pb;
521 check_ns (); 482 check_ns ();
522 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (buffer)]; 483 pb = ns_symbol_to_pb (selection);
523 return ns_string_from_pasteboard (pb); 484 return pb != nil ? ns_string_from_pasteboard (pb) : Qnil;
524} 485}
525 486
526 487
527DEFUN ("ns-rotate-cut-buffers-internal", Fns_rotate_cut_buffers_internal, 488DEFUN ("ns-store-selection-internal", Fns_store_selection_internal,
528 Sns_rotate_cut_buffers_internal, 1, 1, 0, 489 Sns_store_selection_internal, 2, 2, 0,
529 doc: /* Rotate the values of the cut buffers by N steps. 490 doc: /* Sets the string value of SELECTION.
530Positive N means move values forward, negative means 491SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. */)
531backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ ) 492 (Lisp_Object selection, Lisp_Object string)
532 (Lisp_Object n)
533{
534 /* XXX This function is unimplemented under NeXTstep XXX */
535 Fsignal (Qquit, Fcons (build_string (
536 "Warning: ns-rotate-cut-buffers-internal not implemented\n"), Qnil));
537 return Qnil;
538}
539
540
541DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal,
542 Sns_store_cut_buffer_internal, 2, 2, 0,
543 doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */)
544 (Lisp_Object buffer, Lisp_Object string)
545{ 493{
546 id pb; 494 id pb;
547 check_ns (); 495 check_ns ();
548 pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (buffer)]; 496 pb = ns_symbol_to_pb (selection);
549 ns_string_to_pasteboard (pb, string); 497 if (pb != nil) ns_string_to_pasteboard (pb, string);
550 return Qnil; 498 return Qnil;
551} 499}
552#endif
553 500
554 501
555void 502void
@@ -572,11 +519,8 @@ syms_of_nsselect (void)
572 defsubr (&Sx_own_selection_internal); 519 defsubr (&Sx_own_selection_internal);
573 defsubr (&Sx_selection_exists_p); 520 defsubr (&Sx_selection_exists_p);
574 defsubr (&Sx_selection_owner_p); 521 defsubr (&Sx_selection_owner_p);
575#ifdef CUT_BUFFER_SUPPORT 522 defsubr (&Sns_get_selection_internal);
576 defsubr (&Sns_get_cut_buffer_internal); 523 defsubr (&Sns_store_selection_internal);
577 defsubr (&Sns_rotate_cut_buffers_internal);
578 defsubr (&Sns_store_cut_buffer_internal);
579#endif
580 524
581 Vselection_alist = Qnil; 525 Vselection_alist = Qnil;
582 staticpro (&Vselection_alist); 526 staticpro (&Vselection_alist);
diff --git a/src/nsterm.h b/src/nsterm.h
index 52246caac84..14918cca90d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -760,6 +760,7 @@ extern void ns_release_object (void *obj);
760extern void ns_retain_object (void *obj); 760extern void ns_retain_object (void *obj);
761extern void *ns_alloc_autorelease_pool (); 761extern void *ns_alloc_autorelease_pool ();
762extern void ns_release_autorelease_pool (); 762extern void ns_release_autorelease_pool ();
763extern const char *ns_get_defaults_value ();
763 764
764/* in nsmenu */ 765/* in nsmenu */
765extern void update_frame_tool_bar (FRAME_PTR f); 766extern void update_frame_tool_bar (FRAME_PTR f);
@@ -794,6 +795,7 @@ extern void x_set_tool_bar_lines (struct frame *f,
794 Lisp_Object oldval); 795 Lisp_Object oldval);
795extern void x_activate_menubar (struct frame *); 796extern void x_activate_menubar (struct frame *);
796extern void free_frame_menubar (struct frame *); 797extern void free_frame_menubar (struct frame *);
798extern void x_free_frame_resources (struct frame *);
797 799
798#define NSAPP_DATA2_RUNASSCRIPT 10 800#define NSAPP_DATA2_RUNASSCRIPT 10
799extern void ns_run_ascript (void); 801extern void ns_run_ascript (void);
diff --git a/src/nsterm.m b/src/nsterm.m
index 5e19a397c34..f8e69f98942 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1158,6 +1158,9 @@ x_free_frame_resources (struct frame *f)
1158 1158
1159 xfree (f->output_data.ns); 1159 xfree (f->output_data.ns);
1160 1160
1161 if (f->output_data.ns->miniimage != nil)
1162 [f->output_data.ns->miniimage release];
1163
1161 [[view window] close]; 1164 [[view window] close];
1162 [view release]; 1165 [view release];
1163 1166
@@ -1351,7 +1354,7 @@ ns_index_color (NSColor *color, struct frame *f)
1351{ 1354{
1352 struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; 1355 struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table;
1353 ptrdiff_t idx; 1356 ptrdiff_t idx;
1354 NSNumber *index; 1357 ptrdiff_t i;
1355 1358
1356 if (!color_table->colors) 1359 if (!color_table->colors)
1357 { 1360 {
@@ -1364,21 +1367,13 @@ ns_index_color (NSColor *color, struct frame *f)
1364 } 1367 }
1365 1368
1366 /* do we already have this color ? */ 1369 /* do we already have this color ? */
1367 { 1370 for (i = 1; i < color_table->avail; i++)
1368 ptrdiff_t i; 1371 if (color_table->colors[i] && [color_table->colors[i] isEqual: color])
1369 for (i = 1; i < color_table->avail; i++) 1372 return i;
1370 {
1371 if (color_table->colors[i] && [color_table->colors[i] isEqual: color])
1372 {
1373 [color_table->colors[i] retain];
1374 return i;
1375 }
1376 }
1377 }
1378 1373
1379 if ([color_table->empty_indices count] > 0) 1374 if ([color_table->empty_indices count] > 0)
1380 { 1375 {
1381 index = [color_table->empty_indices anyObject]; 1376 NSNumber *index = [color_table->empty_indices anyObject];
1382 [color_table->empty_indices removeObject: index]; 1377 [color_table->empty_indices removeObject: index];
1383 idx = [index unsignedLongValue]; 1378 idx = [index unsignedLongValue];
1384 } 1379 }
@@ -1411,20 +1406,20 @@ ns_free_indexed_color (unsigned long idx, struct frame *f)
1411 color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; 1406 color_table = FRAME_NS_DISPLAY_INFO (f)->color_table;
1412 1407
1413 if (idx <= 0 || idx >= color_table->size) { 1408 if (idx <= 0 || idx >= color_table->size) {
1414 message1("ns_free_indexed_color: Color index out of range.\n"); 1409 message1 ("ns_free_indexed_color: Color index out of range.\n");
1415 return; 1410 return;
1416 } 1411 }
1417 1412
1418 index = [NSNumber numberWithUnsignedInt: idx]; 1413 index = [NSNumber numberWithUnsignedInt: idx];
1419 if ([color_table->empty_indices containsObject: index]) { 1414 if ([color_table->empty_indices containsObject: index]) {
1420 message1("ns_free_indexed_color: attempt to free already freed color.\n"); 1415 message1 ("ns_free_indexed_color: attempt to free already freed color.\n");
1421 return; 1416 return;
1422 } 1417 }
1423 1418
1424 color = color_table->colors[idx]; 1419 color = color_table->colors[idx];
1425 [color release]; 1420 [color release];
1426 color_table->colors[idx] = nil; 1421 color_table->colors[idx] = nil;
1427 [color_table->empty_indices addObject: [NSNumber numberWithUnsignedInt: idx]]; 1422 [color_table->empty_indices addObject: index];
1428/*fprintf(stderr, "color_table: FREED %d\n",idx);*/ 1423/*fprintf(stderr, "color_table: FREED %d\n",idx);*/
1429} 1424}
1430 1425
@@ -2108,7 +2103,7 @@ ns_scroll_run (struct window *w, struct run *run)
2108 } 2103 }
2109 else 2104 else
2110 { 2105 {
2111 /* Scolling down. Make sure we don't copy over the mode line. 2106 /* Scrolling down. Make sure we don't copy over the mode line.
2112 at the bottom. */ 2107 at the bottom. */
2113 if (to_y + run->height > bottom_y) 2108 if (to_y + run->height > bottom_y)
2114 height = bottom_y - to_y; 2109 height = bottom_y - to_y;
@@ -3824,11 +3819,9 @@ ns_default (const char *parameter, Lisp_Object *result,
3824 Check a parameter value in user's preferences 3819 Check a parameter value in user's preferences
3825 -------------------------------------------------------------------------- */ 3820 -------------------------------------------------------------------------- */
3826{ 3821{
3827 const char *value; 3822 const char *value = ns_get_defaults_value (parameter);
3828 3823
3829 if ( (value =[[[NSUserDefaults standardUserDefaults] 3824 if (value)
3830 stringForKey: [NSString stringWithUTF8String: parameter]]
3831 UTF8String]) )
3832 { 3825 {
3833 double f; 3826 double f;
3834 char *pos; 3827 char *pos;
@@ -4205,6 +4198,15 @@ ns_term_init (Lisp_Object display_name)
4205 [NSApp setServicesMenu: svcsMenu]; 4198 [NSApp setServicesMenu: svcsMenu];
4206 /* Needed at least on Cocoa, to get dock menu to show windows */ 4199 /* Needed at least on Cocoa, to get dock menu to show windows */
4207 [NSApp setWindowsMenu: [[NSMenu alloc] init]]; 4200 [NSApp setWindowsMenu: [[NSMenu alloc] init]];
4201
4202 [[NSNotificationCenter defaultCenter]
4203 addObserver: mainMenu
4204 selector: @selector (trackingNotification:)
4205 name: NSMenuDidBeginTrackingNotification object: mainMenu];
4206 [[NSNotificationCenter defaultCenter]
4207 addObserver: mainMenu
4208 selector: @selector (trackingNotification:)
4209 name: NSMenuDidEndTrackingNotification object: mainMenu];
4208 } 4210 }
4209#endif /* MAC OS X menu setup */ 4211#endif /* MAC OS X menu setup */
4210 4212
diff --git a/src/print.c b/src/print.c
index 0fdb750f370..dbe8a8950f7 100644
--- a/src/print.c
+++ b/src/print.c
@@ -622,7 +622,7 @@ A printed representation of an object is text which describes that object. */)
622 printcharfun = Vprin1_to_string_buffer; 622 printcharfun = Vprin1_to_string_buffer;
623 PRINTPREPARE; 623 PRINTPREPARE;
624 print (object, printcharfun, NILP (noescape)); 624 print (object, printcharfun, NILP (noescape));
625 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ 625 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINISH */
626 PRINTFINISH; 626 PRINTFINISH;
627 } 627 }
628 628
diff --git a/src/process.c b/src/process.c
index 05c4be27550..4b0f90b58af 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1521,8 +1521,9 @@ start_process_unwind (Lisp_Object proc)
1521 if (!PROCESSP (proc)) 1521 if (!PROCESSP (proc))
1522 abort (); 1522 abort ();
1523 1523
1524 /* Was PROC started successfully? */ 1524 /* Was PROC started successfully?
1525 if (XPROCESS (proc)->pid == -1) 1525 -2 is used for a pty with no process, eg for gdb. */
1526 if (XPROCESS (proc)->pid <= 0 && XPROCESS (proc)->pid != -2)
1526 remove_process (proc); 1527 remove_process (proc);
1527 1528
1528 return Qnil; 1529 return Qnil;
diff --git a/src/regex.c b/src/regex.c
index b7699378f5a..0ba05a95fdb 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -53,7 +53,7 @@
53 (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC && !emacs) 53 (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC && !emacs)
54#endif 54#endif
55 55
56/* For platform which support the ISO C amendement 1 functionality we 56/* For platform which support the ISO C amendment 1 functionality we
57 support user defined character classes. */ 57 support user defined character classes. */
58#if WIDE_CHAR_SUPPORT 58#if WIDE_CHAR_SUPPORT
59/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ 59/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
diff --git a/src/regex.h b/src/regex.h
index eba62f2e769..32ccfb7ddef 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -582,7 +582,7 @@ extern void regfree _RE_ARGS ((regex_t *__preg));
582} 582}
583#endif /* C++ */ 583#endif /* C++ */
584 584
585/* For platform which support the ISO C amendement 1 functionality we 585/* For platform which support the ISO C amendment 1 functionality we
586 support user defined character classes. */ 586 support user defined character classes. */
587#if WIDE_CHAR_SUPPORT 587#if WIDE_CHAR_SUPPORT
588/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ 588/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
@@ -592,7 +592,7 @@ extern void regfree _RE_ARGS ((regex_t *__preg));
592 592
593#if WIDE_CHAR_SUPPORT 593#if WIDE_CHAR_SUPPORT
594/* The GNU C library provides support for user-defined character classes 594/* The GNU C library provides support for user-defined character classes
595 and the functions from ISO C amendement 1. */ 595 and the functions from ISO C amendment 1. */
596# ifdef CHARCLASS_NAME_MAX 596# ifdef CHARCLASS_NAME_MAX
597# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX 597# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
598# else 598# else
diff --git a/src/region-cache.c b/src/region-cache.c
index ed7a07a6709..054374eb688 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -699,7 +699,7 @@ know_region_cache (struct buffer *buf, struct region_cache *c,
699 699
700/* Return true if the text immediately after POS in BUF is known, for 700/* Return true if the text immediately after POS in BUF is known, for
701 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 701 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
702 position after POS where the knownness changes. */ 702 position after POS where the knowledge changes. */
703int 703int
704region_cache_forward (struct buffer *buf, struct region_cache *c, 704region_cache_forward (struct buffer *buf, struct region_cache *c,
705 ptrdiff_t pos, ptrdiff_t *next) 705 ptrdiff_t pos, ptrdiff_t *next)
@@ -736,7 +736,7 @@ region_cache_forward (struct buffer *buf, struct region_cache *c,
736 736
737/* Return true if the text immediately before POS in BUF is known, for 737/* Return true if the text immediately before POS in BUF is known, for
738 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 738 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
739 position before POS where the knownness changes. */ 739 position before POS where the knowledge changes. */
740int region_cache_backward (struct buffer *buf, struct region_cache *c, 740int region_cache_backward (struct buffer *buf, struct region_cache *c,
741 ptrdiff_t pos, ptrdiff_t *next) 741 ptrdiff_t pos, ptrdiff_t *next)
742{ 742{
diff --git a/src/region-cache.h b/src/region-cache.h
index 8e1be716776..6758f8bcd08 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -97,7 +97,7 @@ extern void invalidate_region_cache (struct buffer *BUF,
97 97
98/* Return true if the text immediately after POS in BUF is known, for 98/* Return true if the text immediately after POS in BUF is known, for
99 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 99 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
100 position after POS where the knownness changes. */ 100 position after POS where the knowledge changes. */
101extern int region_cache_forward (struct buffer *BUF, 101extern int region_cache_forward (struct buffer *BUF,
102 struct region_cache *CACHE, 102 struct region_cache *CACHE,
103 ptrdiff_t POS, 103 ptrdiff_t POS,
@@ -105,7 +105,7 @@ extern int region_cache_forward (struct buffer *BUF,
105 105
106/* Return true if the text immediately before POS in BUF is known, for 106/* Return true if the text immediately before POS in BUF is known, for
107 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 107 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
108 position before POS where the knownness changes. */ 108 position before POS where the knowledge changes. */
109extern int region_cache_backward (struct buffer *BUF, 109extern int region_cache_backward (struct buffer *BUF,
110 struct region_cache *CACHE, 110 struct region_cache *CACHE,
111 ptrdiff_t POS, 111 ptrdiff_t POS,
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 3d78bf695bc..d89b14cc080 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -155,7 +155,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
155 extern void *__libc_ia64_register_backing_store_base; \ 155 extern void *__libc_ia64_register_backing_store_base; \
156 __builtin_ia64_flushrs (); \ 156 __builtin_ia64_flushrs (); \
157 mark_memory (__libc_ia64_register_backing_store_base, \ 157 mark_memory (__libc_ia64_register_backing_store_base, \
158 __builtin_ia64_bsp (), 0); \ 158 __builtin_ia64_bsp ()); \
159 } while (0) 159 } while (0)
160#endif 160#endif
161#endif 161#endif
diff --git a/src/sysdep.c b/src/sysdep.c
index ae200308bf3..b111fa1324c 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -433,7 +433,7 @@ child_setup_tty (int out)
433#endif /* AIX */ 433#endif /* AIX */
434 434
435 /* We originally enabled ICANON (and set VEOF to 04), and then had 435 /* We originally enabled ICANON (and set VEOF to 04), and then had
436 proces.c send additional EOF chars to flush the output when faced 436 process.c send additional EOF chars to flush the output when faced
437 with long lines, but this leads to weird effects when the 437 with long lines, but this leads to weird effects when the
438 subprocess has disabled ICANON and ends up seeing those spurious 438 subprocess has disabled ICANON and ends up seeing those spurious
439 extra EOFs. So we don't send EOFs any more in 439 extra EOFs. So we don't send EOFs any more in
diff --git a/src/termhooks.h b/src/termhooks.h
index a025e2798d9..03d336bf0c8 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -556,7 +556,7 @@ struct terminal
556 556
557 /* Arrange for all scroll bars on FRAME to be removed at the next call 557 /* Arrange for all scroll bars on FRAME to be removed at the next call
558 to `*judge_scroll_bars_hook'. A scroll bar may be spared if 558 to `*judge_scroll_bars_hook'. A scroll bar may be spared if
559 `*redeem_scroll_bar_hook' is applied to its window before the judgement. 559 `*redeem_scroll_bar_hook' is applied to its window before the judgment.
560 560
561 This should be applied to each frame each time its window tree is 561 This should be applied to each frame each time its window tree is
562 redisplayed, even if it is not displaying scroll bars at the moment; 562 redisplayed, even if it is not displaying scroll bars at the moment;
@@ -568,7 +568,7 @@ struct terminal
568 currently displaying them. */ 568 currently displaying them. */
569 void (*condemn_scroll_bars_hook) (struct frame *frame); 569 void (*condemn_scroll_bars_hook) (struct frame *frame);
570 570
571 /* Unmark WINDOW's scroll bar for deletion in this judgement cycle. 571 /* Unmark WINDOW's scroll bar for deletion in this judgment cycle.
572 Note that it's okay to redeem a scroll bar that is not condemned. */ 572 Note that it's okay to redeem a scroll bar that is not condemned. */
573 void (*redeem_scroll_bar_hook) (struct window *window); 573 void (*redeem_scroll_bar_hook) (struct window *window);
574 574
diff --git a/src/textprop.c b/src/textprop.c
index 29425f7a550..a1c7593f568 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1625,7 +1625,7 @@ Return t if any property was actually removed, nil otherwise. */)
1625 1625
1626DEFUN ("text-property-any", Ftext_property_any, 1626DEFUN ("text-property-any", Ftext_property_any,
1627 Stext_property_any, 4, 5, 0, 1627 Stext_property_any, 4, 5, 0,
1628 doc: /* Check text from START to END for property PROPERTY equalling VALUE. 1628 doc: /* Check text from START to END for property PROPERTY equaling VALUE.
1629If so, return the position of the first character whose property PROPERTY 1629If so, return the position of the first character whose property PROPERTY
1630is `eq' to VALUE. Otherwise return nil. 1630is `eq' to VALUE. Otherwise return nil.
1631If the optional fifth argument OBJECT is a buffer (or nil, which means 1631If the optional fifth argument OBJECT is a buffer (or nil, which means
@@ -1661,7 +1661,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
1661 1661
1662DEFUN ("text-property-not-all", Ftext_property_not_all, 1662DEFUN ("text-property-not-all", Ftext_property_not_all,
1663 Stext_property_not_all, 4, 5, 0, 1663 Stext_property_not_all, 4, 5, 0,
1664 doc: /* Check text from START to END for property PROPERTY not equalling VALUE. 1664 doc: /* Check text from START to END for property PROPERTY not equaling VALUE.
1665If so, return the position of the first character whose property PROPERTY 1665If so, return the position of the first character whose property PROPERTY
1666is not `eq' to VALUE. Otherwise, return nil. 1666is not `eq' to VALUE. Otherwise, return nil.
1667If the optional fifth argument OBJECT is a buffer (or nil, which means 1667If the optional fifth argument OBJECT is a buffer (or nil, which means
diff --git a/src/unexelf.c b/src/unexelf.c
index 04c029f7e80..1715c3670ca 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1219,9 +1219,15 @@ temacs:
1219 nn = symp->st_shndx; 1219 nn = symp->st_shndx;
1220 if (nn > old_bss_index) 1220 if (nn > old_bss_index)
1221 nn--; 1221 nn--;
1222 old = ((symp->st_value - NEW_SECTION_H (symp->st_shndx).sh_addr) 1222 if (nn == old_bss_index)
1223 + OLD_SECTION_H (nn).sh_offset + old_base); 1223 memset (new, 0, symp->st_size);
1224 memcpy (new, old, symp->st_size); 1224 else
1225 {
1226 old = ((symp->st_value
1227 - NEW_SECTION_H (symp->st_shndx).sh_addr)
1228 + OLD_SECTION_H (nn).sh_offset + old_base);
1229 memcpy (new, old, symp->st_size);
1230 }
1225 } 1231 }
1226#endif 1232#endif
1227 } 1233 }
diff --git a/src/w16select.c b/src/w16select.c
index cae7a6f82dd..7ba62fde0e5 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -114,7 +114,7 @@ identify_winoldap_version (void)
114 return regs.x.ax; 114 return regs.x.ax;
115} 115}
116 116
117/* Open the clipboard, return non-zero if successfull. */ 117/* Open the clipboard, return non-zero if successful. */
118unsigned 118unsigned
119open_clipboard (void) 119open_clipboard (void)
120{ 120{
@@ -137,7 +137,7 @@ open_clipboard (void)
137 return regs.x.ax; 137 return regs.x.ax;
138} 138}
139 139
140/* Empty clipboard, return non-zero if successfull. */ 140/* Empty clipboard, return non-zero if successful. */
141unsigned 141unsigned
142empty_clipboard (void) 142empty_clipboard (void)
143{ 143{
@@ -207,7 +207,7 @@ free_xfer_buf (void)
207 } 207 }
208} 208}
209 209
210/* Copy data into the clipboard, return zero if successfull. */ 210/* Copy data into the clipboard, return zero if successful. */
211unsigned 211unsigned
212set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) 212set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
213{ 213{
@@ -405,7 +405,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
405 return (unsigned) (dp - (unsigned char *)Data - 1); 405 return (unsigned) (dp - (unsigned char *)Data - 1);
406} 406}
407 407
408/* Close clipboard, return non-zero if successfull. */ 408/* Close clipboard, return non-zero if successful. */
409unsigned 409unsigned
410close_clipboard (void) 410close_clipboard (void)
411{ 411{
@@ -730,4 +730,3 @@ After the communication, this variable is set to nil. */);
730} 730}
731 731
732#endif /* MSDOS */ 732#endif /* MSDOS */
733
diff --git a/src/w32.c b/src/w32.c
index 304445e2238..b26327462d8 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1654,6 +1654,24 @@ init_environment (char ** argv)
1654 } 1654 }
1655 } 1655 }
1656 1656
1657 /* When Emacs is invoked with --no-site-lisp, we must remove the
1658 site-lisp directories from the default value of EMACSLOADPATH.
1659 This assumes that the site-lisp entries are at the front, and
1660 that additional entries do exist. */
1661 if (no_site_lisp)
1662 {
1663 for (i = 0; i < N_ENV_VARS; i++)
1664 {
1665 if (strcmp (env_vars[i].name, "EMACSLOADPATH") == 0)
1666 {
1667 char *site;
1668 while ((site = strstr (env_vars[i].def_value, "site-lisp")))
1669 env_vars[i].def_value = strchr (site, ';') + 1;
1670 break;
1671 }
1672 }
1673 }
1674
1657#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */ 1675#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
1658 1676
1659 /* Treat emacs_dir specially: set it unconditionally based on our 1677 /* Treat emacs_dir specially: set it unconditionally based on our
diff --git a/src/w32fns.c b/src/w32fns.c
index 7a17c108d4d..822e3530bb6 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2417,7 +2417,7 @@ complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result)
2417 deferred_msg * msg_buf = find_deferred_msg (hwnd, msg); 2417 deferred_msg * msg_buf = find_deferred_msg (hwnd, msg);
2418 2418
2419 if (msg_buf == NULL) 2419 if (msg_buf == NULL)
2420 /* Message may have been cancelled, so don't abort. */ 2420 /* Message may have been canceled, so don't abort. */
2421 return; 2421 return;
2422 2422
2423 msg_buf->result = result; 2423 msg_buf->result = result;
@@ -2538,7 +2538,7 @@ post_character_message (HWND hwnd, UINT msg,
2538 the lisp thread to respond. 2538 the lisp thread to respond.
2539 2539
2540 Note that we don't want to block the input thread waiting for 2540 Note that we don't want to block the input thread waiting for
2541 a reponse from the lisp thread (although that would at least 2541 a response from the lisp thread (although that would at least
2542 solve the deadlock problem above), because we want to be able 2542 solve the deadlock problem above), because we want to be able
2543 to receive C-g to interrupt the lisp thread. */ 2543 to receive C-g to interrupt the lisp thread. */
2544 cancel_all_deferred_msgs (); 2544 cancel_all_deferred_msgs ();
@@ -3749,7 +3749,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3749 flags |= TPM_RIGHTBUTTON; 3749 flags |= TPM_RIGHTBUTTON;
3750 3750
3751 /* Remember we did a SetCapture on the initial mouse down event, 3751 /* Remember we did a SetCapture on the initial mouse down event,
3752 so for safety, we make sure the capture is cancelled now. */ 3752 so for safety, we make sure the capture is canceled now. */
3753 ReleaseCapture (); 3753 ReleaseCapture ();
3754 button_state = 0; 3754 button_state = 0;
3755 3755
@@ -4951,7 +4951,7 @@ If TYPE is nil or omitted, get the property as a string.
4951Otherwise TYPE is the name of the atom that denotes the type expected. 4951Otherwise TYPE is the name of the atom that denotes the type expected.
4952If SOURCE is non-nil, get the property on that window instead of from 4952If SOURCE is non-nil, get the property on that window instead of from
4953FRAME. The number 0 denotes the root window. 4953FRAME. The number 0 denotes the root window.
4954If DELETE_P is non-nil, delete the property after retreiving it. 4954If DELETE_P is non-nil, delete the property after retrieving it.
4955If VECTOR_RET_P is non-nil, don't return a string but a vector of values. 4955If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
4956 4956
4957Value is nil if FRAME hasn't a property with name PROP or if PROP has 4957Value is nil if FRAME hasn't a property with name PROP or if PROP has
@@ -6032,7 +6032,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6032 6032
6033 file = DECODE_FILE (build_string (filename)); 6033 file = DECODE_FILE (build_string (filename));
6034 } 6034 }
6035 /* User cancelled the dialog without making a selection. */ 6035 /* User canceled the dialog without making a selection. */
6036 else if (!CommDlgExtendedError ()) 6036 else if (!CommDlgExtendedError ())
6037 file = Qnil; 6037 file = Qnil;
6038 /* An error occurred, fallback on reading from the mini-buffer. */ 6038 /* An error occurred, fallback on reading from the mini-buffer. */
diff --git a/src/w32font.c b/src/w32font.c
index 5cc37c0e74f..e8a223de0a4 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -786,7 +786,7 @@ w32font_free_outline (struct font *font, void *outline);
786 Optional. 786 Optional.
787 Get coordinates of the INDEXth anchor point of the glyph whose 787 Get coordinates of the INDEXth anchor point of the glyph whose
788 code is CODE. Store the coordinates in *X and *Y. Return 0 if 788 code is CODE. Store the coordinates in *X and *Y. Return 0 if
789 the operations was successfull. Otherwise return -1. 789 the operations was successful. Otherwise return -1.
790static int 790static int
791w32font_anchor_point (struct font *font, unsigned code, 791w32font_anchor_point (struct font *font, unsigned code,
792 int index, int *x, int *y); 792 int index, int *x, int *y);
diff --git a/src/w32select.c b/src/w32select.c
index e3225c3f996..392cb07a96d 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -39,7 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39 * 39 *
40 * When copying or cutting (sending data to the OS), the data is 40 * When copying or cutting (sending data to the OS), the data is
41 * announced and stored internally, but only actually rendered on 41 * announced and stored internally, but only actually rendered on
42 * request. The requester determines the format provided. The 42 * request. The requestor determines the format provided. The
43 * {next-}selection-coding-system is only used, when its corresponding 43 * {next-}selection-coding-system is only used, when its corresponding
44 * clipboard type matches the type requested. 44 * clipboard type matches the type requested.
45 * 45 *
@@ -335,7 +335,7 @@ render_all (Lisp_Object ignore)
335 335
336 OpenClipboard (NULL); 336 OpenClipboard (NULL);
337 337
338 /* There is no usefull means to report errors here, there are none 338 /* There is no useful means to report errors here, there are none
339 expected anyway, and even if there were errors, they wouldn't do 339 expected anyway, and even if there were errors, they wouldn't do
340 any harm. So we just go ahead and do what has to be done without 340 any harm. So we just go ahead and do what has to be done without
341 bothering with error handling. */ 341 bothering with error handling. */
@@ -750,7 +750,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
750 else 750 else
751 { 751 {
752 /* Advertise all supported formats so that whatever the 752 /* Advertise all supported formats so that whatever the
753 requester chooses, only one encoding step needs to be 753 requestor chooses, only one encoding step needs to be
754 made. This is intentionally different from what we do in 754 made. This is intentionally different from what we do in
755 the handler for WM_RENDERALLFORMATS. */ 755 the handler for WM_RENDERALLFORMATS. */
756 SetClipboardData (CF_UNICODETEXT, NULL); 756 SetClipboardData (CF_UNICODETEXT, NULL);
@@ -1138,4 +1138,3 @@ globals_of_w32select (void)
1138 1138
1139 clipboard_owner = create_owner (); 1139 clipboard_owner = create_owner ();
1140} 1140}
1141
diff --git a/src/w32term.c b/src/w32term.c
index a2ccdd21f7d..29ac9d119b4 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2665,7 +2665,7 @@ x_scroll_run (struct window *w, struct run *run)
2665 } 2665 }
2666 else 2666 else
2667 { 2667 {
2668 /* Scolling down. Make sure we don't copy over the mode line. 2668 /* Scrolling down. Make sure we don't copy over the mode line.
2669 at the bottom. */ 2669 at the bottom. */
2670 if (to_y + run->height > bottom_y) 2670 if (to_y + run->height > bottom_y)
2671 height = bottom_y - to_y; 2671 height = bottom_y - to_y;
@@ -3286,7 +3286,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3286 ***********************************************************************/ 3286 ***********************************************************************/
3287 3287
3288/* Handle mouse button event on the tool-bar of frame F, at 3288/* Handle mouse button event on the tool-bar of frame F, at
3289 frame-relative coordinates X/Y. EVENT_TYPE is either ButtionPress 3289 frame-relative coordinates X/Y. EVENT_TYPE is either ButtonPress
3290 or ButtonRelease. */ 3290 or ButtonRelease. */
3291 3291
3292static void 3292static void
@@ -3556,7 +3556,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3556 /* Destroy the window. */ 3556 /* Destroy the window. */
3557 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); 3557 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
3558 3558
3559 /* Disassociate this scroll bar from its window. */ 3559 /* Dissociate this scroll bar from its window. */
3560 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; 3560 XWINDOW (bar->window)->vertical_scroll_bar = Qnil;
3561 3561
3562 UNBLOCK_INPUT; 3562 UNBLOCK_INPUT;
diff --git a/src/w32term.h b/src/w32term.h
index 6c73daba601..f587ee11af9 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -229,7 +229,7 @@ enum
229{ 229{
230 /* Values for focus_state, used as bit mask. 230 /* Values for focus_state, used as bit mask.
231 EXPLICIT means we received a FocusIn for the frame and know it has 231 EXPLICIT means we received a FocusIn for the frame and know it has
232 the focus. IMPLICIT means we recevied an EnterNotify and the frame 232 the focus. IMPLICIT means we received an EnterNotify and the frame
233 may have the focus if no window manager is running. 233 may have the focus if no window manager is running.
234 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 234 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
235 FOCUS_NONE = 0, 235 FOCUS_NONE = 0,
diff --git a/src/window.c b/src/window.c
index 86fcca25f2e..4f573a67909 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5000,7 +5000,7 @@ the selected window; if the variable `recenter-redisplay' is non-nil,
5000also erase the entire frame and redraw it (when `auto-resize-tool-bars' 5000also erase the entire frame and redraw it (when `auto-resize-tool-bars'
5001is set to `grow-only', this resets the tool-bar's height to the minimum 5001is set to `grow-only', this resets the tool-bar's height to the minimum
5002height needed); if `recenter-redisplay' has the special value `tty', 5002height needed); if `recenter-redisplay' has the special value `tty',
5003then only tty frame are redrawn. 5003then only tty frames are redrawn.
5004 5004
5005Just C-u as prefix means put point in the center of the window 5005Just C-u as prefix means put point in the center of the window
5006and redisplay normally--don't erase and redraw the frame. */) 5006and redisplay normally--don't erase and redraw the frame. */)
@@ -5772,7 +5772,7 @@ get_leaf_windows (struct window *w, struct window **flat, int i)
5772 5772
5773 5773
5774/* Return a pointer to the glyph W's physical cursor is on. Value is 5774/* Return a pointer to the glyph W's physical cursor is on. Value is
5775 null if W's current matrix is invalid, so that no meaningfull glyph 5775 null if W's current matrix is invalid, so that no meaningful glyph
5776 can be returned. */ 5776 can be returned. */
5777struct glyph * 5777struct glyph *
5778get_phys_cursor_glyph (struct window *w) 5778get_phys_cursor_glyph (struct window *w)
@@ -6505,28 +6505,31 @@ with the relevant frame selected. */);
6505 Vwindow_configuration_change_hook = Qnil; 6505 Vwindow_configuration_change_hook = Qnil;
6506 6506
6507 DEFVAR_LISP ("recenter-redisplay", Vrecenter_redisplay, 6507 DEFVAR_LISP ("recenter-redisplay", Vrecenter_redisplay,
6508 doc: /* If non-nil, then the `recenter' command with a nil argument 6508 doc: /* Non-nil means `recenter' redraws entire frame.
6509will redraw the entire frame; the special value `tty' causes the 6509If this option is non-nil, then the `recenter' command with a nil
6510frame to be redrawn only if it is a tty frame. */); 6510argument will redraw the entire frame; the special value `tty' causes
6511the frame to be redrawn only if it is a tty frame. */);
6511 Vrecenter_redisplay = Qtty; 6512 Vrecenter_redisplay = Qtty;
6512 6513
6513 DEFVAR_LISP ("window-combination-resize", Vwindow_combination_resize, 6514 DEFVAR_LISP ("window-combination-resize", Vwindow_combination_resize,
6514 doc: /* Non-nil means resize window combinations proportionally. 6515 doc: /* If t, resize window combinations proportionally.
6515If this variable is nil, splitting a window gets the entire screen space 6516If this variable is nil, splitting a window gets the entire screen space
6516for displaying the new window from the window to split. Deleting and 6517for displaying the new window from the window to split. Deleting and
6517resizing a window preferably resizes one adjacent window only. 6518resizing a window preferably resizes one adjacent window only.
6518 6519
6519If this variable is non-nil, splitting a window tries to get the space 6520If this variable is t, splitting a window tries to get the space
6520proportionally from all windows in the same combination. This also 6521proportionally from all windows in the same combination. This also
6521allows to split a window that is otherwise too small or of fixed size. 6522allows to split a window that is otherwise too small or of fixed size.
6522Resizing and deleting a window proportionally resize all windows in the 6523Resizing and deleting a window proportionally resize all windows in the
6523same combination. 6524same combination.
6524 6525
6526Other values are reserved for future use.
6527
6525This variable takes no effect if `window-combination-limit' is non-nil. */); 6528This variable takes no effect if `window-combination-limit' is non-nil. */);
6526 Vwindow_combination_resize = Qnil; 6529 Vwindow_combination_resize = Qnil;
6527 6530
6528 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit, 6531 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit,
6529 doc: /* Non-nil means splitting a window makes a new parent window. 6532 doc: /* If t, splitting a window makes a new parent window.
6530If this variable is nil, splitting a window will create a new parent 6533If this variable is nil, splitting a window will create a new parent
6531window only if the window has no parent window or the window shall 6534window only if the window has no parent window or the window shall
6532become a combination orthogonal to the one it is part of. 6535become a combination orthogonal to the one it is part of.
diff --git a/src/window.h b/src/window.h
index df29ca1368f..b4e268b1a34 100644
--- a/src/window.h
+++ b/src/window.h
@@ -877,7 +877,7 @@ extern int buffer_shared;
877extern void check_frame_size (struct frame *frame, int *rows, int *cols); 877extern void check_frame_size (struct frame *frame, int *rows, int *cols);
878 878
879/* Return a pointer to the glyph W's physical cursor is on. Value is 879/* Return a pointer to the glyph W's physical cursor is on. Value is
880 null if W's current matrix is invalid, so that no meaningfull glyph 880 null if W's current matrix is invalid, so that no meaningful glyph
881 can be returned. */ 881 can be returned. */
882 882
883struct glyph *get_phys_cursor_glyph (struct window *w); 883struct glyph *get_phys_cursor_glyph (struct window *w);
diff --git a/src/xdisp.c b/src/xdisp.c
index 530373a4436..1588d490ec3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1920,7 +1920,7 @@ get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, int
1920 environments with anti-aliased text: if the same text is 1920 environments with anti-aliased text: if the same text is
1921 drawn onto the same place multiple times, it gets thicker. 1921 drawn onto the same place multiple times, it gets thicker.
1922 If the overlap we are processing is for the erased cursor, we 1922 If the overlap we are processing is for the erased cursor, we
1923 take the intersection with the rectagle of the cursor. */ 1923 take the intersection with the rectangle of the cursor. */
1924 if (s->for_overlaps & OVERLAPS_ERASED_CURSOR) 1924 if (s->for_overlaps & OVERLAPS_ERASED_CURSOR)
1925 { 1925 {
1926 XRectangle rc, r_save = r; 1926 XRectangle rc, r_save = r;
@@ -4095,10 +4095,11 @@ handle_invisible_prop (struct it *it)
4095 while (invis_p); 4095 while (invis_p);
4096 4096
4097 /* The position newpos is now either ZV or on visible text. */ 4097 /* The position newpos is now either ZV or on visible text. */
4098 if (it->bidi_p && newpos < ZV) 4098 if (it->bidi_p)
4099 { 4099 {
4100 EMACS_INT bpos = CHAR_TO_BYTE (newpos); 4100 EMACS_INT bpos = CHAR_TO_BYTE (newpos);
4101 int on_newline = FETCH_BYTE (bpos) == '\n'; 4101 int on_newline =
4102 bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n';
4102 int after_newline = 4103 int after_newline =
4103 newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n'; 4104 newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n';
4104 4105
@@ -4116,16 +4117,16 @@ handle_invisible_prop (struct it *it)
4116 4117
4117 SET_TEXT_POS (tpos, newpos, bpos); 4118 SET_TEXT_POS (tpos, newpos, bpos);
4118 reseat_1 (it, tpos, 0); 4119 reseat_1 (it, tpos, 0);
4119 /* If we reseat on a newline, we need to prep the 4120 /* If we reseat on a newline/ZV, we need to prep the
4120 bidi iterator for advancing to the next character 4121 bidi iterator for advancing to the next character
4121 after the newline, keeping the current paragraph 4122 after the newline/EOB, keeping the current paragraph
4122 direction (so that PRODUCE_GLYPHS does TRT wrt 4123 direction (so that PRODUCE_GLYPHS does TRT wrt
4123 prepending/appending glyphs to a glyph row). */ 4124 prepending/appending glyphs to a glyph row). */
4124 if (on_newline) 4125 if (on_newline)
4125 { 4126 {
4126 it->bidi_it.first_elt = 0; 4127 it->bidi_it.first_elt = 0;
4127 it->bidi_it.paragraph_dir = pdir; 4128 it->bidi_it.paragraph_dir = pdir;
4128 it->bidi_it.ch = '\n'; 4129 it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n';
4129 it->bidi_it.nchars = 1; 4130 it->bidi_it.nchars = 1;
4130 it->bidi_it.ch_len = 1; 4131 it->bidi_it.ch_len = 1;
4131 } 4132 }
@@ -10288,7 +10289,7 @@ current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
10288} 10289}
10289 10290
10290 10291
10291/* Push the current message on Vmessage_stack for later restauration 10292/* Push the current message on Vmessage_stack for later restoration
10292 by restore_message. Value is non-zero if the current message isn't 10293 by restore_message. Value is non-zero if the current message isn't
10293 empty. This is a relatively infrequent operation, so it's not 10294 empty. This is a relatively infrequent operation, so it's not
10294 worth optimizing. */ 10295 worth optimizing. */
@@ -14421,7 +14422,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14421 { 14422 {
14422 int scroll_margin_y; 14423 int scroll_margin_y;
14423 14424
14424 /* Compute the pixel ypos of the scroll margin, then move it to 14425 /* Compute the pixel ypos of the scroll margin, then move IT to
14425 either that ypos or PT, whichever comes first. */ 14426 either that ypos or PT, whichever comes first. */
14426 start_display (&it, w, startp); 14427 start_display (&it, w, startp);
14427 scroll_margin_y = it.last_visible_y - this_scroll_margin 14428 scroll_margin_y = it.last_visible_y - this_scroll_margin
@@ -14451,7 +14452,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14451 if (dy > scroll_max) 14452 if (dy > scroll_max)
14452 return SCROLLING_FAILED; 14453 return SCROLLING_FAILED;
14453 14454
14454 scroll_down_p = 1; 14455 if (dy > 0)
14456 scroll_down_p = 1;
14455 } 14457 }
14456 } 14458 }
14457 14459
@@ -18991,7 +18993,8 @@ display_line (struct it *it)
18991#define RECORD_MAX_MIN_POS(IT) \ 18993#define RECORD_MAX_MIN_POS(IT) \
18992 do \ 18994 do \
18993 { \ 18995 { \
18994 int composition_p = (IT)->what == IT_COMPOSITION; \ 18996 int composition_p = !STRINGP ((IT)->string) \
18997 && ((IT)->what == IT_COMPOSITION); \
18995 EMACS_INT current_pos = \ 18998 EMACS_INT current_pos = \
18996 composition_p ? (IT)->cmp_it.charpos \ 18999 composition_p ? (IT)->cmp_it.charpos \
18997 : IT_CHARPOS (*(IT)); \ 19000 : IT_CHARPOS (*(IT)); \
diff --git a/src/xfns.c b/src/xfns.c
index 323b272e9f0..e44f28df870 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1877,7 +1877,7 @@ static XIMStyle supported_xim_styles[] =
1877#if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT 1877#if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
1878/* Create an X fontset on frame F with base font name BASE_FONTNAME. */ 1878/* Create an X fontset on frame F with base font name BASE_FONTNAME. */
1879 1879
1880static const char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; 1880static const char xic_default_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
1881 1881
1882/* Create an Xt fontset spec from the name of a base font. 1882/* Create an Xt fontset spec from the name of a base font.
1883 If `motif' is True use the Motif syntax. */ 1883 If `motif' is True use the Motif syntax. */
@@ -1888,7 +1888,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
1888 char *fontsetname; 1888 char *fontsetname;
1889 1889
1890 /* Make a fontset name from the base font name. */ 1890 /* Make a fontset name from the base font name. */
1891 if (xic_defaut_fontset == base_fontname) 1891 if (xic_default_fontset == base_fontname)
1892 { /* There is no base font name, use the default. */ 1892 { /* There is no base font name, use the default. */
1893 ptrdiff_t len = strlen (base_fontname) + 2; 1893 ptrdiff_t len = strlen (base_fontname) + 2;
1894 fontsetname = xmalloc (len); 1894 fontsetname = xmalloc (len);
@@ -1912,12 +1912,12 @@ xic_create_fontsetname (const char *base_fontname, int motif)
1912 modify it to generalize it to allcs and allfamilies. 1912 modify it to generalize it to allcs and allfamilies.
1913 Use the specified font plus the default. */ 1913 Use the specified font plus the default. */
1914 ptrdiff_t len = 1914 ptrdiff_t len =
1915 strlen (base_fontname) + strlen (xic_defaut_fontset) + 3; 1915 strlen (base_fontname) + strlen (xic_default_fontset) + 3;
1916 fontsetname = xmalloc (len); 1916 fontsetname = xmalloc (len);
1917 memset (fontsetname, 0, len); 1917 memset (fontsetname, 0, len);
1918 strcpy (fontsetname, base_fontname); 1918 strcpy (fontsetname, base_fontname);
1919 strcat (fontsetname, sep); 1919 strcat (fontsetname, sep);
1920 strcat (fontsetname, xic_defaut_fontset); 1920 strcat (fontsetname, xic_default_fontset);
1921 } 1921 }
1922 else 1922 else
1923 { 1923 {
@@ -4286,7 +4286,7 @@ If TYPE is nil or omitted, get the property as a string.
4286Otherwise TYPE is the name of the atom that denotes the type expected. 4286Otherwise TYPE is the name of the atom that denotes the type expected.
4287If SOURCE is non-nil, get the property on that window instead of from 4287If SOURCE is non-nil, get the property on that window instead of from
4288FRAME. The number 0 denotes the root window. 4288FRAME. The number 0 denotes the root window.
4289If DELETE_P is non-nil, delete the property after retreiving it. 4289If DELETE_P is non-nil, delete the property after retrieving it.
4290If VECTOR_RET_P is non-nil, don't return a string but a vector of values. 4290If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
4291 4291
4292Value is nil if FRAME hasn't a property with name PROP or if PROP has 4292Value is nil if FRAME hasn't a property with name PROP or if PROP has
diff --git a/src/xftfont.c b/src/xftfont.c
index c27a4fcf91a..8cb4c494854 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -654,7 +654,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b
654 654
655 if (with_background) 655 if (with_background)
656 XftDrawRect (xft_draw, &bg, 656 XftDrawRect (xft_draw, &bg,
657 x, y - face->font->ascent, s->width, face->font->height); 657 x, y - s->font->ascent, s->width, s->font->height);
658 code = alloca (sizeof (FT_UInt) * len); 658 code = alloca (sizeof (FT_UInt) * len);
659 for (i = 0; i < len; i++) 659 for (i = 0; i < len; i++)
660 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) 660 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
diff --git a/src/xmenu.c b/src/xmenu.c
index 4b7bbfd73dc..ba99b8ac1e3 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -102,6 +102,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102 102
103#ifdef USE_GTK 103#ifdef USE_GTK
104#include "gtkutil.h" 104#include "gtkutil.h"
105#ifdef HAVE_GTK3
106#include "xgselect.h"
107#endif
105#endif 108#endif
106 109
107#include "menu.h" 110#include "menu.h"
@@ -408,7 +411,15 @@ x_menu_wait_for_event (void *data)
408 else 411 else
409 ntp = &next_time; 412 ntp = &next_time;
410 413
414#ifdef HAVE_GTK3
415 /* Gtk3 have arrows on menus when they don't fit. When the pointer is
416 over an arrow, a timeout scrolls it a bit. Use xg_select so that
417 timeout gets triggered. */
418
419 xg_select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp);
420#else
411 select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp); 421 select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp);
422#endif
412 } 423 }
413} 424}
414#endif /* ! MSDOS */ 425#endif /* ! MSDOS */
@@ -1435,6 +1446,13 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1435 GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */ 1446 GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */
1436 struct next_popup_x_y popup_x_y; 1447 struct next_popup_x_y popup_x_y;
1437 int specpdl_count = SPECPDL_INDEX (); 1448 int specpdl_count = SPECPDL_INDEX ();
1449 int use_pos_func = ! for_click;
1450
1451#ifdef HAVE_GTK3
1452 /* Always use position function for Gtk3. Otherwise menus may become
1453 too small to show anything. */
1454 use_pos_func = 1;
1455#endif
1438 1456
1439 if (! FRAME_X_P (f)) 1457 if (! FRAME_X_P (f))
1440 abort (); 1458 abort ();
@@ -1446,7 +1464,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1446 G_CALLBACK (menu_highlight_callback)); 1464 G_CALLBACK (menu_highlight_callback));
1447 xg_crazy_callback_abort = 0; 1465 xg_crazy_callback_abort = 0;
1448 1466
1449 if (! for_click) 1467 if (use_pos_func)
1450 { 1468 {
1451 /* Not invoked by a click. pop up at x/y. */ 1469 /* Not invoked by a click. pop up at x/y. */
1452 pos_func = menu_position_func; 1470 pos_func = menu_position_func;
@@ -1461,7 +1479,8 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1461 1479
1462 i = 0; /* gtk_menu_popup needs this to be 0 for a non-button popup. */ 1480 i = 0; /* gtk_menu_popup needs this to be 0 for a non-button popup. */
1463 } 1481 }
1464 else 1482
1483 if (for_click)
1465 { 1484 {
1466 for (i = 0; i < 5; i++) 1485 for (i = 0; i < 5; i++)
1467 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) 1486 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
diff --git a/src/xselect.c b/src/xselect.c
index 4bfab4143cc..5e5e6a098b6 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -516,7 +516,7 @@ static struct selection_data *converted_selections;
516static Atom conversion_fail_tag; 516static Atom conversion_fail_tag;
517 517
518/* Used as an unwind-protect clause so that, if a selection-converter signals 518/* Used as an unwind-protect clause so that, if a selection-converter signals
519 an error, we tell the requester that we were unable to do what they wanted 519 an error, we tell the requestor that we were unable to do what they wanted
520 before we throw to top-level or go into the debugger or whatever. */ 520 before we throw to top-level or go into the debugger or whatever. */
521 521
522static Lisp_Object 522static Lisp_Object
@@ -693,7 +693,7 @@ x_reply_selection_request (struct input_event *event,
693 bytes_remaining = cs->size; 693 bytes_remaining = cs->size;
694 bytes_remaining *= format_bytes; 694 bytes_remaining *= format_bytes;
695 695
696 /* Wait for the requester to ack by deleting the property. 696 /* Wait for the requestor to ack by deleting the property.
697 This can run Lisp code (process handlers) or signal. */ 697 This can run Lisp code (process handlers) or signal. */
698 if (! had_errors) 698 if (! had_errors)
699 { 699 {
@@ -732,7 +732,7 @@ x_reply_selection_request (struct input_event *event,
732 732
733 if (had_errors) break; 733 if (had_errors) break;
734 734
735 /* Wait for the requester to ack this chunk by deleting 735 /* Wait for the requestor to ack this chunk by deleting
736 the property. This can run Lisp code or signal. */ 736 the property. This can run Lisp code or signal. */
737 TRACE1 ("Waiting for increment ACK (deletion of %s)", 737 TRACE1 ("Waiting for increment ACK (deletion of %s)",
738 XGetAtomName (display, cs->property)); 738 XGetAtomName (display, cs->property));
@@ -740,7 +740,7 @@ x_reply_selection_request (struct input_event *event,
740 } 740 }
741 741
742 /* Now write a zero-length chunk to the property to tell the 742 /* Now write a zero-length chunk to the property to tell the
743 requester that we're done. */ 743 requestor that we're done. */
744 BLOCK_INPUT; 744 BLOCK_INPUT;
745 if (! waiting_for_other_props_on_window (display, window)) 745 if (! waiting_for_other_props_on_window (display, window))
746 XSelectInput (display, window, 0L); 746 XSelectInput (display, window, 0L);
@@ -757,7 +757,7 @@ x_reply_selection_request (struct input_event *event,
757 /* The window we're communicating with may have been deleted 757 /* The window we're communicating with may have been deleted
758 in the meantime (that's a real situation from a bug report). 758 in the meantime (that's a real situation from a bug report).
759 In this case, there may be events in the event queue still 759 In this case, there may be events in the event queue still
760 refering to the deleted window, and we'll get a BadWindow error 760 referring to the deleted window, and we'll get a BadWindow error
761 in XTread_socket when processing the events. I don't have 761 in XTread_socket when processing the events. I don't have
762 an idea how to fix that. gerd, 2001-01-98. */ 762 an idea how to fix that. gerd, 2001-01-98. */
763 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are 763 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
diff --git a/src/xterm.c b/src/xterm.c
index 8171fe7738e..3c37b2110d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3326,7 +3326,7 @@ x_scroll_run (struct window *w, struct run *run)
3326 } 3326 }
3327 else 3327 else
3328 { 3328 {
3329 /* Scolling down. Make sure we don't copy over the mode line. 3329 /* Scrolling down. Make sure we don't copy over the mode line.
3330 at the bottom. */ 3330 at the bottom. */
3331 if (to_y + run->height > bottom_y) 3331 if (to_y + run->height > bottom_y)
3332 height = bottom_y - to_y; 3332 height = bottom_y - to_y;
@@ -5160,7 +5160,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5160 XDestroyWindow (FRAME_X_DISPLAY (f), bar->x_window); 5160 XDestroyWindow (FRAME_X_DISPLAY (f), bar->x_window);
5161#endif 5161#endif
5162 5162
5163 /* Disassociate this scroll bar from its window. */ 5163 /* Dissociate this scroll bar from its window. */
5164 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; 5164 XWINDOW (bar->window)->vertical_scroll_bar = Qnil;
5165 5165
5166 UNBLOCK_INPUT; 5166 UNBLOCK_INPUT;
@@ -9978,6 +9978,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9978#ifdef HAVE_CLUTTER 9978#ifdef HAVE_CLUTTER
9979 gtk_clutter_init (&argc, &argv2); 9979 gtk_clutter_init (&argc, &argv2);
9980#else 9980#else
9981
9982 /* NULL window -> events for all windows go to our function.
9983 Call before gtk_init so Gtk+ event filters comes after our. */
9984 gdk_window_add_filter (NULL, event_handler_gdk, NULL);
9985
9981 gtk_init (&argc, &argv2); 9986 gtk_init (&argc, &argv2);
9982#endif 9987#endif
9983 g_log_remove_handler ("GLib", id); 9988 g_log_remove_handler ("GLib", id);
@@ -9988,9 +9993,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9988 9993
9989 dpy = DEFAULT_GDK_DISPLAY (); 9994 dpy = DEFAULT_GDK_DISPLAY ();
9990 9995
9991 /* NULL window -> events for all windows go to our function */
9992 gdk_window_add_filter (NULL, event_handler_gdk, NULL);
9993
9994#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 9996#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90
9995 /* Load our own gtkrc if it exists. */ 9997 /* Load our own gtkrc if it exists. */
9996 { 9998 {
diff --git a/src/xterm.h b/src/xterm.h
index 4385b1a467d..9e0e1acca92 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -643,7 +643,7 @@ enum
643{ 643{
644 /* Values for focus_state, used as bit mask. 644 /* Values for focus_state, used as bit mask.
645 EXPLICIT means we received a FocusIn for the frame and know it has 645 EXPLICIT means we received a FocusIn for the frame and know it has
646 the focus. IMPLICIT means we recevied an EnterNotify and the frame 646 the focus. IMPLICIT means we received an EnterNotify and the frame
647 may have the focus if no window manager is running. 647 may have the focus if no window manager is running.
648 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 648 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
649 FOCUS_NONE = 0, 649 FOCUS_NONE = 0,