aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2004-11-04 08:55:40 +0000
committerMiles Bader2004-11-04 08:55:40 +0000
commitd1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26 (patch)
tree935f61a936f33c7690a201b19b86e89c3d864b61 /src
parent32dc0e8f9bc2d460b3d964c21989de70282bab61 (diff)
parent0683d2414d4de8626f7c46f59937f9bef27302ce (diff)
downloademacs-d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26.tar.gz
emacs-d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-69
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-643 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-649 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-650 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-651 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-655 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-656 Update from CVS: lisp/man.el (Man-xref-normal-file): Fix help-echo. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-657 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-658 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-659 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-660 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-661 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-667 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-61 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit28
-rw-r--r--src/ChangeLog233
-rw-r--r--src/ChangeLog.812
-rw-r--r--src/Makefile.in2
-rw-r--r--src/atimer.c3
-rw-r--r--src/callproc.c5
-rw-r--r--src/config.in9
-rw-r--r--src/dispnew.c2
-rw-r--r--src/editfns.c7
-rw-r--r--src/emacs.c1
-rw-r--r--src/eval.c46
-rw-r--r--src/fileio.c3
-rw-r--r--src/fontset.c4
-rw-r--r--src/gtkutil.c129
-rw-r--r--src/gtkutil.h3
-rw-r--r--src/indent.c53
-rw-r--r--src/insdel.c118
-rw-r--r--src/lisp.h2
-rw-r--r--src/macfns.c38
-rw-r--r--src/macterm.c40
-rw-r--r--src/process.c48
-rw-r--r--src/search.c2
-rw-r--r--src/syntax.c44
-rw-r--r--src/w32fns.c34
-rw-r--r--src/w32term.c4
-rw-r--r--src/window.c40
-rw-r--r--src/xdisp.c35
-rw-r--r--src/xfns.c89
-rw-r--r--src/xmenu.c24
-rw-r--r--src/xselect.c20
-rw-r--r--src/xterm.c4
31 files changed, 816 insertions, 266 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index adf2ccbf5f1..1f179fb6d64 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -70,6 +70,34 @@ Print the argument as an emacs s-expression
70Works only when an inferior emacs is executing. 70Works only when an inferior emacs is executing.
71end 71end
72 72
73# Print out current buffer point and boundaries
74define ppt
75 set $b = current_buffer
76 set $t = $b->text
77 printf "BUF PT: %d", $b->pt
78 if ($b->pt != $b->pt_byte)
79 printf "[%d]", $b->pt_byte
80 end
81 printf " of 1..%d", $t->z
82 if ($t->z != $t->z_byte)
83 printf "[%d]", $t->z_byte
84 end
85 if ($b->begv != 1 || $b->zv != $t->z)
86 printf " NARROW=%d..%d", $b->begv, $b->zv
87 if ($b->begv != $b->begv_byte || $b->zv != $b->zv_byte)
88 printf " [%d..%d]", $b->begv_byte, $b->zv_byte
89 end
90 end
91 printf " GAP: %d", $t->gpt
92 if ($t->gpt != $t->gpt_byte)
93 printf "[%d]", $t->gpt_byte
94 end
95 printf " SZ=%d\n", $t->gap_size
96end
97document ppt
98Print point, beg, end, narrow, and gap for current buffer.
99end
100
73define xtype 101define xtype
74 xgettype $ 102 xgettype $
75 output $type 103 output $type
diff --git a/src/ChangeLog b/src/ChangeLog
index 8c0a7c0bcf1..e0ae2429fcd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,166 @@
12004-11-04 Kenichi Handa <handa@m17n.org>
2
3 * fontset.c (fontset_pattern_regexp): If '*' is preceded by '\',
4 treat it as a literal character.
5
62004-11-03 Kim F. Storm <storm@cua.dk>
7
8 * .gdbinit (ppt): New function.
9
102004-11-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
11
12 * xterm.c (x_window_to_scroll_bar): Only call
13 xg_get_scroll_id_for_window if toolkit scroll bars are used.
14
15 * gtkutil.c (xg_get_file_with_chooser): Use GTK_STOCK_OK instead
16 of save.
17
182004-11-02 Andreas Schwab <schwab@suse.de>
19
20 * window.c (Fscroll_right): Fix last change.
21
222004-11-02 Kim F. Storm <storm@cua.dk>
23
24 * Makefile.in (callproc.o): Depend on blockinput.h atimer.h systime.h.
25
262004-11-02 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
27
28 * callproc.c (Fcall_process): Block input around vfork.
29
302004-11-02 Kim F. Storm <storm@cua.dk>
31
32 * eval.c (Fcalled_interactively_p): Rename from Fcall_interactive_p.
33 (syms_of_eval): Defsubr it.
34
352004-11-02 Richard M. Stallman <rms@gnu.org>
36
37 * insdel.c (replace_range_2): New function.
38
39 * casefiddle.c (casify_region): Handle changes in byte-length
40 using replace_range_2.
41
42 * emacs.c (USAGE3): Delete --horizontal-scroll-bars, -hb.
43
44 * xdisp.c (back_to_previous_visible_line_start):
45 Subtract 1 from pos when checking previous newline for invisibility.
46
47 * window.c (window_scroll_pixel_based): Update preserve_y
48 for header line if any.
49 (Fscroll_left, Fscroll_right): Don't call interactive_p;
50 use a new second argument instead.
51
52 * eval.c (Fcall_interactive_p): New function.
53 (interactive_p): Don't test INTERACTIVE here.
54 (Finteractive_p): Doc fix.
55
56 * eval.c (Feval): Abort if INPUT_BLOCKED_P.
57
582004-11-02 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
59
60 * w32fns.c (w32_font_match): Use fast_string_match_ignore_case for
61 comparing font names.
62
632004-11-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
64
65 * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
66 Fx_file_dialog if only directories should be read.
67
68 * lisp.h: Fx_file_dialog takes 5 parameters.
69
70 * xfns.c (Fx_file_dialog): Both Motif and GTK version: Add
71 parameter only_dir_p.
72 In Motif version, don't put DEFAULT_FILENAME in filter part of the
73 dialog, just text field part. Do not add DEFAULT_FILENAME
74 to list of files if it isn't there.
75 In GTK version, pass only_dir_p parameter to xg_get_file_name.
76
77 * macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check
78 only_dir_p instead of comparing prompt to "Dired". When using
79 a save dialog, add option kNavDontConfirmReplacement, change title
80 to "Enter name", change text for save button to "Ok".
81
82 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check
83 only_dir_p instead of comparing prompt to "Dired".
84
85 * gtkutil.c (xg_get_file_with_chooser)
86 (xg_get_file_with_selection): New functions, only defined ifdef
87 HAVE_GTK_FILE_CHOOSER_DIALOG_NEW and HAVE_GTK_FILE_SELECTION_NEW
88 respectively.
89 (xg_get_file_name): Add parameter only_dir_p.
90 Call xg_get_file_with_chooser or xg_get_file_with_selection
91 depending on HAVE_GTK_FILE* and the value of use_old_gtk_file_dialog.
92 (xg_initialize): New DEFVAR_BOOL use_old_gtk_file_dialog.
93
94 * gtkutil.h (xg_get_file_name): Add parameter only_dir_p.
95
96 * config.in: Rebuild (added HAVE_GTK_FILE_*).
97
982004-11-01 Kim F. Storm <storm@cua.dk>
99
100 * process.c (connect_wait_mask, num_pending_connects): Only
101 declare and use them if NON_BLOCKING_CONNECT is defined.
102 (init_process): Initialize them if NON_BLOCKING_CONNECT defined.
103 (IF_NON_BLOCKING_CONNECT): New helper macro.
104 (wait_reading_process_output): Only declare and use local vars
105 Connecting and check_connect when NON_BLOCKING_CONNECT is defined.
106
1072004-11-01 Andy Petrusenco <Igrek@star-sw.com> (tiny change)
108
109 * w32term.c (x_scroll_run): Delete region objects after use.
110
1112004-10-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
112
113 * xmenu.c: Add prototypes for forward function declarations.
114 (popup_get_selection): Remove parameter do_timers, remove call to
115 timer_check.
116 (create_and_show_popup_menu, create_and_show_dialog): Remove
117 parameter do_timers from call to popup_get_selection.
118
119 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to
120 tool_bar_items and assign the result to f->tool_bar_items if
121 not equal. Move BLOCK/UNBLOCK_INPUT from around call to
122 tool_bar_items to assignment of result.
123
124 * atimer.c (alarm_signal_handler): Do not call set_alarm if
125 pending_atmers is non-zero.
126
1272004-10-31 Kim F. Storm <storm@cua.dk>
128
129 * dispnew.c (margin_glyphs_to_reserve): Don't use ncols_scale_factor.
130
1312004-10-28 Will <will@glozer.net>
132
133 * macterm.c: allow user to assign key modifiers to the Mac Option
134 key via a 'mac-option-modifier' variable.
135
1362004-10-28 Stefan <monnier@iro.umontreal.ca>
137
138 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions):
139 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks.
140 (x_handle_selection_request, x_handle_selection_clear)
141 (x_clear_frame_selections, syms_of_xselect): Adjust accordingly.
142
1432004-10-28 Richard M. Stallman <rms@gnu.org>
144
145 * w32fns.c (Fx_server_vendor, Fx_server_version): Doc fixes.
146
147 * xfns.c (Fx_server_vendor, Fx_server_version): Doc fixes.
148
1492004-10-27 Stefan Monnier <monnier@iro.umontreal.ca>
150
151 * syntax.c (scan_sexps_forward): Give precedence to a 2-char
152 comment-starter over a 1-char one.
153
1542004-10-27 Richard M. Stallman <rms@gnu.org>
155
156 * xdisp.c (get_next_display_element): In mode lines,
157 treat newline and tab like other control characters.
158
159 * editfns.c (Fmessage): Doc fix.
160
161 * indent.c (vmotion): When moving up, check the newline before.
162 Make prevline an int, not a Lisp_Object.
163
12004-10-27 Kim F. Storm <storm@cua.dk> 1642004-10-27 Kim F. Storm <storm@cua.dk>
2 165
3 * editfns.c (Fformat): Allocate discarded table with SAFE_ALLOCA. 166 * editfns.c (Fformat): Allocate discarded table with SAFE_ALLOCA.
@@ -12,8 +175,8 @@
122004-10-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 1752004-10-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
13 176
14 * gtkutil.c: Put empty line between comment and function body. 177 * gtkutil.c: Put empty line between comment and function body.
15 (xg_destroy_widgets): Renamed from remove_from_container. Just 178 (xg_destroy_widgets): Rename from remove_from_container.
16 destroy all widgets in list. Argument wcont removed. 179 Just destroy all widgets in list. Argument wcont removed.
17 (xg_update_menubar, xg_update_submenu): Call xg_destroy_widgets 180 (xg_update_menubar, xg_update_submenu): Call xg_destroy_widgets
18 instead of remove_from_container. 181 instead of remove_from_container.
19 (xg_display_close, xg_create_tool_bar, update_frame_tool_bar) 182 (xg_display_close, xg_create_tool_bar, update_frame_tool_bar)
@@ -54,17 +217,17 @@
54 217
552004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> 2182004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu>
56 219
57 * xterm.h (x_output): New member `xic_base_fontname'. 220 * xterm.h (x_output): New member `xic_base_fontname'.
58 (FRAME_XIC_BASE_FONTNAME): New macro. 221 (FRAME_XIC_BASE_FONTNAME): New macro.
59 (xic_free_xfontset): Declare. 222 (xic_free_xfontset): Declare.
60 223
61 * xfns.c (xic_create_xfontset): Share fontsets between frames 224 * xfns.c (xic_create_xfontset): Share fontsets between frames
62 based on base_fontname. 225 based on base_fontname.
63 (xic_free_xfontset): New function. 226 (xic_free_xfontset): New function.
64 (free_frame_xic): Use it. 227 (free_frame_xic): Use it.
65 (xic_set_xfontset): Ditto. 228 (xic_set_xfontset): Ditto.
66 229
67 * xterm.c (xim_destroy_callback): Ditto. 230 * xterm.c (xim_destroy_callback): Ditto.
68 231
69 232
702004-10-20 B. Anyos <banyos@freemail.hu> (tiny change) 2332004-10-20 B. Anyos <banyos@freemail.hu> (tiny change)
@@ -108,10 +271,10 @@
108 271
109 * gtkutil.h (xg_update_scrollbar_pos): Remove arguments real_left 272 * gtkutil.h (xg_update_scrollbar_pos): Remove arguments real_left
110 and canon_width. 273 and canon_width.
111 (xg_frame_cleared): Removed. 274 (xg_frame_cleared): Remove.
112 275
113 * gtkutil.c (xg_frame_cleared, xg_fixed_handle_expose, 276 * gtkutil.c (xg_frame_cleared, xg_fixed_handle_expose)
114 xg_find_top_left_in_fixed): Removed. 277 (xg_find_top_left_in_fixed): Remove.
115 (xg_create_scroll_bar): Put an event box widget between 278 (xg_create_scroll_bar): Put an event box widget between
116 the scroll bar widget and the edit widget. 279 the scroll bar widget and the edit widget.
117 (xg_show_scroll_bar): Show the parent widget (the event box). 280 (xg_show_scroll_bar): Show the parent widget (the event box).
@@ -120,11 +283,11 @@
120 Move the parent (the event box) widget inside the fixed widget. 283 Move the parent (the event box) widget inside the fixed widget.
121 Move window clear to xterm.c. 284 Move window clear to xterm.c.
122 285
123 * gtkutil.h (xg_frame_cleared): Removed. 286 * gtkutil.h (xg_frame_cleared): Remove.
124 287
125 * xterm.c (x_clear_frame): Remove call to xg_frame_cleared 288 * xterm.c (x_clear_frame): Remove call to xg_frame_cleared
126 (x_scroll_bar_create, XTset_vertical_scroll_bar): Remove 289 (x_scroll_bar_create, XTset_vertical_scroll_bar):
127 arguments left and width to xg_update_scrollbar_pos. 290 Remove arguments left and width to xg_update_scrollbar_pos.
128 (XTset_vertical_scroll_bar): Do x_clear_area for USE_GTK also. 291 (XTset_vertical_scroll_bar): Do x_clear_area for USE_GTK also.
129 292
1302004-10-19 Kenichi Handa <handa@m17n.org> 2932004-10-19 Kenichi Handa <handa@m17n.org>
@@ -349,7 +512,7 @@
349 compositions to encode. 512 compositions to encode.
350 (encode_coding_string): Likewise. Free composition data. 513 (encode_coding_string): Likewise. Free composition data.
351 514
3522004-09-30 Florian Weimer <fw@deneb.enyo.de> (tiny change) 5152004-09-30 Florian Weimer <fw@deneb.enyo.de>
353 516
354 * coding.c (code_convert_region): Free composition data. 517 * coding.c (code_convert_region): Free composition data.
355 518
@@ -923,7 +1086,7 @@
923 (Fsave_window_excursion, Fset_window_vscroll) 1086 (Fsave_window_excursion, Fset_window_vscroll)
924 (syms_of_window) <window-size-fixed>: Doc fixes. 1087 (syms_of_window) <window-size-fixed>: Doc fixes.
925 1088
9262004-07-19 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change) 10892004-07-19 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
927 1090
928 * w32fns.c (Fx_file_dialog): Use ENCODE_FILE instead of 1091 * w32fns.c (Fx_file_dialog): Use ENCODE_FILE instead of
929 ENCODE_SYSTEM for filenames. 1092 ENCODE_SYSTEM for filenames.
@@ -982,7 +1145,7 @@
982 1145
983 * buffer.c (syms_of_buffer) <transient-mark-mode>: Doc fix. 1146 * buffer.c (syms_of_buffer) <transient-mark-mode>: Doc fix.
984 1147
9852004-07-15 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change) 11482004-07-15 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
986 1149
987 * w32fns.c (Fx_file_dialog): Encode strings in system coding 1150 * w32fns.c (Fx_file_dialog): Encode strings in system coding
988 system before passing them to OS functions for display. 1151 system before passing them to OS functions for display.
@@ -1646,7 +1809,7 @@
1646 before actually accepting connection in case it has already been 1809 before actually accepting connection in case it has already been
1647 accepted due to recursion. 1810 accepted due to recursion.
1648 1811
16492004-05-23 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> (tiny change) 18122004-05-23 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu>
1650 1813
1651 * coding.c (Fset_safe_terminal_coding_system_internal): 1814 * coding.c (Fset_safe_terminal_coding_system_internal):
1652 Set suppress_error in safe_terminal_coding, not terminal_coding. 1815 Set suppress_error in safe_terminal_coding, not terminal_coding.
@@ -1960,7 +2123,7 @@
1960 * w32fns.c (Vw32_ansi_code_page): New Lisp variable. 2123 * w32fns.c (Vw32_ansi_code_page): New Lisp variable.
1961 (globals_of_w32fns): Set it. 2124 (globals_of_w32fns): Set it.
1962 2125
19632004-05-09 Piet van Oostrum <piet@cs.uu.nl> (tiny change) 21262004-05-09 Piet van Oostrum <piet@cs.uu.nl>
1964 2127
1965 * data.c (Fquo): Simplify. 2128 * data.c (Fquo): Simplify.
1966 2129
@@ -2009,7 +2172,7 @@
2009 2172
2010 * emacs.c (main) [VMS]: Fix var ref. 2173 * emacs.c (main) [VMS]: Fix var ref.
2011 2174
20122004-05-06 Romain Francoise <romain@orebokech.com> (tiny change) 21752004-05-06 Romain Francoise <romain@orebokech.com>
2013 2176
2014 * data.c (Fsetq_default): Fix docstring. 2177 * data.c (Fsetq_default): Fix docstring.
2015 2178
@@ -2049,7 +2212,7 @@
2049 2212
2050 * Makefile.in (region-cache.o): Depend on config.h. 2213 * Makefile.in (region-cache.o): Depend on config.h.
2051 2214
20522004-05-02 Romain Francoise <romain@orebokech.com> (tiny change) 22152004-05-02 Romain Francoise <romain@orebokech.com>
2053 2216
2054 * indent.c (compute_motion): Save vpos in prev_vpos when dealing 2217 * indent.c (compute_motion): Save vpos in prev_vpos when dealing
2055 with continuation lines, too. 2218 with continuation lines, too.
@@ -3292,7 +3455,7 @@
3292 entries that were used before we return. 3455 entries that were used before we return.
3293 (init_keyboard): Initialize read_avail_input_buf here. 3456 (init_keyboard): Initialize read_avail_input_buf here.
3294 3457
32952004-02-16 Jesper Harder <harder@ifa.au.dk> (tiny change) 34582004-02-16 Jesper Harder <harder@ifa.au.dk>
3296 3459
3297 * cmds.c (Fend_of_line): Doc fix. 3460 * cmds.c (Fend_of_line): Doc fix.
3298 3461
@@ -3960,7 +4123,7 @@
3960 to the definition of `signal' in the Elisp manual. 4123 to the definition of `signal' in the Elisp manual.
3961 * eval.c (Fsignal): Ditto. 4124 * eval.c (Fsignal): Ditto.
3962 4125
39632003-12-29 James Clark <jjc@jclark.com> (tiny change) 41262003-12-29 James Clark <jjc@jclark.com>
3964 4127
3965 * fns.c (internal_equal): Return t for two NaN arguments. 4128 * fns.c (internal_equal): Return t for two NaN arguments.
3966 4129
@@ -5020,7 +5183,7 @@
5020 * fileio.c (Fwrite_region): Fix conditional expression to issue 5183 * fileio.c (Fwrite_region): Fix conditional expression to issue
5021 the right message. 5184 the right message.
5022 5185
50232003-08-16 Juri Linkov <juri@jurta.org> (tiny change) 51862003-08-16 Juri Linkov <juri@jurta.org>
5024 5187
5025 * syntax.c (Fforward_word): Argument changed to optional. 5188 * syntax.c (Fforward_word): Argument changed to optional.
5026 Set default value to 1. 5189 Set default value to 1.
@@ -5079,7 +5242,7 @@
5079 * fns.c (Fclear_string): New function. 5242 * fns.c (Fclear_string): New function.
5080 (syms_of_fns): defsubr it. 5243 (syms_of_fns): defsubr it.
5081 5244
50822003-07-28 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change) 52452003-07-28 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
5083 5246
5084 * xfns.c (xic_set_preeditarea): Add the left fringe width to spot.x. 5247 * xfns.c (xic_set_preeditarea): Add the left fringe width to spot.x.
5085 5248
@@ -5307,7 +5470,7 @@
5307 5470
5308 * alloc.c (Fgarbage_collect): Doc fix. 5471 * alloc.c (Fgarbage_collect): Doc fix.
5309 5472
53102003-07-07 Nozomu Ando <nand@mac.com> (tiny change) 54732003-07-07 Nozomu Ando <nand@mac.com>
5311 5474
5312 * buffer.c (Fkill_buffer): Clear charpos cache if necessary. 5475 * buffer.c (Fkill_buffer): Clear charpos cache if necessary.
5313 5476
@@ -6517,7 +6680,7 @@
6517 * alloc.c (Fgarbage_collect): Cast pointers into specpdl 6680 * alloc.c (Fgarbage_collect): Cast pointers into specpdl
6518 to avoid GCC warning. 6681 to avoid GCC warning.
6519 6682
65202003-05-16 Ralph Schleicher <rs@nunatak.allgaeu.org> (tiny change) 66832003-05-16 Ralph Schleicher <rs@nunatak.allgaeu.org>
6521 6684
6522 * fileio.c (Fdelete_file): Handle symlinks pointing to directories. 6685 * fileio.c (Fdelete_file): Handle symlinks pointing to directories.
6523 6686
@@ -8240,7 +8403,7 @@
8240 (w32_init_class): Use it. 8403 (w32_init_class): Use it.
8241 (x_put_x_image): Declare all args. 8404 (x_put_x_image): Declare all args.
8242 8405
82432003-01-21 Richard Dawe <rich@phekda.freeserve.co.uk> (tiny change) 84062003-01-21 Richard Dawe <rich@phekda.freeserve.co.uk>
8244 8407
8245 * Makefile.in (ALL_CFLAGS): Include MYCPPFLAGS, not MYCPPFLAG. 8408 * Makefile.in (ALL_CFLAGS): Include MYCPPFLAGS, not MYCPPFLAG.
8246 8409
@@ -8612,7 +8775,7 @@
8612 in direct action cases for Qforward_char and Qbackward_char. 8775 in direct action cases for Qforward_char and Qbackward_char.
8613 Set already_adjusted so it won't be done twice. 8776 Set already_adjusted so it won't be done twice.
8614 8777
86152002-12-30 Richard Dawe <rich@phekda.freeserve.co.uk> (tiny change) 87782002-12-30 Richard Dawe <rich@phekda.freeserve.co.uk>
8616 8779
8617 * src/config.in (!HAVE_SIZE_T): Fix order of arguments in 8780 * src/config.in (!HAVE_SIZE_T): Fix order of arguments in
8618 type definition of size_t. 8781 type definition of size_t.
@@ -8710,7 +8873,7 @@
8710 * dired.c (file_name_completion): Fix that change. 8873 * dired.c (file_name_completion): Fix that change.
8711 Delete special quit-handling code; just use QUIT. 8874 Delete special quit-handling code; just use QUIT.
8712 8875
87132002-12-21 Tak Ota <Takaaki.Ota@am.sony.com> (tiny change) 88762002-12-21 Tak Ota <Takaaki.Ota@am.sony.com>
8714 8877
8715 * dired.c (file_name_completion): Close directory on error 8878 * dired.c (file_name_completion): Close directory on error
8716 just as in directory_files_internal. 8879 just as in directory_files_internal.
@@ -10050,8 +10213,8 @@
10050 10213
100512002-08-26 Kim F. Storm <storm@cua.dk> 102142002-08-26 Kim F. Storm <storm@cua.dk>
10052 10215
10053 * frame.c (make_terminal_frame) [CANNOT_DUMP]: Initialize foreground 10216 * frame.c (make_terminal_frame) [CANNOT_DUMP]: Initialize
10054 and background colors. From Joe Buehler (tiny change). 10217 foreground and background colors. From Joe Buehler.
10055 10218
100562002-08-26 Miles Bader <miles@gnu.org> 102192002-08-26 Miles Bader <miles@gnu.org>
10057 10220
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index 91fcdd1c899..a9465058194 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -6,25 +6,25 @@
6 6
71999-12-31 William M. Perry <wmperry@aventail.com> 71999-12-31 William M. Perry <wmperry@aventail.com>
8 8
9 * xfns.c (jpeg_format): Added the :data keyword 9 * xfns.c (jpeg_format): Add the :data keyword
10 (jpeg_image_p): JPEG is valid with :file _or_ :data 10 (jpeg_image_p): JPEG is valid with :file _or_ :data
11 (jpeg_memory_src): Defined new JPEG image source to read from a 11 (jpeg_memory_src): Define new JPEG image source to read from a
12 memory buffer. 12 memory buffer.
13 (jpeg_load): Pay attention to the :data keyword if specified. 13 (jpeg_load): Pay attention to the :data keyword if specified.
14 Instantiates a jpeg_memory_src instead of jpeg_stdio_src if found. 14 Instantiates a jpeg_memory_src instead of jpeg_stdio_src if found.
15 (png_format): Added the :data keyword 15 (png_format): Add the :data keyword
16 (png_image_p): PNG is valid with :file _or_ :data 16 (png_image_p): PNG is valid with :file _or_ :data
17 (png_read_from_memory): New PNG read function to read from a 17 (png_read_from_memory): New PNG read function to read from a
18 memory buffer. 18 memory buffer.
19 (png_load): Pay attention to the :data keyword if specified. 19 (png_load): Pay attention to the :data keyword if specified.
20 Use png_set_read_fn() instead of png_init_io() if specified. 20 Use png_set_read_fn() instead of png_init_io() if specified.
21 (tiff_format): Added the :data keyword for TIFF images. 21 (tiff_format): Add the :data keyword for TIFF images.
22 (tiff_image_p): TIFF is valid with :file _or_ :data 22 (tiff_image_p): TIFF is valid with :file _or_ :data
23 (tiff_read_from_memory): Defined new TIFF I/O functions to read 23 (tiff_read_from_memory): Define new TIFF I/O functions to read
24 from a memory buffer. 24 from a memory buffer.
25 (tiff_load): Pay attention to the :data keyword if specified. 25 (tiff_load): Pay attention to the :data keyword if specified.
26 Uses TIFFClientOpen() instead of TIFFOpen() if specified. 26 Uses TIFFClientOpen() instead of TIFFOpen() if specified.
27 (gif_format): Added the :data keyword 27 (gif_format): Add the :data keyword
28 (gif_image_p): GIF is valid with :file _or_ :data 28 (gif_image_p): GIF is valid with :file _or_ :data
29 (gif_read_from_memory): New GIF input function to read from a 29 (gif_read_from_memory): New GIF input function to read from a
30 memory buffer. 30 memory buffer.
diff --git a/src/Makefile.in b/src/Makefile.in
index 80789a99e39..5d6112c8fec 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1034,7 +1034,7 @@ callint.o: callint.c window.h commands.h buffer.h keymap.h \
1034 keyboard.h dispextern.h $(config_h) 1034 keyboard.h dispextern.h $(config_h)
1035callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \ 1035callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \
1036 process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \ 1036 process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
1037 composite.h w32.h 1037 composite.h w32.h blockinput.h atimer.h systime.h
1038casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \ 1038casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
1039 composite.h \ 1039 composite.h \
1040 charset.h keymap.h $(config_h) 1040 charset.h keymap.h $(config_h)
diff --git a/src/atimer.c b/src/atimer.c
index 9ec0238ff28..7410cad0244 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -397,7 +397,8 @@ alarm_signal_handler (signo)
397 EMACS_GET_TIME (now); 397 EMACS_GET_TIME (now);
398 } 398 }
399 399
400 set_alarm (); 400 if (! pending_atimers)
401 set_alarm ();
401} 402}
402 403
403 404
diff --git a/src/callproc.c b/src/callproc.c
index ba81f426dae..623509ce199 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -83,6 +83,7 @@ extern int errno;
83#include "process.h" 83#include "process.h"
84#include "syssignal.h" 84#include "syssignal.h"
85#include "systty.h" 85#include "systty.h"
86#include "blockinput.h"
86 87
87#ifdef MSDOS 88#ifdef MSDOS
88#include "msdos.h" 89#include "msdos.h"
@@ -620,6 +621,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
620 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 621 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
621 0, current_dir); 622 0, current_dir);
622#else /* not WINDOWSNT */ 623#else /* not WINDOWSNT */
624 BLOCK_INPUT;
625
623 pid = vfork (); 626 pid = vfork ();
624 627
625 if (pid == 0) 628 if (pid == 0)
@@ -637,6 +640,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
637 child_setup (filefd, fd1, fd_error, (char **) new_argv, 640 child_setup (filefd, fd1, fd_error, (char **) new_argv,
638 0, current_dir); 641 0, current_dir);
639 } 642 }
643
644 UNBLOCK_INPUT;
640#endif /* not WINDOWSNT */ 645#endif /* not WINDOWSNT */
641 646
642 /* The MSDOS case did this already. */ 647 /* The MSDOS case did this already. */
diff --git a/src/config.in b/src/config.in
index 136f4ecd55d..0fb9126b470 100644
--- a/src/config.in
+++ b/src/config.in
@@ -217,6 +217,15 @@ Boston, MA 02111-1307, USA. */
217/* Define to 1 if using GTK. */ 217/* Define to 1 if using GTK. */
218#undef HAVE_GTK 218#undef HAVE_GTK
219 219
220/* Define to 1 if GTK has both file selection and chooser dialog. */
221#undef HAVE_GTK_FILE_BOTH
222
223/* Define to 1 if you have the `gtk_file_chooser_dialog_new' function. */
224#undef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
225
226/* Define to 1 if you have the `gtk_file_selection_new' function. */
227#undef HAVE_GTK_FILE_SELECTION_NEW
228
220/* Define to 1 if GTK can handle more than one display. */ 229/* Define to 1 if GTK can handle more than one display. */
221#undef HAVE_GTK_MULTIDISPLAY 230#undef HAVE_GTK_MULTIDISPLAY
222 231
diff --git a/src/dispnew.c b/src/dispnew.c
index 657a8e87b95..814a3095ddf 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -579,7 +579,7 @@ margin_glyphs_to_reserve (w, total_glyphs, margin)
579 int width = XFASTINT (w->total_cols); 579 int width = XFASTINT (w->total_cols);
580 double d = max (0, XFLOATINT (margin)); 580 double d = max (0, XFLOATINT (margin));
581 d = min (width / 2 - 1, d); 581 d = min (width / 2 - 1, d);
582 n = (int) ((double) total_glyphs / width * d) * w->ncols_scale_factor; 582 n = (int) ((double) total_glyphs / width * d);
583 } 583 }
584 else 584 else
585 n = 0; 585 n = 0;
diff --git a/src/editfns.c b/src/editfns.c
index e1482936fe5..f6e3a4bb357 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3168,11 +3168,14 @@ static int message_length;
3168 3168
3169DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, 3169DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
3170 doc: /* Print a one-line message at the bottom of the screen. 3170 doc: /* Print a one-line message at the bottom of the screen.
3171The message also goes into the `*Messages*' buffer.
3172\(In keyboard macros, that's all it does.)
3173
3171The first argument is a format control string, and the rest are data 3174The first argument is a format control string, and the rest are data
3172to be formatted under control of the string. See `format' for details. 3175to be formatted under control of the string. See `format' for details.
3173 3176
3174If the first argument is nil, clear any existing message; let the 3177If the first argument is nil, the function clears any existing message;
3175minibuffer contents show. 3178this lets the minibuffer contents show. See also `current-message'.
3176 3179
3177usage: (message STRING &rest ARGS) */) 3180usage: (message STRING &rest ARGS) */)
3178 (nargs, args) 3181 (nargs, args)
diff --git a/src/emacs.c b/src/emacs.c
index 98572d7e6dc..5e583137dae 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -305,7 +305,6 @@ Display options:\n\
305--fullscreen, -fs make first frame fullscreen\n\ 305--fullscreen, -fs make first frame fullscreen\n\
306--fullwidth, -fw make the first frame wide as the screen\n\ 306--fullwidth, -fw make the first frame wide as the screen\n\
307--geometry, -g GEOMETRY window geometry\n\ 307--geometry, -g GEOMETRY window geometry\n\
308--horizontal-scroll-bars, -hb enable horizontal scroll bars\n\
309--icon-type, -i use picture of gnu for Emacs icon\n\ 308--icon-type, -i use picture of gnu for Emacs icon\n\
310--iconic start Emacs in iconified state\n\ 309--iconic start Emacs in iconified state\n\
311--internal-border, -ib WIDTH width between text and main border\n\ 310--internal-border, -ib WIDTH width between text and main border\n\
diff --git a/src/eval.c b/src/eval.c
index ee74215b2ee..5fb35cee58b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -540,21 +540,45 @@ usage: (function ARG) */)
540 540
541 541
542DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, 542DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
543 doc: /* Return t if function in which this appears was called interactively. 543 doc: /* Return t if the function was run directly by user input.
544This means that the function was called with call-interactively (which 544This means that the function was called with call-interactively (which
545includes being called as the binding of a key) 545includes being called as the binding of a key)
546and input is currently coming from the keyboard (not in keyboard macro). */) 546and input is currently coming from the keyboard (not in keyboard macro),
547and Emacs is not running in batch mode (`noninteractive' is nil).
548
549The only known proper use of `interactive-p' is in deciding whether to
550display a helpful message, or how to display it. If you're thinking
551of using it for any other purpose, it is quite likely that you're
552making a mistake. Think: what do you want to do when the command is
553called from a keyboard macro?
554
555If you want to test whether your function was called with
556`call-interactively', the way to do that is by adding an extra
557optional argument, and making the `interactive' spec specify non-nil
558unconditionally for that argument. (`p' is a good way to do this.) */)
547 () 559 ()
548{ 560{
549 return interactive_p (1) ? Qt : Qnil; 561 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
550} 562}
551 563
552 564
553/* Return 1 if function in which this appears was called 565DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 0, 0,
554 interactively. This means that the function was called with 566 doc: /* Return t if the function using this was called with call-interactively.
555 call-interactively (which includes being called as the binding of 567This is used for implementing advice and other function-modifying
556 a key) and input is currently coming from the keyboard (not in 568features of Emacs.
557 keyboard macro). 569
570The cleanest way to test whether your function was called with
571`call-interactively', the way to do that is by adding an extra
572optional argument, and making the `interactive' spec specify non-nil
573unconditionally for that argument. (`p' is a good way to do this.) */)
574 ()
575{
576 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
577}
578
579
580/* Return 1 if function in which this appears was called using
581 call-interactively.
558 582
559 EXCLUDE_SUBRS_P non-zero means always return 0 if the function 583 EXCLUDE_SUBRS_P non-zero means always return 0 if the function
560 called is a built-in. */ 584 called is a built-in. */
@@ -566,9 +590,6 @@ interactive_p (exclude_subrs_p)
566 struct backtrace *btp; 590 struct backtrace *btp;
567 Lisp_Object fun; 591 Lisp_Object fun;
568 592
569 if (!INTERACTIVE)
570 return 0;
571
572 btp = backtrace_list; 593 btp = backtrace_list;
573 594
574 /* If this isn't a byte-compiled function, there may be a frame at 595 /* If this isn't a byte-compiled function, there may be a frame at
@@ -1975,7 +1996,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1975 struct backtrace backtrace; 1996 struct backtrace backtrace;
1976 struct gcpro gcpro1, gcpro2, gcpro3; 1997 struct gcpro gcpro1, gcpro2, gcpro3;
1977 1998
1978 if (handling_signal) 1999 if (handling_signal || INPUT_BLOCKED_P)
1979 abort (); 2000 abort ();
1980 2001
1981 if (SYMBOLP (form)) 2002 if (SYMBOLP (form))
@@ -3449,6 +3470,7 @@ The value the function returns is not used. */);
3449 defsubr (&Scondition_case); 3470 defsubr (&Scondition_case);
3450 defsubr (&Ssignal); 3471 defsubr (&Ssignal);
3451 defsubr (&Sinteractive_p); 3472 defsubr (&Sinteractive_p);
3473 defsubr (&Scalled_interactively_p);
3452 defsubr (&Scommandp); 3474 defsubr (&Scommandp);
3453 defsubr (&Sautoload); 3475 defsubr (&Sautoload);
3454 defsubr (&Seval); 3476 defsubr (&Seval);
diff --git a/src/fileio.c b/src/fileio.c
index ce05ef1a5ea..83c0866cf06 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6237,7 +6237,8 @@ and `read-file-name-function'. */)
6237 } 6237 }
6238 if (!NILP(default_filename)) 6238 if (!NILP(default_filename))
6239 default_filename = Fexpand_file_name (default_filename, dir); 6239 default_filename = Fexpand_file_name (default_filename, dir);
6240 val = Fx_file_dialog (prompt, dir, default_filename, mustmatch); 6240 val = Fx_file_dialog (prompt, dir, default_filename, mustmatch,
6241 EQ (predicate, Qfile_directory_p) ? Qt : Qnil);
6241 add_to_history = 1; 6242 add_to_history = 1;
6242 } 6243 }
6243 else 6244 else
diff --git a/src/fontset.c b/src/fontset.c
index a8bab6897d6..52d3cc555c5 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1076,7 +1076,7 @@ fontset_pattern_regexp (pattern)
1076 { 1076 {
1077 if (*p0 == '-') 1077 if (*p0 == '-')
1078 ndashes++; 1078 ndashes++;
1079 else if (*p0 == '*') 1079 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
1080 nstars++; 1080 nstars++;
1081 } 1081 }
1082 1082
@@ -1091,7 +1091,7 @@ fontset_pattern_regexp (pattern)
1091 *p1++ = '^'; 1091 *p1++ = '^';
1092 for (p0 = (char *) SDATA (pattern); *p0; p0++) 1092 for (p0 = (char *) SDATA (pattern); *p0; p0++)
1093 { 1093 {
1094 if (*p0 == '*') 1094 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
1095 { 1095 {
1096 if (ndashes < 14) 1096 if (ndashes < 14)
1097 *p1++ = '.'; 1097 *p1++ = '.';
diff --git a/src/gtkutil.c b/src/gtkutil.c
index dc091c1a09b..e1331891140 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1118,6 +1118,10 @@ create_dialog (wv, select_cb, deactivate_cb)
1118} 1118}
1119 1119
1120 1120
1121
1122/***********************************************************************
1123 File dialog functions
1124 ***********************************************************************/
1121enum 1125enum
1122{ 1126{
1123 XG_FILE_NOT_DONE, 1127 XG_FILE_NOT_DONE,
@@ -1126,6 +1130,69 @@ enum
1126 XG_FILE_DESTROYED, 1130 XG_FILE_DESTROYED,
1127}; 1131};
1128 1132
1133#ifdef HAVE_GTK_FILE_BOTH
1134static int use_old_gtk_file_dialog;
1135#endif
1136
1137
1138#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
1139/* Read a file name from the user using a file chooser dialog.
1140 F is the current frame.
1141 PROMPT is a prompt to show to the user. May not be NULL.
1142 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1143 If MUSTMATCH_P is non-zero, the returned file name must be an existing
1144 file.
1145
1146 Returns a file name or NULL if no file was selected.
1147 The returned string must be freed by the caller. */
1148
1149static char *
1150xg_get_file_with_chooser (f, prompt, default_filename, mustmatch_p, only_dir_p)
1151 FRAME_PTR f;
1152 char *prompt;
1153 char *default_filename;
1154 int mustmatch_p, only_dir_p;
1155{
1156 GtkWidget *filewin;
1157 GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
1158
1159 char *fn = 0;
1160 GtkFileChooserAction action = (mustmatch_p ?
1161 GTK_FILE_CHOOSER_ACTION_OPEN :
1162 GTK_FILE_CHOOSER_ACTION_SAVE);
1163
1164 if (only_dir_p)
1165 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
1166
1167 filewin = gtk_file_chooser_dialog_new (prompt, gwin, action,
1168 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1169 (mustmatch_p || only_dir_p ?
1170 GTK_STOCK_OPEN : GTK_STOCK_OK),
1171 GTK_RESPONSE_OK,
1172 NULL);
1173
1174 xg_set_screen (filewin, f);
1175 gtk_widget_set_name (filewin, "emacs-filedialog");
1176 gtk_window_set_transient_for (GTK_WINDOW (filewin), gwin);
1177 gtk_window_set_destroy_with_parent (GTK_WINDOW (filewin), TRUE);
1178
1179
1180 if (default_filename)
1181 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
1182 default_filename);
1183
1184 gtk_widget_show (filewin);
1185
1186 if (gtk_dialog_run (GTK_DIALOG (filewin)) == GTK_RESPONSE_OK)
1187 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filewin));
1188
1189 gtk_widget_destroy (filewin);
1190
1191 return fn;
1192}
1193#endif /* HAVE_GTK_FILE_CHOOSER_DIALOG_NEW */
1194
1195#ifdef HAVE_GTK_FILE_SELECTION_NEW
1129/* Callback function invoked when the Ok button is pressed in 1196/* Callback function invoked when the Ok button is pressed in
1130 a file dialog. 1197 a file dialog.
1131 W is the file dialog widget, 1198 W is the file dialog widget,
@@ -1167,7 +1234,7 @@ xg_file_sel_destroy (w, arg)
1167 *(int*)arg = XG_FILE_DESTROYED; 1234 *(int*)arg = XG_FILE_DESTROYED;
1168} 1235}
1169 1236
1170/* Read a file name from the user using a file dialog. 1237/* Read a file name from the user using a file selection dialog.
1171 F is the current frame. 1238 F is the current frame.
1172 PROMPT is a prompt to show to the user. May not be NULL. 1239 PROMPT is a prompt to show to the user. May not be NULL.
1173 DEFAULT_FILENAME is a default selection to be displayed. May be NULL. 1240 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
@@ -1177,12 +1244,13 @@ xg_file_sel_destroy (w, arg)
1177 Returns a file name or NULL if no file was selected. 1244 Returns a file name or NULL if no file was selected.
1178 The returned string must be freed by the caller. */ 1245 The returned string must be freed by the caller. */
1179 1246
1180char * 1247static char *
1181xg_get_file_name (f, prompt, default_filename, mustmatch_p) 1248xg_get_file_with_selection (f, prompt, default_filename,
1249 mustmatch_p, only_dir_p)
1182 FRAME_PTR f; 1250 FRAME_PTR f;
1183 char *prompt; 1251 char *prompt;
1184 char *default_filename; 1252 char *default_filename;
1185 int mustmatch_p; 1253 int mustmatch_p, only_dir_p;
1186{ 1254{
1187 GtkWidget *filewin; 1255 GtkWidget *filewin;
1188 GtkFileSelection *filesel; 1256 GtkFileSelection *filesel;
@@ -1193,9 +1261,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p)
1193 filesel = GTK_FILE_SELECTION (filewin); 1261 filesel = GTK_FILE_SELECTION (filewin);
1194 1262
1195 xg_set_screen (filewin, f); 1263 xg_set_screen (filewin, f);
1196
1197 gtk_widget_set_name (filewin, "emacs-filedialog"); 1264 gtk_widget_set_name (filewin, "emacs-filedialog");
1198
1199 gtk_window_set_transient_for (GTK_WINDOW (filewin), 1265 gtk_window_set_transient_for (GTK_WINDOW (filewin),
1200 GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); 1266 GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
1201 gtk_window_set_destroy_with_parent (GTK_WINDOW (filewin), TRUE); 1267 gtk_window_set_destroy_with_parent (GTK_WINDOW (filewin), TRUE);
@@ -1237,6 +1303,49 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p)
1237 1303
1238 return fn; 1304 return fn;
1239} 1305}
1306#endif /* HAVE_GTK_FILE_SELECTION_NEW */
1307
1308/* Read a file name from the user using a file dialog, either the old
1309 file selection dialog, or the new file chooser dialog. Which to use
1310 depends on what the GTK version used has, and what the value of
1311 gtk-use-old-file-dialog.
1312 F is the current frame.
1313 PROMPT is a prompt to show to the user. May not be NULL.
1314 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1315 If MUSTMATCH_P is non-zero, the returned file name must be an existing
1316 file.
1317
1318 Returns a file name or NULL if no file was selected.
1319 The returned string must be freed by the caller. */
1320
1321char *
1322xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p)
1323 FRAME_PTR f;
1324 char *prompt;
1325 char *default_filename;
1326 int mustmatch_p, only_dir_p;
1327{
1328#ifdef HAVE_GTK_FILE_BOTH
1329 if (use_old_gtk_file_dialog)
1330 return xg_get_file_with_selection (f, prompt, default_filename,
1331 mustmatch_p, only_dir_p);
1332 return xg_get_file_with_chooser (f, prompt, default_filename,
1333 mustmatch_p, only_dir_p);
1334
1335#else /* not HAVE_GTK_FILE_BOTH */
1336
1337#ifdef HAVE_GTK_FILE_SELECTION_DIALOG_NEW
1338 return xg_get_file_with_selection (f, prompt, default_filename,
1339 mustmatch_p, only_dir_p);
1340#endif
1341#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
1342 return xg_get_file_with_chooser (f, prompt, default_filename,
1343 mustmatch_p, only_dir_p);
1344#endif
1345
1346#endif /* HAVE_GTK_FILE_BOTH */
1347 return 0;
1348}
1240 1349
1241 1350
1242/*********************************************************************** 1351/***********************************************************************
@@ -3429,6 +3538,14 @@ xg_initialize ()
3429 "gtk-key-theme-name", 3538 "gtk-key-theme-name",
3430 "Emacs", 3539 "Emacs",
3431 EMACS_CLASS); 3540 EMACS_CLASS);
3541
3542#ifdef HAVE_GTK_FILE_BOTH
3543 DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
3544 doc: /* *Non-nil means that the old GTK file selection dialog is used.
3545 If nil the new GTK file chooser is used instead. To turn off
3546 all file dialogs set the variable `use-file-dialog'. */);
3547 use_old_gtk_file_dialog = 0;
3548#endif
3432} 3549}
3433 3550
3434#endif /* USE_GTK */ 3551#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index c0055f361cc..b2e2c5f2fff 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -132,7 +132,8 @@ extern void free_widget_value P_ ((widget_value *));
132extern char *xg_get_file_name P_ ((FRAME_PTR f, 132extern char *xg_get_file_name P_ ((FRAME_PTR f,
133 char *prompt, 133 char *prompt,
134 char *default_filename, 134 char *default_filename,
135 int mustmatch_p)); 135 int mustmatch_p,
136 int only_dir_p));
136 137
137extern GtkWidget *xg_create_widget P_ ((char *type, 138extern GtkWidget *xg_create_widget P_ ((char *type,
138 char *name, 139 char *name,
diff --git a/src/indent.c b/src/indent.c
index 9ac4027af36..874662cc47c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1883,7 +1883,7 @@ vmotion (from, vtarget, w)
1883 struct position pos; 1883 struct position pos;
1884 /* vpos is cumulative vertical position, changed as from is changed */ 1884 /* vpos is cumulative vertical position, changed as from is changed */
1885 register int vpos = 0; 1885 register int vpos = 0;
1886 Lisp_Object prevline; 1886 int prevline;
1887 register int first; 1887 register int first;
1888 int from_byte; 1888 int from_byte;
1889 int lmargin = hscroll > 0 ? 1 - hscroll : 0; 1889 int lmargin = hscroll > 0 ? 1 - hscroll : 0;
@@ -1917,23 +1917,21 @@ vmotion (from, vtarget, w)
1917 { 1917 {
1918 Lisp_Object propval; 1918 Lisp_Object propval;
1919 1919
1920 XSETFASTINT (prevline, find_next_newline_no_quit (from - 1, -1)); 1920 prevline = find_next_newline_no_quit (from - 1, -1);
1921 while (XFASTINT (prevline) > BEGV 1921 while (prevline > BEGV
1922 && ((selective > 0 1922 && ((selective > 0
1923 && indented_beyond_p (XFASTINT (prevline), 1923 && indented_beyond_p (prevline,
1924 CHAR_TO_BYTE (XFASTINT (prevline)), 1924 CHAR_TO_BYTE (prevline),
1925 (double) selective)) /* iftc */ 1925 (double) selective)) /* iftc */
1926 /* watch out for newlines with `invisible' property */ 1926 /* Watch out for newlines with `invisible' property.
1927 || (propval = Fget_char_property (prevline, 1927 When moving upward, check the newline before. */
1928 || (propval = Fget_char_property (make_number (prevline - 1),
1928 Qinvisible, 1929 Qinvisible,
1929 text_prop_object), 1930 text_prop_object),
1930 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1931 TEXT_PROP_MEANS_INVISIBLE (propval))))
1931 XSETFASTINT (prevline, 1932 prevline = find_next_newline_no_quit (prevline - 1, -1);
1932 find_next_newline_no_quit (XFASTINT (prevline) - 1, 1933 pos = *compute_motion (prevline, 0,
1933 -1)); 1934 lmargin + (prevline == BEG ? start_hpos : 0),
1934 pos = *compute_motion (XFASTINT (prevline), 0,
1935 lmargin + (XFASTINT (prevline) == BEG
1936 ? start_hpos : 0),
1937 0, 1935 0,
1938 from, 1936 from,
1939 /* Don't care for VPOS... */ 1937 /* Don't care for VPOS... */
@@ -1944,12 +1942,11 @@ vmotion (from, vtarget, w)
1944 /* This compensates for start_hpos 1942 /* This compensates for start_hpos
1945 so that a tab as first character 1943 so that a tab as first character
1946 still occupies 8 columns. */ 1944 still occupies 8 columns. */
1947 (XFASTINT (prevline) == BEG 1945 (prevline == BEG ? -start_hpos : 0),
1948 ? -start_hpos : 0),
1949 w); 1946 w);
1950 vpos -= pos.vpos; 1947 vpos -= pos.vpos;
1951 first = 0; 1948 first = 0;
1952 from = XFASTINT (prevline); 1949 from = prevline;
1953 } 1950 }
1954 1951
1955 /* If we made exactly the desired vertical distance, 1952 /* If we made exactly the desired vertical distance,
@@ -1977,21 +1974,21 @@ vmotion (from, vtarget, w)
1977 { 1974 {
1978 Lisp_Object propval; 1975 Lisp_Object propval;
1979 1976
1980 XSETFASTINT (prevline, find_next_newline_no_quit (from, -1)); 1977 prevline = find_next_newline_no_quit (from, -1);
1981 while (XFASTINT (prevline) > BEGV 1978 while (prevline > BEGV
1982 && ((selective > 0 1979 && ((selective > 0
1983 && indented_beyond_p (XFASTINT (prevline), 1980 && indented_beyond_p (prevline,
1984 CHAR_TO_BYTE (XFASTINT (prevline)), 1981 CHAR_TO_BYTE (prevline),
1985 (double) selective)) /* iftc */ 1982 (double) selective)) /* iftc */
1986 /* watch out for newlines with `invisible' property */ 1983 /* Watch out for newlines with `invisible' property.
1987 || (propval = Fget_char_property (prevline, Qinvisible, 1984 When moving downward, check the newline after. */
1985 || (propval = Fget_char_property (make_number (prevline),
1986 Qinvisible,
1988 text_prop_object), 1987 text_prop_object),
1989 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1988 TEXT_PROP_MEANS_INVISIBLE (propval))))
1990 XSETFASTINT (prevline, 1989 prevline = find_next_newline_no_quit (prevline - 1, -1);
1991 find_next_newline_no_quit (XFASTINT (prevline) - 1, 1990 pos = *compute_motion (prevline, 0,
1992 -1)); 1991 lmargin + (prevline == BEG
1993 pos = *compute_motion (XFASTINT (prevline), 0,
1994 lmargin + (XFASTINT (prevline) == BEG
1995 ? start_hpos : 0), 1992 ? start_hpos : 0),
1996 0, 1993 0,
1997 from, 1994 from,
@@ -2000,7 +1997,7 @@ vmotion (from, vtarget, w)
2000 /* ... nor HPOS. */ 1997 /* ... nor HPOS. */
2001 1 << (BITS_PER_SHORT - 1), 1998 1 << (BITS_PER_SHORT - 1),
2002 -1, hscroll, 1999 -1, hscroll,
2003 (XFASTINT (prevline) == BEG ? -start_hpos : 0), 2000 (prevline == BEG ? -start_hpos : 0),
2004 w); 2001 w);
2005 did_motion = 1; 2002 did_motion = 1;
2006 } 2003 }
diff --git a/src/insdel.c b/src/insdel.c
index 5a4dc5b64a8..4a97eab79ef 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1497,7 +1497,7 @@ adjust_after_insert (from, from_byte, to, to_byte, newlen)
1497 Z -= len; Z_BYTE -= len_byte; 1497 Z -= len; Z_BYTE -= len_byte;
1498 adjust_after_replace (from, from_byte, Qnil, newlen, len_byte); 1498 adjust_after_replace (from, from_byte, Qnil, newlen, len_byte);
1499} 1499}
1500 1500
1501/* Replace the text from character positions FROM to TO with NEW, 1501/* Replace the text from character positions FROM to TO with NEW,
1502 If PREPARE is nonzero, call prepare_to_modify_buffer. 1502 If PREPARE is nonzero, call prepare_to_modify_buffer.
1503 If INHERIT, the newly inserted text should inherit text properties 1503 If INHERIT, the newly inserted text should inherit text properties
@@ -1674,6 +1674,122 @@ replace_range (from, to, new, prepare, inherit, markers)
1674 update_compositions (from, GPT, CHECK_BORDER); 1674 update_compositions (from, GPT, CHECK_BORDER);
1675} 1675}
1676 1676
1677/* Replace the text from character positions FROM to TO with
1678 the text in INS of length INSCHARS.
1679 Keep the text properties that applied to the old characters
1680 (extending them to all the new chars if there are more new chars).
1681
1682 Note that this does not yet handle markers quite right.
1683
1684 If MARKERS is nonzero, relocate markers.
1685
1686 Unlike most functions at this level, never call
1687 prepare_to_modify_buffer and never call signal_after_change. */
1688
1689void
1690replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers)
1691 int from, from_byte, to, to_byte;
1692 char *ins;
1693 int inschars, insbytes, markers;
1694{
1695 int nbytes_del, nchars_del;
1696 Lisp_Object temp;
1697
1698 CHECK_MARKERS ();
1699
1700 nchars_del = to - from;
1701 nbytes_del = to_byte - from_byte;
1702
1703 if (nbytes_del <= 0 && insbytes == 0)
1704 return;
1705
1706 /* Make sure point-max won't overflow after this insertion. */
1707 XSETINT (temp, Z_BYTE - nbytes_del + insbytes);
1708 if (Z_BYTE - nbytes_del + insbytes != XINT (temp))
1709 error ("Maximum buffer size exceeded");
1710
1711 /* Make sure the gap is somewhere in or next to what we are deleting. */
1712 if (from > GPT)
1713 gap_right (from, from_byte);
1714 if (to < GPT)
1715 gap_left (to, to_byte, 0);
1716
1717 GAP_SIZE += nbytes_del;
1718 ZV -= nchars_del;
1719 Z -= nchars_del;
1720 ZV_BYTE -= nbytes_del;
1721 Z_BYTE -= nbytes_del;
1722 GPT = from;
1723 GPT_BYTE = from_byte;
1724 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1725
1726 if (GPT_BYTE < GPT)
1727 abort ();
1728
1729 if (GPT - BEG < BEG_UNCHANGED)
1730 BEG_UNCHANGED = GPT - BEG;
1731 if (Z - GPT < END_UNCHANGED)
1732 END_UNCHANGED = Z - GPT;
1733
1734 if (GAP_SIZE < insbytes)
1735 make_gap (insbytes - GAP_SIZE);
1736
1737 /* Copy the replacement text into the buffer. */
1738 bcopy (ins, GPT_ADDR, insbytes);
1739
1740#ifdef BYTE_COMBINING_DEBUG
1741 /* We have copied text into the gap, but we have not marked
1742 it as part of the buffer. So we can use the old FROM and FROM_BYTE
1743 here, for both the previous text and the following text.
1744 Meanwhile, GPT_ADDR does point to
1745 the text that has been stored by copy_text. */
1746 if (count_combining_before (GPT_ADDR, insbytes, from, from_byte)
1747 || count_combining_after (GPT_ADDR, insbytes, from, from_byte))
1748 abort ();
1749#endif
1750
1751 GAP_SIZE -= insbytes;
1752 GPT += inschars;
1753 ZV += inschars;
1754 Z += inschars;
1755 GPT_BYTE += insbytes;
1756 ZV_BYTE += insbytes;
1757 Z_BYTE += insbytes;
1758 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1759
1760 if (GPT_BYTE < GPT)
1761 abort ();
1762
1763 /* Adjust the overlay center as needed. This must be done after
1764 adjusting the markers that bound the overlays. */
1765 if (nchars_del != inschars)
1766 {
1767 adjust_overlays_for_insert (from, inschars);
1768 adjust_overlays_for_delete (from + inschars, nchars_del);
1769 }
1770
1771 /* Adjust markers for the deletion and the insertion. */
1772 if (markers
1773 && ! (nchars_del == 1 && inschars == 1))
1774 adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
1775 inschars, insbytes);
1776
1777 offset_intervals (current_buffer, from, inschars - nchars_del);
1778
1779 /* Relocate point as if it were a marker. */
1780 if (from < PT && nchars_del != inschars)
1781 adjust_point ((from + inschars - (PT < to ? PT : to)),
1782 (from_byte + insbytes
1783 - (PT_BYTE < to_byte ? PT_BYTE : to_byte)));
1784
1785 if (insbytes == 0)
1786 evaporate_overlays (from);
1787
1788 CHECK_MARKERS ();
1789
1790 MODIFF++;
1791}
1792
1677/* Delete characters in current buffer 1793/* Delete characters in current buffer
1678 from FROM up to (but not including) TO. 1794 from FROM up to (but not including) TO.
1679 If TO comes before FROM, we delete nothing. */ 1795 If TO comes before FROM, we delete nothing. */
diff --git a/src/lisp.h b/src/lisp.h
index 0ab02941c9b..19995c58f54 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3165,7 +3165,7 @@ extern void syms_of_xfns P_ ((void));
3165#ifdef HAVE_WINDOW_SYSTEM 3165#ifdef HAVE_WINDOW_SYSTEM
3166/* Defined in xfns.c, w32fns.c, or macfns.c */ 3166/* Defined in xfns.c, w32fns.c, or macfns.c */
3167EXFUN (Fxw_display_color_p, 1); 3167EXFUN (Fxw_display_color_p, 1);
3168EXFUN (Fx_file_dialog, 4); 3168EXFUN (Fx_file_dialog, 5);
3169#endif /* HAVE_WINDOW_SYSTEM */ 3169#endif /* HAVE_WINDOW_SYSTEM */
3170 3170
3171/* Defined in xsmfns.c */ 3171/* Defined in xsmfns.c */
diff --git a/src/macfns.c b/src/macfns.c
index 88f975a65c8..401c7011fea 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4216,22 +4216,23 @@ Value is t if tooltip was open, nil otherwise. */)
4216 4216
4217extern Lisp_Object Qfile_name_history; 4217extern Lisp_Object Qfile_name_history;
4218 4218
4219DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, 4219DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
4220 doc: /* Read file name, prompting with PROMPT in directory DIR. 4220 doc: /* Read file name, prompting with PROMPT in directory DIR.
4221Use a file selection dialog. 4221Use a file selection dialog.
4222Select DEFAULT-FILENAME in the dialog's file selection box, if 4222Select DEFAULT-FILENAME in the dialog's file selection box, if
4223specified. Ensure that file exists if MUSTMATCH is non-nil. */) 4223specified. Ensure that file exists if MUSTMATCH is non-nil.
4224 (prompt, dir, default_filename, mustmatch) 4224If ONLY-DIR-P is non-nil, the user can only select directories. */)
4225 Lisp_Object prompt, dir, default_filename, mustmatch; 4225 (prompt, dir, default_filename, mustmatch, only_dir_p)
4226 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
4226{ 4227{
4227 struct frame *f = SELECTED_FRAME (); 4228 struct frame *f = SELECTED_FRAME ();
4228 Lisp_Object file = Qnil; 4229 Lisp_Object file = Qnil;
4229 int count = SPECPDL_INDEX (); 4230 int count = SPECPDL_INDEX ();
4230 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 4231 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
4231 char filename[1001]; 4232 char filename[1001];
4232 int default_filter_index = 1; /* 1: All Files, 2: Directories only */ 4233 int default_filter_index = 1; /* 1: All Files, 2: Directories only */
4233 4234
4234 GCPRO5 (prompt, dir, default_filename, mustmatch, file); 4235 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
4235 CHECK_STRING (prompt); 4236 CHECK_STRING (prompt);
4236 CHECK_STRING (dir); 4237 CHECK_STRING (dir);
4237 4238
@@ -4245,7 +4246,8 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4245 NavDialogRef dialogRef; 4246 NavDialogRef dialogRef;
4246 NavTypeListHandle fileTypes = NULL; 4247 NavTypeListHandle fileTypes = NULL;
4247 NavUserAction userAction; 4248 NavUserAction userAction;
4248 CFStringRef message=NULL, client=NULL, saveName = NULL; 4249 CFStringRef message=NULL, client=NULL, saveName = NULL, ok = NULL;
4250 CFStringRef title = NULL;
4249 4251
4250 BLOCK_INPUT; 4252 BLOCK_INPUT;
4251 /* No need for a callback function because we are modal */ 4253 /* No need for a callback function because we are modal */
@@ -4268,13 +4270,19 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4268 options.clientName = client; 4270 options.clientName = client;
4269 */ 4271 */
4270 4272
4271 /* Do Dired hack copied from w32fns.c */ 4273 if (!NILP (only_dir_p))
4272 if (!NILP(prompt) && strncmp (SDATA(prompt), "Dired", 5) == 0)
4273 status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL, 4274 status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL,
4274 &dialogRef); 4275 &dialogRef);
4275 else if (NILP (mustmatch)) 4276 else if (NILP (mustmatch))
4276 { 4277 {
4277 /* This is a save dialog */ 4278 /* This is a save dialog */
4279 ok = CFStringCreateWithCString (NULL, "Ok", kCFStringEncodingUTF8);
4280 title = CFStringCreateWithCString (NULL, "Enter name",
4281 kCFStringEncodingUTF8);
4282 options.optionFlags |= kNavDontConfirmReplacement;
4283 options.actionButtonLabel = ok;
4284 options.windowTitle = title;
4285
4278 if (!NILP(default_filename)) 4286 if (!NILP(default_filename))
4279 { 4287 {
4280 saveName = CFStringCreateWithCString(NULL, SDATA(default_filename), 4288 saveName = CFStringCreateWithCString(NULL, SDATA(default_filename),
@@ -4282,20 +4290,10 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4282 options.saveFileName = saveName; 4290 options.saveFileName = saveName;
4283 options.optionFlags |= kNavSelectDefaultLocation; 4291 options.optionFlags |= kNavSelectDefaultLocation;
4284 } 4292 }
4285 /* MAC_TODO: Find a better way to determine if this is a save
4286 or load dialog than comparing dir with default_filename */
4287 if (EQ(dir, default_filename))
4288 {
4289 status = NavCreateChooseFileDialog(&options, fileTypes,
4290 NULL, NULL, NULL, NULL,
4291 &dialogRef);
4292 }
4293 else {
4294 status = NavCreatePutFileDialog(&options, 4293 status = NavCreatePutFileDialog(&options,
4295 'TEXT', kNavGenericSignature, 4294 'TEXT', kNavGenericSignature,
4296 NULL, NULL, &dialogRef); 4295 NULL, NULL, &dialogRef);
4297 } 4296 }
4298 }
4299 else 4297 else
4300 { 4298 {
4301 /* This is an open dialog*/ 4299 /* This is an open dialog*/
@@ -4324,6 +4322,8 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4324 if (saveName) CFRelease(saveName); 4322 if (saveName) CFRelease(saveName);
4325 if (client) CFRelease(client); 4323 if (client) CFRelease(client);
4326 if (message) CFRelease(message); 4324 if (message) CFRelease(message);
4325 if (ok) CFRelease(ok);
4326 if (title) CFRelease(title);
4327 4327
4328 if (status == noErr) { 4328 if (status == noErr) {
4329 userAction = NavDialogGetUserAction(dialogRef); 4329 userAction = NavDialogGetUserAction(dialogRef);
diff --git a/src/macterm.c b/src/macterm.c
index 2d09a2e93e9..bc35ab21547 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -230,6 +230,10 @@ extern int errno;
230 230
231extern int extra_keyboard_modifiers; 231extern int extra_keyboard_modifiers;
232 232
233/* The keysyms to use for the various modifiers. */
234
235static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value;
236
233static Lisp_Object Qvendor_specific_keysyms; 237static Lisp_Object Qvendor_specific_keysyms;
234 238
235#if 0 239#if 0
@@ -7014,6 +7018,9 @@ Lisp_Object Qreverse;
7014/* True if using command key as meta key. */ 7018/* True if using command key as meta key. */
7015Lisp_Object Vmac_command_key_is_meta; 7019Lisp_Object Vmac_command_key_is_meta;
7016 7020
7021/* Modifier associated with the option key, or nil for normal behavior. */
7022Lisp_Object Vmac_option_modifier;
7023
7017/* True if the ctrl and meta keys should be reversed. */ 7024/* True if the ctrl and meta keys should be reversed. */
7018Lisp_Object Vmac_reverse_ctrl_meta; 7025Lisp_Object Vmac_reverse_ctrl_meta;
7019 7026
@@ -7095,6 +7102,12 @@ mac_to_emacs_modifiers (EventModifiers mods)
7095 result |= meta_modifier; 7102 result |= meta_modifier;
7096 if (NILP (Vmac_command_key_is_meta) && (mods & macAltKey)) 7103 if (NILP (Vmac_command_key_is_meta) && (mods & macAltKey))
7097 result |= alt_modifier; 7104 result |= alt_modifier;
7105 if (!NILP (Vmac_option_modifier) && (mods & optionKey)) {
7106 Lisp_Object val = Fget(Vmac_option_modifier, Qmodifier_value);
7107 if (!NILP(val))
7108 result |= XUINT(val);
7109 }
7110
7098 return result; 7111 return result;
7099} 7112}
7100 7113
@@ -8575,7 +8588,18 @@ XTread_socket (sd, expected, hold_quit)
8575 unsigned long some_state = 0; 8588 unsigned long some_state = 0;
8576 inev.code = KeyTranslate (kchr_ptr, new_keycode, 8589 inev.code = KeyTranslate (kchr_ptr, new_keycode,
8577 &some_state) & 0xff; 8590 &some_state) & 0xff;
8578 } 8591 } else if (!NILP(Vmac_option_modifier) && (er.modifiers & optionKey))
8592 {
8593 /* When using the option key as an emacs modifier, convert
8594 the pressed key code back to one without the Mac option
8595 modifier applied. */
8596 int new_modifiers = er.modifiers & ~optionKey;
8597 int new_keycode = keycode | new_modifiers;
8598 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
8599 unsigned long some_state = 0;
8600 inev.code = KeyTranslate (kchr_ptr, new_keycode,
8601 &some_state) & 0xff;
8602 }
8579 else 8603 else
8580 inev.code = er.message & charCodeMask; 8604 inev.code = er.message & charCodeMask;
8581 inev.kind = ASCII_KEYSTROKE_EVENT; 8605 inev.kind = ASCII_KEYSTROKE_EVENT;
@@ -9274,6 +9298,14 @@ syms_of_macterm ()
9274 x_error_message_string = Qnil; 9298 x_error_message_string = Qnil;
9275#endif 9299#endif
9276 9300
9301 Qmodifier_value = intern ("modifier-value");
9302 Qalt = intern ("alt");
9303 Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
9304 Qhyper = intern ("hyper");
9305 Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
9306 Qsuper = intern ("super");
9307 Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
9308
9277 Fprovide (intern ("mac-carbon"), Qnil); 9309 Fprovide (intern ("mac-carbon"), Qnil);
9278 9310
9279 staticpro (&Qreverse); 9311 staticpro (&Qreverse);
@@ -9330,6 +9362,12 @@ to 4.1, set this to nil. */);
9330Otherwise the option key is used. */); 9362Otherwise the option key is used. */);
9331 Vmac_command_key_is_meta = Qt; 9363 Vmac_command_key_is_meta = Qt;
9332 9364
9365 DEFVAR_LISP ("mac-option-modifier", &Vmac_option_modifier,
9366 doc: /* Modifier to use for the Mac alt/option key. The value can
9367be alt, hyper, or super for the respective modifier. If the value is
9368nil then the key will act as the normal Mac option modifier. */);
9369 Vmac_option_modifier = Qnil;
9370
9333 DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta, 9371 DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta,
9334 doc: /* Non-nil means that the control and meta keys are reversed. This is 9372 doc: /* Non-nil means that the control and meta keys are reversed. This is
9335 useful for non-standard keyboard layouts. */); 9373 useful for non-standard keyboard layouts. */);
diff --git a/src/process.c b/src/process.c
index 688f97dc199..76967cd7ac2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -310,6 +310,7 @@ static SELECT_TYPE non_keyboard_wait_mask;
310 310
311static SELECT_TYPE non_process_wait_mask; 311static SELECT_TYPE non_process_wait_mask;
312 312
313#ifdef NON_BLOCKING_CONNECT
313/* Mask of bits indicating the descriptors that we wait for connect to 314/* Mask of bits indicating the descriptors that we wait for connect to
314 complete on. Once they complete, they are removed from this mask 315 complete on. Once they complete, they are removed from this mask
315 and added to the input_wait_mask and non_keyboard_wait_mask. */ 316 and added to the input_wait_mask and non_keyboard_wait_mask. */
@@ -319,6 +320,11 @@ static SELECT_TYPE connect_wait_mask;
319/* Number of bits set in connect_wait_mask. */ 320/* Number of bits set in connect_wait_mask. */
320static int num_pending_connects; 321static int num_pending_connects;
321 322
323#define IF_NON_BLOCKING_CONNECT(s) s
324#else
325#define IF_NON_BLOCKING_CONNECT(s)
326#endif
327
322/* The largest descriptor currently in use for a process object. */ 328/* The largest descriptor currently in use for a process object. */
323static int max_process_desc; 329static int max_process_desc;
324 330
@@ -3673,12 +3679,14 @@ deactivate_process (proc)
3673 chan_process[inchannel] = Qnil; 3679 chan_process[inchannel] = Qnil;
3674 FD_CLR (inchannel, &input_wait_mask); 3680 FD_CLR (inchannel, &input_wait_mask);
3675 FD_CLR (inchannel, &non_keyboard_wait_mask); 3681 FD_CLR (inchannel, &non_keyboard_wait_mask);
3682#ifdef NON_BLOCKING_CONNECT
3676 if (FD_ISSET (inchannel, &connect_wait_mask)) 3683 if (FD_ISSET (inchannel, &connect_wait_mask))
3677 { 3684 {
3678 FD_CLR (inchannel, &connect_wait_mask); 3685 FD_CLR (inchannel, &connect_wait_mask);
3679 if (--num_pending_connects < 0) 3686 if (--num_pending_connects < 0)
3680 abort (); 3687 abort ();
3681 } 3688 }
3689#endif
3682 if (inchannel == max_process_desc) 3690 if (inchannel == max_process_desc)
3683 { 3691 {
3684 int i; 3692 int i;
@@ -4039,8 +4047,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4039{ 4047{
4040 register int channel, nfds; 4048 register int channel, nfds;
4041 SELECT_TYPE Available; 4049 SELECT_TYPE Available;
4050#ifdef NON_BLOCKING_CONNECT
4042 SELECT_TYPE Connecting; 4051 SELECT_TYPE Connecting;
4043 int check_connect, check_delay, no_avail; 4052 int check_connect;
4053#endif
4054 int check_delay, no_avail;
4044 int xerrno; 4055 int xerrno;
4045 Lisp_Object proc; 4056 Lisp_Object proc;
4046 EMACS_TIME timeout, end_time; 4057 EMACS_TIME timeout, end_time;
@@ -4051,7 +4062,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4051 int saved_waiting_for_user_input_p = waiting_for_user_input_p; 4062 int saved_waiting_for_user_input_p = waiting_for_user_input_p;
4052 4063
4053 FD_ZERO (&Available); 4064 FD_ZERO (&Available);
4065#ifdef NON_BLOCKING_CONNECT
4054 FD_ZERO (&Connecting); 4066 FD_ZERO (&Connecting);
4067#endif
4055 4068
4056 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4069 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4057 if (wait_proc != NULL) 4070 if (wait_proc != NULL)
@@ -4188,7 +4201,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4188 timeout to get our attention. */ 4201 timeout to get our attention. */
4189 if (update_tick != process_tick && do_display) 4202 if (update_tick != process_tick && do_display)
4190 { 4203 {
4191 SELECT_TYPE Atemp, Ctemp; 4204 SELECT_TYPE Atemp;
4205#ifdef NON_BLOCKING_CONNECT
4206 SELECT_TYPE Ctemp;
4207#endif
4192 4208
4193 Atemp = input_wait_mask; 4209 Atemp = input_wait_mask;
4194#if 0 4210#if 0
@@ -4200,11 +4216,16 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4200 */ 4216 */
4201 FD_CLR (0, &Atemp); 4217 FD_CLR (0, &Atemp);
4202#endif 4218#endif
4203 Ctemp = connect_wait_mask; 4219 IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
4220
4204 EMACS_SET_SECS_USECS (timeout, 0, 0); 4221 EMACS_SET_SECS_USECS (timeout, 0, 0);
4205 if ((select (max (max_process_desc, max_keyboard_desc) + 1, 4222 if ((select (max (max_process_desc, max_keyboard_desc) + 1,
4206 &Atemp, 4223 &Atemp,
4224#ifdef NON_BLOCKING_CONNECT
4207 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0), 4225 (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
4226#else
4227 (SELECT_TYPE *)0,
4228#endif
4208 (SELECT_TYPE *)0, &timeout) 4229 (SELECT_TYPE *)0, &timeout)
4209 <= 0)) 4230 <= 0))
4210 { 4231 {
@@ -4264,12 +4285,14 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4264 if (XINT (wait_proc->infd) < 0) /* Terminated */ 4285 if (XINT (wait_proc->infd) < 0) /* Terminated */
4265 break; 4286 break;
4266 FD_SET (XINT (wait_proc->infd), &Available); 4287 FD_SET (XINT (wait_proc->infd), &Available);
4267 check_connect = check_delay = 0; 4288 check_delay = 0;
4289 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4268 } 4290 }
4269 else if (!NILP (wait_for_cell)) 4291 else if (!NILP (wait_for_cell))
4270 { 4292 {
4271 Available = non_process_wait_mask; 4293 Available = non_process_wait_mask;
4272 check_connect = check_delay = 0; 4294 check_delay = 0;
4295 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4273 } 4296 }
4274 else 4297 else
4275 { 4298 {
@@ -4277,7 +4300,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4277 Available = non_keyboard_wait_mask; 4300 Available = non_keyboard_wait_mask;
4278 else 4301 else
4279 Available = input_wait_mask; 4302 Available = input_wait_mask;
4280 check_connect = (num_pending_connects > 0); 4303 IF_NON_BLOCKING_CONNECT (check_connect = (num_pending_connects > 0));
4281 check_delay = wait_channel >= 0 ? 0 : process_output_delay_count; 4304 check_delay = wait_channel >= 0 ? 0 : process_output_delay_count;
4282 } 4305 }
4283 4306
@@ -4302,8 +4325,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4302 } 4325 }
4303 else 4326 else
4304 { 4327 {
4328#ifdef NON_BLOCKING_CONNECT
4305 if (check_connect) 4329 if (check_connect)
4306 Connecting = connect_wait_mask; 4330 Connecting = connect_wait_mask;
4331#endif
4307 4332
4308#ifdef ADAPTIVE_READ_BUFFERING 4333#ifdef ADAPTIVE_READ_BUFFERING
4309 if (process_output_skip && check_delay > 0) 4334 if (process_output_skip && check_delay > 0)
@@ -4334,7 +4359,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4334 4359
4335 nfds = select (max (max_process_desc, max_keyboard_desc) + 1, 4360 nfds = select (max (max_process_desc, max_keyboard_desc) + 1,
4336 &Available, 4361 &Available,
4362#ifdef NON_BLOCKING_CONNECT
4337 (check_connect ? &Connecting : (SELECT_TYPE *)0), 4363 (check_connect ? &Connecting : (SELECT_TYPE *)0),
4364#else
4365 (SELECT_TYPE *)0,
4366#endif
4338 (SELECT_TYPE *)0, &timeout); 4367 (SELECT_TYPE *)0, &timeout);
4339 } 4368 }
4340 4369
@@ -4390,7 +4419,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4390 if (no_avail) 4419 if (no_avail)
4391 { 4420 {
4392 FD_ZERO (&Available); 4421 FD_ZERO (&Available);
4393 check_connect = 0; 4422 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4394 } 4423 }
4395 4424
4396#if defined(sun) && !defined(USG5_4) 4425#if defined(sun) && !defined(USG5_4)
@@ -6626,6 +6655,11 @@ init_process ()
6626 FD_ZERO (&non_process_wait_mask); 6655 FD_ZERO (&non_process_wait_mask);
6627 max_process_desc = 0; 6656 max_process_desc = 0;
6628 6657
6658#ifdef NON_BLOCKING_CONNECT
6659 FD_ZERO (&connect_wait_mask);
6660 num_pending_connects = 0;
6661#endif
6662
6629#ifdef ADAPTIVE_READ_BUFFERING 6663#ifdef ADAPTIVE_READ_BUFFERING
6630 process_output_delay_count = 0; 6664 process_output_delay_count = 0;
6631 process_output_skip = 0; 6665 process_output_skip = 0;
diff --git a/src/search.c b/src/search.c
index be2ea2bcd89..59539de8768 100644
--- a/src/search.c
+++ b/src/search.c
@@ -521,7 +521,7 @@ newline_cache_on_off (buf)
521 direction indicated by COUNT. 521 direction indicated by COUNT.
522 522
523 If we find COUNT instances, set *SHORTAGE to zero, and return the 523 If we find COUNT instances, set *SHORTAGE to zero, and return the
524 position after the COUNTth match. Note that for reverse motion 524 position past the COUNTth match. Note that for reverse motion
525 this is not the same as the usual convention for Emacs motion commands. 525 this is not the same as the usual convention for Emacs motion commands.
526 526
527 If we don't find COUNT instances before reaching END, set *SHORTAGE 527 If we don't find COUNT instances before reaching END, set *SHORTAGE
diff --git a/src/syntax.c b/src/syntax.c
index d68628b181c..b062264ac24 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3023,12 +3023,23 @@ do { prev_from = from; \
3023 INC_FROM; 3023 INC_FROM;
3024 code = prev_from_syntax & 0xff; 3024 code = prev_from_syntax & 0xff;
3025 3025
3026 if (code == Scomment) 3026 if (from < end
3027 && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
3028 && (c1 = FETCH_CHAR (from_byte),
3029 SYNTAX_COMSTART_SECOND (c1)))
3030 /* Duplicate code to avoid a complex if-expression
3031 which causes trouble for the SGI compiler. */
3027 { 3032 {
3028 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax); 3033 /* Record the comment style we have entered so that only
3029 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? 3034 the comment-end sequence of the same style actually
3030 1 : -1); 3035 terminates the comment section. */
3036 state.comstyle = SYNTAX_COMMENT_STYLE (c1);
3037 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
3038 comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
3039 state.incomment = comnested ? 1 : -1;
3031 state.comstr_start = prev_from; 3040 state.comstr_start = prev_from;
3041 INC_FROM;
3042 code = Scomment;
3032 } 3043 }
3033 else if (code == Scomment_fence) 3044 else if (code == Scomment_fence)
3034 { 3045 {
@@ -3040,24 +3051,13 @@ do { prev_from = from; \
3040 state.comstr_start = prev_from; 3051 state.comstr_start = prev_from;
3041 code = Scomment; 3052 code = Scomment;
3042 } 3053 }
3043 else if (from < end) 3054 else if (code == Scomment)
3044 if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) 3055 {
3045 if (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), 3056 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax);
3046 SYNTAX_COMSTART_SECOND (c1)) 3057 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ?
3047 /* Duplicate code to avoid a complex if-expression 3058 1 : -1);
3048 which causes trouble for the SGI compiler. */ 3059 state.comstr_start = prev_from;
3049 { 3060 }
3050 /* Record the comment style we have entered so that only
3051 the comment-end sequence of the same style actually
3052 terminates the comment section. */
3053 state.comstyle = SYNTAX_COMMENT_STYLE (c1);
3054 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
3055 comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
3056 state.incomment = comnested ? 1 : -1;
3057 state.comstr_start = prev_from;
3058 INC_FROM;
3059 code = Scomment;
3060 }
3061 3061
3062 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) 3062 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax))
3063 continue; 3063 continue;
diff --git a/src/w32fns.c b/src/w32fns.c
index e5a1ca00cc3..df6228b09b1 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5667,14 +5667,12 @@ w32_font_match (fontname, pattern)
5667 char * fontname; 5667 char * fontname;
5668 char * pattern; 5668 char * pattern;
5669{ 5669{
5670 char *font_name_copy;
5671 char *ptr; 5670 char *ptr;
5672 Lisp_Object encoded_font_name; 5671 char *font_name_copy;
5673 char *regex = alloca (strlen (pattern) * 2 + 3); 5672 char *regex = alloca (strlen (pattern) * 2 + 3);
5674 5673
5675 /* Convert fontname to unibyte for match. */ 5674 font_name_copy = alloca (strlen (fontname) + 1);
5676 encoded_font_name = string_make_unibyte (build_string (fontname)); 5675 strcpy (font_name_copy, fontname);
5677 font_name_copy = SDATA (encoded_font_name);
5678 5676
5679 ptr = regex; 5677 ptr = regex;
5680 *ptr++ = '^'; 5678 *ptr++ = '^';
@@ -5712,8 +5710,8 @@ w32_font_match (fontname, pattern)
5712 return FALSE; 5710 return FALSE;
5713 } 5711 }
5714 5712
5715 return (fast_c_string_match_ignore_case (build_string (regex), 5713 return (fast_string_match_ignore_case (build_string (regex),
5716 font_name_copy) >= 0); 5714 build_string(font_name_copy)) >= 0);
5717} 5715}
5718 5716
5719/* Callback functions, and a structure holding info they need, for 5717/* Callback functions, and a structure holding info they need, for
@@ -6459,7 +6457,7 @@ If omitted or nil, that stands for the selected frame's display. */)
6459} 6457}
6460 6458
6461DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 6459DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
6462 doc: /* Returns the vendor ID string of the W32 system (Microsoft). 6460 doc: /* Returns the "vendor ID" string of the W32 system (Microsoft).
6463The optional argument DISPLAY specifies which display to ask about. 6461The optional argument DISPLAY specifies which display to ask about.
6464DISPLAY should be either a frame or a display name (a string). 6462DISPLAY should be either a frame or a display name (a string).
6465If omitted or nil, that stands for the selected frame's display. */) 6463If omitted or nil, that stands for the selected frame's display. */)
@@ -6472,7 +6470,7 @@ If omitted or nil, that stands for the selected frame's display. */)
6472DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, 6470DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
6473 doc: /* Returns the version numbers of the server of DISPLAY. 6471 doc: /* Returns the version numbers of the server of DISPLAY.
6474The value is a list of three integers: the major and minor 6472The value is a list of three integers: the major and minor
6475version numbers, and the vendor-specific release 6473version numbers of the X Protocol in use, and the distributor-specific release
6476number. See also the function `x-server-vendor'. 6474number. See also the function `x-server-vendor'.
6477 6475
6478The optional argument DISPLAY specifies which display to ask about. 6476The optional argument DISPLAY specifies which display to ask about.
@@ -7803,23 +7801,24 @@ file_dialog_callback (hwnd, msg, wParam, lParam)
7803 return 0; 7801 return 0;
7804} 7802}
7805 7803
7806DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, 7804DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
7807 doc: /* Read file name, prompting with PROMPT in directory DIR. 7805 doc: /* Read file name, prompting with PROMPT in directory DIR.
7808Use a file selection dialog. 7806Use a file selection dialog.
7809Select DEFAULT-FILENAME in the dialog's file selection box, if 7807Select DEFAULT-FILENAME in the dialog's file selection box, if
7810specified. Ensure that file exists if MUSTMATCH is non-nil. */) 7808specified. Ensure that file exists if MUSTMATCH is non-nil.
7811 (prompt, dir, default_filename, mustmatch) 7809If ONLY-DIR-P is non-nil, the user can only select directories. */)
7812 Lisp_Object prompt, dir, default_filename, mustmatch; 7810 (prompt, dir, default_filename, mustmatch, only_dir_p)
7811 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
7813{ 7812{
7814 struct frame *f = SELECTED_FRAME (); 7813 struct frame *f = SELECTED_FRAME ();
7815 Lisp_Object file = Qnil; 7814 Lisp_Object file = Qnil;
7816 int count = SPECPDL_INDEX (); 7815 int count = SPECPDL_INDEX ();
7817 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 7816 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
7818 char filename[MAX_PATH + 1]; 7817 char filename[MAX_PATH + 1];
7819 char init_dir[MAX_PATH + 1]; 7818 char init_dir[MAX_PATH + 1];
7820 int default_filter_index = 1; /* 1: All Files, 2: Directories only */ 7819 int default_filter_index = 1; /* 1: All Files, 2: Directories only */
7821 7820
7822 GCPRO5 (prompt, dir, default_filename, mustmatch, file); 7821 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
7823 CHECK_STRING (prompt); 7822 CHECK_STRING (prompt);
7824 CHECK_STRING (dir); 7823 CHECK_STRING (dir);
7825 7824
@@ -7867,10 +7866,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
7867 file_details.lpstrInitialDir = init_dir; 7866 file_details.lpstrInitialDir = init_dir;
7868 file_details.lpstrTitle = SDATA (prompt); 7867 file_details.lpstrTitle = SDATA (prompt);
7869 7868
7870 /* If prompt starts with Dired, default to directories only. */ 7869 if (! NILP (only_dir_p))
7871 /* A bit hacky, but there doesn't seem to be a better way to
7872 DTRT for dired. */
7873 if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0)
7874 default_filter_index = 2; 7870 default_filter_index = 2;
7875 7871
7876 file_details.nFilterIndex = default_filter_index; 7872 file_details.nFilterIndex = default_filter_index;
diff --git a/src/w32term.c b/src/w32term.c
index a69552a2812..f50f5a49e8a 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2914,9 +2914,13 @@ x_scroll_run (w, run)
2914 /* If the dirty region is not what we expected, redraw the entire frame. */ 2914 /* If the dirty region is not what we expected, redraw the entire frame. */
2915 if (!EqualRgn (combined, expect_dirty)) 2915 if (!EqualRgn (combined, expect_dirty))
2916 SET_FRAME_GARBAGED (f); 2916 SET_FRAME_GARBAGED (f);
2917
2918 DeleteObject (dirty);
2919 DeleteObject (combined);
2917 } 2920 }
2918 2921
2919 UNBLOCK_INPUT; 2922 UNBLOCK_INPUT;
2923 DeleteObject (expect_dirty);
2920} 2924}
2921 2925
2922 2926
diff --git a/src/window.c b/src/window.c
index 2aa8bed7dbc..b6738457de4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4625,17 +4625,25 @@ window_scroll_pixel_based (window, n, whole, noerror)
4625 w->force_start = Qt; 4625 w->force_start = Qt;
4626 } 4626 }
4627 4627
4628 /* The rest of this function uses current_y in a nonstandard way,
4629 not including the height of the header line if any. */
4628 it.current_y = it.vpos = 0; 4630 it.current_y = it.vpos = 0;
4629 4631
4630 /* Preserve the screen position if we must. */ 4632 /* Preserve the screen position if we should. */
4631 if (preserve_y >= 0) 4633 if (preserve_y >= 0)
4632 { 4634 {
4635 /* If we have a header line, take account of it. */
4636 if (WINDOW_WANTS_HEADER_LINE_P (w))
4637 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4638
4633 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4639 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4634 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4640 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4635 } 4641 }
4636 else 4642 else
4637 { 4643 {
4638 /* Move PT out of scroll margins. */ 4644 /* Move PT out of scroll margins.
4645 This code wants current_y to be zero at the window start position
4646 even if there is a header line. */
4639 this_scroll_margin = max (0, scroll_margin); 4647 this_scroll_margin = max (0, scroll_margin);
4640 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); 4648 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
4641 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 4649 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
@@ -4990,17 +4998,17 @@ specifies the window to scroll. This takes precedence over
4990 return Qnil; 4998 return Qnil;
4991} 4999}
4992 5000
4993DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", 5001DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 2, "P\np",
4994 doc: /* Scroll selected window display ARG columns left. 5002 doc: /* Scroll selected window display ARG columns left.
4995Default for ARG is window width minus 2. 5003Default for ARG is window width minus 2.
4996Value is the total amount of leftward horizontal scrolling in 5004Value is the total amount of leftward horizontal scrolling in
4997effect after the change. 5005effect after the change.
4998If `automatic-hscrolling' is non-nil, the argument ARG modifies 5006If SET_MINIMUM is non-nil, the new scroll amount becomes the
4999a lower bound for automatic scrolling, i.e. automatic scrolling 5007lower bound for automatic scrolling, i.e. automatic scrolling
5000will not scroll a window to a column less than the value returned 5008will not scroll a window to a column less than the value returned
5001by this function. */) 5009by this function. This happens in an interactive call. */)
5002 (arg) 5010 (arg, set_minimum)
5003 register Lisp_Object arg; 5011 register Lisp_Object arg, set_minimum;
5004{ 5012{
5005 Lisp_Object result; 5013 Lisp_Object result;
5006 int hscroll; 5014 int hscroll;
@@ -5014,23 +5022,23 @@ by this function. */)
5014 hscroll = XINT (w->hscroll) + XINT (arg); 5022 hscroll = XINT (w->hscroll) + XINT (arg);
5015 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 5023 result = Fset_window_hscroll (selected_window, make_number (hscroll));
5016 5024
5017 if (interactive_p (0)) 5025 if (!NILP (set_minimum))
5018 w->min_hscroll = w->hscroll; 5026 w->min_hscroll = w->hscroll;
5019 5027
5020 return result; 5028 return result;
5021} 5029}
5022 5030
5023DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", 5031DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 2, "P\np",
5024 doc: /* Scroll selected window display ARG columns right. 5032 doc: /* Scroll selected window display ARG columns right.
5025Default for ARG is window width minus 2. 5033Default for ARG is window width minus 2.
5026Value is the total amount of leftward horizontal scrolling in 5034Value is the total amount of leftward horizontal scrolling in
5027effect after the change. 5035effect after the change.
5028If `automatic-hscrolling' is non-nil, the argument ARG modifies 5036If SET_MINIMUM is non-nil, the new scroll amount becomes the
5029a lower bound for automatic scrolling, i.e. automatic scrolling 5037lower bound for automatic scrolling, i.e. automatic scrolling
5030will not scroll a window to a column less than the value returned 5038will not scroll a window to a column less than the value returned
5031by this function. */) 5039by this function. This happens in an interactive call. */)
5032 (arg) 5040 (arg, set_minimum)
5033 register Lisp_Object arg; 5041 register Lisp_Object arg, set_minimum;
5034{ 5042{
5035 Lisp_Object result; 5043 Lisp_Object result;
5036 int hscroll; 5044 int hscroll;
@@ -5044,7 +5052,7 @@ by this function. */)
5044 hscroll = XINT (w->hscroll) - XINT (arg); 5052 hscroll = XINT (w->hscroll) - XINT (arg);
5045 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 5053 result = Fset_window_hscroll (selected_window, make_number (hscroll));
5046 5054
5047 if (interactive_p (0)) 5055 if (!NILP (set_minimum))
5048 w->min_hscroll = w->hscroll; 5056 w->min_hscroll = w->hscroll;
5049 5057
5050 return result; 5058 return result;
diff --git a/src/xdisp.c b/src/xdisp.c
index 799f435c7fb..22f870d16ef 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4651,7 +4651,8 @@ back_to_previous_visible_line_start (it)
4651 { 4651 {
4652 Lisp_Object prop; 4652 Lisp_Object prop;
4653 4653
4654 prop = Fget_char_property (make_number (IT_CHARPOS (*it)), 4654 /* Check the newline before point for invisibility. */
4655 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
4655 Qinvisible, it->window); 4656 Qinvisible, it->window);
4656 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 4657 if (TEXT_PROP_MEANS_INVISIBLE (prop))
4657 visible_p = 0; 4658 visible_p = 0;
@@ -4984,8 +4985,11 @@ get_next_display_element (it)
4984 If it->multibyte_p is zero, eight-bit characters that 4985 If it->multibyte_p is zero, eight-bit characters that
4985 don't have corresponding multibyte char code are also 4986 don't have corresponding multibyte char code are also
4986 translated to octal form. */ 4987 translated to octal form. */
4987 else if ((it->c < ' ' ? (it->area != TEXT_AREA 4988 else if ((it->c < ' '
4988 || (it->c != '\n' && it->c != '\t')) 4989 ? (it->area != TEXT_AREA
4990 /* In mode line, treat \n, \t like other crl chars. */
4991 || (it->glyph_row && it->glyph_row->mode_line_p)
4992 || (it->c != '\n' && it->c != '\t'))
4989 : it->multibyte_p ? !CHAR_PRINTABLE_P (it->c) 4993 : it->multibyte_p ? !CHAR_PRINTABLE_P (it->c)
4990 : (it->c >= 127 4994 : (it->c >= 127
4991 && (! unibyte_display_via_language_environment 4995 && (! unibyte_display_via_language_environment
@@ -8525,7 +8529,8 @@ update_tool_bar (f, save_match_data)
8525 { 8529 {
8526 struct buffer *prev = current_buffer; 8530 struct buffer *prev = current_buffer;
8527 int count = SPECPDL_INDEX (); 8531 int count = SPECPDL_INDEX ();
8528 Lisp_Object old_tool_bar; 8532 Lisp_Object new_tool_bar;
8533 int new_n_tool_bar;
8529 struct gcpro gcpro1; 8534 struct gcpro gcpro1;
8530 8535
8531 /* Set current_buffer to the buffer of the selected 8536 /* Set current_buffer to the buffer of the selected
@@ -8544,18 +8549,24 @@ update_tool_bar (f, save_match_data)
8544 specbind (Qoverriding_local_map, Qnil); 8549 specbind (Qoverriding_local_map, Qnil);
8545 } 8550 }
8546 8551
8547 old_tool_bar = f->tool_bar_items; 8552 GCPRO1 (new_tool_bar);
8548 GCPRO1 (old_tool_bar);
8549 8553
8550 /* Build desired tool-bar items from keymaps. */ 8554 /* Build desired tool-bar items from keymaps. */
8551 BLOCK_INPUT; 8555 new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items),
8552 f->tool_bar_items 8556 &new_n_tool_bar);
8553 = tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items);
8554 UNBLOCK_INPUT;
8555 8557
8556 /* Redisplay the tool-bar if we changed it. */ 8558 /* Redisplay the tool-bar if we changed it. */
8557 if (! NILP (Fequal (old_tool_bar, f->tool_bar_items))) 8559 if (NILP (Fequal (new_tool_bar, f->tool_bar_items)))
8558 w->update_mode_line = Qt; 8560 {
8561 /* Redisplay that happens asynchronously due to an expose event
8562 may access f->tool_bar_items. Make sure we update both
8563 variables within BLOCK_INPUT so no such event interrupts. */
8564 BLOCK_INPUT;
8565 f->tool_bar_items = new_tool_bar;
8566 f->n_tool_bar_items = new_n_tool_bar;
8567 w->update_mode_line = Qt;
8568 UNBLOCK_INPUT;
8569 }
8559 8570
8560 UNGCPRO; 8571 UNGCPRO;
8561 8572
diff --git a/src/xfns.c b/src/xfns.c
index 39262235e8b..8ddb29310df 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3483,7 +3483,9 @@ If omitted or nil, that stands for the selected frame's display. */)
3483} 3483}
3484 3484
3485DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 3485DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
3486 doc: /* Returns the vendor ID string of the X server of display DISPLAY. 3486 doc: /* Returns the "vendor ID" string of the X server of display DISPLAY.
3487\(Labelling every distributor as a "vendor" embodies the false assumption
3488that operating systems cannot be developed and distributed noncommercially.)
3487The optional argument DISPLAY specifies which display to ask about. 3489The optional argument DISPLAY specifies which display to ask about.
3488DISPLAY should be either a frame or a display name (a string). 3490DISPLAY should be either a frame or a display name (a string).
3489If omitted or nil, that stands for the selected frame's display. */) 3491If omitted or nil, that stands for the selected frame's display. */)
@@ -3500,7 +3502,7 @@ If omitted or nil, that stands for the selected frame's display. */)
3500DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, 3502DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
3501 doc: /* Returns the version numbers of the X server of display DISPLAY. 3503 doc: /* Returns the version numbers of the X server of display DISPLAY.
3502The value is a list of three integers: the major and minor 3504The value is a list of three integers: the major and minor
3503version numbers of the X Protocol in use, and the vendor-specific release 3505version numbers of the X Protocol in use, and the distributor-specific release
3504number. See also the function `x-server-vendor'. 3506number. See also the function `x-server-vendor'.
3505 3507
3506The optional argument DISPLAY specifies which display to ask about. 3508The optional argument DISPLAY specifies which display to ask about.
@@ -5088,27 +5090,26 @@ file_dialog_unmap_cb (widget, client_data, call_data)
5088} 5090}
5089 5091
5090 5092
5091DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, 5093DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
5092 doc: /* Read file name, prompting with PROMPT in directory DIR. 5094 doc: /* Read file name, prompting with PROMPT in directory DIR.
5093Use a file selection dialog. 5095Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
5094Select DEFAULT-FILENAME in the dialog's file selection box, if 5096selection box, if specified. If MUSTMATCH is non-nil, the returned file
5095specified. Don't let the user enter a file name in the file 5097or directory must exist. ONLY-DIR-P is ignored." */)
5096selection dialog's entry field, if MUSTMATCH is non-nil. */) 5098 (prompt, dir, default_filename, mustmatch, only_dir_p)
5097 (prompt, dir, default_filename, mustmatch) 5099 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
5098 Lisp_Object prompt, dir, default_filename, mustmatch;
5099{ 5100{
5100 int result; 5101 int result;
5101 struct frame *f = SELECTED_FRAME (); 5102 struct frame *f = SELECTED_FRAME ();
5102 Lisp_Object file = Qnil; 5103 Lisp_Object file = Qnil;
5103 Widget dialog, text, list, help; 5104 Widget dialog, text, help;
5104 Arg al[10]; 5105 Arg al[10];
5105 int ac = 0; 5106 int ac = 0;
5106 extern XtAppContext Xt_app_con; 5107 extern XtAppContext Xt_app_con;
5107 XmString dir_xmstring, pattern_xmstring; 5108 XmString dir_xmstring, pattern_xmstring;
5108 int count = SPECPDL_INDEX (); 5109 int count = SPECPDL_INDEX ();
5109 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 5110 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
5110 5111
5111 GCPRO5 (prompt, dir, default_filename, mustmatch, file); 5112 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
5112 CHECK_STRING (prompt); 5113 CHECK_STRING (prompt);
5113 CHECK_STRING (dir); 5114 CHECK_STRING (dir);
5114 5115
@@ -5141,9 +5142,9 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
5141 XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb, 5142 XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb,
5142 (XtPointer) &result); 5143 (XtPointer) &result);
5143 5144
5144 /* Disable the help button since we can't display help. */ 5145 /* Remove the help button since we can't display help. */
5145 help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); 5146 help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
5146 XtSetSensitive (help, False); 5147 XtUnmanageChild (help);
5147 5148
5148 /* Mark OK button as default. */ 5149 /* Mark OK button as default. */
5149 XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), 5150 XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
@@ -5165,30 +5166,30 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
5165 /* Manage the dialog, so that list boxes get filled. */ 5166 /* Manage the dialog, so that list boxes get filled. */
5166 XtManageChild (dialog); 5167 XtManageChild (dialog);
5167 5168
5168 /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME
5169 must include the path for this to work. */
5170 list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST);
5171 if (STRINGP (default_filename)) 5169 if (STRINGP (default_filename))
5172 { 5170 {
5173 XmString default_xmstring; 5171 XmString default_xmstring;
5174 int item_pos; 5172 Widget wtext = XmFileSelectionBoxGetChild (dialog, XmDIALOG_TEXT);
5173 Widget list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST);
5175 5174
5176 default_xmstring 5175 XmTextPosition last_pos = XmTextFieldGetLastPosition (wtext);
5177 = XmStringCreateLocalized (SDATA (default_filename)); 5176 XmTextFieldReplace (wtext, 0, last_pos,
5177 (SDATA (Ffile_name_nondirectory (default_filename))));
5178 5178
5179 if (!XmListItemExists (list, default_xmstring)) 5179 /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME
5180 { 5180 must include the path for this to work. */
5181 /* Add a new item if DEFAULT_FILENAME is not in the list. */ 5181
5182 XmListAddItem (list, default_xmstring, 0); 5182 default_xmstring = XmStringCreateLocalized (SDATA (default_filename));
5183 item_pos = 0;
5184 }
5185 else
5186 item_pos = XmListItemPos (list, default_xmstring);
5187 XmStringFree (default_xmstring);
5188 5183
5189 /* Select the item and scroll it into view. */ 5184 if (XmListItemExists (list, default_xmstring))
5190 XmListSelectPos (list, item_pos, True); 5185 {
5191 XmListSetPos (list, item_pos); 5186 int item_pos = XmListItemPos (list, default_xmstring);
5187 /* Select the item and scroll it into view. */
5188 XmListSelectPos (list, item_pos, True);
5189 XmListSetPos (list, item_pos);
5190 }
5191
5192 XmStringFree (default_xmstring);
5192 } 5193 }
5193 5194
5194 /* Process events until the user presses Cancel or OK. */ 5195 /* Process events until the user presses Cancel or OK. */
@@ -5232,23 +5233,23 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
5232 5233
5233#ifdef USE_GTK 5234#ifdef USE_GTK
5234 5235
5235DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, 5236DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
5236 "Read file name, prompting with PROMPT in directory DIR.\n\ 5237 doc: /* Read file name, prompting with PROMPT in directory DIR.
5237Use a file selection dialog.\n\ 5238Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
5238Select DEFAULT-FILENAME in the dialog's file selection box, if\n\ 5239selection box, if specified. If MUSTMATCH is non-nil, the returned file
5239specified. Don't let the user enter a file name in the file\n\ 5240or directory must exist. If ONLY-DIR-P is non-nil, the user can only select
5240selection dialog's entry field, if MUSTMATCH is non-nil.") 5241directories. */)
5241 (prompt, dir, default_filename, mustmatch) 5242 (prompt, dir, default_filename, mustmatch, only_dir_p)
5242 Lisp_Object prompt, dir, default_filename, mustmatch; 5243 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
5243{ 5244{
5244 FRAME_PTR f = SELECTED_FRAME (); 5245 FRAME_PTR f = SELECTED_FRAME ();
5245 char *fn; 5246 char *fn;
5246 Lisp_Object file = Qnil; 5247 Lisp_Object file = Qnil;
5247 int count = specpdl_ptr - specpdl; 5248 int count = specpdl_ptr - specpdl;
5248 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 5249 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
5249 char *cdef_file; 5250 char *cdef_file;
5250 5251
5251 GCPRO5 (prompt, dir, default_filename, mustmatch, file); 5252 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
5252 CHECK_STRING (prompt); 5253 CHECK_STRING (prompt);
5253 CHECK_STRING (dir); 5254 CHECK_STRING (dir);
5254 5255
@@ -5262,7 +5263,9 @@ selection dialog's entry field, if MUSTMATCH is non-nil.")
5262 else 5263 else
5263 cdef_file = SDATA (dir); 5264 cdef_file = SDATA (dir);
5264 5265
5265 fn = xg_get_file_name (f, SDATA (prompt), cdef_file, ! NILP (mustmatch)); 5266 fn = xg_get_file_name (f, SDATA (prompt), cdef_file,
5267 ! NILP (mustmatch),
5268 ! NILP (only_dir_p));
5266 5269
5267 if (fn) 5270 if (fn)
5268 { 5271 {
diff --git a/src/xmenu.c b/src/xmenu.c
index 040bb6df622..0da826e4cb0 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -110,11 +110,12 @@ extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
110extern Lisp_Object Qmenu_bar_update_hook; 110extern Lisp_Object Qmenu_bar_update_hook;
111 111
112#ifdef USE_X_TOOLKIT 112#ifdef USE_X_TOOLKIT
113extern void set_frame_menubar (); 113extern void set_frame_menubar P_ ((FRAME_PTR, int, int));
114extern XtAppContext Xt_app_con; 114extern XtAppContext Xt_app_con;
115 115
116static Lisp_Object xdialog_show (); 116static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **));
117static void popup_get_selection (); 117static void popup_get_selection P_ ((XEvent *, struct x_display_info *,
118 LWLIB_ID, int));
118 119
119/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ 120/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */
120 121
@@ -124,8 +125,8 @@ static void popup_get_selection ();
124#ifdef USE_GTK 125#ifdef USE_GTK
125#include "gtkutil.h" 126#include "gtkutil.h"
126#define HAVE_BOXES 1 127#define HAVE_BOXES 1
127extern void set_frame_menubar (); 128extern void set_frame_menubar P_ ((FRAME_PTR, int, int));
128static Lisp_Object xdialog_show (); 129static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **));
129#endif 130#endif
130 131
131/* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU 132/* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU
@@ -156,7 +157,6 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
156static void list_of_panes P_ ((Lisp_Object)); 157static void list_of_panes P_ ((Lisp_Object));
157static void list_of_items P_ ((Lisp_Object)); 158static void list_of_items P_ ((Lisp_Object));
158 159
159extern EMACS_TIME timer_check P_ ((int));
160 160
161/* This holds a Lisp vector that holds the results of decoding 161/* This holds a Lisp vector that holds the results of decoding
162 the keymaps or alist-of-alists that specify a menu. 162 the keymaps or alist-of-alists that specify a menu.
@@ -1128,21 +1128,16 @@ on the left of the dialog box and all following items on the right.
1128 1128
1129#ifdef USE_X_TOOLKIT 1129#ifdef USE_X_TOOLKIT
1130static void 1130static void
1131popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) 1131popup_get_selection (initial_event, dpyinfo, id, down_on_keypress)
1132 XEvent *initial_event; 1132 XEvent *initial_event;
1133 struct x_display_info *dpyinfo; 1133 struct x_display_info *dpyinfo;
1134 LWLIB_ID id; 1134 LWLIB_ID id;
1135 int do_timers;
1136 int down_on_keypress; 1135 int down_on_keypress;
1137{ 1136{
1138 XEvent event; 1137 XEvent event;
1139 1138
1140 while (popup_activated_flag) 1139 while (popup_activated_flag)
1141 { 1140 {
1142 /* If we have no events to run, consider timers. */
1143 if (do_timers && !XtAppPending (Xt_app_con))
1144 timer_check (1);
1145
1146 if (initial_event) 1141 if (initial_event)
1147 { 1142 {
1148 event = *initial_event; 1143 event = *initial_event;
@@ -2489,7 +2484,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2489 popup_activated_flag = 1; 2484 popup_activated_flag = 1;
2490 2485
2491 /* Process events that apply to the menu. */ 2486 /* Process events that apply to the menu. */
2492 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0); 2487 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0);
2493 2488
2494 /* fp turned off the following statement and wrote a comment 2489 /* fp turned off the following statement and wrote a comment
2495 that it is unnecessary--that the menu has already disappeared. 2490 that it is unnecessary--that the menu has already disappeared.
@@ -2883,8 +2878,7 @@ create_and_show_dialog (f, first_wv)
2883 Fcons (make_number (dialog_id >> (fact)), 2878 Fcons (make_number (dialog_id >> (fact)),
2884 make_number (dialog_id & ~(-1 << (fact))))); 2879 make_number (dialog_id & ~(-1 << (fact)))));
2885 2880
2886 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), 2881 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1);
2887 dialog_id, 1, 1);
2888 2882
2889 unbind_to (count, Qnil); 2883 unbind_to (count, Qnil);
2890 } 2884 }
diff --git a/src/xselect.c b/src/xselect.c
index 1e3efd2bf54..35f4586b754 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -108,8 +108,8 @@ Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3,
108 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7; 108 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7;
109#endif 109#endif
110 110
111static Lisp_Object Vx_lost_selection_hooks; 111static Lisp_Object Vx_lost_selection_functions;
112static Lisp_Object Vx_sent_selection_hooks; 112static Lisp_Object Vx_sent_selection_functions;
113/* Coding system for communicating with other X clients via cutbuffer, 113/* Coding system for communicating with other X clients via cutbuffer,
114 selection, and clipboard. */ 114 selection, and clipboard. */
115static Lisp_Object Vselection_coding_system; 115static Lisp_Object Vselection_coding_system;
@@ -856,7 +856,7 @@ x_handle_selection_request (event)
856 /* Let random lisp code notice that the selection has been asked for. */ 856 /* Let random lisp code notice that the selection has been asked for. */
857 { 857 {
858 Lisp_Object rest; 858 Lisp_Object rest;
859 rest = Vx_sent_selection_hooks; 859 rest = Vx_sent_selection_functions;
860 if (!EQ (rest, Qunbound)) 860 if (!EQ (rest, Qunbound))
861 for (; CONSP (rest); rest = Fcdr (rest)) 861 for (; CONSP (rest); rest = Fcdr (rest))
862 call3 (Fcar (rest), selection_symbol, target_symbol, successful_p); 862 call3 (Fcar (rest), selection_symbol, target_symbol, successful_p);
@@ -939,7 +939,7 @@ x_handle_selection_clear (event)
939 939
940 { 940 {
941 Lisp_Object rest; 941 Lisp_Object rest;
942 rest = Vx_lost_selection_hooks; 942 rest = Vx_lost_selection_functions;
943 if (!EQ (rest, Qunbound)) 943 if (!EQ (rest, Qunbound))
944 { 944 {
945 for (; CONSP (rest); rest = Fcdr (rest)) 945 for (; CONSP (rest); rest = Fcdr (rest))
@@ -972,7 +972,7 @@ x_clear_frame_selections (f)
972 /* Let random Lisp code notice that the selection has been stolen. */ 972 /* Let random Lisp code notice that the selection has been stolen. */
973 Lisp_Object hooks, selection_symbol; 973 Lisp_Object hooks, selection_symbol;
974 974
975 hooks = Vx_lost_selection_hooks; 975 hooks = Vx_lost_selection_functions;
976 selection_symbol = Fcar (Fcar (Vselection_alist)); 976 selection_symbol = Fcar (Fcar (Vselection_alist));
977 977
978 if (!EQ (hooks, Qunbound)) 978 if (!EQ (hooks, Qunbound))
@@ -996,7 +996,7 @@ x_clear_frame_selections (f)
996 /* Let random Lisp code notice that the selection has been stolen. */ 996 /* Let random Lisp code notice that the selection has been stolen. */
997 Lisp_Object hooks, selection_symbol; 997 Lisp_Object hooks, selection_symbol;
998 998
999 hooks = Vx_lost_selection_hooks; 999 hooks = Vx_lost_selection_functions;
1000 selection_symbol = Fcar (Fcar (XCDR (rest))); 1000 selection_symbol = Fcar (Fcar (XCDR (rest)));
1001 1001
1002 if (!EQ (hooks, Qunbound)) 1002 if (!EQ (hooks, Qunbound))
@@ -2699,15 +2699,15 @@ means that a side-effect was executed,
2699and there is no meaningful selection value. */); 2699and there is no meaningful selection value. */);
2700 Vselection_converter_alist = Qnil; 2700 Vselection_converter_alist = Qnil;
2701 2701
2702 DEFVAR_LISP ("x-lost-selection-hooks", &Vx_lost_selection_hooks, 2702 DEFVAR_LISP ("x-lost-selection-functions", &Vx_lost_selection_functions,
2703 doc: /* A list of functions to be called when Emacs loses an X selection. 2703 doc: /* A list of functions to be called when Emacs loses an X selection.
2704\(This happens when some other X client makes its own selection 2704\(This happens when some other X client makes its own selection
2705or when a Lisp program explicitly clears the selection.) 2705or when a Lisp program explicitly clears the selection.)
2706The functions are called with one argument, the selection type 2706The functions are called with one argument, the selection type
2707\(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'). */); 2707\(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'). */);
2708 Vx_lost_selection_hooks = Qnil; 2708 Vx_lost_selection_functions = Qnil;
2709 2709
2710 DEFVAR_LISP ("x-sent-selection-hooks", &Vx_sent_selection_hooks, 2710 DEFVAR_LISP ("x-sent-selection-functions", &Vx_sent_selection_functions,
2711 doc: /* A list of functions to be called when Emacs answers a selection request. 2711 doc: /* A list of functions to be called when Emacs answers a selection request.
2712The functions are called with four arguments: 2712The functions are called with four arguments:
2713 - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD'); 2713 - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');
@@ -2719,7 +2719,7 @@ including being asked for a selection that we no longer own, or being asked
2719to convert into a type that we don't know about or that is inappropriate. 2719to convert into a type that we don't know about or that is inappropriate.
2720This hook doesn't let you change the behavior of Emacs's selection replies, 2720This hook doesn't let you change the behavior of Emacs's selection replies,
2721it merely informs you that they have happened. */); 2721it merely informs you that they have happened. */);
2722 Vx_sent_selection_hooks = Qnil; 2722 Vx_sent_selection_functions = Qnil;
2723 2723
2724 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, 2724 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
2725 doc: /* Coding system for communicating with other X clients. 2725 doc: /* Coding system for communicating with other X clients.
diff --git a/src/xterm.c b/src/xterm.c
index 603df429dce..9b5d768b2af 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3930,9 +3930,9 @@ x_window_to_scroll_bar (display, window_id)
3930{ 3930{
3931 Lisp_Object tail; 3931 Lisp_Object tail;
3932 3932
3933#ifdef USE_GTK 3933#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
3934 window_id = (Window) xg_get_scroll_id_for_window (display, window_id); 3934 window_id = (Window) xg_get_scroll_id_for_window (display, window_id);
3935#endif /* USE_GTK */ 3935#endif /* USE_GTK && USE_TOOLKIT_SCROLL_BARS */
3936 3936
3937 for (tail = Vframe_list; 3937 for (tail = Vframe_list;
3938 XGCTYPE (tail) == Lisp_Cons; 3938 XGCTYPE (tail) == Lisp_Cons;