aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Tromey2013-06-13 11:29:06 -0600
committerTom Tromey2013-06-13 11:29:06 -0600
commit5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da (patch)
treeaf9b79246f0b18d748c3e1c33b1bb1b33cf1fbe0 /src
parent313dfb6277b3e1ef28c7bb76e776f10168e3f0a3 (diff)
parent94fa6ec7b306b47c251f7b8b67662598027a7ff3 (diff)
downloademacs-5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da.tar.gz
emacs-5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da.zip
merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog247
-rw-r--r--src/ChangeLog.32
-rw-r--r--src/Makefile.in24
-rw-r--r--src/bidi.c14
-rw-r--r--src/data.c3
-rw-r--r--src/dispextern.h3
-rw-r--r--src/doc.c4
-rw-r--r--src/emacs.c4
-rw-r--r--src/epaths.in6
-rw-r--r--src/eval.c23
-rw-r--r--src/fileio.c7
-rw-r--r--src/frame.c7
-rw-r--r--src/frame.h2
-rw-r--r--src/gfilenotify.c81
-rw-r--r--src/keyboard.c34
-rw-r--r--src/keymap.c45
-rw-r--r--src/lisp.h1
-rw-r--r--src/lisp.mk1
-rw-r--r--src/nsterm.m8
-rw-r--r--src/process.c33
-rw-r--r--src/process.h2
-rw-r--r--src/syssignal.h4
-rw-r--r--src/term.c9
-rw-r--r--src/w32console.c16
-rw-r--r--src/w32inevt.c8
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32term.c7
-rw-r--r--src/w32term.h2
-rw-r--r--src/window.c7
-rw-r--r--src/xdisp.c88
-rw-r--r--src/xgselect.c15
-rw-r--r--src/xterm.c7
32 files changed, 530 insertions, 186 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a1aa4efcc86..4d6e669612f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,209 @@
12013-06-13 Kelly Dean <kellydeanch@yahoo.com> (tiny change)
2
3 * fileio.c (Fdo_auto_save): Trap errors in auto-save-hook. (Bug#14479)
4
52013-06-12 Xue Fuqiao <xfq.free@gmail.com>
6
7 * fileio.c (expand_file_name): Doc fix.
8
92013-06-11 Paul Eggert <eggert@cs.ucla.edu>
10
11 Tickle glib by waiting for Emacs itself, not for process 0 (Bug#14569).
12 * process.c (init_process_emacs) [HAVE_GLIB && !WINDOWSNT]:
13 Wait for self, not for 0. This can't hurt on GNU or similar
14 system, and may help with Cygwin.
15
16 * keyboard.c: Don't use PROP (...) as an lvalue.
17 (parse_tool_bar_item) [!USE_GTK && !HAVE_NS]:
18 Use set_prop (A, B), not PROP (A) = B.
19
202013-06-10 Eli Zaretskii <eliz@gnu.org>
21
22 * xdisp.c (get_it_property): Use it->window instead of generating
23 a Lisp object from it->w.
24
252013-06-09 Eli Zaretskii <eliz@gnu.org>
26
27 * xdisp.c (get_it_property): If it->object is a buffer, pass to
28 get-char-property the window that is being rendered, instead of
29 the buffer, to support window-specific overlays. (Bug#14575)
30 (compute_display_string_pos): When W is NULL, use the current
31 buffer as the object to pass to get-char-property.
32 (Fcurrent_bidi_paragraph_direction): Assign NULL to the window
33 pointer member of the bidi iterator, since no window is pertinent
34 to this function.
35
362013-06-08 Eli Zaretskii <eliz@gnu.org>
37
38 * bidi.c (bidi_fetch_char): Accept additional argument, the window
39 being displayed, and pass it to compute_display_string_pos.
40 (bidi_level_of_next_char, bidi_resolve_explicit_1)
41 (bidi_paragraph_init): All callers changed.
42
43 * xdisp.c (init_from_display_pos, init_iterator)
44 (handle_single_display_spec, next_overlay_string)
45 (get_overlay_strings_1, reseat_1, reseat_to_string)
46 (push_prefix_prop, Fcurrent_bidi_paragraph_direction):
47 Set bidi_it.w member from it->w.
48 (compute_display_string_pos): Accept additional argument, the
49 window being displayed, and pass it to Fget_char_property.
50 (Bug#14575)
51
52 * dispextern.h (struct bidi_it): New member w, the window being
53 displayed.
54 (compute_display_string_pos): Adjust prototype.
55
562013-06-08 Jan Djärv <jan.h.d@swipnet.se>
57
58 * xgselect.c: Remove unneeded include xterm.h.
59
60 * process.c (wait_reading_process_output): Check for NS before GLIB.
61 GLIB may be linked in due to rsvg, but ns_select must be called.
62
63 * xgselect.c (xg_select): Remove call to window_system_available
64 and g_main_context_pending at the top, so Gdk events (i.e. file
65 notify) are processed when Emacs is started with -nw.
66
672013-06-07 Eli Zaretskii <eliz@gnu.org>
68
69 * Makefile.in (ctagsfiles1, ctagsfiles2): Don't include *.m files.
70 (ctagsfiles3): New variable, includes only *.m files.
71 (TAGS): Use an explicit language name in the regular expressions,
72 to avoid transformation of '/SOMETHING' by MSYS to
73 'c:\MSYS\SOMETHING'.
74
752013-06-07 Richard Copley <rcopley@gmail.com> (tiny change)
76
77 * epaths.in: Fix commentary to PATH_SITELOADSEARCH.
78
792013-06-06 Eli Zaretskii <eliz@gnu.org>
80
81 * xdisp.c (note_mouse_highlight): When mouse-highlight is off,
82 still need to set the mouse pointer shape and activate help-echo.
83 (Bug#14558)
84
852013-06-06 Paul Eggert <eggert@cs.ucla.edu>
86
87 A few porting etc. fixes for the new file monitor code.
88 See the thread containing
89 <http://lists.gnu.org/archive/html/emacs-devel/2013-06/msg00109.html>.
90 * gfilenotify.c (dir_monitor_callback, Fgfile_add_watch)
91 (Fgfile_rm_watch): Don't assume EMACS_INT is the same width as a pointer.
92 (dir_monitor_callback, Fgfile_rm_watch):
93 Use assq_no_quit instead of Fassoc, for speed.
94 (dir_monitor_callback, Fgfile_rm_watch):
95 eassert that the monitor is a fixnum.
96 (dir_monitor_callback): No need for CDR_SAFE.
97 Simplify building of lisp with alternative tails.
98 (Fgfile_add_watch, Fgfile_rm_watch):
99 Do not assume glib functions set errno reliably on failure.
100 (Fgfile_add_watch): Check that the monitor survives the XIL trick,
101 and signal an error otherwise.
102 (Fgfile_rm_watch): Prefer CONSP to !NILP.
103 Use Fdelq instead of Fdelete, for speed.
104
1052013-06-05 Eli Zaretskii <eliz@gnu.org>
106
107 * xdisp.c (handle_tool_bar_click): When mouse-highlight is off,
108 don't insist on being invoked on a highlighted tool-bar button.
109 Avoids losing tool-bar functionality when mouse-highlight is nil.
110 (note_tool_bar_highlight, note_mode_line_or_margin_highlight):
111 Don't highlight when mouse-highlight is nil.
112 (note_mouse_highlight): When mouse-highlight is nil, don't return
113 right away; instead, run tool-bar and mode-line highlight
114 subroutine, clear any existing highlight, and revert the mouse
115 pointer to its default shape. (Bug#14558)
116
1172013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
118
119 * lisp.mk (lisp): Add prog-mode.el.
120
1212013-06-05 Paul Eggert <eggert@cs.ucla.edu>
122
123 Chain glib's SIGCHLD handler from Emacs's (Bug#14474).
124 * process.c (dummy_handler): New function.
125 (lib_child_handler): New static var.
126 (handle_child_signal): Invoke it.
127 (catch_child_signal): If a library has set up a signal handler,
128 save it into lib_child_handler.
129 (init_process_emacs): If using glib and not on Windows, tickle glib's
130 child-handling code so that it initializes its private SIGCHLD handler.
131 * syssignal.h (SA_SIGINFO): Default to 0.
132 * xterm.c (x_term_init): Remove D-bus hack that I installed on May
133 31; it should no longer be needed now.
134
1352013-06-05 Michael Albinus <michael.albinus@gmx.de>
136
137 * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify.
138
139 * gfilenotify.c (globals_of_gfilenotify): New function.
140 (syms_of_gfilenotify): Move global initialization there.
141
142 * lisp.h (globals_of_gfilenotify) [HAVE_GFILENOTIFY]: Add prototype.
143
1442013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
145
146 * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
147 * keyboard.c (menu_bar_items, tool_bar_items):
148 * doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does
149 not override local keymaps any more.
150
1512013-06-04 Eli Zaretskii <eliz@gnu.org>
152
153 * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540)
154
1552013-06-03 Eli Zaretskii <eliz@gnu.org>
156
157 * w32console.c (initialize_w32_display): Return the dimensions of
158 the console window via 2 additional arguments, not via the current
159 frame. This avoids crashes due to overrunning the bounds of
160 frame's decode_mode_spec_buffer, which is not resized following
161 the change of the frame dimensions from the initial 10x10.
162
163 * w32term.h (w32_initialize_display_info): Adjust prototype.
164
165 * term.c (init_tty): Take dimensions of the frame from the values
166 returned by initialize_w32_display.
167
168 * Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables.
169 (ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS).
170 (LIBES): Add $(GFILENOTIFY_LIBS).
171
172 * w32inevt.c (handle_file_notifications): Add dummy implementation
173 for !HAVE_W32NOTIFY.
174
175 * w32term.c: Wrap code with HAVE_W32NOTIFY.
176
1772013-06-03 Jan Djärv <jan.h.d@swipnet.se>
178
179 * xgselect.c: Replace #if defined ... with #ifdef HAVE_GLIB.
180
181 * process.c (wait_reading_process_output): Call xg_select if HAVE_GLIB.
182
183 * Makefile.in (XGSELOBJ): New, xgselect.o if GLib is used, or empty.
184
1852013-06-03 Paul Eggert <eggert@cs.ucla.edu>
186
187 Fix minor problems found by static checking.
188 * data.c (pure_write_error):
189 Use xsignal2, not Fsignal, as Fsignal might return.
190 * eval.c (set_backtrace_debug_on_exit): Now static.
191 (backtrace_p, backtrace_top, backtrace_next, record_in_backtrace):
192 No longer inline. EXTERN_INLINE is needed only for functions
193 defined in .h files. Reindent function header as per GNU style.
194 (backtrace_p, backtrace_top, backtrace_next):
195 Mark EXTERNALLY_VISIBLE so they don't get optimized away by the
196 compiler or linker. Add extern decls to pacify gcc -Wall.
197 * frame.c, frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource):
198 Now static.
199 * frame.c (free_monitors): Define only on platforms that need it.
200 * nsterm.m (ns_term_init):
201 * process.c (catch_child_signal):
202 Don't worry about whether SIGCHLD is defined, as SIGCHLD is
203 defined on all porting targets these days.
204 * process.c, process.h (catch_child_signal):
205 Make it extern only if NS_IMPL_GNUSTEP is defined.
206
12013-06-03 Eli Zaretskii <eliz@gnu.org> 2072013-06-03 Eli Zaretskii <eliz@gnu.org>
2 208
3 * w32.c (gettimeofday): Make the signature identical to prototype 209 * w32.c (gettimeofday): Make the signature identical to prototype
@@ -151,8 +357,8 @@
151 (update_frame_tool_bar): Update code for GNUStep. 357 (update_frame_tool_bar): Update code for GNUStep.
152 (clearAll): New method. 358 (clearAll): New method.
153 (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag 359 (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag
154 argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move 360 argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP.
155 identifierToItem setObject and activeIdentifiers addObject before 361 Move identifierToItem setObject and activeIdentifiers addObject before
156 call to insertItemWithItemIdentifier. 362 call to insertItemWithItemIdentifier.
157 (validateVisibleItems): Fix indentation. 363 (validateVisibleItems): Fix indentation.
158 (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. 364 (toolbarAllowedItemIdentifiers:): Return activeIdentifiers.
@@ -166,19 +372,19 @@
166 Use F suffix on floats. 372 Use F suffix on floats.
167 (ns_char_width): Returns CGFloat. 373 (ns_char_width): Returns CGFloat.
168 (ns_ascii_average_width): w is CGFloat instead of float. 374 (ns_ascii_average_width): w is CGFloat instead of float.
169 (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to 375 (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to
170 DPSxshow. 376 DPSxshow.
171 (ns_glyph_metrics): CGFloat instead of float. 377 (ns_glyph_metrics): CGFloat instead of float.
172 378
173 * nsfns.m (x_set_foreground_color, x_set_background_color): Use 379 * nsfns.m (x_set_foreground_color, x_set_background_color):
174 EmacsCGFloat. 380 Use EmacsCGFloat.
175 (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove 381 (ns_implicitly_set_icon_type, Fx_create_frame): Make static,
176 unused variables. 382 remove unused variables.
177 (Fns_read_file_name): Keep track if panel is for save. Use 383 (Fns_read_file_name): Keep track if panel is for save.
178 ns_filename_from_panel/ns_directory_from_panel. 384 Use ns_filename_from_panel/ns_directory_from_panel.
179 (Fns_list_services): delegate only used for COCOA. 385 (Fns_list_services): delegate only used for COCOA.
180 (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just 386 (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep.
181 return the input if GNUStep. 387 Just return the input if GNUStep.
182 (x_screen_planes): Remove. 388 (x_screen_planes): Remove.
183 (Fxw_color_values): Use EmacsCGFloat 389 (Fxw_color_values): Use EmacsCGFloat
184 (Fns_display_monitor_attributes_list): Only get screen number for 390 (Fns_display_monitor_attributes_list): Only get screen number for
@@ -294,7 +500,7 @@
2942013-05-21 Dmitry Antipov <dmantipov@yandex.ru> 5002013-05-21 Dmitry Antipov <dmantipov@yandex.ru>
295 501
296 * xdisp.c (reseat_at_previous_visible_line_start): 502 * xdisp.c (reseat_at_previous_visible_line_start):
297 Already declared in dispextern.h, so remove it here. 503 Already declared in dispextern.h, so remove it here.
298 (move_it_vertically_backward): Likewise. 504 (move_it_vertically_backward): Likewise.
299 505
3002013-05-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 5062013-05-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
@@ -305,7 +511,7 @@
305 Mention `display-monitor-attributes-list' in docstrings. 511 Mention `display-monitor-attributes-list' in docstrings.
306 512
307 * nsfns.m (ns_get_screen): Remove function. All uses removed. 513 * nsfns.m (ns_get_screen): Remove function. All uses removed.
308 (check_ns_display_info): Sync with check_x_display_info in xfns.c. 514 (check_ns_display_info): Sync with check_x_display_info in xfns.c.
309 (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version) 515 (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version)
310 (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height) 516 (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height)
311 (Fx_display_backing_store, Fx_display_visual_class) 517 (Fx_display_backing_store, Fx_display_visual_class)
@@ -461,7 +667,7 @@
461 667
4622013-05-07 Paul Eggert <eggert@cs.ucla.edu> 6682013-05-07 Paul Eggert <eggert@cs.ucla.edu>
463 669
464 Use Gnulib ACL implementation, for benefit of Solaris etc. (Bug#14295) 670 Use Gnulib ACL implementation, for benefit of Solaris etc. (Bug#14295)
465 * Makefile.in (LIB_ACL): New macro. 671 * Makefile.in (LIB_ACL): New macro.
466 (LIBACL_LIBS): Remove. 672 (LIBACL_LIBS): Remove.
467 (LIBES): Use LIB_ACL, not LIBACL_LIBS. 673 (LIBES): Use LIB_ACL, not LIBACL_LIBS.
@@ -2894,11 +3100,10 @@
28942012-12-31 Adam Sjøgren <asjo@koldfront.dk> (tiny change) 31002012-12-31 Adam Sjøgren <asjo@koldfront.dk> (tiny change)
2895 3101
2896 * xterm.c (scroll-bar-adjust-thumb-portion): New variable to 3102 * xterm.c (scroll-bar-adjust-thumb-portion): New variable to
2897 determine whether scroll bar thumb size should be adjusted or 3103 determine whether scroll bar thumb size should be adjusted or not.
2898 not. Use variable for MOTIF. 3104 Use variable for MOTIF.
2899 3105
2900 * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for 3106 * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for GTK.
2901 GTK.
2902 3107
29032013-01-13 Jan Djärv <jan.h.d@swipnet.se> 31082013-01-13 Jan Djärv <jan.h.d@swipnet.se>
2904 3109
@@ -3443,7 +3648,7 @@
3443 3648
34442012-12-14 Paul Eggert <eggert@cs.ucla.edu> 36492012-12-14 Paul Eggert <eggert@cs.ucla.edu>
3445 3650
3446 Fix permissions bugs with setgid directories etc. (Bug#13125) 3651 Fix permissions bugs with setgid directories etc. (Bug#13125)
3447 * dired.c (Ffile_attributes): Return t as the 9th attribute, 3652 * dired.c (Ffile_attributes): Return t as the 9th attribute,
3448 to mark it as a placeholder. The old value was often wrong. 3653 to mark it as a placeholder. The old value was often wrong.
3449 The only user of this attribute has been changed to use 3654 The only user of this attribute has been changed to use
@@ -4544,7 +4749,7 @@
4544 * w32term.c (x_window_to_scroll_bar): Likewise. 4749 * w32term.c (x_window_to_scroll_bar): Likewise.
4545 * window.c (window_list): Likewise. 4750 * window.c (window_list): Likewise.
4546 * xdisp.c (x_consider_frame_title): Likewise. 4751 * xdisp.c (x_consider_frame_title): Likewise.
4547 * xfaces.c ( Fdisplay_supports_face_attributes_p): Likewise. 4752 * xfaces.c (Fdisplay_supports_face_attributes_p): Likewise.
4548 * xfns.c (x_window_to_frame, x_any_window_to_frame) 4753 * xfns.c (x_window_to_frame, x_any_window_to_frame)
4549 (x_menubar_window_to_frame, x_top_window_to_frame): Likewise. 4754 (x_menubar_window_to_frame, x_top_window_to_frame): Likewise.
4550 * xmenu.c (menubar_id_to_frame): Likewise. 4755 * xmenu.c (menubar_id_to_frame): Likewise.
@@ -17776,7 +17981,7 @@
17776 17981
17777 Fix memory allocation problems in Cygwin build (Bug#9273). 17982 Fix memory allocation problems in Cygwin build (Bug#9273).
17778 17983
17779 * unexcw.c ( __malloc_initialized): Declare external variable. 17984 * unexcw.c (__malloc_initialized): Declare external variable.
17780 (fixup_executable): Force the dumped emacs to reinitialize malloc. 17985 (fixup_executable): Force the dumped emacs to reinitialize malloc.
17781 17986
17782 * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): 17987 * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo):
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 2f798e1f0bc..fb1b96f738c 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -15447,7 +15447,7 @@
15447 * xterm.c (XTread_socket_hook): For X11, on map and unmap events 15447 * xterm.c (XTread_socket_hook): For X11, on map and unmap events
15448 check the window manager hints for iconification status. 15448 check the window manager hints for iconification status.
15449 15449
15450 * xterm.c (x_make_widow_icon): For X11, just request 15450 * xterm.c (x_make_window_icon): For X11, just request
15451 iconification of the window manager. 15451 iconification of the window manager.
15452 15452
154531989-05-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu) 154531989-05-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
diff --git a/src/Makefile.in b/src/Makefile.in
index 86e5aca36ec..9ad425674f3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -160,6 +160,8 @@ GTK_OBJ=@GTK_OBJ@
160## inotify.o if HAVE_INOTIFY. 160## inotify.o if HAVE_INOTIFY.
161## w32notify.o if HAVE_W32NOTIFY. 161## w32notify.o if HAVE_W32NOTIFY.
162NOTIFY_OBJ = @NOTIFY_OBJ@ 162NOTIFY_OBJ = @NOTIFY_OBJ@
163GFILENOTIFY_CFLAGS = @GFILENOTIFY_CFLAGS@
164GFILENOTIFY_LIBS = @GFILENOTIFY_LIBS@
163 165
164## -ltermcap, or -lncurses, or -lcurses, or "". 166## -ltermcap, or -lncurses, or -lcurses, or "".
165LIBS_TERMCAP=@LIBS_TERMCAP@ 167LIBS_TERMCAP=@LIBS_TERMCAP@
@@ -205,10 +207,13 @@ LIBXMENU=@LIBXMENU@
205 207
206## xmenu.o if HAVE_X_WINDOWS, else empty. 208## xmenu.o if HAVE_X_WINDOWS, else empty.
207XMENU_OBJ=@XMENU_OBJ@ 209XMENU_OBJ=@XMENU_OBJ@
208## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if 210## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o if
209## HAVE_X_WINDOWS, else empty. 211## HAVE_X_WINDOWS, else empty.
210XOBJ=@XOBJ@ 212XOBJ=@XOBJ@
211 213
214# xgselect.o if linking with GLib, else empty
215XGSELOBJ=@XGSELOBJ@
216
212TOOLKIT_LIBW=@TOOLKIT_LIBW@ 217TOOLKIT_LIBW=@TOOLKIT_LIBW@
213 218
214## Only used if HAVE_X11, in LIBX_OTHER. 219## Only used if HAVE_X11, in LIBX_OTHER.
@@ -342,7 +347,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
342 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \ 347 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \
343 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ 348 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
344 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ 349 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
345 $(LIBGNUTLS_CFLAGS) \ 350 $(LIBGNUTLS_CFLAGS) $(GFILENOTIFY_CFLAGS) \
346 $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) 351 $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
347ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) 352ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
348 353
@@ -372,7 +377,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
372 profiler.o \ 377 profiler.o \
373 thread.o systhread.o \ 378 thread.o systhread.o \
374 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ 379 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
375 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) 380 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ)
376obj = $(base_obj) $(NS_OBJC_OBJ) 381obj = $(base_obj) $(NS_OBJC_OBJ)
377 382
378## Object files used on some machine or other. 383## Object files used on some machine or other.
@@ -425,7 +430,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
425 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 430 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
426 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 431 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
427 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \ 432 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
428 $(LIB_MATH) 433 $(GFILENOTIFY_LIBS) $(LIB_MATH)
429 434
430all: emacs$(EXEEXT) $(OTHER_FILES) 435all: emacs$(EXEEXT) $(OTHER_FILES)
431.PHONY: all 436.PHONY: all
@@ -584,13 +589,16 @@ extraclean: distclean
584## Arrange to make a tags table TAGS-LISP for ../lisp, 589## Arrange to make a tags table TAGS-LISP for ../lisp,
585## plus TAGS for the C files, which includes ../lisp/TAGS by reference. 590## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
586 591
587ctagsfiles1 = [xyzXYZ]*.[hcm] 592ctagsfiles1 = [xyzXYZ]*.[hc]
588ctagsfiles2 = [a-wA-W]*.[hcm] 593ctagsfiles2 = [a-wA-W]*.[hc]
594ctagsfiles3 = [a-zA-Z]*.m
589 595
590TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) 596TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE)
591 ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ 597 ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \
592 --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ 598 --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
593 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) 599 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) \
600 --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
601 $(srcdir)/$(ctagsfiles3)
594frc: 602frc:
595TAGS-LISP: frc 603TAGS-LISP: frc
596 $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags 604 $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags
diff --git a/src/bidi.c b/src/bidi.c
index c6bea62f67b..c31d208ecbc 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -927,6 +927,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
927static int 927static int
928bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, 928bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
929 int *disp_prop, struct bidi_string_data *string, 929 int *disp_prop, struct bidi_string_data *string,
930 struct window *w,
930 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) 931 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
931{ 932{
932 int ch; 933 int ch;
@@ -940,7 +941,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
940 if (charpos < endpos && charpos > *disp_pos) 941 if (charpos < endpos && charpos > *disp_pos)
941 { 942 {
942 SET_TEXT_POS (pos, charpos, bytepos); 943 SET_TEXT_POS (pos, charpos, bytepos);
943 *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, 944 *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p,
944 disp_prop); 945 disp_prop);
945 } 946 }
946 947
@@ -1045,7 +1046,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
1045 && *disp_prop) 1046 && *disp_prop)
1046 { 1047 {
1047 SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); 1048 SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len);
1048 *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, 1049 *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p,
1049 disp_prop); 1050 disp_prop);
1050 } 1051 }
1051 1052
@@ -1224,7 +1225,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1224 if (!string_p) 1225 if (!string_p)
1225 pos = BYTE_TO_CHAR (bytepos); 1226 pos = BYTE_TO_CHAR (bytepos);
1226 ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, 1227 ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop,
1227 &bidi_it->string, 1228 &bidi_it->string, bidi_it->w,
1228 bidi_it->frame_window_p, &ch_len, &nchars); 1229 bidi_it->frame_window_p, &ch_len, &nchars);
1229 type = bidi_get_type (ch, NEUTRAL_DIR); 1230 type = bidi_get_type (ch, NEUTRAL_DIR);
1230 1231
@@ -1252,7 +1253,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1252 break; 1253 break;
1253 /* Fetch next character and advance to get past it. */ 1254 /* Fetch next character and advance to get past it. */
1254 ch = bidi_fetch_char (pos, bytepos, &disp_pos, 1255 ch = bidi_fetch_char (pos, bytepos, &disp_pos,
1255 &disp_prop, &bidi_it->string, 1256 &disp_prop, &bidi_it->string, bidi_it->w,
1256 bidi_it->frame_window_p, &ch_len, &nchars); 1257 bidi_it->frame_window_p, &ch_len, &nchars);
1257 pos += nchars; 1258 pos += nchars;
1258 bytepos += ch_len; 1259 bytepos += ch_len;
@@ -1402,7 +1403,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
1402 a single character u+FFFC. */ 1403 a single character u+FFFC. */
1403 curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, 1404 curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos,
1404 &bidi_it->disp_pos, &bidi_it->disp_prop, 1405 &bidi_it->disp_pos, &bidi_it->disp_prop,
1405 &bidi_it->string, bidi_it->frame_window_p, 1406 &bidi_it->string, bidi_it->w,
1407 bidi_it->frame_window_p,
1406 &bidi_it->ch_len, &bidi_it->nchars); 1408 &bidi_it->ch_len, &bidi_it->nchars);
1407 } 1409 }
1408 bidi_it->ch = curchar; 1410 bidi_it->ch = curchar;
@@ -2194,7 +2196,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
2194 emacs_abort (); 2196 emacs_abort ();
2195 do { 2197 do {
2196 ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, 2198 ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs,
2197 fwp, &clen, &nc); 2199 bidi_it->w, fwp, &clen, &nc);
2198 if (ch == '\n' || ch == BIDI_EOB) 2200 if (ch == '\n' || ch == BIDI_EOB)
2199 chtype = NEUTRAL_B; 2201 chtype = NEUTRAL_B;
2200 else 2202 else
diff --git a/src/data.c b/src/data.c
index c6cb1b43dd6..59fd921747a 100644
--- a/src/data.c
+++ b/src/data.c
@@ -103,8 +103,7 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value)
103void 103void
104pure_write_error (Lisp_Object obj) 104pure_write_error (Lisp_Object obj)
105{ 105{
106 Fsignal (Qerror, Fcons (build_string ("Attempt to modify read-only object"), 106 xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj);
107 Fcons (obj, Qnil)));
108} 107}
109 108
110void 109void
diff --git a/src/dispextern.h b/src/dispextern.h
index 50a32ffaf8f..83e8792dfe0 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1881,6 +1881,7 @@ struct bidi_it {
1881 stuff that is not part of the bidi iterator's state! */ 1881 stuff that is not part of the bidi iterator's state! */
1882 struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ 1882 struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */
1883 struct bidi_string_data string; /* string to reorder */ 1883 struct bidi_string_data string; /* string to reorder */
1884 struct window *w; /* the window being displayed */
1884 bidi_dir_t paragraph_dir; /* current paragraph direction */ 1885 bidi_dir_t paragraph_dir; /* current paragraph direction */
1885 ptrdiff_t separator_limit; /* where paragraph separator should end */ 1886 ptrdiff_t separator_limit; /* where paragraph separator should end */
1886 unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ 1887 unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */
@@ -3077,7 +3078,7 @@ extern void reseat_at_previous_visible_line_start (struct it *);
3077extern Lisp_Object lookup_glyphless_char_display (int, struct it *); 3078extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
3078extern ptrdiff_t compute_display_string_pos (struct text_pos *, 3079extern ptrdiff_t compute_display_string_pos (struct text_pos *,
3079 struct bidi_string_data *, 3080 struct bidi_string_data *,
3080 int, int *); 3081 struct window *, int, int *);
3081extern ptrdiff_t compute_display_string_end (ptrdiff_t, 3082extern ptrdiff_t compute_display_string_end (ptrdiff_t,
3082 struct bidi_string_data *); 3083 struct bidi_string_data *);
3083extern void produce_stretch_glyph (struct it *); 3084extern void produce_stretch_glyph (struct it *);
diff --git a/src/doc.c b/src/doc.c
index e45481944f0..155a9891303 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -758,9 +758,7 @@ Otherwise, return a new string, without any text properties. */)
758 or a specified local map (which means search just that and the 758 or a specified local map (which means search just that and the
759 global map). If non-nil, it might come from Voverriding_local_map, 759 global map). If non-nil, it might come from Voverriding_local_map,
760 or from a \\<mapname> construct in STRING itself.. */ 760 or from a \\<mapname> construct in STRING itself.. */
761 keymap = KVAR (current_kboard, Voverriding_terminal_local_map); 761 keymap = Voverriding_local_map;
762 if (NILP (keymap))
763 keymap = Voverriding_local_map;
764 762
765 bsize = SBYTES (string); 763 bsize = SBYTES (string);
766 bufp = buf = xmalloc (bsize); 764 bufp = buf = xmalloc (bsize);
diff --git a/src/emacs.c b/src/emacs.c
index b4b726183cf..537574d93ab 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1241,6 +1241,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1241 tzset (); 1241 tzset ();
1242#endif /* MSDOS */ 1242#endif /* MSDOS */
1243 1243
1244#ifdef HAVE_GFILENOTIFY
1245 globals_of_gfilenotify ();
1246#endif
1247
1244#ifdef WINDOWSNT 1248#ifdef WINDOWSNT
1245 globals_of_w32 (); 1249 globals_of_w32 ();
1246#ifdef HAVE_W32NOTIFY 1250#ifdef HAVE_W32NOTIFY
diff --git a/src/epaths.in b/src/epaths.in
index 0cf8cc9ce5b..1f5701e5337 100644
--- a/src/epaths.in
+++ b/src/epaths.in
@@ -30,10 +30,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30 30
31 31
32/* Like PATH_LOADSEARCH, but contains the non-standard pieces. 32/* Like PATH_LOADSEARCH, but contains the non-standard pieces.
33 These are the site-lisp directories, typically something like 33 These are the site-lisp directories. Configure sets this to
34 ${locallisppath}, which typically defaults to something like:
34 <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp 35 <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp
35 Configure prepends any $locallisppath, as set by the 36 but can be overridden by the --enable-locallisppath argument.
36 --enable-locallisppath argument.
37 This is combined with PATH_LOADSEARCH to make the default load-path. 37 This is combined with PATH_LOADSEARCH to make the default load-path.
38 If the --no-site-lisp option is used, this piece is excluded. 38 If the --no-site-lisp option is used, this piece is excluded.
39*/ 39*/
diff --git a/src/eval.c b/src/eval.c
index 7520164108f..3f7be81a7e4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -117,21 +117,29 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
117 117
118/* Functions to modify slots of backtrace records. */ 118/* Functions to modify slots of backtrace records. */
119 119
120static void set_backtrace_args (struct specbinding *pdl, Lisp_Object *args) 120static void
121set_backtrace_args (struct specbinding *pdl, Lisp_Object *args)
121{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; } 122{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; }
122 123
123static void set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n) 124static void
125set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n)
124{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; } 126{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; }
125 127
126void set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) 128static void
129set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe)
127{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; } 130{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; }
128 131
129/* Helper functions to scan the backtrace. */ 132/* Helper functions to scan the backtrace. */
130 133
131EXTERN_INLINE bool backtrace_p (struct specbinding *pdl) 134bool backtrace_p (struct specbinding *) EXTERNALLY_VISIBLE;
135struct specbinding *backtrace_top (void) EXTERNALLY_VISIBLE;
136struct specbinding *backtrace_next (struct specbinding *pdl) EXTERNALLY_VISIBLE;
137
138bool backtrace_p (struct specbinding *pdl)
132{ return pdl >= specpdl; } 139{ return pdl >= specpdl; }
133 140
134EXTERN_INLINE struct specbinding *backtrace_top (void) 141struct specbinding *
142backtrace_top (void)
135{ 143{
136 struct specbinding *pdl = specpdl_ptr - 1; 144 struct specbinding *pdl = specpdl_ptr - 1;
137 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) 145 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE)
@@ -139,7 +147,8 @@ EXTERN_INLINE struct specbinding *backtrace_top (void)
139 return pdl; 147 return pdl;
140} 148}
141 149
142EXTERN_INLINE struct specbinding *backtrace_next (struct specbinding *pdl) 150struct specbinding *
151backtrace_next (struct specbinding *pdl)
143{ 152{
144 pdl--; 153 pdl--;
145 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) 154 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE)
@@ -1938,7 +1947,7 @@ grow_specpdl (void)
1938 specpdl_ptr = specpdl + count; 1947 specpdl_ptr = specpdl + count;
1939} 1948}
1940 1949
1941LISP_INLINE void 1950void
1942record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) 1951record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
1943{ 1952{
1944 eassert (nargs >= UNEVALLED); 1953 eassert (nargs >= UNEVALLED);
diff --git a/src/fileio.c b/src/fileio.c
index 75e1f13a09b..6a60186a84f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -776,8 +776,9 @@ probably use `make-temp-file' instead, except in three circumstances:
776DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, 776DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
777 doc: /* Convert filename NAME to absolute, and canonicalize it. 777 doc: /* Convert filename NAME to absolute, and canonicalize it.
778Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative 778Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
779\(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing, 779\(does not start with slash or tilde); both the directory name and
780the current buffer's value of `default-directory' is used. 780a directory's file name are accepted. If DEFAULT-DIRECTORY is nil or
781missing, the current buffer's value of `default-directory' is used.
781NAME should be a string that is a valid file name for the underlying 782NAME should be a string that is a valid file name for the underlying
782filesystem. 783filesystem.
783File name components that are `.' are removed, and 784File name components that are `.' are removed, and
@@ -5595,7 +5596,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5595 point to non-strings reached from Vbuffer_alist. */ 5596 point to non-strings reached from Vbuffer_alist. */
5596 5597
5597 hook = intern ("auto-save-hook"); 5598 hook = intern ("auto-save-hook");
5598 Frun_hooks (1, &hook); 5599 safe_run_hooks (hook);
5599 5600
5600 if (STRINGP (Vauto_save_list_file_name)) 5601 if (STRINGP (Vauto_save_list_file_name))
5601 { 5602 {
diff --git a/src/frame.c b/src/frame.c
index e88432b9802..a207ef690da 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -114,7 +114,7 @@ Lisp_Object Qface_set_after_frame_default;
114 114
115static Lisp_Object Qdelete_frame_functions; 115static Lisp_Object Qdelete_frame_functions;
116 116
117Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; 117static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
118 118
119#ifdef HAVE_WINDOW_SYSTEM 119#ifdef HAVE_WINDOW_SYSTEM
120static void x_report_frame_params (struct frame *, Lisp_Object *); 120static void x_report_frame_params (struct frame *, Lisp_Object *);
@@ -167,7 +167,7 @@ struct frame *
167decode_window_system_frame (Lisp_Object frame) 167decode_window_system_frame (Lisp_Object frame)
168{ 168{
169 struct frame *f = decode_live_frame (frame); 169 struct frame *f = decode_live_frame (frame);
170 170
171 if (!window_system_available (f)) 171 if (!window_system_available (f))
172 error ("Window system frame should be used"); 172 error ("Window system frame should be used");
173 return f; 173 return f;
@@ -4138,6 +4138,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */)
4138 4138
4139#ifdef HAVE_WINDOW_SYSTEM 4139#ifdef HAVE_WINDOW_SYSTEM
4140 4140
4141# if (defined HAVE_NS \
4142 || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR)))
4141void 4143void
4142free_monitors (struct MonitorInfo *monitors, int n_monitors) 4144free_monitors (struct MonitorInfo *monitors, int n_monitors)
4143{ 4145{
@@ -4146,6 +4148,7 @@ free_monitors (struct MonitorInfo *monitors, int n_monitors)
4146 xfree (monitors[i].name); 4148 xfree (monitors[i].name);
4147 xfree (monitors); 4149 xfree (monitors);
4148} 4150}
4151# endif
4149 4152
4150Lisp_Object 4153Lisp_Object
4151make_monitor_attribute_list (struct MonitorInfo *monitors, 4154make_monitor_attribute_list (struct MonitorInfo *monitors,
diff --git a/src/frame.h b/src/frame.h
index 12aa48b2d92..31d3e73c3c3 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1198,8 +1198,6 @@ extern Lisp_Object Qdisplay;
1198 1198
1199extern Lisp_Object Qrun_hook_with_args; 1199extern Lisp_Object Qrun_hook_with_args;
1200 1200
1201extern Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
1202
1203#ifdef HAVE_WINDOW_SYSTEM 1201#ifdef HAVE_WINDOW_SYSTEM
1204 1202
1205/* The class of this X application. */ 1203/* The class of this X application. */
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 4ccc430d815..c8d12ce8fa0 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -53,13 +53,13 @@ static Lisp_Object watch_list;
53 g_file_monitor. It shall create a Lisp event, and put it into 53 g_file_monitor. It shall create a Lisp event, and put it into
54 Emacs input queue. */ 54 Emacs input queue. */
55static gboolean 55static gboolean
56dir_monitor_callback (GFileMonitor* monitor, 56dir_monitor_callback (GFileMonitor *monitor,
57 GFile* file, 57 GFile *file,
58 GFile* other_file, 58 GFile *other_file,
59 GFileMonitorEvent event_type, 59 GFileMonitorEvent event_type,
60 gpointer user_data) 60 gpointer user_data)
61{ 61{
62 Lisp_Object symbol, watch_object; 62 Lisp_Object symbol, monitor_object, watch_object;
63 char *name = g_file_get_parse_name (file); 63 char *name = g_file_get_parse_name (file);
64 char *oname = other_file ? g_file_get_parse_name (other_file) : NULL; 64 char *oname = other_file ? g_file_get_parse_name (other_file) : NULL;
65 65
@@ -95,21 +95,23 @@ dir_monitor_callback (GFileMonitor* monitor,
95 } 95 }
96 96
97 /* Determine callback function. */ 97 /* Determine callback function. */
98 watch_object = Fassoc (XIL ((EMACS_INT) monitor), watch_list); 98 monitor_object = XIL ((intptr_t) monitor);
99 eassert (INTEGERP (monitor_object));
100 watch_object = assq_no_quit (monitor_object, watch_list);
99 101
100 if (FUNCTIONP (CDR_SAFE (watch_object))) 102 if (CONSP (watch_object))
101 { 103 {
102 /* Construct an event. */ 104 /* Construct an event. */
103 struct input_event event; 105 struct input_event event;
106 Lisp_Object otail = oname ? list1 (build_string (oname)) : Qnil;
104 EVENT_INIT (event); 107 EVENT_INIT (event);
105 event.kind = FILE_NOTIFY_EVENT; 108 event.kind = FILE_NOTIFY_EVENT;
106 event.frame_or_window = Qnil; 109 event.frame_or_window = Qnil;
107 event.arg = oname 110 event.arg = list2 (Fcons (monitor_object,
108 ? list2 (list4 (XIL ((EMACS_INT) monitor), symbol, 111 Fcons (symbol,
109 build_string (name), build_string (oname)), 112 Fcons (build_string (name),
110 CDR_SAFE (watch_object)) 113 otail))),
111 : list2 (list3 (XIL ((EMACS_INT) monitor), symbol, build_string (name)), 114 XCDR (watch_object));
112 CDR_SAFE (watch_object));
113 115
114 /* Store it into the input event queue. */ 116 /* Store it into the input event queue. */
115 kbd_buffer_store_event (&event); 117 kbd_buffer_store_event (&event);
@@ -165,7 +167,7 @@ will be reported only in case of the 'moved' event. */)
165{ 167{
166 Lisp_Object watch_descriptor, watch_object; 168 Lisp_Object watch_descriptor, watch_object;
167 GFile *gfile; 169 GFile *gfile;
168 GFileMonitor* monitor; 170 GFileMonitor *monitor;
169 GFileMonitorFlags gflags = G_FILE_MONITOR_NONE; 171 GFileMonitorFlags gflags = G_FILE_MONITOR_NONE;
170 172
171 /* Check parameters. */ 173 /* Check parameters. */
@@ -190,14 +192,23 @@ will be reported only in case of the 'moved' event. */)
190 192
191 /* Enable watch. */ 193 /* Enable watch. */
192 monitor = g_file_monitor (gfile, gflags, NULL, NULL); 194 monitor = g_file_monitor (gfile, gflags, NULL, NULL);
193 if (monitor != NULL) 195 if (! monitor)
194 g_signal_connect (monitor, "changed", 196 xsignal2 (Qfile_error, build_string ("Cannot watch file"), file);
195 (GCallback) dir_monitor_callback, NULL); 197
196 else 198 /* On all known glib platforms, converting MONITOR directly to a
197 report_file_error ("Cannot watch file", Fcons (file, Qnil)); 199 Lisp_Object value results is a Lisp integer, which is safe. This
200 assumption is dicey, though, so check it now. */
201 watch_descriptor = XIL ((intptr_t) monitor);
202 if (! INTEGERP (watch_descriptor))
203 {
204 g_object_unref (monitor);
205 xsignal2 (Qfile_error, build_string ("Unsupported file watcher"), file);
206 }
207
208 g_signal_connect (monitor, "changed",
209 (GCallback) dir_monitor_callback, NULL);
198 210
199 /* Store watch object in watch list. */ 211 /* Store watch object in watch list. */
200 watch_descriptor = XIL ((EMACS_INT) monitor);
201 watch_object = Fcons (watch_descriptor, callback); 212 watch_object = Fcons (watch_descriptor, callback);
202 watch_list = Fcons (watch_object, watch_list); 213 watch_list = Fcons (watch_object, watch_list);
203 214
@@ -210,20 +221,23 @@ DEFUN ("gfile-rm-watch", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0,
210WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) 221WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */)
211 (Lisp_Object watch_descriptor) 222 (Lisp_Object watch_descriptor)
212{ 223{
213 Lisp_Object watch_object; 224 intptr_t int_monitor;
214 GFileMonitor *monitor = (GFileMonitor *) XLI (watch_descriptor); 225 GFileMonitor *monitor;
226 Lisp_Object watch_object = assq_no_quit (watch_descriptor, watch_list);
215 227
216 watch_object = Fassoc (watch_descriptor, watch_list); 228 if (! CONSP (watch_object))
217 if (NILP (watch_object)) 229 xsignal2 (Qfile_error, build_string ("Not a watch descriptor"),
218 report_file_error ("Not a watch descriptor", 230 watch_descriptor);
219 Fcons (watch_descriptor, Qnil));
220 231
232 eassert (INTEGERP (watch_descriptor));
233 int_monitor = XLI (watch_descriptor);
234 monitor = (GFileMonitor *) int_monitor;
221 if (!g_file_monitor_cancel (monitor)) 235 if (!g_file_monitor_cancel (monitor))
222 report_file_error ("Could not rm watch", 236 xsignal2 (Qfile_error, build_string ("Could not rm watch"),
223 Fcons (watch_descriptor, Qnil)); 237 watch_descriptor);
224 238
225 /* Remove watch descriptor from watch list. */ 239 /* Remove watch descriptor from watch list. */
226 watch_list = Fdelete (watch_object, watch_list); 240 watch_list = Fdelq (watch_object, watch_list);
227 241
228 /* Cleanup. */ 242 /* Cleanup. */
229 g_object_unref (monitor); 243 g_object_unref (monitor);
@@ -233,10 +247,15 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */)
233 247
234 248
235void 249void
236syms_of_gfilenotify (void) 250globals_of_gfilenotify (void)
237{ 251{
238
239 g_type_init (); 252 g_type_init ();
253 watch_list = Qnil;
254}
255
256void
257syms_of_gfilenotify (void)
258{
240 259
241 DEFSYM (Qgfile_add_watch, "gfile-add-watch"); 260 DEFSYM (Qgfile_add_watch, "gfile-add-watch");
242 defsubr (&Sgfile_add_watch); 261 defsubr (&Sgfile_add_watch);
@@ -255,8 +274,6 @@ syms_of_gfilenotify (void)
255 DEFSYM (Qunmounted, "unmounted"); 274 DEFSYM (Qunmounted, "unmounted");
256 DEFSYM (Qmoved, "moved"); 275 DEFSYM (Qmoved, "moved");
257 276
258 /* Initialize internal objects. */
259 watch_list = Qnil;
260 staticpro (&watch_list); 277 staticpro (&watch_list);
261 278
262 Fprovide (intern_c_string ("gfilenotify"), Qnil); 279 Fprovide (intern_c_string ("gfilenotify"), Qnil);
diff --git a/src/keyboard.c b/src/keyboard.c
index 8dd109d252d..7cb4c4b91e3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7392,7 +7392,8 @@ menu_bar_items (Lisp_Object old)
7392 Lisp_Object *tmaps; 7392 Lisp_Object *tmaps;
7393 7393
7394 /* Should overriding-terminal-local-map and overriding-local-map apply? */ 7394 /* Should overriding-terminal-local-map and overriding-local-map apply? */
7395 if (!NILP (Voverriding_local_map_menu_flag)) 7395 if (!NILP (Voverriding_local_map_menu_flag)
7396 && !NILP (Voverriding_local_map))
7396 { 7397 {
7397 /* Yes, use them (if non-nil) as well as the global map. */ 7398 /* Yes, use them (if non-nil) as well as the global map. */
7398 maps = alloca (3 * sizeof (maps[0])); 7399 maps = alloca (3 * sizeof (maps[0]));
@@ -7412,8 +7413,11 @@ menu_bar_items (Lisp_Object old)
7412 Lisp_Object tem; 7413 Lisp_Object tem;
7413 ptrdiff_t nminor; 7414 ptrdiff_t nminor;
7414 nminor = current_minor_maps (NULL, &tmaps); 7415 nminor = current_minor_maps (NULL, &tmaps);
7415 maps = alloca ((nminor + 3) * sizeof *maps); 7416 maps = alloca ((nminor + 4) * sizeof *maps);
7416 nmaps = 0; 7417 nmaps = 0;
7418 tem = KVAR (current_kboard, Voverriding_terminal_local_map);
7419 if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
7420 maps[nmaps++] = tem;
7417 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 7421 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
7418 maps[nmaps++] = tem; 7422 maps[nmaps++] = tem;
7419 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); 7423 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -7938,7 +7942,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
7938 to process. */ 7942 to process. */
7939 7943
7940 /* Should overriding-terminal-local-map and overriding-local-map apply? */ 7944 /* Should overriding-terminal-local-map and overriding-local-map apply? */
7941 if (!NILP (Voverriding_local_map_menu_flag)) 7945 if (!NILP (Voverriding_local_map_menu_flag)
7946 && !NILP (Voverriding_local_map))
7942 { 7947 {
7943 /* Yes, use them (if non-nil) as well as the global map. */ 7948 /* Yes, use them (if non-nil) as well as the global map. */
7944 maps = alloca (3 * sizeof *maps); 7949 maps = alloca (3 * sizeof *maps);
@@ -7958,8 +7963,11 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
7958 Lisp_Object tem; 7963 Lisp_Object tem;
7959 ptrdiff_t nminor; 7964 ptrdiff_t nminor;
7960 nminor = current_minor_maps (NULL, &tmaps); 7965 nminor = current_minor_maps (NULL, &tmaps);
7961 maps = alloca ((nminor + 3) * sizeof *maps); 7966 maps = alloca ((nminor + 4) * sizeof *maps);
7962 nmaps = 0; 7967 nmaps = 0;
7968 tem = KVAR (current_kboard, Voverriding_terminal_local_map);
7969 if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
7970 maps[nmaps++] = tem;
7963 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 7971 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
7964 maps[nmaps++] = tem; 7972 maps[nmaps++] = tem;
7965 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); 7973 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -8142,11 +8150,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8142#if !defined (USE_GTK) && !defined (HAVE_NS) 8150#if !defined (USE_GTK) && !defined (HAVE_NS)
8143 /* If we use build_desired_tool_bar_string to render the 8151 /* If we use build_desired_tool_bar_string to render the
8144 tool bar, the separator is rendered as an image. */ 8152 tool bar, the separator is rendered as an image. */
8145 PROP (TOOL_BAR_ITEM_IMAGES) 8153 set_prop (TOOL_BAR_ITEM_IMAGES,
8146 = menu_item_eval_property (Vtool_bar_separator_image_expression); 8154 (menu_item_eval_property
8147 PROP (TOOL_BAR_ITEM_ENABLED_P) = Qnil; 8155 (Vtool_bar_separator_image_expression)));
8148 PROP (TOOL_BAR_ITEM_SELECTED_P) = Qnil; 8156 set_prop (TOOL_BAR_ITEM_ENABLED_P, Qnil);
8149 PROP (TOOL_BAR_ITEM_CAPTION) = Qnil; 8157 set_prop (TOOL_BAR_ITEM_SELECTED_P, Qnil);
8158 set_prop (TOOL_BAR_ITEM_CAPTION, Qnil);
8150#endif 8159#endif
8151 return 1; 8160 return 1;
8152 } 8161 }
@@ -11443,10 +11452,7 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
11443 11452
11444 DEFVAR_KBOARD ("overriding-terminal-local-map", 11453 DEFVAR_KBOARD ("overriding-terminal-local-map",
11445 Voverriding_terminal_local_map, 11454 Voverriding_terminal_local_map,
11446 doc: /* Per-terminal keymap that overrides all other local keymaps. 11455 doc: /* Per-terminal keymap that takes precedence over all other keymaps.
11447If this variable is non-nil, it is used as a keymap instead of the
11448buffer's local map, and the minor mode keymaps and text property keymaps.
11449It also replaces `overriding-local-map'.
11450 11456
11451This variable is intended to let commands such as `universal-argument' 11457This variable is intended to let commands such as `universal-argument'
11452set up a different keymap for reading the next command. 11458set up a different keymap for reading the next command.
@@ -11456,7 +11462,7 @@ terminal device.
11456See Info node `(elisp)Multiple Terminals'. */); 11462See Info node `(elisp)Multiple Terminals'. */);
11457 11463
11458 DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, 11464 DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
11459 doc: /* Keymap that overrides all other local keymaps. 11465 doc: /* Keymap that overrides almost all other local keymaps.
11460If this variable is non-nil, it is used as a keymap--replacing the 11466If this variable is non-nil, it is used as a keymap--replacing the
11461buffer's local map, the minor mode keymaps, and char property keymaps. */); 11467buffer's local map, the minor mode keymaps, and char property keymaps. */);
11462 Voverriding_local_map = Qnil; 11468 Voverriding_local_map = Qnil;
diff --git a/src/keymap.c b/src/keymap.c
index c43d528b25b..536db77f59b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -56,28 +56,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56#include "keymap.h" 56#include "keymap.h"
57#include "window.h" 57#include "window.h"
58 58
59/* Actually allocate storage for these variables */ 59/* Actually allocate storage for these variables. */
60 60
61Lisp_Object current_global_map; /* Current global keymap */ 61Lisp_Object current_global_map; /* Current global keymap. */
62 62
63Lisp_Object global_map; /* default global key bindings */ 63Lisp_Object global_map; /* Default global key bindings. */
64 64
65Lisp_Object meta_map; /* The keymap used for globally bound 65Lisp_Object meta_map; /* The keymap used for globally bound
66 ESC-prefixed default commands */ 66 ESC-prefixed default commands. */
67 67
68Lisp_Object control_x_map; /* The keymap used for globally bound 68Lisp_Object control_x_map; /* The keymap used for globally bound
69 C-x-prefixed default commands */ 69 C-x-prefixed default commands. */
70 70
71 /* The keymap used by the minibuf for local 71 /* The keymap used by the minibuf for local
72 bindings when spaces are allowed in the 72 bindings when spaces are allowed in the
73 minibuf */ 73 minibuf. */
74 74
75 /* The keymap used by the minibuf for local 75 /* The keymap used by the minibuf for local
76 bindings when spaces are not encouraged 76 bindings when spaces are not encouraged
77 in the minibuf */ 77 in the minibuf. */
78 78
79/* keymap used for minibuffers when doing completion */ 79/* Keymap used for minibuffers when doing completion. */
80/* keymap used for minibuffers when doing completion and require a match */ 80/* Keymap used for minibuffers when doing completion and require a match. */
81static Lisp_Object Qkeymapp, Qnon_ascii; 81static Lisp_Object Qkeymapp, Qnon_ascii;
82Lisp_Object Qkeymap, Qmenu_item, Qremap; 82Lisp_Object Qkeymap, Qmenu_item, Qremap;
83static Lisp_Object QCadvertised_binding; 83static Lisp_Object QCadvertised_binding;
@@ -1571,17 +1571,14 @@ like in the respective argument of `key-binding'. */)
1571 } 1571 }
1572 } 1572 }
1573 1573
1574 if (!NILP (olp)) 1574 if (!NILP (olp)
1575 {
1576 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
1577 keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map),
1578 keymaps);
1579 /* The doc said that overriding-terminal-local-map should 1575 /* The doc said that overriding-terminal-local-map should
1580 override overriding-local-map. The code used them both, 1576 override overriding-local-map. The code used them both,
1581 but it seems clearer to use just one. rms, jan 2005. */ 1577 but it seems clearer to use just one. rms, jan 2005. */
1582 else if (!NILP (Voverriding_local_map)) 1578 && NILP (KVAR (current_kboard, Voverriding_terminal_local_map))
1583 keymaps = Fcons (Voverriding_local_map, keymaps); 1579 && !NILP (Voverriding_local_map))
1584 } 1580 keymaps = Fcons (Voverriding_local_map, keymaps);
1581
1585 if (NILP (XCDR (keymaps))) 1582 if (NILP (XCDR (keymaps)))
1586 { 1583 {
1587 Lisp_Object *maps; 1584 Lisp_Object *maps;
@@ -1592,6 +1589,7 @@ like in the respective argument of `key-binding'. */)
1592 Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); 1589 Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
1593 /* This returns nil unless there is a `keymap' property. */ 1590 /* This returns nil unless there is a `keymap' property. */
1594 Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); 1591 Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
1592 Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map);
1595 1593
1596 if (CONSP (position)) 1594 if (CONSP (position))
1597 { 1595 {
@@ -1656,6 +1654,9 @@ like in the respective argument of `key-binding'. */)
1656 1654
1657 if (!NILP (keymap)) 1655 if (!NILP (keymap))
1658 keymaps = Fcons (keymap, keymaps); 1656 keymaps = Fcons (keymap, keymaps);
1657
1658 if (!NILP (olp) && !NILP (otlp))
1659 keymaps = Fcons (otlp, keymaps);
1659 } 1660 }
1660 1661
1661 unbind_to (count, Qnil); 1662 unbind_to (count, Qnil);
@@ -2851,7 +2852,7 @@ You type Translation\n\
2851 2852
2852 insert ("\n", 1); 2853 insert ("\n", 1);
2853 2854
2854 /* Insert calls signal_after_change which may GC. */ 2855 /* Insert calls signal_after_change which may GC. */
2855 translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); 2856 translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
2856 } 2857 }
2857 2858
@@ -2867,6 +2868,14 @@ You type Translation\n\
2867 start1 = Qnil; 2868 start1 = Qnil;
2868 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) 2869 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
2869 start1 = KVAR (current_kboard, Voverriding_terminal_local_map); 2870 start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
2871
2872 if (!NILP (start1))
2873 {
2874 describe_map_tree (start1, 1, shadow, prefix,
2875 "\f\nOverriding Bindings", nomenu, 0, 0, 0);
2876 shadow = Fcons (start1, shadow);
2877 start1 = Qnil;
2878 }
2870 else if (!NILP (Voverriding_local_map)) 2879 else if (!NILP (Voverriding_local_map))
2871 start1 = Voverriding_local_map; 2880 start1 = Voverriding_local_map;
2872 2881
diff --git a/src/lisp.h b/src/lisp.h
index c8732d125cc..1892c5f959c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3816,6 +3816,7 @@ extern Lisp_Object Qfont_param;
3816 3816
3817/* Defined in gfilenotify.c */ 3817/* Defined in gfilenotify.c */
3818#ifdef HAVE_GFILENOTIFY 3818#ifdef HAVE_GFILENOTIFY
3819extern void globals_of_gfilenotify (void);
3819extern void syms_of_gfilenotify (void); 3820extern void syms_of_gfilenotify (void);
3820#endif 3821#endif
3821 3822
diff --git a/src/lisp.mk b/src/lisp.mk
index 174e53ed561..edd81bcf493 100644
--- a/src/lisp.mk
+++ b/src/lisp.mk
@@ -129,6 +129,7 @@ lisp = \
129 $(lispsource)/textmodes/page.elc \ 129 $(lispsource)/textmodes/page.elc \
130 $(lispsource)/register.elc \ 130 $(lispsource)/register.elc \
131 $(lispsource)/textmodes/paragraphs.elc \ 131 $(lispsource)/textmodes/paragraphs.elc \
132 $(lispsource)/progmodes/prog-mode.elc \
132 $(lispsource)/emacs-lisp/lisp-mode.elc \ 133 $(lispsource)/emacs-lisp/lisp-mode.elc \
133 $(lispsource)/textmodes/text-mode.elc \ 134 $(lispsource)/textmodes/text-mode.elc \
134 $(lispsource)/textmodes/fill.elc \ 135 $(lispsource)/textmodes/fill.elc \
diff --git a/src/nsterm.m b/src/nsterm.m
index 9cf138837f6..93f693fe55e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4361,7 +4361,7 @@ ns_term_init (Lisp_Object display_name)
4361 [NSApp run]; 4361 [NSApp run];
4362 ns_do_open_file = YES; 4362 ns_do_open_file = YES;
4363 4363
4364#if defined (NS_IMPL_GNUSTEP) && defined (SIGCHLD) 4364#ifdef NS_IMPL_GNUSTEP
4365 /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask. 4365 /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask.
4366 We must re-catch it so subprocess works. */ 4366 We must re-catch it so subprocess works. */
4367 catch_child_signal (); 4367 catch_child_signal ();
@@ -5600,7 +5600,7 @@ not_in_argv (NSString *arg)
5600#ifdef NS_IMPL_GNUSTEP 5600#ifdef NS_IMPL_GNUSTEP
5601 gsextra = 3; 5601 gsextra = 3;
5602#endif 5602#endif
5603 5603
5604 NSTRACE (windowWillResize); 5604 NSTRACE (windowWillResize);
5605/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ 5605/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */
5606 5606
@@ -5666,7 +5666,7 @@ not_in_argv (NSString *arg)
5666 5666
5667- (void)windowDidResize: (NSNotification *)notification 5667- (void)windowDidResize: (NSNotification *)notification
5668{ 5668{
5669 if (! [self fsIsNative]) 5669 if (! [self fsIsNative])
5670 { 5670 {
5671 NSWindow *theWindow = [notification object]; 5671 NSWindow *theWindow = [notification object];
5672 /* We can get notification on the non-FS window when in 5672 /* We can get notification on the non-FS window when in
@@ -6115,7 +6115,7 @@ not_in_argv (NSString *arg)
6115 } 6115 }
6116} 6116}
6117#endif 6117#endif
6118 6118
6119- (void)toggleFullScreen: (id)sender 6119- (void)toggleFullScreen: (id)sender
6120{ 6120{
6121 NSWindow *w, *fw; 6121 NSWindow *w, *fw;
diff --git a/src/process.c b/src/process.c
index c1726e7ad60..17facf567b8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4693,10 +4693,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4693 } 4693 }
4694#endif 4694#endif
4695 nfds = thread_select ( 4695 nfds = thread_select (
4696#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) 4696#if defined (HAVE_NS)
4697 xg_select
4698#elif defined (HAVE_NS)
4699 ns_select 4697 ns_select
4698#elif defined (HAVE_GLIB)
4699 xg_select
4700#else 4700#else
4701 pselect 4701 pselect
4702#endif 4702#endif
@@ -6255,6 +6255,12 @@ process has been transmitted to the serial port. */)
6255 might inadvertently reap a GTK-created process that happened to 6255 might inadvertently reap a GTK-created process that happened to
6256 have the same process ID. */ 6256 have the same process ID. */
6257 6257
6258/* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing
6259 its own SIGCHLD handling. On POSIXish systems, glib needs this to
6260 keep track of its own children. The default handler does nothing. */
6261static void dummy_handler (int sig) {}
6262static signal_handler_t volatile lib_child_handler = dummy_handler;
6263
6258/* Handle a SIGCHLD signal by looking for known child processes of 6264/* Handle a SIGCHLD signal by looking for known child processes of
6259 Emacs whose status have changed. For each one found, record its 6265 Emacs whose status have changed. For each one found, record its
6260 new status. 6266 new status.
@@ -6336,6 +6342,8 @@ handle_child_signal (int sig)
6336 } 6342 }
6337 } 6343 }
6338 } 6344 }
6345
6346 lib_child_handler (sig);
6339} 6347}
6340 6348
6341static void 6349static void
@@ -7181,14 +7189,19 @@ integer or floating point values.
7181 return system_process_attributes (pid); 7189 return system_process_attributes (pid);
7182} 7190}
7183 7191
7192#ifndef NS_IMPL_GNUSTEP
7193static
7194#endif
7184void 7195void
7185catch_child_signal (void) 7196catch_child_signal (void)
7186{ 7197{
7187#ifdef SIGCHLD 7198 struct sigaction action, old_action;
7188 struct sigaction action;
7189 emacs_sigaction_init (&action, deliver_child_signal); 7199 emacs_sigaction_init (&action, deliver_child_signal);
7190 sigaction (SIGCHLD, &action, 0); 7200 sigaction (SIGCHLD, &action, &old_action);
7191#endif 7201 eassert (! (old_action.sa_flags & SA_SIGINFO));
7202 if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN
7203 && old_action.sa_handler != deliver_child_signal)
7204 lib_child_handler = old_action.sa_handler;
7192} 7205}
7193 7206
7194 7207
@@ -7206,6 +7219,12 @@ init_process_emacs (void)
7206 if (! noninteractive || initialized) 7219 if (! noninteractive || initialized)
7207#endif 7220#endif
7208 { 7221 {
7222#if defined HAVE_GLIB && !defined WINDOWSNT
7223 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7224 this should always fail, but is enough to initialize glib's
7225 private SIGCHLD handler. */
7226 g_source_unref (g_child_watch_source_new (getpid ()));
7227#endif
7209 catch_child_signal (); 7228 catch_child_signal ();
7210 } 7229 }
7211 7230
diff --git a/src/process.h b/src/process.h
index cf1e0ea1d44..38994461029 100644
--- a/src/process.h
+++ b/src/process.h
@@ -220,7 +220,9 @@ extern void add_read_fd (int fd, fd_callback func, void *data);
220extern void delete_read_fd (int fd); 220extern void delete_read_fd (int fd);
221extern void add_write_fd (int fd, fd_callback func, void *data); 221extern void add_write_fd (int fd, fd_callback func, void *data);
222extern void delete_write_fd (int fd); 222extern void delete_write_fd (int fd);
223#ifdef NS_IMPL_GNUSTEP
223extern void catch_child_signal (void); 224extern void catch_child_signal (void);
225#endif
224 226
225extern void update_processes_for_thread_death (Lisp_Object); 227extern void update_processes_for_thread_death (Lisp_Object);
226 228
diff --git a/src/syssignal.h b/src/syssignal.h
index d7399c6cb8c..45ea8f1af3c 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -50,6 +50,10 @@ char const *safe_strsignal (int) ATTRIBUTE_CONST;
50# define NSIG NSIG_MINIMUM 50# define NSIG NSIG_MINIMUM
51#endif 51#endif
52 52
53#ifndef SA_SIGINFO
54# define SA_SIGINFO 0
55#endif
56
53#ifndef emacs_raise 57#ifndef emacs_raise
54# define emacs_raise(sig) raise (sig) 58# define emacs_raise(sig) raise (sig)
55#endif 59#endif
diff --git a/src/term.c b/src/term.c
index 28b944c6436..0bcef55947a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3189,12 +3189,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3189#ifdef WINDOWSNT 3189#ifdef WINDOWSNT
3190 { 3190 {
3191 struct frame *f = XFRAME (selected_frame); 3191 struct frame *f = XFRAME (selected_frame);
3192 int height, width;
3192 3193
3193 initialize_w32_display (terminal); 3194 initialize_w32_display (terminal, &width, &height);
3194 3195
3195 FrameRows (tty) = FRAME_LINES (f); 3196 FrameRows (tty) = height;
3196 FrameCols (tty) = FRAME_COLS (f); 3197 FrameCols (tty) = width;
3197 tty->specified_window = FRAME_LINES (f); 3198 tty->specified_window = height;
3198 3199
3199 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 3200 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
3200 terminal->char_ins_del_ok = 1; 3201 terminal->char_ins_del_ok = 1;
diff --git a/src/w32console.c b/src/w32console.c
index 06b2c7aa24e..ee92a593301 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -601,7 +601,7 @@ w32_face_attributes (struct frame *f, int face_id)
601} 601}
602 602
603void 603void
604initialize_w32_display (struct terminal *term) 604initialize_w32_display (struct terminal *term, int *width, int *height)
605{ 605{
606 CONSOLE_SCREEN_BUFFER_INFO info; 606 CONSOLE_SCREEN_BUFFER_INFO info;
607 Mouse_HLInfo *hlinfo; 607 Mouse_HLInfo *hlinfo;
@@ -722,23 +722,21 @@ initialize_w32_display (struct terminal *term)
722 || info.srWindow.Right - info.srWindow.Left < 40 722 || info.srWindow.Right - info.srWindow.Left < 40
723 || info.srWindow.Right - info.srWindow.Left > 100))) 723 || info.srWindow.Right - info.srWindow.Left > 100)))
724 { 724 {
725 FRAME_LINES (SELECTED_FRAME ()) = 25; 725 *height = 25;
726 SET_FRAME_COLS (SELECTED_FRAME (), 80); 726 *width = 80;
727 } 727 }
728 728
729 else if (w32_use_full_screen_buffer) 729 else if (w32_use_full_screen_buffer)
730 { 730 {
731 FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ 731 *height = info.dwSize.Y; /* lines per page */
732 SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ 732 *width = info.dwSize.X; /* characters per line */
733 } 733 }
734 else 734 else
735 { 735 {
736 /* Lines per page. Use buffer coords instead of buffer size. */ 736 /* Lines per page. Use buffer coords instead of buffer size. */
737 FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - 737 *height = 1 + info.srWindow.Bottom - info.srWindow.Top;
738 info.srWindow.Top;
739 /* Characters per line. Use buffer coords instead of buffer size. */ 738 /* Characters per line. Use buffer coords instead of buffer size. */
740 SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - 739 *width = 1 + info.srWindow.Right - info.srWindow.Left;
741 info.srWindow.Left);
742 } 740 }
743 741
744 if (os_subtype == OS_NT) 742 if (os_subtype == OS_NT)
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 3c38cf806e8..88a3f9739cd 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -577,6 +577,7 @@ maybe_generate_resize_event (void)
577 0, 0, 0); 577 0, 0, 0);
578} 578}
579 579
580#if HAVE_W32NOTIFY
580static int 581static int
581handle_file_notifications (struct input_event *hold_quit) 582handle_file_notifications (struct input_event *hold_quit)
582{ 583{
@@ -644,6 +645,13 @@ handle_file_notifications (struct input_event *hold_quit)
644 leave_crit (); 645 leave_crit ();
645 return nevents; 646 return nevents;
646} 647}
648#else /* !HAVE_W32NOTIFY */
649static int
650handle_file_notifications (struct input_event *hold_quit)
651{
652 return 0;
653}
654#endif /* !HAVE_W32NOTIFY */
647 655
648/* Here's an overview of how Emacs input works in non-GUI sessions on 656/* Here's an overview of how Emacs input works in non-GUI sessions on
649 MS-Windows. (For description of the GUI input, see the commentary 657 MS-Windows. (For description of the GUI input, see the commentary
diff --git a/src/w32notify.c b/src/w32notify.c
index 1bcaa794565..be03a6ce45f 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -39,7 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39 return, and watch_worker then issues another call to 39 return, and watch_worker then issues another call to
40 ReadDirectoryChangesW. (Except when it does not, see below.) 40 ReadDirectoryChangesW. (Except when it does not, see below.)
41 41
42 In a GUI session, The WM_EMACS_FILENOTIFY message, posted to the 42 In a GUI session, the WM_EMACS_FILENOTIFY message posted to the
43 message queue gets dispatched to the main Emacs window procedure, 43 message queue gets dispatched to the main Emacs window procedure,
44 which queues it for processing by w32_read_socket. When 44 which queues it for processing by w32_read_socket. When
45 w32_read_socket sees this message, it accesses the buffer with file 45 w32_read_socket sees this message, it accesses the buffer with file
diff --git a/src/w32term.c b/src/w32term.c
index 58b1d3ca308..617492e189f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3210,6 +3210,8 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f)
3210} 3210}
3211 3211
3212 3212
3213#if HAVE_W32NOTIFY
3214
3213/* File event notifications (see w32notify.c). */ 3215/* File event notifications (see w32notify.c). */
3214 3216
3215Lisp_Object 3217Lisp_Object
@@ -3325,7 +3327,8 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f,
3325 /* We've stuffed all the events ourselves, so w32_read_socket shouldn't. */ 3327 /* We've stuffed all the events ourselves, so w32_read_socket shouldn't. */
3326 event->kind = NO_EVENT; 3328 event->kind = NO_EVENT;
3327} 3329}
3328#endif 3330#endif /* WINDOWSNT */
3331#endif /* HAVE_W32NOTIFY */
3329 3332
3330 3333
3331/* Function to report a mouse movement to the mainstream Emacs code. 3334/* Function to report a mouse movement to the mainstream Emacs code.
@@ -4968,7 +4971,7 @@ w32_read_socket (struct terminal *terminal,
4968 check_visibility = 1; 4971 check_visibility = 1;
4969 break; 4972 break;
4970 4973
4971#ifdef WINDOWSNT 4974#if HAVE_W32NOTIFY
4972 case WM_EMACS_FILENOTIFY: 4975 case WM_EMACS_FILENOTIFY:
4973 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 4976 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4974 if (f) 4977 if (f)
diff --git a/src/w32term.h b/src/w32term.h
index 9c27c09d03d..be0b4a6f350 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -683,7 +683,7 @@ extern Lisp_Object w32_get_watch_object (void *);
683extern Lisp_Object lispy_file_action (DWORD); 683extern Lisp_Object lispy_file_action (DWORD);
684 684
685extern void w32_initialize_display_info (Lisp_Object); 685extern void w32_initialize_display_info (Lisp_Object);
686extern void initialize_w32_display (struct terminal *); 686extern void initialize_w32_display (struct terminal *, int *, int *);
687 687
688/* Keypad command key support. W32 doesn't have virtual keys defined 688/* Keypad command key support. W32 doesn't have virtual keys defined
689 for the function keys on the keypad (they are mapped to the standard 689 for the function keys on the keypad (they are mapped to the standard
diff --git a/src/window.c b/src/window.c
index 33bf70b75c8..81a2285edba 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1620,12 +1620,13 @@ specifies the position of the last visible glyph in WINDOW. POS
1620defaults to point in WINDOW; WINDOW defaults to the selected window. 1620defaults to point in WINDOW; WINDOW defaults to the selected window.
1621 1621
1622If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 1622If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
1623return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), 1623the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
1624where X and Y are the pixel coordinates relative to the top left corner 1624where X and Y are the pixel coordinates relative to the top left corner
1625of the window. The remaining elements are omitted if the character after 1625of the window. The remaining elements are omitted if the character after
1626POS is fully visible; otherwise, RTOP and RBOT are the number of pixels 1626POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
1627off-window at the top and bottom of the row, ROWH is the height of the 1627off-window at the top and bottom of the screen line ("row") containing
1628display row, and VPOS is the row number (0-based) containing POS. */) 1628POS, ROWH is the visible height of that row, and VPOS is the row number
1629\(zero-based). */)
1629 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) 1630 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
1630{ 1631{
1631 register struct window *w; 1632 register struct window *w;
diff --git a/src/xdisp.c b/src/xdisp.c
index 5ae15cbd0b3..e1d6b0c9a27 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2650,6 +2650,7 @@ init_iterator (struct it *it, struct window *w,
2650 it->bidi_it.string.lstring = Qnil; 2650 it->bidi_it.string.lstring = Qnil;
2651 it->bidi_it.string.s = NULL; 2651 it->bidi_it.string.s = NULL;
2652 it->bidi_it.string.bufpos = 0; 2652 it->bidi_it.string.bufpos = 0;
2653 it->bidi_it.w = w;
2653 2654
2654 /* The window in which we iterate over current_buffer: */ 2655 /* The window in which we iterate over current_buffer: */
2655 XSETWINDOW (it->window, w); 2656 XSETWINDOW (it->window, w);
@@ -3124,6 +3125,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
3124 it->bidi_it.string.bufpos = it->overlay_strings_charpos; 3125 it->bidi_it.string.bufpos = it->overlay_strings_charpos;
3125 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; 3126 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
3126 it->bidi_it.string.unibyte = !it->multibyte_p; 3127 it->bidi_it.string.unibyte = !it->multibyte_p;
3128 it->bidi_it.w = it->w;
3127 bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), 3129 bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it),
3128 FRAME_WINDOW_P (it->f), &it->bidi_it); 3130 FRAME_WINDOW_P (it->f), &it->bidi_it);
3129 3131
@@ -3490,11 +3492,11 @@ next_overlay_change (ptrdiff_t pos)
3490ptrdiff_t 3492ptrdiff_t
3491compute_display_string_pos (struct text_pos *position, 3493compute_display_string_pos (struct text_pos *position,
3492 struct bidi_string_data *string, 3494 struct bidi_string_data *string,
3495 struct window *w,
3493 int frame_window_p, int *disp_prop) 3496 int frame_window_p, int *disp_prop)
3494{ 3497{
3495 /* OBJECT = nil means current buffer. */ 3498 /* OBJECT = nil means current buffer. */
3496 Lisp_Object object = 3499 Lisp_Object object, object1;
3497 (string && STRINGP (string->lstring)) ? string->lstring : Qnil;
3498 Lisp_Object pos, spec, limpos; 3500 Lisp_Object pos, spec, limpos;
3499 int string_p = (string && (STRINGP (string->lstring) || string->s)); 3501 int string_p = (string && (STRINGP (string->lstring) || string->s));
3500 ptrdiff_t eob = string_p ? string->schars : ZV; 3502 ptrdiff_t eob = string_p ? string->schars : ZV;
@@ -3505,6 +3507,16 @@ compute_display_string_pos (struct text_pos *position,
3505 struct text_pos tpos; 3507 struct text_pos tpos;
3506 int rv = 0; 3508 int rv = 0;
3507 3509
3510 if (string && STRINGP (string->lstring))
3511 object1 = object = string->lstring;
3512 else if (w && !string_p)
3513 {
3514 XSETWINDOW (object, w);
3515 object1 = Qnil;
3516 }
3517 else
3518 object1 = object = Qnil;
3519
3508 *disp_prop = 1; 3520 *disp_prop = 1;
3509 3521
3510 if (charpos >= eob 3522 if (charpos >= eob
@@ -3543,7 +3555,7 @@ compute_display_string_pos (struct text_pos *position,
3543 that will replace the underlying text when displayed. */ 3555 that will replace the underlying text when displayed. */
3544 limpos = make_number (lim); 3556 limpos = make_number (lim);
3545 do { 3557 do {
3546 pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos); 3558 pos = Fnext_single_char_property_change (pos, Qdisplay, object1, limpos);
3547 CHARPOS (tpos) = XFASTINT (pos); 3559 CHARPOS (tpos) = XFASTINT (pos);
3548 if (CHARPOS (tpos) >= lim) 3560 if (CHARPOS (tpos) >= lim)
3549 { 3561 {
@@ -5031,6 +5043,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5031 it->bidi_it.string.bufpos = bufpos; 5043 it->bidi_it.string.bufpos = bufpos;
5032 it->bidi_it.string.from_disp_str = 1; 5044 it->bidi_it.string.from_disp_str = 1;
5033 it->bidi_it.string.unibyte = !it->multibyte_p; 5045 it->bidi_it.string.unibyte = !it->multibyte_p;
5046 it->bidi_it.w = it->w;
5034 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 5047 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
5035 } 5048 }
5036 } 5049 }
@@ -5409,6 +5422,7 @@ next_overlay_string (struct it *it)
5409 it->bidi_it.string.bufpos = it->overlay_strings_charpos; 5422 it->bidi_it.string.bufpos = it->overlay_strings_charpos;
5410 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; 5423 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
5411 it->bidi_it.string.unibyte = !it->multibyte_p; 5424 it->bidi_it.string.unibyte = !it->multibyte_p;
5425 it->bidi_it.w = it->w;
5412 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 5426 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
5413 } 5427 }
5414 } 5428 }
@@ -5712,6 +5726,7 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p)
5712 it->bidi_it.string.bufpos = pos; 5726 it->bidi_it.string.bufpos = pos;
5713 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; 5727 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
5714 it->bidi_it.string.unibyte = !it->multibyte_p; 5728 it->bidi_it.string.unibyte = !it->multibyte_p;
5729 it->bidi_it.w = it->w;
5715 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 5730 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
5716 } 5731 }
5717 return 1; 5732 return 1;
@@ -6344,6 +6359,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
6344 it->bidi_it.string.lstring = Qnil; 6359 it->bidi_it.string.lstring = Qnil;
6345 it->bidi_it.string.bufpos = 0; 6360 it->bidi_it.string.bufpos = 0;
6346 it->bidi_it.string.unibyte = 0; 6361 it->bidi_it.string.unibyte = 0;
6362 it->bidi_it.w = it->w;
6347 } 6363 }
6348 6364
6349 if (set_stop_p) 6365 if (set_stop_p)
@@ -6421,6 +6437,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6421 it->bidi_it.string.bufpos = 0; 6437 it->bidi_it.string.bufpos = 0;
6422 it->bidi_it.string.from_disp_str = 0; 6438 it->bidi_it.string.from_disp_str = 0;
6423 it->bidi_it.string.unibyte = !it->multibyte_p; 6439 it->bidi_it.string.unibyte = !it->multibyte_p;
6440 it->bidi_it.w = it->w;
6424 bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), 6441 bidi_init_it (charpos, IT_STRING_BYTEPOS (*it),
6425 FRAME_WINDOW_P (it->f), &it->bidi_it); 6442 FRAME_WINDOW_P (it->f), &it->bidi_it);
6426 } 6443 }
@@ -6452,6 +6469,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6452 it->bidi_it.string.bufpos = 0; 6469 it->bidi_it.string.bufpos = 0;
6453 it->bidi_it.string.from_disp_str = 0; 6470 it->bidi_it.string.from_disp_str = 0;
6454 it->bidi_it.string.unibyte = !it->multibyte_p; 6471 it->bidi_it.string.unibyte = !it->multibyte_p;
6472 it->bidi_it.w = it->w;
6455 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), 6473 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f),
6456 &it->bidi_it); 6474 &it->bidi_it);
6457 } 6475 }
@@ -12132,12 +12150,27 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12132 int hpos, vpos, prop_idx; 12150 int hpos, vpos, prop_idx;
12133 struct glyph *glyph; 12151 struct glyph *glyph;
12134 Lisp_Object enabled_p; 12152 Lisp_Object enabled_p;
12135 12153 int ts;
12136 /* If not on the highlighted tool-bar item, return. */ 12154
12155 /* If not on the highlighted tool-bar item, and mouse-highlight is
12156 non-nil, return. This is so we generate the tool-bar button
12157 click only when the mouse button is released on the same item as
12158 where it was pressed. However, when mouse-highlight is disabled,
12159 generate the click when the button is released regardless of the
12160 highlight, since tool-bar items are not highlighted in that
12161 case. */
12137 frame_to_window_pixel_xy (w, &x, &y); 12162 frame_to_window_pixel_xy (w, &x, &y);
12138 if (get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) 12163 ts = get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx);
12164 if (ts == -1
12165 || (ts != 0 && !NILP (Vmouse_highlight)))
12139 return; 12166 return;
12140 12167
12168 /* When mouse-highlight is off, generate the click for the item
12169 where the button was pressed, disregarding where it was
12170 released. */
12171 if (NILP (Vmouse_highlight) && !down_p)
12172 prop_idx = last_tool_bar_item;
12173
12141 /* If item is disabled, do nothing. */ 12174 /* If item is disabled, do nothing. */
12142 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 12175 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
12143 if (NILP (enabled_p)) 12176 if (NILP (enabled_p))
@@ -12146,7 +12179,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12146 if (down_p) 12179 if (down_p)
12147 { 12180 {
12148 /* Show item in pressed state. */ 12181 /* Show item in pressed state. */
12149 show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); 12182 if (!NILP (Vmouse_highlight))
12183 show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
12150 last_tool_bar_item = prop_idx; 12184 last_tool_bar_item = prop_idx;
12151 } 12185 }
12152 else 12186 else
@@ -12156,7 +12190,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12156 EVENT_INIT (event); 12190 EVENT_INIT (event);
12157 12191
12158 /* Show item in released state. */ 12192 /* Show item in released state. */
12159 show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); 12193 if (!NILP (Vmouse_highlight))
12194 show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
12160 12195
12161 key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); 12196 key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY);
12162 12197
@@ -12229,7 +12264,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12229 12264
12230 /* If tool-bar item is not enabled, don't highlight it. */ 12265 /* If tool-bar item is not enabled, don't highlight it. */
12231 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 12266 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
12232 if (!NILP (enabled_p)) 12267 if (!NILP (enabled_p) && !NILP (Vmouse_highlight))
12233 { 12268 {
12234 /* Compute the x-position of the glyph. In front and past the 12269 /* Compute the x-position of the glyph. In front and past the
12235 image is a space. We include this in the highlighted area. */ 12270 image is a space. We include this in the highlighted area. */
@@ -18904,6 +18939,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
18904 it->bidi_it.string.bufpos = IT_CHARPOS (*it); 18939 it->bidi_it.string.bufpos = IT_CHARPOS (*it);
18905 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; 18940 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
18906 it->bidi_it.string.unibyte = !it->multibyte_p; 18941 it->bidi_it.string.unibyte = !it->multibyte_p;
18942 it->bidi_it.w = it->w;
18907 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 18943 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
18908 } 18944 }
18909 } 18945 }
@@ -18934,16 +18970,19 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
18934static Lisp_Object 18970static Lisp_Object
18935get_it_property (struct it *it, Lisp_Object prop) 18971get_it_property (struct it *it, Lisp_Object prop)
18936{ 18972{
18937 Lisp_Object position; 18973 Lisp_Object position, object = it->object;
18938 18974
18939 if (STRINGP (it->object)) 18975 if (STRINGP (object))
18940 position = make_number (IT_STRING_CHARPOS (*it)); 18976 position = make_number (IT_STRING_CHARPOS (*it));
18941 else if (BUFFERP (it->object)) 18977 else if (BUFFERP (object))
18942 position = make_number (IT_CHARPOS (*it)); 18978 {
18979 position = make_number (IT_CHARPOS (*it));
18980 object = it->window;
18981 }
18943 else 18982 else
18944 return Qnil; 18983 return Qnil;
18945 18984
18946 return Fget_char_property (position, prop, it->object); 18985 return Fget_char_property (position, prop, object);
18947} 18986}
18948 18987
18949/* See if there's a line- or wrap-prefix, and if so, push it on IT. */ 18988/* See if there's a line- or wrap-prefix, and if so, push it on IT. */
@@ -19973,6 +20012,10 @@ See also `bidi-paragraph-direction'. */)
19973 itb.string.lstring = Qnil; 20012 itb.string.lstring = Qnil;
19974 itb.string.bufpos = 0; 20013 itb.string.bufpos = 0;
19975 itb.string.unibyte = 0; 20014 itb.string.unibyte = 0;
20015 /* We have no window to use here for ignoring window-specific
20016 overlays. Using NULL for window pointer will cause
20017 compute_display_string_pos to use the current buffer. */
20018 itb.w = NULL;
19976 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 20019 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
19977 bidi_unshelve_cache (itb_data, 0); 20020 bidi_unshelve_cache (itb_data, 0);
19978 set_buffer_temp (old); 20021 set_buffer_temp (old);
@@ -27399,7 +27442,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27399 if (STRINGP (string)) 27442 if (STRINGP (string))
27400 { 27443 {
27401 mouse_face = Fget_text_property (pos, Qmouse_face, string); 27444 mouse_face = Fget_text_property (pos, Qmouse_face, string);
27402 if (!NILP (mouse_face) 27445 if (!NILP (Vmouse_highlight) && !NILP (mouse_face)
27403 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) 27446 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
27404 && glyph) 27447 && glyph)
27405 { 27448 {
@@ -27537,8 +27580,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27537 27580
27538/* EXPORT: 27581/* EXPORT:
27539 Take proper action when the mouse has moved to position X, Y on 27582 Take proper action when the mouse has moved to position X, Y on
27540 frame F as regards highlighting characters that have mouse-face 27583 frame F with regards to highlighting portions of display that have
27541 properties. Also de-highlighting chars where the mouse was before. 27584 mouse-face properties. Also de-highlight portions of display where
27585 the mouse was before, set the mouse pointer shape as appropriate
27586 for the mouse coordinates, and activate help echo (tooltips).
27542 X and Y can be negative or out of range. */ 27587 X and Y can be negative or out of range. */
27543 27588
27544void 27589void
@@ -27558,8 +27603,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
27558 return; 27603 return;
27559#endif 27604#endif
27560 27605
27561 if (NILP (Vmouse_highlight) 27606 if (!f->glyphs_initialized_p
27562 || !f->glyphs_initialized_p
27563 || f->pointer_invisible) 27607 || f->pointer_invisible)
27564 return; 27608 return;
27565 27609
@@ -27755,6 +27799,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
27755 else 27799 else
27756 noverlays = 0; 27800 noverlays = 0;
27757 27801
27802 if (NILP (Vmouse_highlight))
27803 {
27804 clear_mouse_face (hlinfo);
27805 goto check_help_echo;
27806 }
27807
27758 same_region = coords_in_mouse_face_p (w, hpos, vpos); 27808 same_region = coords_in_mouse_face_p (w, hpos, vpos);
27759 27809
27760 if (same_region) 27810 if (same_region)
diff --git a/src/xgselect.c b/src/xgselect.c
index 0b5ad6ae70d..4d90298a9d9 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -21,11 +21,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "xgselect.h" 22#include "xgselect.h"
23 23
24#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) 24#ifdef HAVE_GLIB
25 25
26#include <glib.h> 26#include <glib.h>
27#include <errno.h> 27#include <errno.h>
28#include "xterm.h"
29#include "frame.h" 28#include "frame.h"
30 29
31int 30int
@@ -44,9 +43,13 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
44 int i, nfds, tmo_in_millisec; 43 int i, nfds, tmo_in_millisec;
45 USE_SAFE_ALLOCA; 44 USE_SAFE_ALLOCA;
46 45
47 if (! (window_system_available (NULL) 46 /* Do not try to optimize with an initial check with g_main_context_pending
48 && g_main_context_pending (context = g_main_context_default ()))) 47 and a call to pselect if it returns false. If Gdk has a timeout for 0.01
49 return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); 48 second, and Emacs has a timeout for 1 second, g_main_context_pending will
49 return false, but the timeout will be 1 second, thus missing the gdk
50 timeout with a lot. */
51
52 context = g_main_context_default ();
50 53
51 if (rfds) all_rfds = *rfds; 54 if (rfds) all_rfds = *rfds;
52 else FD_ZERO (&all_rfds); 55 else FD_ZERO (&all_rfds);
@@ -140,4 +143,4 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
140 143
141 return retval; 144 return retval;
142} 145}
143#endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */ 146#endif /* HAVE_GLIB */
diff --git a/src/xterm.c b/src/xterm.c
index 7038de7039f..7505aa3936b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9897,13 +9897,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9897 9897
9898 XSetLocaleModifiers (""); 9898 XSetLocaleModifiers ("");
9899 9899
9900 /* If D-Bus is not already configured, inhibit D-Bus autolaunch,
9901 as autolaunch can mess up Emacs's SIGCHLD handler.
9902 FIXME: Rewrite subprocess handlers to use glib's child watchers.
9903 See Bug#14474. */
9904 if (! egetenv ("DBUS_SESSION_BUS_ADDRESS"))
9905 xputenv ("DBUS_SESSION_BUS_ADDRESS=unix:path=/dev/null");
9906
9907 /* Emacs can only handle core input events, so make sure 9900 /* Emacs can only handle core input events, so make sure
9908 Gtk doesn't use Xinput or Xinput2 extensions. */ 9901 Gtk doesn't use Xinput or Xinput2 extensions. */
9909 xputenv ("GDK_CORE_DEVICE_EVENTS=1"); 9902 xputenv ("GDK_CORE_DEVICE_EVENTS=1");