aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-10-14 17:36:28 +0000
committerKaroly Lorentey2006-10-14 17:36:28 +0000
commit12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a (patch)
tree1775f9fd1c92defd8b61304a08ec00da95bc4539 /src
parent3f87f67ee215ffeecbd2f53bd7f342cdf03f47df (diff)
parentf763da8d0808af7c80d72bc586bf4fcf50b37ddd (diff)
downloademacs-12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a.tar.gz
emacs-12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-413 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-414 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-415 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-416 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-417 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-418 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-419 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-420 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-421 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-422 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-423 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-424 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-425 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-426 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-427 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-428 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-429 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-430 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-431 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-432 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-433 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-434 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-435 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-436 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-437 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-438 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-439 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-440 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-441 lisp/url/url-methods.el: Fix format error when http_proxy is empty string * emacs@sv.gnu.org/emacs--devo--0--patch-442 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-443 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-444 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-445 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-446 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-447 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-448 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-449 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-450 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-451 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-452 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-453 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-454 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-455 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-456 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-457 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-458 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-459 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-460 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-461 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-462 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-463 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-464 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-465 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-466 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-467 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-468 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-469 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-470 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-471 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-472 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-473 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-128 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-129 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-130 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-131 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-132 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-133 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-134 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-135 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-136 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-137 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-138 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-139 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-140 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-141 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-142 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-143 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-144 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-145 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-146 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-147 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-148 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-149 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-582
Diffstat (limited to 'src')
-rw-r--r--src/COPYING25
-rw-r--r--src/ChangeLog781
-rw-r--r--src/Makefile.in49
-rw-r--r--src/buffer.c29
-rw-r--r--src/buffer.h10
-rw-r--r--src/callint.c6
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/casetab.c3
-rw-r--r--src/charset.h22
-rw-r--r--src/coding.c6
-rw-r--r--src/dispextern.h5
-rw-r--r--src/dispnew.c18
-rw-r--r--src/editfns.c31
-rw-r--r--src/emacs.c3
-rw-r--r--src/eval.c15
-rw-r--r--src/fns.c49
-rw-r--r--src/frame.c14
-rw-r--r--src/gmalloc.c64
-rw-r--r--src/gtkutil.c126
-rw-r--r--src/image.c2
-rw-r--r--src/indent.c37
-rw-r--r--src/insdel.c19
-rw-r--r--src/keyboard.c54
-rw-r--r--src/keymap.c204
-rw-r--r--src/keymap.h4
-rw-r--r--src/lisp.h5
-rw-r--r--src/m/ibms390x.h6
-rw-r--r--src/mac.c463
-rw-r--r--src/macfns.c3
-rw-r--r--src/macmenu.c72
-rw-r--r--src/macterm.c497
-rw-r--r--src/macterm.h10
-rw-r--r--src/makefile.w32-in4
-rw-r--r--src/marker.c3
-rw-r--r--src/md5.c8
-rw-r--r--src/md5.h8
-rw-r--r--src/minibuf.c36
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c54
-rw-r--r--src/process.c28
-rw-r--r--src/process.h4
-rw-r--r--src/regex.c63
-rw-r--r--src/regex.h12
-rw-r--r--src/s/gnu-linux.h6
-rw-r--r--src/search.c50
-rw-r--r--src/strftime.c8
-rw-r--r--src/syntax.c5
-rw-r--r--src/textprop.c79
-rw-r--r--src/w32.c24
-rw-r--r--src/w32fns.c68
-rw-r--r--src/w32menu.c9
-rw-r--r--src/w32proc.c68
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c247
-rw-r--r--src/xdisp.c199
-rw-r--r--src/xfns.c20
-rw-r--r--src/xmenu.c29
-rw-r--r--src/xterm.c78
-rw-r--r--src/xterm.h1
59 files changed, 2785 insertions, 964 deletions
diff --git a/src/COPYING b/src/COPYING
index 3912109b5cd..d511905c164 100644
--- a/src/COPYING
+++ b/src/COPYING
@@ -1,8 +1,8 @@
1 GNU GENERAL PUBLIC LICENSE 1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991 2 Version 2, June 1991
3 3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies 6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed. 7 of this license document, but changing it is not allowed.
8 8
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software 15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to 16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by 17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to 18the GNU Lesser General Public License instead.) You can apply it to
19your programs, too. 19your programs, too.
20 20
21 When we speak of free software, we are referring to freedom, not 21 When we speak of free software, we are referring to freedom, not
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
55 55
56 The precise terms and conditions for copying, distribution and 56 The precise terms and conditions for copying, distribution and
57modification follow. 57modification follow.
58 58
59 GNU GENERAL PUBLIC LICENSE 59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 61
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
110 License. (Exception: if the Program itself is interactive but 110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on 111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.) 112 the Program is not required to print an announcement.)
113 113
114These requirements apply to the modified work as a whole. If 114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program, 115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in 116and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as 168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not 169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code. 170compelled to copy the source along with the object code.
171 171
172 4. You may not copy, modify, sublicense, or distribute the Program 172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt 173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is 174otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
225 225
226This section is intended to make thoroughly clear what is believed to 226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License. 227be a consequence of the rest of this License.
228 228
229 8. If the distribution and/or use of the Program is restricted in 229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the 230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License 231original copyright holder who places the Program under this License
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES. 278POSSIBILITY OF SUCH DAMAGES.
279 279
280 END OF TERMS AND CONDITIONS 280 END OF TERMS AND CONDITIONS
281 281
282 How to Apply These Terms to Your New Programs 282 How to Apply These Terms to Your New Programs
283 283
284 If you develop a new program, and you want it to be of the greatest 284 If you develop a new program, and you want it to be of the greatest
@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details. 304 GNU General Public License for more details.
305 305
306 You should have received a copy of the GNU General Public License 306 You should have received a copy of the GNU General Public License along
307 along with this program; if not, write to the Free Software 307 with this program; if not, write to the Free Software Foundation, Inc.,
308 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 308 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
310 309
311Also add information on how to contact you by electronic and paper mail. 310Also add information on how to contact you by electronic and paper mail.
312 311
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
336This General Public License does not permit incorporating your program into 335This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may 336proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the 337consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General 338library. If this is what you want to do, use the GNU Lesser General
340Public License instead of this License. 339Public License instead of this License.
diff --git a/src/ChangeLog b/src/ChangeLog
index c7a065c091e..f86c4c6a21c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,672 @@
12006-10-13 Chong Yidong <cyd@stupidchicken.com>
2
3 * xdisp.c (decode_mode_spec): Ignore %c and %l constructs in frame
4 title.
5
62006-10-12 Chong Yidong <cyd@stupidchicken.com>
7
8 * keymap.c (Fkey_binding): Check Lisp_Object types before doing
9 XCAR and XINT.
10
112006-10-12 Romain Francoise <romain@orebokech.com>
12
13 * image.c (xbm_read_bitmap_data): Delete extra semicolon.
14
152006-10-10 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * eval.c: Include xterm.h for x_fully_uncatch_errors and friends.
18
19 * dispextern.h: Declare x_create_bitmap_from_xpm_data.
20
21 * xterm.c (x_check_expected_move): Remove unused var `count'.
22
23 * xmenu.c (syms_of_xmenu): Use Ffset rather than Fdefalias, since
24 Fdefalias is not declared in any *.h file.
25
262006-10-09 Chong Yidong <cyd@stupidchicken.com>
27
28 * dispnew.c (sit_for): Sit forever if TIMEOUT is t.
29
30 * keyboard.c (command_loop_1): Handle non-number values of
31 `minibuffer-message-timeout'.
32 (Fexecute_extended_command): Fix typo.
33
34 * minibuf.c (temp_echo_area_glyphs): Sit for
35 `minibuffer-message-timeout' seconds.
36
372006-10-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
38
39 * macterm.c (mac_draw_image_string, mac_draw_image_string_16):
40 Add argument OVERSTRIKE_P.
41 (mac_draw_string_common, mac_draw_image_string_cg): Likewise.
42 Support overstrike.
43 (mac_draw_string, mac_draw_string_16): Remove functions.
44 (x_draw_glyph_string_foreground): Use overstrike when needed.
45 (x_draw_composite_glyph_string_foreground): Likewise.
46 Use mac_draw_image_string_16 instead of mac_draw_string_16.
47 (mac_load_query_font): Rename from XLoadQueryFont. Take argument F
48 instead of DPY. All uses changed. Don't save/restore font.
49
502006-10-07 Ralf Angeli <angeli@caeruleus.net>
51
52 * w32fns.c (w32_createwindow): Honour left and top positions if
53 supplied explicitly.
54
552006-10-06 Kim F. Storm <storm@cua.dk>
56
57 * xdisp.c (pos_visible_p): Fix value when EOB is visible.
58
592006-10-05 Chong Yidong <cyd@stupidchicken.com>
60
61 * frame.c (Qinhibit_face_set_after_frame_default): New var.
62 (syms_of_frame): Initialize it.
63 (x_set_frame_parameters): Avoid resetting :font attributes to the
64 new-frame defaults.
65
662006-10-03 Stefan Monnier <monnier@iro.umontreal.ca>
67
68 * lisp.h (clear_regexp_cache): Declare.
69
70 * search.c (compile_pattern): Only check `cp->syntax_table' if needed.
71 (compile_pattern_1): Remember `used_syntax' in `cp->syntax_table'.
72 (clear_regexp_cache): Only flush those regexps which depend on
73 a syntax-table.
74
75 * regex.c (regex_compile): Set the new `used_syntax' bit.
76
77 * regex.h: Remove file local variables.
78 (struct re_pattern_buffer): New field `used_syntax'.
79
802006-10-03 Kim F. Storm <storm@cua.dk>
81
82 * process.c (list_processes_1): Run sentinels before removing dead
83 processes. Also remove `closed' network connections.
84
852006-10-01 Stefan Monnier <monnier@iro.umontreal.ca>
86
87 * xdisp.c (handle_fontified_prop): Don't fontify at EOB.
88
892006-09-30 Eli Zaretskii <eliz@gnu.org>
90
91 * config.in Regenerated.
92
932006-09-29 Juri Linkov <juri@jurta.org>
94
95 * buffer.c (syms_of_buffer): Reorder coding systems in the
96 docstring of %z to the real order displayed in the modeline.
97
982006-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
99
100 * keymap.c (Fdefine_key): Yet another int/Lisp_Object mixup (YAILOM).
101
1022006-09-26 Chong Yidong <cyd@stupidchicken.com>
103
104 * indent.c (Fvertical_motion): Do move back if the Lisp string
105 being displayed contains newlines.
106
1072006-09-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
108
109 * macterm.c (mac_compute_glyph_string_overhangs, XLoadQueryFont)
110 [USE_CG_DRAWING]: Call mac_prepare_for_quickdraw before QDTextBounds.
111
1122006-09-26 Kenichi Handa <handa@m17n.org>
113
114 * keymap.c (Fsingle_key_description): For an invalid char, return
115 "Invalid char code NNNNN".
116
1172006-09-25 Chong Yidong <cyd@stupidchicken.com>
118
119 * callint.c (Fcall_interactively): Doc fix.
120
1212006-09-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
122
123 * macterm.c (x_underline_at_descent_line): New variable.
124 (syms_of_macterm): DEFVAR_BOOL it.
125 (x_draw_glyph_string): Use it.
126 (XLoadQueryFont): Calculate min_bounds.descent and max_bounds.descent.
127
1282006-09-25 Kenichi Handa <handa@m17n.org>
129
130 * keymap.c (Fsingle_key_description): Return unique names for
131 generic characters.
132
1332006-09-24 Richard Stallman <rms@gnu.org>
134
135 * search.c (compile_pattern_1): Don't BLOCK_INPUT.
136
1372006-09-24 Eli Zaretskii <eliz@gnu.org>
138
139 * makefile.w32-in ($(BLD)/fns.$(O), $(BLD)/w32proc.$(O)):
140 Depend on nt/inc/langinfo.h and nt/inc/nl_types.h.
141
142 * w32proc.c (nl_langinfo): New function.
143
144 * w32fns.c (w32-pass-alt-to-system, w32-alt-is-meta)
145 (w32-pass-lwindow-to-system, w32-enable-num-lock)
146 (w32-enable-caps-lock, w32-scroll-lock-modifier)
147 (w32-lwindow-modifier, w32-rwindow-modifier)
148 (w32-apps-modifier, w32-mouse-button-tolerance): Doc fix.
149
1502006-09-23 Juanma Barranquero <lekktu@gmail.com>
151
152 * minibuf.c (Finternal_complete_buffer, Fread_minibuffer)
153 (Fdisplay_completion_list): Fix typos in docstrings.
154
1552006-09-23 Romain Francoise <romain@orebokech.com>
156
157 * s/gnu-linux.h (MAIL_USE_FLOCK): Check for HAVE_LIBLOCKFILE too.
158
1592006-09-23 Kenichi Handa <handa@m17n.org>
160
161 * keymap.c (Fmap_keymap): Docstring mentions about generic character.
162
1632006-09-22 Stefan Monnier <monnier@iro.umontreal.ca>
164
165 * regex.c (analyse_first): For eight-bit-control chars, mark both the
166 char's value and its leading byte in the fastmap.
167 (re_search_2): When fast-scanning without translation, be careful to
168 check that we only match the leading byte of a multibyte char.
169
170 * charset.h (PREV_CHAR_BOUNDARY): Make it work from within a char's
171 byte sequence.
172 (AT_CHAR_BOUNDARY): New macro.
173
1742006-09-22 Kenichi Handa <handa@m17n.org>
175
176 * fns.c (optimize_sub_char_table): Don't optimize a sub-char-table
177 whose default value is non-nil.
178
1792006-09-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
180
181 * gtkutil.c (xg_get_file_with_chooser): Only show C-l help for
182 Gtk+ versions < 2.10.
183
184 * xfns.c (syms_of_xfns): Fix typo in help text for
185 x-gtk-file-dialog-help-text.
186
1872006-09-21 Kim F. Storm <storm@cua.dk>
188
189 * fns.c (Fmemq): Refill doc string.
190 (Fmemql): New defun, like memq but using eql.
191 (syms_of_fns): Defsubr it.
192
1932006-09-20 Kim F. Storm <storm@cua.dk>
194
195 * xdisp.c (pos_visible_p): CHARPOS < 0 means return info for
196 last visible glyph in window.
197
198 * window.c (Fset_window_hscroll, Fwindow_line_height):
199 Doc fix. Use "off-window" instead of "off-screen".
200 (Fpos_visible_in_window_p): Likewise.
201 If POS is t, return info for last visible glyph in window.
202
2032006-09-19 Chong Yidong <cyd@stupidchicken.com>
204
205 * search.c (struct regexp_cache): New entry syntax_table.
206 (compile_pattern_1): Set it.
207 (syms_of_search): Initialize it.
208 (compile_pattern): Require the syntax_table entry of the cache
209 element to match the current syntax table entry.
210
2112006-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
212
213 * window.c (Fwindow_end): Fix recent change.
214
2152006-09-19 Kim F. Storm <storm@cua.dk>
216
217 * window.c (Fset_window_hscroll, Fpos_visible_in_window_p):
218 Doc fix. Use "off-screen" instead of "invisible".
219 (Fwindow_line_height): Make line numbers 0-based. Make line arg
220 optional; if nil, use current cursor row. Handle text terminals
221 properly. Return nil if non-interactive or pseudo-window.
222
2232006-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
224
225 * keymap.c: Include alloca.h if available.
226 (Fkey_binding): Only use AREF after checking it's a vector.
227 Remove unused var `window'.
228
2292006-09-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
230
231 * emacs.c (shut_down_emacs) [!subprocesses]: Don't set
232 inhibit_sentinels.
233
234 * mac.c [!MAC_OSX] (select): Fix argument name.
235
236 * macmenu.c (enum mac_menu_kind, min_menu_id): New enumerator and
237 menu ID for Apple menu.
238 (menubar_selection_callback): Remove function.
239 (find_and_call_menu_selection): New function from xmenu.c.
240 (x_activate_menubar): Use it.
241 (set_frame_menubar): Don't use f->output_data.mac->menubar_active.
242
243 * macterm.c (menubar_selection_callback): Remove extern.
244 (M_APPLE): Change to 234.
245 (do_apple_menu) [!TARGET_API_MAC_CARBON]: Make non-static.
246 (do_menu_choice): Remove function.
247
248 * macterm.h (struct mac_output): Remove member menubar_active.
249 (do_menu_choice): Remove extern.
250 (do_apple_menu) [!TARGET_API_MAC_CARBON]: Add extern.
251
2522006-09-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
253
254 * xfns.c (syms_of_xfns): Rename x_gtk_show_chooser_help_text to
255 x_gtk_file_dialog_help_text.
256
257 * gtkutil.c (xg_uses_old_file_dialog): Rename x-use-old-gtk-file-dialog
258 to x-gtk-use-old-file-dialog.
259 (xg_get_file_with_chooser): Rename x_gtk_show_chooser_help_text to
260 x_gtk_file_dialog_help_text.
261
262 * xfns.c (syms_of_xfns): Ditto.
263
2642006-09-18 Kim F. Storm <storm@cua.dk>
265
266 * window.c (Fwindow_line_visibility): Remove.
267 (Fwindow_line_height): New defun replacing it.
268 (syms_of_window): Defsubr it.
269
2702006-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
271
272 * mac.c (SELECT_USE_CFSOCKET) [MAC_OSX]: Set default to 1.
273 [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Fix pointer type.
274
2752006-09-17 Jay Belanger <belanger@truman.edu>
276
277 * gmalloc.c:
278 * md5.c:
279 * md5.h:
280 * strftime.c: Replace "GNU Library General Public License" by "GNU
281 General Public License" throughout.
282
2832006-09-17 Kim F. Storm <storm@cua.dk>
284
285 * dispnew.c (update_text_area): Undo 2000-07-18 change.
286 Always redrawing whole row if line has mouse-face in it causes
287 excessive flickering of the mode line.
288
2892006-09-17 Chong Yidong <cyd@stupidchicken.com>
290
291 * search.c (clear_regexp_cache): New function.
292
293 * syntax.c (Fmodify_syntax_entry): Clear regexp cache.
294
2952006-09-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
296
297 * gtkutil.c (xg_get_file_with_chooser):
298 Check x-gtk-show-chooser-help-text before adding the help text.
299
300 * xfns.c (syms_of_xfns): New variable: x-gtk-show-chooser-help-text.
301
302 * gtkutil.c (get_utf8_string): Try harder to convert to UTF8. Gtk+
303 will simply crash if we fail.
304
3052006-09-16 Richard Stallman <rms@gnu.org>
306
307 * regex.c (re_compile_pattern): Set gl_state.current_syntax_table.
308
3092006-09-15 Kim F. Storm <storm@cua.dk>
310
311 * window.c (Fwindow_line_visibility): New defun for line-move-partial.
312 (syms_of_window): Defsubr it.
313 (Fwindow_end): Use window's buffer rather than current buffer.
314
3152006-09-15 Jay Belanger <belanger@truman.edu>
316
317 * COPYING: Replace "Library Public License" by "Lesser Public
318 License" throughout.
319
3202006-09-15 David Kastrup <dak@gnu.org>
321
322 * Makefile.in (keymap.o): Add "keymap.h" and "window.h" dependencies.
323
324 * keymap.c: include "window.h".
325 (Fcommand_remapping): New optional POSITION argument.
326 (Fkey_binding): New optional POSITION argument. Completely rework
327 handling of mouse clicks to get the same order of keymaps as
328 `read-key-sequence' and heed POSITION. Also temporarily switch
329 buffers to location of mouse click and back.
330
331 * keyboard.c (command_loop_1): Adjust call of `Fcommand_remapping'
332 for additional argument.
333 (parse_menu_item): Adjust call of `Fkey_binding' for additional
334 argument.
335 (read_key_sequence): If there are both `local-map' and `keymap'
336 text properties at some buffer position, heed both.
337
338 * keymap.h: Declare additional optional arguments of
339 `Fcommand_remapping' and `Fkey_binding'.
340
3412006-09-15 Juanma Barranquero <lekktu@gmail.com>
342
343 * indent.c (Fcurrent_column, Findent_to): Fix typos in docstring.
344
3452006-09-14 Andreas Schwab <schwab@suse.de>
346
347 * print.c: Whitespace fixup.
348
3492006-09-14 Kim F. Storm <storm@cua.dk>
350
351 * xdisp.c (produce_image_glyph): Automatically crop wide images at
352 right window edge so we can draw the cursor on the same row to
353 avoid confusing redisplay by placing the cursor outside the visible
354 window area.
355
3562006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
357
358 * xterm.c (x_initialize): Don't install Xt event timer here.
359 (x_timeout_atimer_activated_flag): New var.
360 (x_activate_timeout_atimer): New function to install Xt timer.
361 (x_send_scroll_bar_event, x_process_timeouts): Use it.
362
363 * xmenu.c (x_menu_set_in_use, popup_activate_callback)
364 (create_and_show_popup_menu, create_and_show_dialog): Use it.
365
366 * xterm.h (x_activate_timeout_atimer): Add prototype.
367
3682006-09-13 Richard Stallman <rms@gnu.org>
369
370 * print.c (print_string): When printcharfun is t,
371 copy string contents and call strout on the copy.
372
373 * keyboard.c (read_char): If end_time specified, don't put the
374 event into this_command_keys.
375 (read_key_sequence): If Voverriding_terminal_local_map is specified,
376 don't check Voverriding_local_map at all.
377
3782006-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
379
380 * textprop.c (Fnext_property_change, Fnext_single_property_change)
381 (Fprevious_property_change, Fprevious_single_property_change):
382 Avoid changing limit, so we can correctly catch the case where the
383 property is constant up to limit.
384
3852006-09-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
386
387 * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]:
388 * macterm.c (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]:
389 Undo 2006-09-08 change.
390
3912006-09-11 Chong Yidong <cyd@stupidchicken.com>
392
393 * keymap.c (Fkey_binding): Use string position for string objects.
394
3952006-09-11 Kim F. Storm <storm@cua.dk>
396
397 * keymap.c (Fkey_binding): Fix last change.
398
399 * editfns.c (Fmessage): Recommend using (message "%s" ...).
400
4012006-09-10 Chong Yidong <cyd@stupidchicken.com>
402
403 * keymap.c (Fkey_binding): Check for local keymap for mouse click
404 events.
405
4062006-09-10 Kim F. Storm <storm@cua.dk>
407
408 * keyboard.c (Finput_pending_p): Check Vunread_input_method_events
409 and Vunread_post_input_method_events.
410
411 * dispnew.c (Fredisplay): Document return value.
412
4132006-09-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
414
415 * xfns.c (Fx_close_connection): Call xg_display_close when USE_GTK.
416
417 * gtkutil.c (xg_display_close): Always change default display if needed,
418 check for < Gtk+ version 2.10 before calling gdk_display_close.
419
4202006-09-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
421
422 * mac.c [MAC_OSX] (sys_select): Check argument `nfds' more rigidly.
423 Make variable `ofds' static. Remove variable `maxfd'.
424
425 * macfns.c (Fx_file_dialog): Remove unused variable `f'.
426 Call check_mac.
427
428 * macmenu.c (Vmenu_updating_frame, syms_of_macmenu):
429 * w32menu.c (Vmenu_updating_frame, syms_of_w32menu):
430 Apply 2006-09-08 change for xmenu.c.
431
432 * xfns.c (Fx_file_dialog): Call check_x.
433
4342006-09-10 Kim F. Storm <storm@cua.dk>
435
436 * xdisp.c (get_window_cursor_type): Use hollow cursor on
437 non-transparent images.
438
4392006-09-09 Eli Zaretskii <eliz@gnu.org>
440
441 * editfns.c (Fsystem_name): Mention "host" in the doc string.
442 (syms_of_editfns) <system-name>: Likewise.
443
4442006-08-27 Martin Rudalics <rudalics@gmx.at>
445
446 * xdisp.c (mouse_autoselect_window): Remove.
447 (Vmouse_autoselect_window): New variable. DEFVAR_LISP it.
448
449 * dispextern.h (mouse_autoselect_window): Remove extern.
450 (Vmouse_autoselect_window): Add extern.
451
452 * macterm.c (XTread_socket): Test Vmouse_autoselect_window
453 instead of mouse_autoselect_window.
454
455 * msdos.c (dos_rawgetc): Likewise.
456
457 * w32term.c (w32_read_socket): Likewise.
458
459 * xterm.c (handle_one_xevent): Likewise.
460
4612006-09-08 Richard Stallman <rms@gnu.org>
462
463 * xdisp.c (Vmenu_updating_frame): Define here.
464 (syms_of_xdisp): DEFVAR it here.
465 (update_menu_bar): Always return hooks_run.
466 Set Vmenu_updating_frame.
467
468 * xdisp.c (redisplay_internal): Test Vinhibit_redisplay
469 before calculating SELECTED_FRAME.
470
471 * xmenu.c (Vmenu_updating_frame): Don't define here.
472 (syms_of_xmenu): Don't DEFVAR it here.
473
474 * xterm.c (x_error_quitter): For BadName error, just return.
475
476 * eval.c (find_handler_clause): Give up on debugger if INPUT_BLOCKED_P.
477
478 * casetab.c (init_casetab_once): Call set_case_table.
479
480 * emacs.c (shut_down_emacs): Set inhibit_sentinels.
481
482 * process.c (inhibit_sentinels): New variable.
483 (exec_sentinel): Test inhibit_sentinels.
484 (init_process): Initialize it.
485
486 * process.h (inhibit_sentinels): Add decl.
487
488 * search.c (looking_at_1, string_match_1, search_command):
489 Make syntax table's canon table point to eqv table.
490
4912006-09-08 Andreas Schwab <schwab@suse.de>
492
493 * print.c (strout): Fix whitespace.
494
4952006-09-08 Kim F. Storm <storm@cua.dk>
496
497 * xterm.c (x_draw_glyph_string): Fix 2006-08-24 change.
498
4992006-09-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
500
501 * mac.c [!MAC_OSX]: Don't include keyboard.h.
502 [!MAC_OSX] (select): Try detect_input_pending before ReceiveNextEvent
503 in the same BLOCK_INPUT block, in case that some input has already
504 been read asynchronously. Pretend to be interrupted by a signal
505 if some input is available.
506 [MAC_OSX] (select_and_poll_event, sys_select): Likewise.
507 (SELECT_POLLING_PERIOD_USEC) [SELECT_USE_CFSOCKET]: Change to 100000.
508 Now used for ReceiveNextEvent timeout instead of select timeout.
509 (EVENT_CLASS_SOCK) [SELECT_USE_CFSOCKET]: Remove macro.
510 [SELECT_USE_CFSOCKET] (socket_callback): Add non-blocking connect
511 support. Quit event loop.
512 [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Add non-blocking
513 connect support. Reuse previously allocated CFRunLoopSource.
514 (Fmac_process_hi_command) [TARGET_API_MAC_CARBON]: New function.
515 (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it.
516
517 * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]:
518 Specify kWindowAsyncDragAttribute.
519
520 * macterm.c (mac_handle_origin_change, mac_handle_size_change)
521 (mac_get_ideal_size): New functions.
522 (x_set_offset, x_set_window_size, x_make_frame_visible)
523 (do_zoom_window, mac_handle_window_event, XTread_socket): Use them.
524 (install_window_handler, mac_handle_window_event)
525 [USE_CARBON_EVENTS]: Handle kEventWindowGetIdealSize and
526 kEventWindowBoundsChanged.
527 (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Don't call
528 DragWindow.
529
5302006-09-07 Andreas Schwab <schwab@suse.de>
531
532 * m/ibms390x.h (START_FILES, LIB_STANDARD): Override to
533 use lib64 instead of lib.
534
5352006-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
536
537 * Makefile.in: Avoid double quotes when possible.
538
5392006-09-06 Kenichi Handa <handa@m17n.org>
540
541 * editfns.c (Fformat_time_string): Use make_unibyte_string to make
542 a Lisp string from the result of emacs_memftimeu call.
543
5442006-09-06 Kim F. Storm <storm@cua.dk>
545
546 * xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg;
547 so calculate heights even when pos-visible-in-window-p is called
548 with partially = t. Don't overshoot last_visible_y in move_it_to.
549 Return row height and row number in new rowh and vpos args.
550 (cursor_row_fully_visible_p): First line is always "fully visible".
551 (try_window): Don't clear matrix if vscrolled.
552
553 * lisp.h (pos_visible_p): Update prototype.
554
555 * window.c (Fpos_visible_in_window_p): Adapt to new pos_visible_p.
556 Return row height and row number for partially visible rows.
557 Modify return value to a 2 element list for fully visible rows and
558 6 for partially visible row.
559 (window_scroll_pixel_based): Use pos_visible_p directly instead of
560 Fpos_visible_in_window_p. Fix auto vscrolling for partially
561 visible lines. Only vscroll backwards if already vscrolled
562 forwards. Unconditionally vscroll forwards if PT is first (and
563 only) line. Set new window start instead of scrolling at
564 start/end of tall line.
565
5662006-09-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
567
568 * macterm.c (install_window_handler, mac_handle_window_event)
569 [USE_CARBON_EVENTS]: Handle kEventWindowClose.
570 [USE_MAC_TSM] (mac_handle_text_input_event): Set modifiers for
571 ASCII keystroke event.
572
5732006-09-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
574
575 * gtkutil.c (xg_get_file_with_chooser): Don't mention specific keys in
576 the file chooser message. Only call gtk_file_chooser_set_current_name
577 when action is SAVE.
578
5792006-09-04 Andreas Schwab <schwab@suse.de>
580
581 * Makefile.in: Double all single and back quotes in C-style
582 comments to help fontifier.
583
5842006-09-03 Jason Rumney <jasonr@gnu.org>
585
586 * w32.c (shutdown_handler): New function to exit cleanly on shutdown.
587 (globals_of_w32): Register it as a signal handler.
588
5892006-09-02 Juri Linkov <juri@jurta.org>
590
591 * marker.c (Fmarker_position): Doc fix.
592
5932006-09-03 Eli Zaretskii <eliz@gnu.org>
594
595 * window.c (syms_of_window) <split-height-threshold>:
596 <window-min-height, window-min-width>: Doc fix.
597
5982006-09-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
599
600 * gtkutil.c (xg_get_file_with_chooser): Change file chooser message
601 for writing files. Call gtk_file_chooser_set_current_name to keep
602 default filename.
603
604 * minibuf.c (Finternal_complete_buffer): Move after DEFUN:s it calls
605
6062006-09-02 Jindrich Makovicka <makovick@gmail.com> (tiny change)
607
608 * fns.c (concat) [__GNUC__]: Declare with
609 `__attribute__((noinline))'.
610
611 * eval.c (apply1, call2) [__GNUC__]: Declare with
612 `__attribute__((noinline))'.
613
6142006-09-02 Stuart D. Herring <herring@lanl.gov>
615
616 * minibuf.c (Finternal_complete_buffer): New function.
617 (syms_of_minibuf): Defsubr it.
618 (Fread_buffer): Use it, instead of Vbuffer_alist.
619
6202006-09-01 Martin Rudalics <rudalics@gmx.at>
621
622 * buffer.h (struct buffer_text): New field chars_modiff.
623 (CHARS_MODIFF, BUF_CHARS_MODIFF): New macros.
624 * buffer.c (Fbuffer_chars_modified_tick): New function returning
625 value of BUF_CHARS_MODIFF.
626 (syms_of_buffer): Defsubr it.
627 (Fget_buffer_create): Initialize BUF_CHARS_MODIFF.
628 * insdel.c (modify_region): New argument preserve_chars_modiff.
629 Set CHARS_MODIFF to MODIFF provided preserve_chars_modiff is zero.
630 (insert_1_both, insert_from_string_1, insert_from_buffer_1)
631 (adjust_after_replace, adjust_after_replace_noundo)
632 (replace_range, replace_range_2, del_range_2): Reset CHARS_MODIFF.
633 * lisp.h (modify_region): Add fourth argument in extern.
634 * casefiddle.c (casify_region): Call modify_region with fourth
635 argument zero to assert that CHARS_MODIFF is updated.
636 * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal)
637 (Ftranspose_regions): Likewise.
638 * textprop.c (Fadd_text_properties, Fset_text_properties)
639 (Fremove_text_properties, Fremove_list_of_text_properties):
640 Call modify_region with fourth argument 1 to avoid that
641 CHARS_MODIFF is updated.
642
6432006-08-31 Richard Stallman <rms@gnu.org>
644
645 * editfns.c (Fformat): Don't sign-extend for %o or %x.
646
6472006-08-29 Chong Yidong <cyd@stupidchicken.com>
648
649 * indent.c (Fvertical_motion): Don't move back if we were
650 displaying a Lisp string, either.
651
6522006-08-28 Kim F. Storm <storm@cua.dk>
653
654 * xdisp.c (get_window_cursor_type) [!HAVE_WINDOW_SYSTEM]:
655 Don't attempt to replace cursor on image glyphs.
656
6572006-08-28 Kenichi Handa <handa@m17n.org>
658
659 * coding.c (Fdetect_coding_region, Fdetect_coding_string): Fix
660 docstring about ISO-2022 control characters.
661
6622006-08-28 Kim F. Storm <storm@cua.dk>
663
664 * xdisp.c (get_window_cursor_type): Replace BOX cursor on images
665 with a hollow box cursor if image is larger than 32x32 (or the default
666 frame font if that is bigger). Replace any other cursor on images
667 with hollow box cursor, as redisplay doesn't support bar and hbar
668 cursors on images.
669
12006-08-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 6702006-08-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 671
3 * alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous 672 * alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous
@@ -18,11 +687,11 @@
18 * mac.c (create_apple_event_from_event_ref, select) 687 * mac.c (create_apple_event_from_event_ref, select)
19 (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) 688 (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator)
20 (Fmac_set_file_type, cfstring_create_normalized) 689 (Fmac_set_file_type, cfstring_create_normalized)
21 (mac_get_system_locale, select_and_poll_event, sys_select): Use 690 (mac_get_system_locale, select_and_poll_event, sys_select):
22 OSStatus instead of OSErr. 691 Use OSStatus instead of OSErr.
23 692
24 * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't 693 * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon):
25 use FRAME_FILE_NAME. Use (FS)UpdateAlias. 694 Don't use FRAME_FILE_NAME. Use (FS)UpdateAlias.
26 (Fx_create_frame): Apply 2006-07-03 for xfns.c. 695 (Fx_create_frame): Apply 2006-07-03 for xfns.c.
27 696
28 * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string) 697 * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string)
@@ -60,6 +729,10 @@
60 (Frename_file, Fadd_name_to_file, Fmake_symbolic_link): 729 (Frename_file, Fadd_name_to_file, Fmake_symbolic_link):
61 Simplify; remove NO_ARG_ARRAY stuff, use list2. 730 Simplify; remove NO_ARG_ARRAY stuff, use list2.
62 731
7322006-08-25 Richard Stallman <rms@gnu.org>
733
734 * buffer.c (Fswitch_to_buffer): Fix previous change.
735
632006-08-25 Kim F. Storm <storm@cua.dk> 7362006-08-25 Kim F. Storm <storm@cua.dk>
64 737
65 * keyboard.c (Fcurrent_idle_time): Simplify. 738 * keyboard.c (Fcurrent_idle_time): Simplify.
@@ -187,7 +860,6 @@
187 860
188 * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* 861 * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms*
189 862
190
1912006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 8632006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
192 864
193 * keyboard.c: Define in_sighandler. 865 * keyboard.c: Define in_sighandler.
@@ -381,7 +1053,7 @@
381 (FletX, Flet, grow_specpdl): Use signal_error. 1053 (FletX, Flet, grow_specpdl): Use signal_error.
382 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2. 1054 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2.
383 1055
384 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop. 1056 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop.
385 (list1): New function. 1057 (list1): New function.
386 1058
387 * lisp.h (list1): Add EXFUN. 1059 * lisp.h (list1): Add EXFUN.
@@ -888,7 +1560,7 @@
888 (x_set_offset, x_check_fullscreen): Extensive changes to make 1560 (x_set_offset, x_check_fullscreen): Extensive changes to make
889 frame positioning deterministic under X. 1561 frame positioning deterministic under X.
890 1562
891 * xterm.h (x_output): Added members left_before_move and 1563 * xterm.h (x_output): Add members left_before_move and
892 top_before_move. Removed members expected_left and expected_top. 1564 top_before_move. Removed members expected_left and expected_top.
893 1565
8942006-06-16 Kim F. Storm <storm@cua.dk> 15662006-06-16 Kim F. Storm <storm@cua.dk>
@@ -1423,13 +2095,13 @@
1423 2095
14242006-05-18 Kim F. Storm <storm@cua.dk> 20962006-05-18 Kim F. Storm <storm@cua.dk>
1425 2097
1426 * xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when 2098 * xdisp.c (display_tool_bar_line): Restore entire tool-bar
1427 backtracking in case last image doesn't fit on line. 2099 geometry when backtracking in case last image doesn't fit on line.
1428 2100
14292006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change) 21012006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change)
1430 2102
1431 * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than 2103 * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by
1432 height of one frame default line. 2104 more than height of one frame default line.
1433 2105
14342006-05-17 Richard Stallman <rms@gnu.org> 21062006-05-17 Richard Stallman <rms@gnu.org>
1435 2107
@@ -2229,10 +2901,11 @@
2229 * term.c: Define aliases for append_glyph and produce_stretch_glyph 2901 * term.c: Define aliases for append_glyph and produce_stretch_glyph
2230 when `static' is defined to avoid name clash with those in xdisp.c. 2902 when `static' is defined to avoid name clash with those in xdisp.c.
2231 2903
2232 * process.c (Faccept_process_output): Fix to comply with lisp reference. 2904 * process.c (Faccept_process_output): Fix to comply with lisp
2233 Change arg "timeout" to "seconds" and allow both integer and float value. 2905 reference. Change arg "timeout" to "seconds" and allow both
2234 Change arg "timeout-msec" to "millisec" and interpret" as milliseconds 2906 integer and float value. Change arg "timeout-msec" to "millisec"
2235 rather than microseconds. Fix doc string accordingly. 2907 and interpret" as milliseconds rather than microseconds. Fix doc
2908 string accordingly.
2236 2909
22372006-03-21 Ken Raeburn <raeburn@raeburn.org> 29102006-03-21 Ken Raeburn <raeburn@raeburn.org>
2238 2911
@@ -4442,7 +5115,8 @@
4442 * xdisp.c (pos_visible_p): Convert w->hscroll to pixels before use. 5115 * xdisp.c (pos_visible_p): Convert w->hscroll to pixels before use.
4443 (remember_mouse_glyph): Clear RECT if mouse is over an image glyph. 5116 (remember_mouse_glyph): Clear RECT if mouse is over an image glyph.
4444 5117
4445 * keyboard.c (make_lispy_position): Adjust wx for left margin if ON_TEXT. 5118 * keyboard.c (make_lispy_position): Adjust wx for left margin if
5119 ON_TEXT.
4446 (Fposn_at_x_y): Fix calculation of x coordinate. 5120 (Fposn_at_x_y): Fix calculation of x coordinate.
4447 (Fposn_at_point): Return nil if point is hscrolled out of view. 5121 (Fposn_at_point): Return nil if point is hscrolled out of view.
4448 5122
@@ -9936,7 +10610,6 @@
9936 10610
9937 * xterm.c (xim_destroy_callback): Ditto. 10611 * xterm.c (xim_destroy_callback): Ditto.
9938 10612
9939
99402004-10-20 B. Anyos <banyos@freemail.hu> (tiny change) 106132004-10-20 B. Anyos <banyos@freemail.hu> (tiny change)
9941 10614
9942 * w32term.c (x_draw_glyph_string): Use overline_color for overlines. 10615 * w32term.c (x_draw_glyph_string): Use overline_color for overlines.
@@ -10940,7 +11613,8 @@
10940 11613
10941 * search.c (match_limit, Fmatch_data, Fset_match_data): YAILOM. 11614 * search.c (match_limit, Fmatch_data, Fset_match_data): YAILOM.
10942 11615
10943 * fontset.c (Fset_fontset_font): Remove unused vars `family' and `registry'. 11616 * fontset.c (Fset_fontset_font): Remove unused vars `family' and
11617 `registry'.
10944 11618
10945 * Makefile.in (${etc}DOC): Fix file name of make-docfile. 11619 * Makefile.in (${etc}DOC): Fix file name of make-docfile.
10946 11620
@@ -13914,11 +14588,11 @@
13914 pointer types. 14588 pointer types.
13915 (Qrelative_width, Qalign_to): Remove unused variables. 14589 (Qrelative_width, Qalign_to): Remove unused variables.
13916 (Vvoid_text_area_pointer): Replace Vshow_text_cursor_in_void. 14590 (Vvoid_text_area_pointer): Replace Vshow_text_cursor_in_void.
13917 (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for 14591 (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for image
13918 image maps. 14592 maps.
13919 (x_y_to_hpos_vpos): Return glyph relative coordinates through 14593 (x_y_to_hpos_vpos): Return glyph relative coordinates through new
13920 new dx and dy args. 14594 dx and dy args. Remove buffer_only_p arg (always 0). Simplify
13921 Remove buffer_only_p arg (always 0). Simplify code accordingly. 14595 code accordingly.
13922 (get_glyph_string_clip_rect): Draw cursor using glyph's rather 14596 (get_glyph_string_clip_rect): Draw cursor using glyph's rather
13923 than row's ascent and height, to get sensible height on tall rows. 14597 than row's ascent and height, to get sensible height on tall rows.
13924 (build_desired_tool_bar_string): Remove Qimage extern. 14598 (build_desired_tool_bar_string): Remove Qimage extern.
@@ -13931,14 +14605,16 @@
13931 rectangular, circular, or polygon-shaped image hot-spot, 14605 rectangular, circular, or polygon-shaped image hot-spot,
13932 (find_hot_spot): New function to search for image hot-spot. 14606 (find_hot_spot): New function to search for image hot-spot.
13933 (Flookup_image_map): New defun to search for image hot-spot. 14607 (Flookup_image_map): New defun to search for image hot-spot.
13934 (define_frame_cursor1): New aux function to determine frame pointer. 14608 (define_frame_cursor1): New aux function to determine frame
13935 (note_mode_line_or_margin_highlight, note_mouse_highlight): 14609 pointer.
13936 Handle `pointer' text property and :pointer image property to 14610 (note_mode_line_or_margin_highlight, note_mouse_highlight): Handle
13937 control frame pointer shape. Detect image hot-spots for pointer 14611 `pointer' text property and :pointer image property to control
13938 and help_echo properties. Use define_frame_cursor1. 14612 frame pointer shape. Detect image hot-spots for pointer and
13939 (note_mouse_highlight): Use Vvoid_text_area_pointer. 14613 help_echo properties. Use define_frame_cursor1.
13940 (syms_of_xdisp): Defsubr new defun. Intern and staticpro new variables. 14614 (note_mouse_highlight): Use Vvoid_text_area_pointer.
13941 DEFVAR_LISP Vvoid_text_area_pointer instead of Vshow_text_cursor_in_void. 14615 (syms_of_xdisp): Defsubr new defun. Intern and staticpro new
14616 variables. DEFVAR_LISP Vvoid_text_area_pointer instead of
14617 Vshow_text_cursor_in_void.
13942 14618
13943 * xfaces.c (cache_face): Abort if c->size exceeds MAX_FACE_ID. 14619 * xfaces.c (cache_face): Abort if c->size exceeds MAX_FACE_ID.
13944 14620
@@ -14422,8 +15098,8 @@
14422 * alloc.c (lisp_align_malloc): If BASE is 0, call memory_full. 15098 * alloc.c (lisp_align_malloc): If BASE is 0, call memory_full.
14423 15099
14424 * window.c (Fset_window_margins): Allow only integers as args. 15100 * window.c (Fset_window_margins): Allow only integers as args.
14425 (syms_of_window) <special-display-buffer-names, special-display-regexps>: 15101 (syms_of_window) <special-display-buffer-names,
14426 Doc fixes. 15102 special-display-regexps>: Doc fixes.
14427 15103
144282003-10-13 Lute Kamstra <lute@gnu.org> 151042003-10-13 Lute Kamstra <lute@gnu.org>
14429 15105
@@ -18423,6 +19099,14 @@
18423 19099
18424 * Makefile.in (fns.o): Depend on coding.h. 19100 * Makefile.in (fns.o): Depend on coding.h.
18425 19101
191022003-01-06 Dave Love <fx@gnu.org>
19103
19104 * fns.c: Include coding.h. Use POINTER_TYPE*, not void*.
19105 (Vlocale_coding_system): Declare.
19106 (Qcodeset, Qdays, Qmonths, Qpaper): New.
19107 (Flanginfo): New.
19108 (syms_of_fns): Initialize new stuff.
19109
184262003-01-07 Markus Rost <rost@math.ohio-state.edu> 191102003-01-07 Markus Rost <rost@math.ohio-state.edu>
18427 19111
18428 * minibuf.c (Fread_variable): Doc fix. 19112 * minibuf.c (Fread_variable): Doc fix.
@@ -22226,15 +22910,15 @@
22226 22910
22227 * process.c (Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily) 22911 * process.c (Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
22228 (QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery, QCstop) 22912 (QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery, QCstop)
22229 (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): 22913 (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): New
22230 New variables. 22914 variables.
22231 (NETCONN1_P): New macro. 22915 (NETCONN1_P): New macro.
22232 (DATAGRAM_SOCKETS): New conditional symbol. 22916 (DATAGRAM_SOCKETS): New conditional symbol.
22233 (datagram_address): New array. 22917 (datagram_address): New array.
22234 (DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros. 22918 (DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
22235 (status_message): Use concat3. 22919 (status_message): Use concat3.
22236 (Fprocess_status): Add `listen' status to doc string. Return `stop' 22920 (Fprocess_status): Add `listen' status to doc string. Return
22237 for a stopped network process. 22921 `stop' for a stopped network process.
22238 (Fset_process_buffer): Update contact plist for network process. 22922 (Fset_process_buffer): Update contact plist for network process.
22239 (Fset_process_filter): Ditto. Don't enable input for stopped 22923 (Fset_process_filter): Ditto. Don't enable input for stopped
22240 network processes. Server must listen, even if filter is t. 22924 network processes. Server must listen, even if filter is t.
@@ -22244,26 +22928,29 @@
22244 (Fprocess_contact): Added KEY argument. Handle datagrams. 22928 (Fprocess_contact): Added KEY argument. Handle datagrams.
22245 (list_processes_1): Optionally show only processes with the query 22929 (list_processes_1): Optionally show only processes with the query
22246 on exit flag set. Dynamically adjust column widths. Omit tty 22930 on exit flag set. Dynamically adjust column widths. Omit tty
22247 column if not needed. Report stopped network processes. 22931 column if not needed. Report stopped network processes. Identify
22248 Identify server and datagram network processes. 22932 server and datagram network processes.
22249 (Flist_processes): New optional arg `query-only'. 22933 (Flist_processes): New optional arg `query-only'.
22250 (conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size) 22934 (conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
22251 (conv_lisp_to_sockaddr, set_socket_options) 22935 (conv_lisp_to_sockaddr, set_socket_options)
22252 (network_process_featurep, unwind_request_sigio): New helper functions. 22936 (network_process_featurep, unwind_request_sigio): New helper
22937 functions.
22253 (Fprocess_datagram_address, Fset_process_datagram_address): 22938 (Fprocess_datagram_address, Fset_process_datagram_address):
22254 (Fset_network_process_options): New lisp functions. 22939 (Fset_network_process_options): New lisp functions.
22255 (Fopen_network_stream): Removed. Now defined in simple.el. 22940 (Fopen_network_stream): Removed. Now defined in simple.el.
22256 (Fmake_network_process): New lisp function. Code is based on previous 22941 (Fmake_network_process): New lisp function. Code is based on
22257 Fopen_network_stream, but heavily reworked with new property list based 22942 previous Fopen_network_stream, but heavily reworked with new
22258 argument list, support for datagrams, server processes, and local 22943 property list based argument list, support for datagrams, server
22259 sockets in addition to old client-only functionality. 22944 processes, and local sockets in addition to old client-only
22945 functionality.
22260 (server_accept_connection): New function. 22946 (server_accept_connection): New function.
22261 (wait_reading_process_input): Use it to handle incoming connects. 22947 (wait_reading_process_input): Use it to handle incoming connects.
22262 Do not enable input on a new connection if process is stopped. 22948 Do not enable input on a new connection if process is stopped.
22263 (read_process_output): Handle datagram sockets. Use 2k buffer for them. 22949 (read_process_output): Handle datagram sockets. Use 2k buffer for
22950 them.
22264 (send_process): Handle datagram sockets. 22951 (send_process): Handle datagram sockets.
22265 (Fstop_process, Fcontinue_process): Apply to network processes. A stopped 22952 (Fstop_process, Fcontinue_process): Apply to network processes. A
22266 network process is indicated by setting command field to t . 22953 stopped network process is indicated by setting command field to t.
22267 (Fprocess_send_eof): No-op if datagram connection. 22954 (Fprocess_send_eof): No-op if datagram connection.
22268 (Fstatus_notify): Don't read input for a stream server socket or a 22955 (Fstatus_notify): Don't read input for a stream server socket or a
22269 stopped network process. 22956 stopped network process.
diff --git a/src/Makefile.in b/src/Makefile.in
index cb9db5614a1..71eaeadb6ba 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -74,13 +74,13 @@ SHELL=/bin/sh
74#define NOT_C_CODE 74#define NOT_C_CODE
75#include "config.h" 75#include "config.h"
76 76
77/* We won't really call alloca; 77/* We will not really call alloca;
78 don't let the file name alloca.c get messed up. */ 78 do not let the file name alloca.c get messed up. */
79#ifdef alloca 79#ifdef alloca
80#undef alloca 80#undef alloca
81#endif 81#endif
82 82
83/* Don't let the file name mktime.c get messed up. */ 83/* Do not let the file name mktime.c get messed up. */
84#ifdef mktime 84#ifdef mktime
85#undef mktime 85#undef mktime
86#endif 86#endif
@@ -95,7 +95,7 @@ SHELL=/bin/sh
95#endif 95#endif
96 96
97/* On some machines #define register is done in config; 97/* On some machines #define register is done in config;
98 don't let it interfere with this file. */ 98 do not let it interfere with this file. */
99#undef register 99#undef register
100 100
101/* On some systems we may not be able to use the system make command. */ 101/* On some systems we may not be able to use the system make command. */
@@ -115,7 +115,7 @@ CC = C_COMPILER
115#endif 115#endif
116#endif 116#endif
117 117
118/* Some machines don't find the standard C libraries in the usual place. */ 118/* Some machines do not find the standard C libraries in the usual place. */
119#ifndef ORDINARY_LINK 119#ifndef ORDINARY_LINK
120#ifndef LIB_STANDARD 120#ifndef LIB_STANDARD
121#define LIB_STANDARD -lc 121#define LIB_STANDARD -lc
@@ -247,7 +247,7 @@ STARTFILES = START_FILES
247#endif /* not ORDINARY_LINK */ 247#endif /* not ORDINARY_LINK */
248 248
249 249
250/* cc switches needed to make `asm' keyword work. 250/* cc switches needed to make ``asm'' keyword work.
251 Nothing special needed on most machines. */ 251 Nothing special needed on most machines. */
252#ifndef C_SWITCH_ASM 252#ifndef C_SWITCH_ASM
253#define C_SWITCH_ASM 253#define C_SWITCH_ASM
@@ -276,7 +276,7 @@ TOOLKIT_DEFINES =
276 for use in Emacs. 276 for use in Emacs.
277 277
278 -DHAVE_CONFIG_H is needed for some other files to take advantage of 278 -DHAVE_CONFIG_H is needed for some other files to take advantage of
279 the information in `config.h'. */ 279 the information in ``config.h''. */
280 280
281/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM 281/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
282 since it may have -I options that should override those two. */ 282 since it may have -I options that should override those two. */
@@ -336,7 +336,7 @@ LIBXMENU= -lXMenu
336 336
337#else /* not HAVE_MENUS */ 337#else /* not HAVE_MENUS */
338 338
339/* Otherwise, don't worry about the menu library at all. */ 339/* Otherwise, do not worry about the menu library at all. */
340LIBXMENU= 340LIBXMENU=
341#endif /* not HAVE_MENUS */ 341#endif /* not HAVE_MENUS */
342 342
@@ -380,7 +380,7 @@ LIBXTR6 = -lSM -lICE
380#ifdef LIBXT_STATIC 380#ifdef LIBXT_STATIC
381/* We assume the config files have defined STATIC_OPTION 381/* We assume the config files have defined STATIC_OPTION
382 since that might depend on the operating system. 382 since that might depend on the operating system.
383 (Don't forget you need different definitions with and without __GNUC__.) */ 383 (Do not forget you need different definitions with and without __GNUC__.) */
384LIBXT= STATIC_OPTION $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext DYNAMIC_OPTION 384LIBXT= STATIC_OPTION $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext DYNAMIC_OPTION
385#else /* not LIBXT_STATIC */ 385#else /* not LIBXT_STATIC */
386LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext 386LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext
@@ -468,9 +468,9 @@ CFLAGS_SOUND= @CFLAGS_SOUND@
468/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure 468/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
469 places that are difficult to figure out at make time. Fortunately, 469 places that are difficult to figure out at make time. Fortunately,
470 these same versions allow you to pass arbitrary flags on to the 470 these same versions allow you to pass arbitrary flags on to the
471 linker, so there's no reason not to use it as a linker. 471 linker, so there is no reason not to use it as a linker.
472 472
473 Well, it's not quite perfect. The `-nostdlib' keeps GCC from 473 Well, it is not quite perfect. The "-nostdlib" keeps GCC from
474 searching for libraries in its internal directories, so we have to 474 searching for libraries in its internal directories, so we have to
475 ask GCC explicitly where to find libgcc.a. */ 475 ask GCC explicitly where to find libgcc.a. */
476 476
@@ -487,9 +487,9 @@ GNULIB_VAR = LIB_GCC
487 487
488#ifndef LINKER_WAS_SPECIFIED 488#ifndef LINKER_WAS_SPECIFIED
489/* GCC passes any argument prefixed with -Xlinker directly to the 489/* GCC passes any argument prefixed with -Xlinker directly to the
490 linker. See prefix-args.c for an explanation of why we don't do 490 linker. See prefix-args.c for an explanation of why we do not do
491 this with the shell's `for' construct. 491 this with the shell''s ``for'' construct.
492 Note that some people don't have '.' in their paths, so we must 492 Note that some people do not have '.' in their paths, so we must
493 use ./prefix-args. */ 493 use ./prefix-args. */
494#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` 494#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
495#else 495#else
@@ -530,12 +530,12 @@ LD=ld
530#endif /* not ORDINARY_LINK */ 530#endif /* not ORDINARY_LINK */
531 531
532/* Flags to pass to LD only for temacs. */ 532/* Flags to pass to LD only for temacs. */
533/* Don't split this line with a backslash. That can cause trouble with 533/* Do not split this line with a backslash. That can cause trouble with
534 some cpps. */ 534 some cpps. */
535TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE 535TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE
536 536
537/* A macro which other sections of Makefile can redefine to munge the 537/* A macro which other sections of Makefile can redefine to munge the
538 flags before they're passed to LD. This is helpful if you have 538 flags before they are passed to LD. This is helpful if you have
539 redefined LD to something odd, like "gcc". 539 redefined LD to something odd, like "gcc".
540 (The YMF prefix is a holdover from the old name "ymakefile".) 540 (The YMF prefix is a holdover from the old name "ymakefile".)
541 */ 541 */
@@ -705,8 +705,8 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBO
705#define TOOLTIP_SUPPORT 705#define TOOLTIP_SUPPORT
706#endif 706#endif
707 707
708/* List of Lisp files loaded into the dumped Emacs. It's arranged 708/* List of Lisp files loaded into the dumped Emacs. It is arranged
709 like this because it's easier to generate it semi-mechanically from 709 like this because it is easier to generate it semi-mechanically from
710 loadup.el this way. 710 loadup.el this way.
711 711
712 Note that this list should not include lisp files which might not 712 Note that this list should not include lisp files which might not
@@ -913,7 +913,7 @@ shortlisp= \
913 We must unconditionally put them in the DOC file. 913 We must unconditionally put them in the DOC file.
914 We use ../lisp/ to start the file names 914 We use ../lisp/ to start the file names
915 to reduce the size of the argument list for make-docfile 915 to reduce the size of the argument list for make-docfile
916 for the sake of systems which can\'t handle large ones. */ 916 for the sake of systems which can''t handle large ones. */
917SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \ 917SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \
918 ${dotdot}/lisp/select.elc ${dotdot}/lisp/scroll-bar.elc \ 918 ${dotdot}/lisp/select.elc ${dotdot}/lisp/scroll-bar.elc \
919 ${dotdot}/lisp/vmsproc.elc ${dotdot}/lisp/vms-patch.elc \ 919 ${dotdot}/lisp/vmsproc.elc ${dotdot}/lisp/vms-patch.elc \
@@ -993,13 +993,13 @@ temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} $
993 -o temacs ${STARTFILES} ${obj} ${otherobj} \ 993 -o temacs ${STARTFILES} ${obj} ${otherobj} \
994 OBJECTS_MACHINE ${LIBES} 994 OBJECTS_MACHINE ${LIBES}
995 995
996/* We don't use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE 996/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
997 often contain options that have to do with using Emacs's crt0, 997 often contain options that have to do with using Emacs''s crt0,
998 which are only good with temacs. */ 998 which are only good with temacs. */
999prefix-args${EXEEXT}: prefix-args.c $(config_h) 999prefix-args${EXEEXT}: prefix-args.c $(config_h)
1000 $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args 1000 $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args
1001 1001
1002/* Don't lose if this was not defined. */ 1002/* Do not lose if this was not defined. */
1003#ifndef OLDXMENU_OPTIONS 1003#ifndef OLDXMENU_OPTIONS
1004#define OLDXMENU_OPTIONS 1004#define OLDXMENU_OPTIONS
1005#endif 1005#endif
@@ -1062,7 +1062,7 @@ really-oldXMenu:
1062#endif /* not USE_X_TOOLKIT */ 1062#endif /* not USE_X_TOOLKIT */
1063#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ 1063#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1064 1064
1065/* We don\'t really need this, but satisfy the dependency. */ 1065/* We don''t really need this, but satisfy the dependency. */
1066stamp-oldxmenu: 1066stamp-oldxmenu:
1067 touch stamp-oldxmenu 1067 touch stamp-oldxmenu
1068#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ 1068#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
@@ -1152,7 +1152,8 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \
1152 systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ 1152 systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
1153 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h) 1153 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
1154keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 1154keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
1155 atimer.h systime.h puresize.h charset.h intervals.h $(config_h) 1155 atimer.h systime.h puresize.h charset.h intervals.h keymap.h window.h \
1156 $(config_h)
1156lastfile.o: lastfile.c $(config_h) 1157lastfile.o: lastfile.c $(config_h)
1157macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \ 1158macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
1158 dispextern.h $(config_h) 1159 dispextern.h $(config_h)
diff --git a/src/buffer.c b/src/buffer.c
index 6a11569c85a..f2f15a54743 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -387,6 +387,7 @@ The value is never nil. */)
387 BUF_ZV_BYTE (b) = BEG_BYTE; 387 BUF_ZV_BYTE (b) = BEG_BYTE;
388 BUF_Z_BYTE (b) = BEG_BYTE; 388 BUF_Z_BYTE (b) = BEG_BYTE;
389 BUF_MODIFF (b) = 1; 389 BUF_MODIFF (b) = 1;
390 BUF_CHARS_MODIFF (b) = 1;
390 BUF_OVERLAY_MODIFF (b) = 1; 391 BUF_OVERLAY_MODIFF (b) = 1;
391 BUF_SAVE_MODIFF (b) = 1; 392 BUF_SAVE_MODIFF (b) = 1;
392 BUF_INTERVALS (b) = 0; 393 BUF_INTERVALS (b) = 0;
@@ -1161,6 +1162,31 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1161 1162
1162 return make_number (BUF_MODIFF (buf)); 1163 return make_number (BUF_MODIFF (buf));
1163} 1164}
1165
1166DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick,
1167 Sbuffer_chars_modified_tick, 0, 1, 0,
1168 doc: /* Return BUFFER's character-change tick counter.
1169Each buffer has a character-change tick counter, which is set to the
1170value of the buffer's tick counter \(see `buffer-modified-tick'), each
1171time text in that buffer is inserted or deleted. By comparing the
1172values returned by two individual calls of `buffer-chars-modified-tick',
1173you can tell whether a character change occurred in that buffer in
1174between these calls. No argument or nil as argument means use current
1175buffer as BUFFER. */)
1176 (buffer)
1177 register Lisp_Object buffer;
1178{
1179 register struct buffer *buf;
1180 if (NILP (buffer))
1181 buf = current_buffer;
1182 else
1183 {
1184 CHECK_BUFFER (buffer);
1185 buf = XBUFFER (buffer);
1186 }
1187
1188 return make_number (BUF_CHARS_MODIFF (buf));
1189}
1164 1190
1165DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, 1191DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
1166 "sRename buffer (to new name): \nP", 1192 "sRename buffer (to new name): \nP",
@@ -5495,7 +5521,7 @@ A string is printed verbatim in the mode line except for %-constructs:
5495 or print Bottom or All. 5521 or print Bottom or All.
5496 %n -- print Narrow if appropriate. 5522 %n -- print Narrow if appropriate.
5497 %t -- visited file is text or binary (if OS supports this distinction). 5523 %t -- visited file is text or binary (if OS supports this distinction).
5498 %z -- print mnemonics of buffer, terminal, and keyboard coding systems. 5524 %z -- print mnemonics of keyboard, terminal, and buffer coding systems.
5499 %Z -- like %z, but including the end-of-line format. 5525 %Z -- like %z, but including the end-of-line format.
5500 %e -- print error message about full memory. 5526 %e -- print error message about full memory.
5501 %[ -- print one [ for each recursive editing level. %] similar. 5527 %[ -- print one [ for each recursive editing level. %] similar.
@@ -6074,6 +6100,7 @@ The function `kill-all-local-variables' runs this before doing anything else. *
6074 defsubr (&Sbuffer_modified_p); 6100 defsubr (&Sbuffer_modified_p);
6075 defsubr (&Sset_buffer_modified_p); 6101 defsubr (&Sset_buffer_modified_p);
6076 defsubr (&Sbuffer_modified_tick); 6102 defsubr (&Sbuffer_modified_tick);
6103 defsubr (&Sbuffer_chars_modified_tick);
6077 defsubr (&Srename_buffer); 6104 defsubr (&Srename_buffer);
6078 defsubr (&Sother_buffer); 6105 defsubr (&Sother_buffer);
6079 defsubr (&Sbuffer_enable_undo); 6106 defsubr (&Sbuffer_enable_undo);
diff --git a/src/buffer.h b/src/buffer.h
index efe0252453a..a5f8a6a4070 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -82,6 +82,9 @@ Boston, MA 02110-1301, USA. */
82/* Modification count. */ 82/* Modification count. */
83#define MODIFF (current_buffer->text->modiff) 83#define MODIFF (current_buffer->text->modiff)
84 84
85/* Character modification count. */
86#define CHARS_MODIFF (current_buffer->text->chars_modiff)
87
85/* Overlay modification count. */ 88/* Overlay modification count. */
86#define OVERLAY_MODIFF (current_buffer->text->overlay_modiff) 89#define OVERLAY_MODIFF (current_buffer->text->overlay_modiff)
87 90
@@ -147,6 +150,9 @@ Boston, MA 02110-1301, USA. */
147/* Modification count. */ 150/* Modification count. */
148#define BUF_MODIFF(buf) ((buf)->text->modiff) 151#define BUF_MODIFF(buf) ((buf)->text->modiff)
149 152
153/* Character modification count. */
154#define BUF_CHARS_MODIFF(buf) ((buf)->text->chars_modiff)
155
150/* Modification count as of last visit or save. */ 156/* Modification count as of last visit or save. */
151#define BUF_SAVE_MODIFF(buf) ((buf)->text->save_modiff) 157#define BUF_SAVE_MODIFF(buf) ((buf)->text->save_modiff)
152 158
@@ -406,6 +412,10 @@ struct buffer_text
406 for this buffer. It is incremented for 412 for this buffer. It is incremented for
407 each such event, and never otherwise 413 each such event, and never otherwise
408 changed. */ 414 changed. */
415 int chars_modiff; /* This is modified with character change
416 events for this buffer. It is set to
417 modiff for each such event, and never
418 otherwise changed. */
409 int save_modiff; /* Previous value of modiff, as of last 419 int save_modiff; /* Previous value of modiff, as of last
410 time buffer visited or saved a file. */ 420 time buffer visited or saved a file. */
411 421
diff --git a/src/callint.c b/src/callint.c
index e48168db164..5c54cdcaf48 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -257,9 +257,11 @@ See `interactive'.
257Optional second arg RECORD-FLAG non-nil 257Optional second arg RECORD-FLAG non-nil
258means unconditionally put this command in the command-history. 258means unconditionally put this command in the command-history.
259Otherwise, this is done only if an arg is read using the minibuffer. 259Otherwise, this is done only if an arg is read using the minibuffer.
260
260Optional third arg KEYS, if given, specifies the sequence of events to 261Optional third arg KEYS, if given, specifies the sequence of events to
261supply if the command inquires which events were used to invoke it. 262supply, as a vector, if the command inquires which events were used to
262If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) 263invoke it. If KEYS is omitted or nil, the return value of
264`this-command-keys-vector' is used. */)
263 (function, record_flag, keys) 265 (function, record_flag, keys)
264 Lisp_Object function, record_flag, keys; 266 Lisp_Object function, record_flag, keys;
265{ 267{
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 0ad884310ed..cb7c953a3e4 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -187,7 +187,7 @@ casify_region (flag, b, e)
187 validate_region (&b, &e); 187 validate_region (&b, &e);
188 start = XFASTINT (b); 188 start = XFASTINT (b);
189 end = XFASTINT (e); 189 end = XFASTINT (e);
190 modify_region (current_buffer, start, end); 190 modify_region (current_buffer, start, end, 0);
191 record_change (start, end - start); 191 record_change (start, end - start);
192 start_byte = CHAR_TO_BYTE (start); 192 start_byte = CHAR_TO_BYTE (start);
193 end_byte = CHAR_TO_BYTE (end); 193 end_byte = CHAR_TO_BYTE (end);
diff --git a/src/casetab.c b/src/casetab.c
index 5483f5663fa..8c46ab11c60 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -262,6 +262,9 @@ init_casetab_once ()
262 : i))); 262 : i)));
263 263
264 XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up); 264 XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up);
265
266 /* Fill in what isn't filled in. */
267 set_case_table (down, 1);
265} 268}
266 269
267void 270void
diff --git a/src/charset.h b/src/charset.h
index b7ab4cb8b53..b25a2ffa85a 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -658,22 +658,34 @@ else
658 } while (0) 658 } while (0)
659 659
660 660
661/* If P is after LIMIT, advance P to the previous character boundary. 661/* If P is after LIMIT, advance P to the previous character boundary. */
662 It assumes that P is already at a character boundary of the sane
663 mulitbyte form whose beginning address is LIMIT. */
664 662
665#define PREV_CHAR_BOUNDARY(p, limit) \ 663#define PREV_CHAR_BOUNDARY(p, limit) \
666 do { \ 664 do { \
667 if ((p) > (limit)) \ 665 if ((p) > (limit)) \
668 { \ 666 { \
669 const unsigned char *p0 = (p); \ 667 const unsigned char *p0 = (p); \
668 const unsigned char *p_limit = max (limit, p0 - MAX_MULTIBYTE_LENGTH);\
670 do { \ 669 do { \
671 p0--; \ 670 p0--; \
672 } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \ 671 } while (p0 >= p_limit && ! CHAR_HEAD_P (*p0)); \
673 (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \ 672 /* If BBCH(*p0) > p-p0, it means we were not on a boundary. */ \
673 (p) = (BYTES_BY_CHAR_HEAD (*p0) >= (p) - p0) ? p0 : (p) - 1; \
674 } \ 674 } \
675 } while (0) 675 } while (0)
676 676
677#define AT_CHAR_BOUNDARY_P(result, p, limit) \
678 do { \
679 if (CHAR_HEAD_P (*(p)) || (p) <= limit) \
680 /* Optimization for the common case. */ \
681 (result) = 1; \
682 else \
683 { \
684 const unsigned char *p_aux = (p)+1; \
685 PREV_CHAR_BOUNDARY (p_aux, limit); \
686 (result) = (p_aux == (p)); \
687 } \
688} while (0)
677 689
678#ifdef emacs 690#ifdef emacs
679 691
diff --git a/src/coding.c b/src/coding.c
index 53f37c580de..24c6ef0b6b1 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6654,7 +6654,8 @@ sequence containing the bytes in the region between START and END when
6654the coding system `undecided' is specified. The list is ordered by 6654the coding system `undecided' is specified. The list is ordered by
6655priority decided in the current language environment. 6655priority decided in the current language environment.
6656 6656
6657If only ASCII characters are found, it returns a list of single element 6657If only ASCII characters are found (except for such ISO-2022 control
6658characters ISO-2022 as ESC), it returns a list of single element
6658`undecided' or its subsidiary coding system according to a detected 6659`undecided' or its subsidiary coding system according to a detected
6659end-of-line format. 6660end-of-line format.
6660 6661
@@ -6701,7 +6702,8 @@ sequence containing the bytes in STRING when the coding system
6701`undecided' is specified. The list is ordered by priority decided in 6702`undecided' is specified. The list is ordered by priority decided in
6702the current language environment. 6703the current language environment.
6703 6704
6704If only ASCII characters are found, it returns a list of single element 6705If only ASCII characters are found (except for such ISO-2022 control
6706characters ISO-2022 as ESC), it returns a list of single element
6705`undecided' or its subsidiary coding system according to a detected 6707`undecided' or its subsidiary coding system according to a detected
6706end-of-line format. 6708end-of-line format.
6707 6709
diff --git a/src/dispextern.h b/src/dispextern.h
index 52e549ebc0f..1198838c17d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2679,7 +2679,7 @@ extern Lisp_Object help_echo_object, previous_help_echo_string;
2679extern int help_echo_pos; 2679extern int help_echo_pos;
2680extern struct frame *last_mouse_frame; 2680extern struct frame *last_mouse_frame;
2681extern int last_tool_bar_item; 2681extern int last_tool_bar_item;
2682extern int mouse_autoselect_window; 2682extern Lisp_Object Vmouse_autoselect_window;
2683extern int unibyte_display_via_language_environment; 2683extern int unibyte_display_via_language_environment;
2684 2684
2685extern void reseat_at_previous_visible_line_start P_ ((struct it *)); 2685extern void reseat_at_previous_visible_line_start P_ ((struct it *));
@@ -2773,6 +2773,9 @@ extern void x_reference_bitmap P_ ((struct frame *, int));
2773extern int x_create_bitmap_from_data P_ ((struct frame *, char *, 2773extern int x_create_bitmap_from_data P_ ((struct frame *, char *,
2774 unsigned int, unsigned int)); 2774 unsigned int, unsigned int));
2775extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object)); 2775extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
2776#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
2777extern int x_create_bitmap_from_xpm_data P_ ((struct frame *f, char **bits));
2778#endif
2776#ifndef x_destroy_bitmap 2779#ifndef x_destroy_bitmap
2777extern void x_destroy_bitmap P_ ((struct frame *, int)); 2780extern void x_destroy_bitmap P_ ((struct frame *, int));
2778#endif 2781#endif
diff --git a/src/dispnew.c b/src/dispnew.c
index 1d977898f60..394c550fa73 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4409,7 +4409,12 @@ update_text_area (w, vpos)
4409 || desired_row->phys_height != current_row->phys_height 4409 || desired_row->phys_height != current_row->phys_height
4410 || desired_row->visible_height != current_row->visible_height 4410 || desired_row->visible_height != current_row->visible_height
4411 || current_row->overlapped_p 4411 || current_row->overlapped_p
4412#if 0
4413 /* This causes excessive flickering when mouse is moved across
4414 the mode line. Luckily everything seems to work just fine
4415 without doing this. KFS 2006-09-17. */
4412 || current_row->mouse_face_p 4416 || current_row->mouse_face_p
4417#endif
4413 || current_row->x != desired_row->x) 4418 || current_row->x != desired_row->x)
4414 { 4419 {
4415 rif->cursor_to (vpos, 0, desired_row->y, desired_row->x); 4420 rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
@@ -6529,7 +6534,8 @@ Emacs was built without floating point support.
6529/* This is just like wait_reading_process_output, except that 6534/* This is just like wait_reading_process_output, except that
6530 it does redisplay. 6535 it does redisplay.
6531 6536
6532 TIMEOUT is number of seconds to wait (float or integer). 6537 TIMEOUT is number of seconds to wait (float or integer),
6538 or t to wait forever.
6533 READING is 1 if reading input. 6539 READING is 1 if reading input.
6534 If DO_DISPLAY is >0 display process output while waiting. 6540 If DO_DISPLAY is >0 display process output while waiting.
6535 If DO_DISPLAY is >1 perform an initial redisplay before waiting. 6541 If DO_DISPLAY is >1 perform an initial redisplay before waiting.
@@ -6562,10 +6568,15 @@ sit_for (timeout, reading, do_display)
6562 sec = (int) seconds; 6568 sec = (int) seconds;
6563 usec = (int) ((seconds - sec) * 1000000); 6569 usec = (int) ((seconds - sec) * 1000000);
6564 } 6570 }
6571 else if (EQ (timeout, Qt))
6572 {
6573 sec = 0;
6574 usec = 0;
6575 }
6565 else 6576 else
6566 wrong_type_argument (Qnumberp, timeout); 6577 wrong_type_argument (Qnumberp, timeout);
6567 6578
6568 if (sec == 0 && usec == 0) 6579 if (sec == 0 && usec == 0 && !EQ (timeout, Qt))
6569 return Qt; 6580 return Qt;
6570 6581
6571#ifdef SIGIO 6582#ifdef SIGIO
@@ -6582,7 +6593,8 @@ sit_for (timeout, reading, do_display)
6582DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0, 6593DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0,
6583 doc: /* Perform redisplay if no input is available. 6594 doc: /* Perform redisplay if no input is available.
6584If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil, 6595If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil,
6585perform a full redisplay even if input is available. */) 6596perform a full redisplay even if input is available.
6597Return t if redisplay was performed, nil otherwise. */)
6586 (force) 6598 (force)
6587 Lisp_Object force; 6599 Lisp_Object force;
6588{ 6600{
diff --git a/src/editfns.c b/src/editfns.c
index c43528c4863..71b518acb74 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1390,7 +1390,7 @@ name, or nil if there is no such user. */)
1390} 1390}
1391 1391
1392DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, 1392DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
1393 doc: /* Return the name of the machine you are running on, as a string. */) 1393 doc: /* Return the host name of the machine you are running on, as a string. */)
1394 () 1394 ()
1395{ 1395{
1396 return Vsystem_name; 1396 return Vsystem_name;
@@ -1694,7 +1694,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1694 SBYTES (format_string), 1694 SBYTES (format_string),
1695 tm, ut); 1695 tm, ut);
1696 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) 1696 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
1697 return code_convert_string_norecord (make_string (buf, result), 1697 return code_convert_string_norecord (make_unibyte_string (buf, result),
1698 Vlocale_coding_system, 0); 1698 Vlocale_coding_system, 0);
1699 1699
1700 /* If buffer was too small, make it bigger and try again. */ 1700 /* If buffer was too small, make it bigger and try again. */
@@ -2781,7 +2781,7 @@ Both characters must have the same length of multi-byte form. */)
2781 else if (!changed) 2781 else if (!changed)
2782 { 2782 {
2783 changed = -1; 2783 changed = -1;
2784 modify_region (current_buffer, pos, XINT (end)); 2784 modify_region (current_buffer, pos, XINT (end), 0);
2785 2785
2786 if (! NILP (noundo)) 2786 if (! NILP (noundo))
2787 { 2787 {
@@ -2897,7 +2897,7 @@ It returns the number of characters changed. */)
2897 pos = XINT (start); 2897 pos = XINT (start);
2898 pos_byte = CHAR_TO_BYTE (pos); 2898 pos_byte = CHAR_TO_BYTE (pos);
2899 end_pos = XINT (end); 2899 end_pos = XINT (end);
2900 modify_region (current_buffer, pos, XINT (end)); 2900 modify_region (current_buffer, pos, XINT (end), 0);
2901 2901
2902 cnt = 0; 2902 cnt = 0;
2903 for (; pos < end_pos; ) 2903 for (; pos < end_pos; )
@@ -3178,6 +3178,9 @@ The message also goes into the `*Messages*' buffer.
3178The first argument is a format control string, and the rest are data 3178The first argument is a format control string, and the rest are data
3179to be formatted under control of the string. See `format' for details. 3179to be formatted under control of the string. See `format' for details.
3180 3180
3181Note: Use (message "%s" VALUE) to print the value of expressions and
3182variables to avoid accidentally interpreting `%' as format specifiers.
3183
3181If the first argument is nil or the empty string, the function clears 3184If the first argument is nil or the empty string, the function clears
3182any existing message; this lets the minibuffer contents show. See 3185any existing message; this lets the minibuffer contents show. See
3183also `current-message'. 3186also `current-message'.
@@ -3758,7 +3761,13 @@ usage: (format STRING &rest OBJECTS) */)
3758 this_format[format - this_format_start] = 0; 3761 this_format[format - this_format_start] = 0;
3759 3762
3760 if (INTEGERP (args[n])) 3763 if (INTEGERP (args[n]))
3761 sprintf (p, this_format, XINT (args[n])); 3764 {
3765 if (format[-1] == 'd')
3766 sprintf (p, this_format, XINT (args[n]));
3767 /* Don't sign-extend for octal or hex printing. */
3768 else
3769 sprintf (p, this_format, XUINT (args[n]));
3770 }
3762 else 3771 else
3763 sprintf (p, this_format, XFLOAT_DATA (args[n])); 3772 sprintf (p, this_format, XFLOAT_DATA (args[n]));
3764 3773
@@ -4162,7 +4171,7 @@ Transposing beyond buffer boundaries is an error. */)
4162 4171
4163 if (end1 == start2) /* adjacent regions */ 4172 if (end1 == start2) /* adjacent regions */
4164 { 4173 {
4165 modify_region (current_buffer, start1, end2); 4174 modify_region (current_buffer, start1, end2, 0);
4166 record_change (start1, len1 + len2); 4175 record_change (start1, len1 + len2);
4167 4176
4168 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4177 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
@@ -4218,8 +4227,8 @@ Transposing beyond buffer boundaries is an error. */)
4218 { 4227 {
4219 USE_SAFE_ALLOCA; 4228 USE_SAFE_ALLOCA;
4220 4229
4221 modify_region (current_buffer, start1, end1); 4230 modify_region (current_buffer, start1, end1, 0);
4222 modify_region (current_buffer, start2, end2); 4231 modify_region (current_buffer, start2, end2, 0);
4223 record_change (start1, len1); 4232 record_change (start1, len1);
4224 record_change (start2, len2); 4233 record_change (start2, len2);
4225 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4234 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
@@ -4248,7 +4257,7 @@ Transposing beyond buffer boundaries is an error. */)
4248 { 4257 {
4249 USE_SAFE_ALLOCA; 4258 USE_SAFE_ALLOCA;
4250 4259
4251 modify_region (current_buffer, start1, end2); 4260 modify_region (current_buffer, start1, end2, 0);
4252 record_change (start1, (end2 - start1)); 4261 record_change (start1, (end2 - start1));
4253 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4262 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4254 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4263 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
@@ -4279,7 +4288,7 @@ Transposing beyond buffer boundaries is an error. */)
4279 USE_SAFE_ALLOCA; 4288 USE_SAFE_ALLOCA;
4280 4289
4281 record_change (start1, (end2 - start1)); 4290 record_change (start1, (end2 - start1));
4282 modify_region (current_buffer, start1, end2); 4291 modify_region (current_buffer, start1, end2, 0);
4283 4292
4284 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4293 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4285 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4294 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
@@ -4364,7 +4373,7 @@ functions if all the text being accessed has this property. */);
4364 Vbuffer_access_fontified_property = Qnil; 4373 Vbuffer_access_fontified_property = Qnil;
4365 4374
4366 DEFVAR_LISP ("system-name", &Vsystem_name, 4375 DEFVAR_LISP ("system-name", &Vsystem_name,
4367 doc: /* The name of the machine Emacs is running on. */); 4376 doc: /* The host name of the machine Emacs is running on. */);
4368 4377
4369 DEFVAR_LISP ("user-full-name", &Vuser_full_name, 4378 DEFVAR_LISP ("user-full-name", &Vuser_full_name,
4370 doc: /* The full name of the user logged in. */); 4379 doc: /* The full name of the user logged in. */);
diff --git a/src/emacs.c b/src/emacs.c
index 530f008270c..26a0c4da859 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2138,6 +2138,9 @@ shut_down_emacs (sig, no_x, stuff)
2138 2138
2139 stuff_buffered_input (stuff); 2139 stuff_buffered_input (stuff);
2140 2140
2141#ifdef subprocesses
2142 inhibit_sentinels = 1;
2143#endif
2141 kill_buffer_processes (Qnil); 2144 kill_buffer_processes (Qnil);
2142 Fdo_auto_save (Qt, Qnil); 2145 Fdo_auto_save (Qt, Qnil);
2143 2146
diff --git a/src/eval.c b/src/eval.c
index c8ad9004c44..3c9a0c03214 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -28,6 +28,10 @@ Boston, MA 02110-1301, USA. */
28#include "dispextern.h" 28#include "dispextern.h"
29#include <setjmp.h> 29#include <setjmp.h>
30 30
31#if HAVE_X_WINDOWS
32#include "xterm.h"
33#endif
34
31/* This definition is duplicated in alloc.c and keyboard.c */ 35/* This definition is duplicated in alloc.c and keyboard.c */
32/* Putting it in lisp.h makes cc bomb out! */ 36/* Putting it in lisp.h makes cc bomb out! */
33 37
@@ -199,6 +203,14 @@ extern Lisp_Object Qrisky_local_variable;
199 203
200static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); 204static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*));
201static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN; 205static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN;
206
207#if __GNUC__
208/* "gcc -O3" enables automatic function inlining, which optimizes out
209 the arguments for the invocations of these functions, whereas they
210 expect these values on the stack. */
211Lisp_Object apply1 () __attribute__((noinline));
212Lisp_Object call2 () __attribute__((noinline));
213#endif
202 214
203void 215void
204init_eval_once () 216init_eval_once ()
@@ -1906,6 +1918,9 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1906 max_specpdl_size--; 1918 max_specpdl_size--;
1907 } 1919 }
1908 if (! no_debugger 1920 if (! no_debugger
1921 /* Don't try to run the debugger with interrupts blocked.
1922 The editing loop would return anyway. */
1923 && ! INPUT_BLOCKED_P
1909 && (EQ (sig_symbol, Qquit) 1924 && (EQ (sig_symbol, Qquit)
1910 ? debug_on_quit 1925 ? debug_on_quit
1911 : wants_debugger (Vdebug_on_error, conditions)) 1926 : wants_debugger (Vdebug_on_error, conditions))
diff --git a/src/fns.c b/src/fns.c
index 5fe429fcf8b..31774e71787 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -387,7 +387,12 @@ Symbols are also allowed; their print names are used instead. */)
387 return i1 < SCHARS (s2) ? Qt : Qnil; 387 return i1 < SCHARS (s2) ? Qt : Qnil;
388} 388}
389 389
390static Lisp_Object concat (); 390#if __GNUC__
391/* "gcc -O3" enables automatic function inlining, which optimizes out
392 the arguments for the invocations of this function, whereas it
393 expects these values on the stack. */
394static Lisp_Object concat () __attribute__((noinline));
395#endif
391 396
392/* ARGSUSED */ 397/* ARGSUSED */
393Lisp_Object 398Lisp_Object
@@ -1459,11 +1464,10 @@ The value is actually the tail of LIST whose car is ELT. */)
1459} 1464}
1460 1465
1461DEFUN ("memq", Fmemq, Smemq, 2, 2, 0, 1466DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
1462 doc: /* Return non-nil if ELT is an element of LIST. 1467doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'.
1463Comparison done with `eq'. The value is actually the tail of LIST 1468The value is actually the tail of LIST whose car is ELT. */)
1464whose car is ELT. */)
1465 (elt, list) 1469 (elt, list)
1466 Lisp_Object elt, list; 1470 register Lisp_Object elt, list;
1467{ 1471{
1468 while (1) 1472 while (1)
1469 { 1473 {
@@ -1486,6 +1490,30 @@ whose car is ELT. */)
1486 return list; 1490 return list;
1487} 1491}
1488 1492
1493DEFUN ("memql", Fmemql, Smemql, 2, 2, 0,
1494doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'.
1495The value is actually the tail of LIST whose car is ELT. */)
1496 (elt, list)
1497 register Lisp_Object elt;
1498 Lisp_Object list;
1499{
1500 register Lisp_Object tail;
1501
1502 if (!FLOATP (elt))
1503 return Fmemq (elt, list);
1504
1505 for (tail = list; !NILP (tail); tail = XCDR (tail))
1506 {
1507 register Lisp_Object tem;
1508 CHECK_LIST_CONS (tail, list);
1509 tem = XCAR (tail);
1510 if (FLOATP (tem) && internal_equal (elt, tem, 0, 0))
1511 return tail;
1512 QUIT;
1513 }
1514 return Qnil;
1515}
1516
1489DEFUN ("assq", Fassq, Sassq, 2, 2, 0, 1517DEFUN ("assq", Fassq, Sassq, 2, 2, 0,
1490 doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST. 1518 doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST.
1491The value is actually the first element of LIST whose car is KEY. 1519The value is actually the first element of LIST whose car is KEY.
@@ -2749,7 +2777,8 @@ optimize_sub_char_table (table, chars)
2749 else 2777 else
2750 from = 32, to = 128; 2778 from = 32, to = 128;
2751 2779
2752 if (!SUB_CHAR_TABLE_P (*table)) 2780 if (!SUB_CHAR_TABLE_P (*table)
2781 || ! NILP (XCHAR_TABLE (*table)->defalt))
2753 return; 2782 return;
2754 elt = XCHAR_TABLE (*table)->contents[from++]; 2783 elt = XCHAR_TABLE (*table)->contents[from++];
2755 for (; from < to; from++) 2784 for (; from < to; from++)
@@ -2764,7 +2793,7 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table,
2764 Lisp_Object table; 2793 Lisp_Object table;
2765{ 2794{
2766 Lisp_Object elt; 2795 Lisp_Object elt;
2767 int dim; 2796 int dim, chars;
2768 int i, j; 2797 int i, j;
2769 2798
2770 CHECK_CHAR_TABLE (table); 2799 CHECK_CHAR_TABLE (table);
@@ -2775,10 +2804,11 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table,
2775 if (!SUB_CHAR_TABLE_P (elt)) 2804 if (!SUB_CHAR_TABLE_P (elt))
2776 continue; 2805 continue;
2777 dim = CHARSET_DIMENSION (i - 128); 2806 dim = CHARSET_DIMENSION (i - 128);
2807 chars = CHARSET_CHARS (i - 128);
2778 if (dim == 2) 2808 if (dim == 2)
2779 for (j = 32; j < SUB_CHAR_TABLE_ORDINARY_SLOTS; j++) 2809 for (j = 32; j < SUB_CHAR_TABLE_ORDINARY_SLOTS; j++)
2780 optimize_sub_char_table (XCHAR_TABLE (elt)->contents + j, dim); 2810 optimize_sub_char_table (XCHAR_TABLE (elt)->contents + j, chars);
2781 optimize_sub_char_table (XCHAR_TABLE (table)->contents + i, dim); 2811 optimize_sub_char_table (XCHAR_TABLE (table)->contents + i, chars);
2782 } 2812 }
2783 return Qnil; 2813 return Qnil;
2784} 2814}
@@ -5831,6 +5861,7 @@ used if both `use-dialog-box' and this variable are non-nil. */);
5831 defsubr (&Selt); 5861 defsubr (&Selt);
5832 defsubr (&Smember); 5862 defsubr (&Smember);
5833 defsubr (&Smemq); 5863 defsubr (&Smemq);
5864 defsubr (&Smemql);
5834 defsubr (&Sassq); 5865 defsubr (&Sassq);
5835 defsubr (&Sassoc); 5866 defsubr (&Sassoc);
5836 defsubr (&Srassq); 5867 defsubr (&Srassq);
diff --git a/src/frame.c b/src/frame.c
index 021e9bf604f..d7c58fd8faa 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -115,6 +115,7 @@ Lisp_Object Qenvironment;
115 115
116Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; 116Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
117 117
118Lisp_Object Qinhibit_face_set_after_frame_default;
118Lisp_Object Qface_set_after_frame_default; 119Lisp_Object Qface_set_after_frame_default;
119 120
120Lisp_Object Vterminal_frame; 121Lisp_Object Vterminal_frame;
@@ -3036,12 +3037,20 @@ x_set_frame_parameters (f, alist)
3036 || EQ (prop, Qfullscreen)) 3037 || EQ (prop, Qfullscreen))
3037 { 3038 {
3038 register Lisp_Object param_index, old_value; 3039 register Lisp_Object param_index, old_value;
3040 int count = SPECPDL_INDEX ();
3039 3041
3040 old_value = get_frame_param (f, prop); 3042 old_value = get_frame_param (f, prop);
3041 fullscreen_is_being_set |= EQ (prop, Qfullscreen); 3043 fullscreen_is_being_set |= EQ (prop, Qfullscreen);
3042 3044
3043 if (NILP (Fequal (val, old_value))) 3045 if (NILP (Fequal (val, old_value)))
3044 { 3046 {
3047 /* For :font attributes, the frame_parm_handler
3048 x_set_font calls `face-set-after-frame-default'.
3049 Unless we bind inhibit-face-set-after-frame-default
3050 here, this would reset the :font attribute that we
3051 just applied to the default value for new faces. */
3052 specbind (Qinhibit_face_set_after_frame_default, Qt);
3053
3045 store_frame_param (f, prop, val); 3054 store_frame_param (f, prop, val);
3046 3055
3047 param_index = Fget (prop, Qx_frame_parameter); 3056 param_index = Fget (prop, Qx_frame_parameter);
@@ -3050,6 +3059,7 @@ x_set_frame_parameters (f, alist)
3050 < sizeof (frame_parms)/sizeof (frame_parms[0])) 3059 < sizeof (frame_parms)/sizeof (frame_parms[0]))
3051 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) 3060 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
3052 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); 3061 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
3062 unbind_to (count, Qnil);
3053 } 3063 }
3054 } 3064 }
3055 } 3065 }
@@ -4321,6 +4331,10 @@ syms_of_frame ()
4321 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); 4331 Qface_set_after_frame_default = intern ("face-set-after-frame-default");
4322 staticpro (&Qface_set_after_frame_default); 4332 staticpro (&Qface_set_after_frame_default);
4323 4333
4334 Qinhibit_face_set_after_frame_default
4335 = intern ("inhibit-face-set-after-frame-default");
4336 staticpro (&Qinhibit_face_set_after_frame_default);
4337
4324 Qfullwidth = intern ("fullwidth"); 4338 Qfullwidth = intern ("fullwidth");
4325 staticpro (&Qfullwidth); 4339 staticpro (&Qfullwidth);
4326 Qfullheight = intern ("fullheight"); 4340 Qfullheight = intern ("fullheight");
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 71df287a6b6..646fbbc4e4c 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -10,17 +10,17 @@
10 Written May 1989 by Mike Haertel. 10 Written May 1989 by Mike Haertel.
11 11
12This library is free software; you can redistribute it and/or 12This library is free software; you can redistribute it and/or
13modify it under the terms of the GNU Library General Public License as 13modify it under the terms of the GNU General Public License as
14published by the Free Software Foundation; either version 2 of the 14published by the Free Software Foundation; either version 2 of the
15License, or (at your option) any later version. 15License, or (at your option) any later version.
16 16
17This library is distributed in the hope that it will be useful, 17This library is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of 18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20Library General Public License for more details. 20General Public License for more details.
21 21
22You should have received a copy of the GNU Library General Public 22You should have received a copy of the GNU General Public
23License along with this library; see the file COPYING.LIB. If 23License along with this library; see the file COPYING. If
24not, write to the Free Software Foundation, Inc., 51 Franklin Street, 24not, write to the Free Software Foundation, Inc., 51 Franklin Street,
25Fifth Floor, Boston, MA 02110-1301, USA. 25Fifth Floor, Boston, MA 02110-1301, USA.
26 26
@@ -329,17 +329,17 @@ extern __ptr_t r_re_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size));
329 Written May 1989 by Mike Haertel. 329 Written May 1989 by Mike Haertel.
330 330
331This library is free software; you can redistribute it and/or 331This library is free software; you can redistribute it and/or
332modify it under the terms of the GNU Library General Public License as 332modify it under the terms of the GNU General Public License as
333published by the Free Software Foundation; either version 2 of the 333published by the Free Software Foundation; either version 2 of the
334License, or (at your option) any later version. 334License, or (at your option) any later version.
335 335
336This library is distributed in the hope that it will be useful, 336This library is distributed in the hope that it will be useful,
337but WITHOUT ANY WARRANTY; without even the implied warranty of 337but WITHOUT ANY WARRANTY; without even the implied warranty of
338MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 338MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
339Library General Public License for more details. 339General Public License for more details.
340 340
341You should have received a copy of the GNU Library General Public 341You should have received a copy of the GNU General Public
342License along with this library; see the file COPYING.LIB. If 342License along with this library; see the file COPYING. If
343not, write to the Free Software Foundation, Inc., 51 Franklin Street, 343not, write to the Free Software Foundation, Inc., 51 Franklin Street,
344Fifth Floor, Boston, MA 02110-1301, USA. 344Fifth Floor, Boston, MA 02110-1301, USA.
345 345
@@ -932,17 +932,17 @@ _realloc (ptr, size)
932 Written May 1989 by Mike Haertel. 932 Written May 1989 by Mike Haertel.
933 933
934This library is free software; you can redistribute it and/or 934This library is free software; you can redistribute it and/or
935modify it under the terms of the GNU Library General Public License as 935modify it under the terms of the GNU General Public License as
936published by the Free Software Foundation; either version 2 of the 936published by the Free Software Foundation; either version 2 of the
937License, or (at your option) any later version. 937License, or (at your option) any later version.
938 938
939This library is distributed in the hope that it will be useful, 939This library is distributed in the hope that it will be useful,
940but WITHOUT ANY WARRANTY; without even the implied warranty of 940but WITHOUT ANY WARRANTY; without even the implied warranty of
941MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 941MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
942Library General Public License for more details. 942General Public License for more details.
943 943
944You should have received a copy of the GNU Library General Public 944You should have received a copy of the GNU General Public
945License along with this library; see the file COPYING.LIB. If 945License along with this library; see the file COPYING. If
946not, write to the Free Software Foundation, Inc., 51 Franklin Street, 946not, write to the Free Software Foundation, Inc., 51 Franklin Street,
947Fifth Floor, Boston, MA 02110-1301, USA. 947Fifth Floor, Boston, MA 02110-1301, USA.
948 948
@@ -1251,17 +1251,17 @@ cfree (ptr)
1251 Written May 1989 by Mike Haertel. 1251 Written May 1989 by Mike Haertel.
1252 1252
1253This library is free software; you can redistribute it and/or 1253This library is free software; you can redistribute it and/or
1254modify it under the terms of the GNU Library General Public License as 1254modify it under the terms of the GNU General Public License as
1255published by the Free Software Foundation; either version 2 of the 1255published by the Free Software Foundation; either version 2 of the
1256License, or (at your option) any later version. 1256License, or (at your option) any later version.
1257 1257
1258This library is distributed in the hope that it will be useful, 1258This library is distributed in the hope that it will be useful,
1259but WITHOUT ANY WARRANTY; without even the implied warranty of 1259but WITHOUT ANY WARRANTY; without even the implied warranty of
1260MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1260MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1261Library General Public License for more details. 1261General Public License for more details.
1262 1262
1263You should have received a copy of the GNU Library General Public 1263You should have received a copy of the GNU General Public
1264License along with this library; see the file COPYING.LIB. If 1264License along with this library; see the file COPYING. If
1265not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1265not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1266Fifth Floor, Boston, MA 02110-1301, USA. 1266Fifth Floor, Boston, MA 02110-1301, USA.
1267 1267
@@ -1496,17 +1496,17 @@ realloc (ptr, size)
1496/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. 1496/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
1497 1497
1498This library is free software; you can redistribute it and/or 1498This library is free software; you can redistribute it and/or
1499modify it under the terms of the GNU Library General Public License as 1499modify it under the terms of the GNU General Public License as
1500published by the Free Software Foundation; either version 2 of the 1500published by the Free Software Foundation; either version 2 of the
1501License, or (at your option) any later version. 1501License, or (at your option) any later version.
1502 1502
1503This library is distributed in the hope that it will be useful, 1503This library is distributed in the hope that it will be useful,
1504but WITHOUT ANY WARRANTY; without even the implied warranty of 1504but WITHOUT ANY WARRANTY; without even the implied warranty of
1505MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1505MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1506Library General Public License for more details. 1506General Public License for more details.
1507 1507
1508You should have received a copy of the GNU Library General Public 1508You should have received a copy of the GNU General Public
1509License along with this library; see the file COPYING.LIB. If 1509License along with this library; see the file COPYING. If
1510not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1510not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1511Fifth Floor, Boston, MA 02110-1301, USA. 1511Fifth Floor, Boston, MA 02110-1301, USA.
1512 1512
@@ -1593,17 +1593,17 @@ __default_morecore (increment)
1593/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. 1593/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
1594 1594
1595This library is free software; you can redistribute it and/or 1595This library is free software; you can redistribute it and/or
1596modify it under the terms of the GNU Library General Public License as 1596modify it under the terms of the GNU General Public License as
1597published by the Free Software Foundation; either version 2 of the 1597published by the Free Software Foundation; either version 2 of the
1598License, or (at your option) any later version. 1598License, or (at your option) any later version.
1599 1599
1600This library is distributed in the hope that it will be useful, 1600This library is distributed in the hope that it will be useful,
1601but WITHOUT ANY WARRANTY; without even the implied warranty of 1601but WITHOUT ANY WARRANTY; without even the implied warranty of
1602MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1602MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1603Library General Public License for more details. 1603General Public License for more details.
1604 1604
1605You should have received a copy of the GNU Library General Public 1605You should have received a copy of the GNU General Public
1606License along with this library; see the file COPYING.LIB. If 1606License along with this library; see the file COPYING. If
1607not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1607not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1608Fifth Floor, Boston, MA 02110-1301, USA. */ 1608Fifth Floor, Boston, MA 02110-1301, USA. */
1609 1609
@@ -1693,17 +1693,17 @@ memalign (alignment, size)
1693 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. 1693 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
1694 1694
1695This library is free software; you can redistribute it and/or 1695This library is free software; you can redistribute it and/or
1696modify it under the terms of the GNU Library General Public License as 1696modify it under the terms of the GNU General Public License as
1697published by the Free Software Foundation; either version 2 of the 1697published by the Free Software Foundation; either version 2 of the
1698License, or (at your option) any later version. 1698License, or (at your option) any later version.
1699 1699
1700This library is distributed in the hope that it will be useful, 1700This library is distributed in the hope that it will be useful,
1701but WITHOUT ANY WARRANTY; without even the implied warranty of 1701but WITHOUT ANY WARRANTY; without even the implied warranty of
1702MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1702MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1703Library General Public License for more details. 1703General Public License for more details.
1704 1704
1705You should have received a copy of the GNU Library General Public 1705You should have received a copy of the GNU General Public
1706License along with this library; see the file COPYING.LIB. If 1706License along with this library; see the file COPYING. If
1707not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1707not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1708Fifth Floor, Boston, MA 02110-1301, USA. 1708Fifth Floor, Boston, MA 02110-1301, USA.
1709 1709
@@ -1760,17 +1760,17 @@ valloc (size)
1760 Written May 1989 by Mike Haertel. 1760 Written May 1989 by Mike Haertel.
1761 1761
1762This library is free software; you can redistribute it and/or 1762This library is free software; you can redistribute it and/or
1763modify it under the terms of the GNU Library General Public License as 1763modify it under the terms of the GNU General Public License as
1764published by the Free Software Foundation; either version 2 of the 1764published by the Free Software Foundation; either version 2 of the
1765License, or (at your option) any later version. 1765License, or (at your option) any later version.
1766 1766
1767This library is distributed in the hope that it will be useful, 1767This library is distributed in the hope that it will be useful,
1768but WITHOUT ANY WARRANTY; without even the implied warranty of 1768but WITHOUT ANY WARRANTY; without even the implied warranty of
1769MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1769MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1770Library General Public License for more details. 1770General Public License for more details.
1771 1771
1772You should have received a copy of the GNU Library General Public 1772You should have received a copy of the GNU General Public
1773License along with this library; see the file COPYING.LIB. If 1773License along with this library; see the file COPYING. If
1774not, write to the Free Software Foundation, Inc., 51 Franklin Street, 1774not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1775Fifth Floor, Boston, MA 02110-1301, USA. 1775Fifth Floor, Boston, MA 02110-1301, USA.
1776 1776
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 4329ce236de..18b3607fc6f 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -131,14 +131,8 @@ xg_display_close (Display *dpy)
131#ifdef HAVE_GTK_MULTIDISPLAY 131#ifdef HAVE_GTK_MULTIDISPLAY
132 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); 132 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
133 133
134 /* GTK 2.2 has a bug that makes gdk_display_close crash (bug
135 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way
136 we can continue running, but there will be memory leaks. */
137
138#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4
139
140 /* If this is the default display, we must change it before calling 134 /* If this is the default display, we must change it before calling
141 dispose, otherwise it will crash. */ 135 dispose, otherwise it will crash on some Gtk+ versions. */
142 if (gdk_display_get_default () == gdpy) 136 if (gdk_display_get_default () == gdpy)
143 { 137 {
144 struct x_display_info *dpyinfo; 138 struct x_display_info *dpyinfo;
@@ -160,10 +154,14 @@ xg_display_close (Display *dpy)
160 gdpy_new); 154 gdpy_new);
161 } 155 }
162 156
163 g_object_run_dispose (G_OBJECT (gdpy)); 157 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug
158 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way
159 we can continue running, but there will be memory leaks. */
164 160
161#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10
162 g_object_run_dispose (G_OBJECT (gdpy));
165#else 163#else
166 /* I hope this will be fixed in GTK 2.4. It is what bug 85715 says. */ 164 /* This seems to be fixed in GTK 2.10. */
167 gdk_display_close (gdpy); 165 gdk_display_close (gdpy);
168#endif 166#endif
169#endif /* HAVE_GTK_MULTIDISPLAY */ 167#endif /* HAVE_GTK_MULTIDISPLAY */
@@ -509,10 +507,66 @@ get_utf8_string (str)
509{ 507{
510 char *utf8_str = str; 508 char *utf8_str = str;
511 509
510 if (!str) return NULL;
511
512 /* If not UTF-8, try current locale. */ 512 /* If not UTF-8, try current locale. */
513 if (str && !g_utf8_validate (str, -1, NULL)) 513 if (!g_utf8_validate (str, -1, NULL))
514 utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); 514 utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
515 515
516 if (!utf8_str)
517 {
518 /* Probably some control characters in str. Escape them. */
519 size_t nr_bad = 0;
520 gsize bytes_read;
521 gsize bytes_written;
522 unsigned char *p = (unsigned char *)str;
523 char *cp, *up;
524 GError *error = NULL;
525
526 while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read,
527 &bytes_written, &error))
528 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
529 {
530 ++nr_bad;
531 p += bytes_written+1;
532 g_error_free (error);
533 error = NULL;
534 }
535
536 if (error)
537 {
538 g_error_free (error);
539 error = NULL;
540 }
541 if (cp) g_free (cp);
542
543 up = utf8_str = xmalloc (strlen (str) + nr_bad * 4 + 1);
544 p = str;
545
546 while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read,
547 &bytes_written, &error))
548 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
549 {
550 strncpy (up, p, bytes_written);
551 sprintf (up + bytes_written, "\\%03o", p[bytes_written]);
552 up[bytes_written+4] = '\0';
553 up += bytes_written+4;
554 p += bytes_written+1;
555 g_error_free (error);
556 error = NULL;
557 }
558
559 if (cp)
560 {
561 strcat (utf8_str, cp);
562 g_free (cp);
563 }
564 if (error)
565 {
566 g_error_free (error);
567 error = NULL;
568 }
569 }
516 return utf8_str; 570 return utf8_str;
517} 571}
518 572
@@ -1158,8 +1212,8 @@ int
1158xg_uses_old_file_dialog () 1212xg_uses_old_file_dialog ()
1159{ 1213{
1160#ifdef HAVE_GTK_FILE_BOTH 1214#ifdef HAVE_GTK_FILE_BOTH
1161 extern int x_use_old_gtk_file_dialog; 1215 extern int x_gtk_use_old_file_dialog;
1162 return x_use_old_gtk_file_dialog; 1216 return x_gtk_use_old_file_dialog;
1163#else /* ! HAVE_GTK_FILE_BOTH */ 1217#else /* ! HAVE_GTK_FILE_BOTH */
1164 1218
1165#ifdef HAVE_GTK_FILE_SELECTION_NEW 1219#ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -1296,6 +1350,8 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1296 GTK_FILE_CHOOSER_ACTION_OPEN : 1350 GTK_FILE_CHOOSER_ACTION_OPEN :
1297 GTK_FILE_CHOOSER_ACTION_SAVE); 1351 GTK_FILE_CHOOSER_ACTION_SAVE);
1298 extern int x_gtk_show_hidden_files; 1352 extern int x_gtk_show_hidden_files;
1353 extern int x_gtk_file_dialog_help_text;
1354
1299 1355
1300 if (only_dir_p) 1356 if (only_dir_p)
1301 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; 1357 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
@@ -1323,16 +1379,24 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1323 g_signal_connect (G_OBJECT (filewin), "notify", 1379 g_signal_connect (G_OBJECT (filewin), "notify",
1324 G_CALLBACK (xg_toggle_notify_cb), wtoggle); 1380 G_CALLBACK (xg_toggle_notify_cb), wtoggle);
1325 1381
1326 message[0] = '\0'; 1382 if (x_gtk_file_dialog_help_text)
1327 if (action != GTK_FILE_CHOOSER_ACTION_SAVE) 1383 {
1328 strcat (message, "\nType C-l to display a file name text entry box.\n"); 1384 message[0] = '\0';
1329 strcat (message, "\nIf you don't like this file selector, customize " 1385 /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
1330 "use-file-dialog\nto turn it off, or type C-x C-f to visit files."); 1386 Show the C-l help text only for versions < 2.10. */
1387 if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
1388 strcat (message, "\nType C-l to display a file name text entry box.\n");
1389 strcat (message, "\nIf you don't like this file selector, use the "
1390 "corresponding\nkey binding or customize "
1391 "use-file-dialog to turn it off.");
1392
1393 wmessage = gtk_label_new (message);
1394 gtk_widget_show (wmessage);
1395 }
1331 1396
1332 wmessage = gtk_label_new (message);
1333 gtk_widget_show (wmessage);
1334 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0); 1397 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0);
1335 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0); 1398 if (x_gtk_file_dialog_help_text)
1399 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0);
1336 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox); 1400 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox);
1337 1401
1338 if (default_filename) 1402 if (default_filename)
@@ -1340,6 +1404,7 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1340 Lisp_Object file; 1404 Lisp_Object file;
1341 struct gcpro gcpro1; 1405 struct gcpro gcpro1;
1342 GCPRO1 (file); 1406 GCPRO1 (file);
1407 char *utf8_filename;
1343 1408
1344 file = build_string (default_filename); 1409 file = build_string (default_filename);
1345 1410
@@ -1347,14 +1412,23 @@ xg_get_file_with_chooser (f, prompt, default_filename,
1347 an absolute name starting with /. */ 1412 an absolute name starting with /. */
1348 if (default_filename[0] != '/') 1413 if (default_filename[0] != '/')
1349 file = Fexpand_file_name (file, Qnil); 1414 file = Fexpand_file_name (file, Qnil);
1350 1415
1351 default_filename = SSDATA (file); 1416 utf8_filename = SSDATA (ENCODE_UTF_8 (file));
1352 if (Ffile_directory_p (file)) 1417 if (! NILP (Ffile_directory_p (file)))
1353 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin), 1418 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin),
1354 default_filename); 1419 utf8_filename);
1355 else 1420 else
1356 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), 1421 {
1357 default_filename); 1422 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
1423 utf8_filename);
1424 if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
1425 {
1426 char *cp = strrchr (utf8_filename, '/');
1427 if (cp) ++cp;
1428 else cp = utf8_filename;
1429 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filewin), cp);
1430 }
1431 }
1358 1432
1359 UNGCPRO; 1433 UNGCPRO;
1360 } 1434 }
diff --git a/src/image.c b/src/image.c
index a3ae6ceb3ce..5b80fe5b692 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3153,7 +3153,7 @@ xbm_read_bitmap_data (f, contents, end, width, height, data)
3153 expect_ident ("define"); 3153 expect_ident ("define");
3154 expect (XBM_TK_IDENT); 3154 expect (XBM_TK_IDENT);
3155 3155
3156 if (LA1 == XBM_TK_NUMBER); 3156 if (LA1 == XBM_TK_NUMBER)
3157 { 3157 {
3158 char *p = strrchr (buffer, '_'); 3158 char *p = strrchr (buffer, '_');
3159 p = p ? p + 1 : buffer; 3159 p = p ? p + 1 : buffer;
diff --git a/src/indent.c b/src/indent.c
index efc375e27f7..efe10bc3f78 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -337,8 +337,8 @@ DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0,
337 doc: /* Return the horizontal position of point. Beginning of line is column 0. 337 doc: /* Return the horizontal position of point. Beginning of line is column 0.
338This is calculated by adding together the widths of all the displayed 338This is calculated by adding together the widths of all the displayed
339representations of the character between the start of the previous line 339representations of the character between the start of the previous line
340and point. (eg control characters will have a width of 2 or 4, tabs 340and point (eg. control characters will have a width of 2 or 4, tabs
341will have a variable width) 341will have a variable width).
342Ignores finite width of frame, which means that this function may return 342Ignores finite width of frame, which means that this function may return
343values greater than (frame-width). 343values greater than (frame-width).
344Whether the line is visible (if `selective-display' is t) has no effect; 344Whether the line is visible (if `selective-display' is t) has no effect;
@@ -736,8 +736,8 @@ string_display_width (string, beg, end)
736 736
737DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", 737DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ",
738 doc: /* Indent from point with tabs and spaces until COLUMN is reached. 738 doc: /* Indent from point with tabs and spaces until COLUMN is reached.
739Optional second argument MININUM says always do at least MININUM spaces 739Optional second argument MINIMUM says always do at least MINIMUM spaces
740even if that goes past COLUMN; by default, MININUM is zero. */) 740even if that goes past COLUMN; by default, MINIMUM is zero. */)
741 (column, minimum) 741 (column, minimum)
742 Lisp_Object column, minimum; 742 Lisp_Object column, minimum;
743{ 743{
@@ -2076,7 +2076,7 @@ whether or not it is currently displayed in some window. */)
2076 { 2076 {
2077 int it_start; 2077 int it_start;
2078 int oselective; 2078 int oselective;
2079 int start_on_image_or_stretch_p; 2079 int it_overshoot_expected_p;
2080 2080
2081 SET_TEXT_POS (pt, PT, PT_BYTE); 2081 SET_TEXT_POS (pt, PT, PT_BYTE);
2082 start_display (&it, w, pt); 2082 start_display (&it, w, pt);
@@ -2088,8 +2088,26 @@ whether or not it is currently displayed in some window. */)
2088 while the end position is really at some X > 0, the same X that 2088 while the end position is really at some X > 0, the same X that
2089 PT had. */ 2089 PT had. */
2090 it_start = IT_CHARPOS (it); 2090 it_start = IT_CHARPOS (it);
2091 start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE 2091
2092 || it.method == GET_FROM_STRETCH); 2092 /* We expect the call to move_it_to, further down, to overshoot
2093 if the starting point is on an image, stretch glyph, or Lisp
2094 string. We won't need to backtrack in this situation, except
2095 for one corner case: when the Lisp string contains a
2096 newline. */
2097 if (it.method == GET_FROM_STRING)
2098 {
2099 const char *s = SDATA (it.string);
2100 const char *e = s + SBYTES (it.string);
2101
2102 while (s < e && *s != '\n')
2103 ++s;
2104
2105 it_overshoot_expected_p = (s == e);
2106 }
2107 else
2108 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE
2109 || it.method == GET_FROM_STRETCH);
2110
2093 reseat_at_previous_visible_line_start (&it); 2111 reseat_at_previous_visible_line_start (&it);
2094 it.current_x = it.hpos = 0; 2112 it.current_x = it.hpos = 0;
2095 /* Temporarily disable selective display so we don't move too far */ 2113 /* Temporarily disable selective display so we don't move too far */
@@ -2100,10 +2118,9 @@ whether or not it is currently displayed in some window. */)
2100 2118
2101 /* Move back if we got too far. This may happen if 2119 /* Move back if we got too far. This may happen if
2102 truncate-lines is on and PT is beyond right margin. 2120 truncate-lines is on and PT is beyond right margin.
2103 It may also happen if it_start is on an image or a stretch 2121 Don't go back if the overshoot is expected (see above). */
2104 glyph -- in that case, don't go back. */
2105 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 2122 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
2106 && !start_on_image_or_stretch_p) 2123 && !it_overshoot_expected_p)
2107 move_it_by_lines (&it, -1, 0); 2124 move_it_by_lines (&it, -1, 0);
2108 2125
2109 it.vpos = 0; 2126 it.vpos = 0;
diff --git a/src/insdel.c b/src/insdel.c
index b97539c1cc2..bd6e30d9449 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1007,6 +1007,7 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers)
1007 will add up to the right stuff in the undo list. */ 1007 will add up to the right stuff in the undo list. */
1008 record_insert (PT, nchars); 1008 record_insert (PT, nchars);
1009 MODIFF++; 1009 MODIFF++;
1010 CHARS_MODIFF = MODIFF;
1010 1011
1011 bcopy (string, GPT_ADDR, nbytes); 1012 bcopy (string, GPT_ADDR, nbytes);
1012 1013
@@ -1144,6 +1145,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes,
1144 1145
1145 record_insert (PT, nchars); 1146 record_insert (PT, nchars);
1146 MODIFF++; 1147 MODIFF++;
1148 CHARS_MODIFF = MODIFF;
1147 1149
1148 GAP_SIZE -= outgoing_nbytes; 1150 GAP_SIZE -= outgoing_nbytes;
1149 GPT += nchars; 1151 GPT += nchars;
@@ -1295,6 +1297,7 @@ insert_from_buffer_1 (buf, from, nchars, inherit)
1295 1297
1296 record_insert (PT, nchars); 1298 record_insert (PT, nchars);
1297 MODIFF++; 1299 MODIFF++;
1300 CHARS_MODIFF = MODIFF;
1298 1301
1299 GAP_SIZE -= outgoing_nbytes; 1302 GAP_SIZE -= outgoing_nbytes;
1300 GPT += nchars; 1303 GPT += nchars;
@@ -1403,6 +1406,7 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte)
1403 if (len == 0) 1406 if (len == 0)
1404 evaporate_overlays (from); 1407 evaporate_overlays (from);
1405 MODIFF++; 1408 MODIFF++;
1409 CHARS_MODIFF = MODIFF;
1406} 1410}
1407 1411
1408/* Like adjust_after_replace, but doesn't require PREV_TEXT. 1412/* Like adjust_after_replace, but doesn't require PREV_TEXT.
@@ -1453,6 +1457,7 @@ adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_b
1453 if (len == 0) 1457 if (len == 0)
1454 evaporate_overlays (from); 1458 evaporate_overlays (from);
1455 MODIFF++; 1459 MODIFF++;
1460 CHARS_MODIFF = MODIFF;
1456} 1461}
1457 1462
1458/* Record undo information, adjust markers and position keepers for an 1463/* Record undo information, adjust markers and position keepers for an
@@ -1645,6 +1650,7 @@ replace_range (from, to, new, prepare, inherit, markers)
1645 CHECK_MARKERS (); 1650 CHECK_MARKERS ();
1646 1651
1647 MODIFF++; 1652 MODIFF++;
1653 CHARS_MODIFF = MODIFF;
1648 UNGCPRO; 1654 UNGCPRO;
1649 1655
1650 signal_after_change (from, nchars_del, GPT - from); 1656 signal_after_change (from, nchars_del, GPT - from);
@@ -1769,6 +1775,7 @@ replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers)
1769 CHECK_MARKERS (); 1775 CHECK_MARKERS ();
1770 1776
1771 MODIFF++; 1777 MODIFF++;
1778 CHARS_MODIFF = MODIFF;
1772} 1779}
1773 1780
1774/* Delete characters in current buffer 1781/* Delete characters in current buffer
@@ -1950,6 +1957,7 @@ del_range_2 (from, from_byte, to, to_byte, ret_string)
1950 if (! EQ (current_buffer->undo_list, Qt)) 1957 if (! EQ (current_buffer->undo_list, Qt))
1951 record_delete (from, deletion); 1958 record_delete (from, deletion);
1952 MODIFF++; 1959 MODIFF++;
1960 CHARS_MODIFF = MODIFF;
1953 1961
1954 /* Relocate point as if it were a marker. */ 1962 /* Relocate point as if it were a marker. */
1955 if (from < PT) 1963 if (from < PT)
@@ -1990,12 +1998,15 @@ del_range_2 (from, from_byte, to, to_byte, ret_string)
1990 character positions START to END. This checks the read-only 1998 character positions START to END. This checks the read-only
1991 properties of the region, calls the necessary modification hooks, 1999 properties of the region, calls the necessary modification hooks,
1992 and warns the next redisplay that it should pay attention to that 2000 and warns the next redisplay that it should pay attention to that
1993 area. */ 2001 area.
2002
2003 If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF.
2004 Otherwise set CHARS_MODIFF to the new value of MODIFF. */
1994 2005
1995void 2006void
1996modify_region (buffer, start, end) 2007modify_region (buffer, start, end, preserve_chars_modiff)
1997 struct buffer *buffer; 2008 struct buffer *buffer;
1998 int start, end; 2009 int start, end, preserve_chars_modiff;
1999{ 2010{
2000 struct buffer *old_buffer = current_buffer; 2011 struct buffer *old_buffer = current_buffer;
2001 2012
@@ -2009,6 +2020,8 @@ modify_region (buffer, start, end)
2009 if (MODIFF <= SAVE_MODIFF) 2020 if (MODIFF <= SAVE_MODIFF)
2010 record_first_change (); 2021 record_first_change ();
2011 MODIFF++; 2022 MODIFF++;
2023 if (! preserve_chars_modiff)
2024 CHARS_MODIFF = MODIFF;
2012 2025
2013 buffer->point_before_scroll = Qnil; 2026 buffer->point_before_scroll = Qnil;
2014 2027
diff --git a/src/keyboard.c b/src/keyboard.c
index 681018bbab9..5d0e05f887d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1619,15 +1619,17 @@ command_loop_1 ()
1619 1619
1620 if (minibuf_level 1620 if (minibuf_level
1621 && !NILP (echo_area_buffer[0]) 1621 && !NILP (echo_area_buffer[0])
1622 && EQ (minibuf_window, echo_area_window) 1622 && EQ (minibuf_window, echo_area_window))
1623 && NUMBERP (Vminibuffer_message_timeout))
1624 { 1623 {
1625 /* Bind inhibit-quit to t so that C-g gets read in 1624 /* Bind inhibit-quit to t so that C-g gets read in
1626 rather than quitting back to the minibuffer. */ 1625 rather than quitting back to the minibuffer. */
1627 int count = SPECPDL_INDEX (); 1626 int count = SPECPDL_INDEX ();
1628 specbind (Qinhibit_quit, Qt); 1627 specbind (Qinhibit_quit, Qt);
1629 1628
1630 sit_for (Vminibuffer_message_timeout, 0, 2); 1629 if (NUMBERP (Vminibuffer_message_timeout))
1630 sit_for (Vminibuffer_message_timeout, 0, 2);
1631 else
1632 sit_for (Qt, 0, 2);
1631 1633
1632 /* Clear the echo area. */ 1634 /* Clear the echo area. */
1633 message2 (0, 0, 0); 1635 message2 (0, 0, 0);
@@ -1747,7 +1749,7 @@ command_loop_1 ()
1747 if (SYMBOLP (cmd)) 1749 if (SYMBOLP (cmd))
1748 { 1750 {
1749 Lisp_Object cmd1; 1751 Lisp_Object cmd1;
1750 if (cmd1 = Fcommand_remapping (cmd), !NILP (cmd1)) 1752 if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1))
1751 cmd = cmd1; 1753 cmd = cmd1;
1752 } 1754 }
1753 1755
@@ -3365,8 +3367,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
3365 goto retry; 3367 goto retry;
3366 } 3368 }
3367 3369
3368 if (! reread || this_command_key_count == 0 3370 if ((! reread || this_command_key_count == 0
3369 || this_command_key_count_reset) 3371 || this_command_key_count_reset)
3372 && !end_time)
3370 { 3373 {
3371 3374
3372 /* Don't echo mouse motion events. */ 3375 /* Don't echo mouse motion events. */
@@ -7700,7 +7703,7 @@ parse_menu_item (item, notreal, inmenubar)
7700 Lisp_Object prefix; 7703 Lisp_Object prefix;
7701 7704
7702 if (!NILP (tem)) 7705 if (!NILP (tem))
7703 tem = Fkey_binding (tem, Qnil, Qnil); 7706 tem = Fkey_binding (tem, Qnil, Qnil, Qnil);
7704 7707
7705 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 7708 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
7706 if (CONSP (prefix)) 7709 if (CONSP (prefix))
@@ -8954,17 +8957,25 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8954 the initial keymaps from the current buffer. */ 8957 the initial keymaps from the current buffer. */
8955 nmaps = 0; 8958 nmaps = 0;
8956 8959
8957 if (!NILP (current_kboard->Voverriding_terminal_local_map) 8960 if (!NILP (current_kboard->Voverriding_terminal_local_map))
8958 || !NILP (Voverriding_local_map))
8959 { 8961 {
8960 if (3 > nmaps_allocated) 8962 if (2 > nmaps_allocated)
8961 { 8963 {
8962 submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0])); 8964 submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
8963 defs = (Lisp_Object *) alloca (3 * sizeof (defs[0])); 8965 defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
8964 nmaps_allocated = 3; 8966 nmaps_allocated = 2;
8965 } 8967 }
8966 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 8968 if (!NILP (current_kboard->Voverriding_terminal_local_map))
8967 submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; 8969 submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
8970 }
8971 else if (!NILP (Voverriding_local_map))
8972 {
8973 if (2 > nmaps_allocated)
8974 {
8975 submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
8976 defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
8977 nmaps_allocated = 2;
8978 }
8968 if (!NILP (Voverriding_local_map)) 8979 if (!NILP (Voverriding_local_map))
8969 submaps[nmaps++] = Voverriding_local_map; 8980 submaps[nmaps++] = Voverriding_local_map;
8970 } 8981 }
@@ -9332,16 +9343,19 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9332 if (!EQ (map_here, orig_local_map)) 9343 if (!EQ (map_here, orig_local_map))
9333 { 9344 {
9334 orig_local_map = map_here; 9345 orig_local_map = map_here;
9335 keybuf[t] = key; 9346 ++localized_local_map;
9336 mock_input = t + 1;
9337
9338 goto replay_sequence;
9339 } 9347 }
9348
9340 map_here = get_local_map (XINT (pos), 9349 map_here = get_local_map (XINT (pos),
9341 current_buffer, Qkeymap); 9350 current_buffer, Qkeymap);
9342 if (!EQ (map_here, orig_keymap)) 9351 if (!EQ (map_here, orig_keymap))
9343 { 9352 {
9344 orig_keymap = map_here; 9353 orig_keymap = map_here;
9354 ++localized_local_map;
9355 }
9356
9357 if (localized_local_map > 1)
9358 {
9345 keybuf[t] = key; 9359 keybuf[t] = key;
9346 mock_input = t + 1; 9360 mock_input = t + 1;
9347 9361
@@ -10177,7 +10191,7 @@ give to the command you invoke, if it asks for an argument. */)
10177 if (NILP (echo_area_buffer[0])) 10191 if (NILP (echo_area_buffer[0]))
10178 waited = sit_for (make_number (0), 0, 2); 10192 waited = sit_for (make_number (0), 0, 2);
10179 else if (NUMBERP (Vsuggest_key_bindings)) 10193 else if (NUMBERP (Vsuggest_key_bindings))
10180 waited = sit_for (Vminibuffer_message_timeout, 0, 2); 10194 waited = sit_for (Vsuggest_key_bindings, 0, 2);
10181 else 10195 else
10182 waited = sit_for (make_number (2), 0, 2); 10196 waited = sit_for (make_number (2), 0, 2);
10183 10197
@@ -10299,7 +10313,9 @@ Actually, the value is nil only if we can be sure that no input is available;
10299if there is a doubt, the value is t. */) 10313if there is a doubt, the value is t. */)
10300 () 10314 ()
10301{ 10315{
10302 if (!NILP (Vunread_command_events) || unread_command_char != -1) 10316 if (!NILP (Vunread_command_events) || unread_command_char != -1
10317 || !NILP (Vunread_post_input_method_events)
10318 || !NILP (Vunread_input_method_events))
10303 return (Qt); 10319 return (Qt);
10304 10320
10305 get_input_pending (&input_pending, 10321 get_input_pending (&input_pending,
diff --git a/src/keymap.c b/src/keymap.c
index 9e1f01e7a79..065631ccff5 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -23,6 +23,9 @@ Boston, MA 02110-1301, USA. */
23 23
24#include <config.h> 24#include <config.h>
25#include <stdio.h> 25#include <stdio.h>
26#if HAVE_ALLOCA_H
27# include <alloca.h>
28#endif
26#include "lisp.h" 29#include "lisp.h"
27#include "commands.h" 30#include "commands.h"
28#include "buffer.h" 31#include "buffer.h"
@@ -34,6 +37,7 @@ Boston, MA 02110-1301, USA. */
34#include "puresize.h" 37#include "puresize.h"
35#include "intervals.h" 38#include "intervals.h"
36#include "keymap.h" 39#include "keymap.h"
40#include "window.h"
37 41
38/* The number of elements in keymap vectors. */ 42/* The number of elements in keymap vectors. */
39#define DENSE_TABLE_SIZE (0200) 43#define DENSE_TABLE_SIZE (0200)
@@ -739,7 +743,10 @@ map_keymap_call (key, val, fun, dummy)
739DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 3, 0, 743DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 3, 0,
740 doc: /* Call FUNCTION once for each event binding in KEYMAP. 744 doc: /* Call FUNCTION once for each event binding in KEYMAP.
741FUNCTION is called with two arguments: the event that is bound, and 745FUNCTION is called with two arguments: the event that is bound, and
742the definition it is bound to. 746the definition it is bound to. If the event is an integer, it may be
747a generic character (see Info node `(elisp)Splitting Characters'), and
748that means that all actual character events belonging to that generic
749character are bound to the definition.
743 750
744If KEYMAP has a parent, the parent's bindings are included as well. 751If KEYMAP has a parent, the parent's bindings are included as well.
745This works recursively: if the parent has itself a parent, then the 752This works recursively: if the parent has itself a parent, then the
@@ -1142,7 +1149,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1142 1149
1143 meta_bit = VECTORP (key) ? meta_modifier : 0x80; 1150 meta_bit = VECTORP (key) ? meta_modifier : 0x80;
1144 1151
1145 if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, make_number (0)))) 1152 if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
1146 { /* DEF is apparently an XEmacs-style keyboard macro. */ 1153 { /* DEF is apparently an XEmacs-style keyboard macro. */
1147 Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil); 1154 Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil);
1148 int i = ASIZE (def); 1155 int i = ASIZE (def);
@@ -1209,17 +1216,23 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1209 1216
1210/* This function may GC (it calls Fkey_binding). */ 1217/* This function may GC (it calls Fkey_binding). */
1211 1218
1212DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 1, 0, 1219DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0,
1213 doc: /* Return the remapping for command COMMAND in current keymaps. 1220 doc: /* Return the remapping for command COMMAND in current keymaps.
1214Returns nil if COMMAND is not remapped (or not a symbol). */) 1221Returns nil if COMMAND is not remapped (or not a symbol).
1215 (command) 1222
1216 Lisp_Object command; 1223If the optional argument POSITION is non-nil, it specifies a mouse
1224position as returned by `event-start' and `event-end', and the
1225remapping occurs in the keymaps associated with it. It can also be a
1226number or marker, in which case the keymap properties at the specified
1227buffer position instead of point are used. */)
1228 (command, position)
1229 Lisp_Object command, position;
1217{ 1230{
1218 if (!SYMBOLP (command)) 1231 if (!SYMBOLP (command))
1219 return Qnil; 1232 return Qnil;
1220 1233
1221 ASET (command_remapping_vector, 1, command); 1234 ASET (command_remapping_vector, 1, command);
1222 return Fkey_binding (command_remapping_vector, Qnil, Qt); 1235 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1223} 1236}
1224 1237
1225/* Value is number if KEY is too long; nil if valid but has no definition. */ 1238/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1545,7 +1558,7 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and
1545 1558
1546/* GC is possible in this function if it autoloads a keymap. */ 1559/* GC is possible in this function if it autoloads a keymap. */
1547 1560
1548DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 3, 0, 1561DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 4, 0,
1549 doc: /* Return the binding for command KEY in current keymaps. 1562 doc: /* Return the binding for command KEY in current keymaps.
1550KEY is a string or vector, a sequence of keystrokes. 1563KEY is a string or vector, a sequence of keystrokes.
1551The binding is probably a symbol with a function definition. 1564The binding is probably a symbol with a function definition.
@@ -1559,24 +1572,82 @@ recognize the default bindings, just as `read-key-sequence' does.
1559Like the normal command loop, `key-binding' will remap the command 1572Like the normal command loop, `key-binding' will remap the command
1560resulting from looking up KEY by looking up the command in the 1573resulting from looking up KEY by looking up the command in the
1561current keymaps. However, if the optional third argument NO-REMAP 1574current keymaps. However, if the optional third argument NO-REMAP
1562is non-nil, `key-binding' returns the unmapped command. */) 1575is non-nil, `key-binding' returns the unmapped command.
1563 (key, accept_default, no_remap) 1576
1564 Lisp_Object key, accept_default, no_remap; 1577If KEY is a key sequence initiated with the mouse, the used keymaps
1578will depend on the clicked mouse position with regard to the buffer
1579and possible local keymaps on strings.
1580
1581If the optional argument POSITION is non-nil, it specifies a mouse
1582position as returned by `event-start' and `event-end', and the lookup
1583occurs in the keymaps associated with it instead of KEY. It can also
1584be a number or marker, in which case the keymap properties at the
1585specified buffer position instead of point are used.
1586 */)
1587 (key, accept_default, no_remap, position)
1588 Lisp_Object key, accept_default, no_remap, position;
1565{ 1589{
1566 Lisp_Object *maps, value; 1590 Lisp_Object *maps, value;
1567 int nmaps, i; 1591 int nmaps, i;
1568 struct gcpro gcpro1; 1592 struct gcpro gcpro1, gcpro2;
1593 int count = SPECPDL_INDEX ();
1569 1594
1570 GCPRO1 (key); 1595 GCPRO2 (key, position);
1571 1596
1572 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 1597 if (NILP (position) && VECTORP (key))
1598 {
1599 Lisp_Object event
1600 /* mouse events may have a symbolic prefix indicating the
1601 scrollbar or mode line */
1602 = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
1603
1604 /* We are not interested in locations without event data */
1605
1606 if (EVENT_HAS_PARAMETERS (event))
1607 {
1608 Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (event));
1609 if (CONSP (XCDR (event)) && EQ (kind, Qmouse_click))
1610 position = EVENT_START (event);
1611 }
1612 }
1613
1614 /* Key sequences beginning with mouse clicks
1615 are read using the keymaps of the buffer clicked on, not
1616 the current buffer. So we may have to switch the buffer
1617 here. */
1618
1619 if (CONSP (position))
1620 {
1621 Lisp_Object window;
1622
1623 window = POSN_WINDOW (position);
1624
1625 if (WINDOWP (window)
1626 && BUFFERP (XWINDOW (window)->buffer)
1627 && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
1628 {
1629 /* Arrange to go back to the original buffer once we're done
1630 processing the key sequence. We don't use
1631 save_excursion_{save,restore} here, in analogy to
1632 `read-key-sequence' to avoid saving point. Maybe this
1633 would not be a problem here, but it is easier to keep
1634 things the same.
1635 */
1636
1637 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
1638
1639 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
1640 }
1641 }
1642
1643 if (! NILP (current_kboard->Voverriding_terminal_local_map))
1573 { 1644 {
1574 value = Flookup_key (current_kboard->Voverriding_terminal_local_map, 1645 value = Flookup_key (current_kboard->Voverriding_terminal_local_map,
1575 key, accept_default); 1646 key, accept_default);
1576 if (! NILP (value) && !INTEGERP (value)) 1647 if (! NILP (value) && !INTEGERP (value))
1577 goto done; 1648 goto done;
1578 } 1649 }
1579 else if (!NILP (Voverriding_local_map)) 1650 else if (! NILP (Voverriding_local_map))
1580 { 1651 {
1581 value = Flookup_key (Voverriding_local_map, key, accept_default); 1652 value = Flookup_key (Voverriding_local_map, key, accept_default);
1582 if (! NILP (value) && !INTEGERP (value)) 1653 if (! NILP (value) && !INTEGERP (value))
@@ -1584,12 +1655,71 @@ is non-nil, `key-binding' returns the unmapped command. */)
1584 } 1655 }
1585 else 1656 else
1586 { 1657 {
1587 Lisp_Object local; 1658 Lisp_Object keymap, local_map;
1659 EMACS_INT pt;
1588 1660
1589 local = get_local_map (PT, current_buffer, Qkeymap); 1661 pt = INTEGERP (position) ? XINT (position)
1590 if (! NILP (local)) 1662 : MARKERP (position) ? marker_position (position)
1663 : PT;
1664
1665 local_map = get_local_map (pt, current_buffer, Qlocal_map);
1666 keymap = get_local_map (pt, current_buffer, Qkeymap);
1667
1668 if (CONSP (position))
1591 { 1669 {
1592 value = Flookup_key (local, key, accept_default); 1670 Lisp_Object string;
1671
1672 /* For a mouse click, get the local text-property keymap
1673 of the place clicked on, rather than point. */
1674
1675 if (POSN_INBUFFER_P (position))
1676 {
1677 Lisp_Object pos;
1678
1679 pos = POSN_BUFFER_POSN (position);
1680 if (INTEGERP (pos)
1681 && XINT (pos) >= BEG && XINT (pos) <= Z)
1682 {
1683 local_map = get_local_map (XINT (pos),
1684 current_buffer, Qlocal_map);
1685
1686 keymap = get_local_map (XINT (pos),
1687 current_buffer, Qkeymap);
1688 }
1689 }
1690
1691 /* If on a mode line string with a local keymap,
1692 or for a click on a string, i.e. overlay string or a
1693 string displayed via the `display' property,
1694 consider `local-map' and `keymap' properties of
1695 that string. */
1696
1697 if (string = POSN_STRING (position),
1698 (CONSP (string) && STRINGP (XCAR (string))))
1699 {
1700 Lisp_Object pos, map;
1701
1702 pos = XCDR (string);
1703 string = XCAR (string);
1704 if (INTEGERP (pos)
1705 && XINT (pos) >= 0
1706 && XINT (pos) < SCHARS (string))
1707 {
1708 map = Fget_text_property (pos, Qlocal_map, string);
1709 if (!NILP (map))
1710 local_map = map;
1711
1712 map = Fget_text_property (pos, Qkeymap, string);
1713 if (!NILP (map))
1714 keymap = map;
1715 }
1716 }
1717
1718 }
1719
1720 if (! NILP (keymap))
1721 {
1722 value = Flookup_key (keymap, key, accept_default);
1593 if (! NILP (value) && !INTEGERP (value)) 1723 if (! NILP (value) && !INTEGERP (value))
1594 goto done; 1724 goto done;
1595 } 1725 }
@@ -1606,10 +1736,9 @@ is non-nil, `key-binding' returns the unmapped command. */)
1606 goto done; 1736 goto done;
1607 } 1737 }
1608 1738
1609 local = get_local_map (PT, current_buffer, Qlocal_map); 1739 if (! NILP (local_map))
1610 if (! NILP (local))
1611 { 1740 {
1612 value = Flookup_key (local, key, accept_default); 1741 value = Flookup_key (local_map, key, accept_default);
1613 if (! NILP (value) && !INTEGERP (value)) 1742 if (! NILP (value) && !INTEGERP (value))
1614 goto done; 1743 goto done;
1615 } 1744 }
@@ -1618,6 +1747,8 @@ is non-nil, `key-binding' returns the unmapped command. */)
1618 value = Flookup_key (current_global_map, key, accept_default); 1747 value = Flookup_key (current_global_map, key, accept_default);
1619 1748
1620 done: 1749 done:
1750 unbind_to (count, Qnil);
1751
1621 UNGCPRO; 1752 UNGCPRO;
1622 if (NILP (value) || INTEGERP (value)) 1753 if (NILP (value) || INTEGERP (value))
1623 return Qnil; 1754 return Qnil;
@@ -1628,7 +1759,7 @@ is non-nil, `key-binding' returns the unmapped command. */)
1628 if (NILP (no_remap) && SYMBOLP (value)) 1759 if (NILP (no_remap) && SYMBOLP (value))
1629 { 1760 {
1630 Lisp_Object value1; 1761 Lisp_Object value1;
1631 if (value1 = Fcommand_remapping (value), !NILP (value1)) 1762 if (value1 = Fcommand_remapping (value, position), !NILP (value1))
1632 value = value1; 1763 value = value1;
1633 } 1764 }
1634 1765
@@ -2247,16 +2378,29 @@ around function keys and event symbols. */)
2247 else 2378 else
2248 SPLIT_CHAR (without_bits, charset, c1, c2); 2379 SPLIT_CHAR (without_bits, charset, c1, c2);
2249 2380
2250 if (charset 2381 if (! CHAR_VALID_P (without_bits, 1))
2251 && CHARSET_DEFINED_P (charset) 2382 {
2252 && ((c1 >= 0 && c1 < 32) 2383 char buf[256];
2253 || (c2 >= 0 && c2 < 32))) 2384
2385 sprintf (buf, "Invalid char code %d", XINT (key));
2386 return build_string (buf);
2387 }
2388 else if (charset
2389 && ((c1 == 0 && c2 == -1) || c2 == 0))
2254 { 2390 {
2255 /* Handle a generic character. */ 2391 /* Handle a generic character. */
2256 Lisp_Object name; 2392 Lisp_Object name;
2257 name = CHARSET_TABLE_INFO (charset, CHARSET_LONG_NAME_IDX); 2393 char buf[256];
2394
2395 name = CHARSET_TABLE_INFO (charset, CHARSET_SHORT_NAME_IDX);
2258 CHECK_STRING (name); 2396 CHECK_STRING (name);
2259 return concat2 (build_string ("Character set "), name); 2397 if (c1 == 0)
2398 /* Only a charset is specified. */
2399 sprintf (buf, "Generic char %d: all of ", without_bits);
2400 else
2401 /* 1st code-point of 2-dimensional charset is specified. */
2402 sprintf (buf, "Generic char %d: row %d of ", without_bits, c1);
2403 return concat2 (build_string (buf), name);
2260 } 2404 }
2261 else 2405 else
2262 { 2406 {
@@ -2429,7 +2573,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2429 if (NILP (no_remap) && SYMBOLP (definition)) 2573 if (NILP (no_remap) && SYMBOLP (definition))
2430 { 2574 {
2431 Lisp_Object tem; 2575 Lisp_Object tem;
2432 if (tem = Fcommand_remapping (definition), !NILP (tem)) 2576 if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
2433 return Qnil; 2577 return Qnil;
2434 } 2578 }
2435 2579
diff --git a/src/keymap.h b/src/keymap.h
index 3170877f497..271a2e64284 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -29,8 +29,8 @@ EXFUN (Fmake_sparse_keymap, 1);
29EXFUN (Fkeymap_prompt, 1); 29EXFUN (Fkeymap_prompt, 1);
30EXFUN (Fdefine_key, 3); 30EXFUN (Fdefine_key, 3);
31EXFUN (Flookup_key, 3); 31EXFUN (Flookup_key, 3);
32EXFUN (Fcommand_remapping, 1); 32EXFUN (Fcommand_remapping, 2);
33EXFUN (Fkey_binding, 3); 33EXFUN (Fkey_binding, 4);
34EXFUN (Fkey_description, 2); 34EXFUN (Fkey_description, 2);
35EXFUN (Fsingle_key_description, 2); 35EXFUN (Fsingle_key_description, 2);
36EXFUN (Fwhere_is_internal, 5); 36EXFUN (Fwhere_is_internal, 5);
diff --git a/src/lisp.h b/src/lisp.h
index 4bdb0e67947..f5d936089cf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2471,7 +2471,7 @@ extern Lisp_Object del_range_1 P_ ((int, int, int, int));
2471extern void del_range_byte P_ ((int, int, int)); 2471extern void del_range_byte P_ ((int, int, int));
2472extern void del_range_both P_ ((int, int, int, int, int)); 2472extern void del_range_both P_ ((int, int, int, int, int));
2473extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); 2473extern Lisp_Object del_range_2 P_ ((int, int, int, int, int));
2474extern void modify_region P_ ((struct buffer *, int, int)); 2474extern void modify_region P_ ((struct buffer *, int, int, int));
2475extern void prepare_to_modify_buffer P_ ((int, int, int *)); 2475extern void prepare_to_modify_buffer P_ ((int, int, int *));
2476extern void signal_before_change P_ ((int, int, int *)); 2476extern void signal_before_change P_ ((int, int, int *));
2477extern void signal_after_change P_ ((int, int, int)); 2477extern void signal_after_change P_ ((int, int, int));
@@ -2538,7 +2538,7 @@ extern void syms_of_xdisp P_ ((void));
2538extern void init_xdisp P_ ((void)); 2538extern void init_xdisp P_ ((void));
2539extern Lisp_Object safe_eval P_ ((Lisp_Object)); 2539extern Lisp_Object safe_eval P_ ((Lisp_Object));
2540extern int pos_visible_p P_ ((struct window *, int, int *, 2540extern int pos_visible_p P_ ((struct window *, int, int *,
2541 int *, int *, int *, int)); 2541 int *, int *, int *, int *, int *));
2542 2542
2543/* Defined in vm-limit.c. */ 2543/* Defined in vm-limit.c. */
2544extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ())); 2544extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
@@ -2920,6 +2920,7 @@ extern int find_next_newline P_ ((int, int));
2920extern int find_next_newline_no_quit P_ ((int, int)); 2920extern int find_next_newline_no_quit P_ ((int, int));
2921extern int find_before_next_newline P_ ((int, int, int)); 2921extern int find_before_next_newline P_ ((int, int, int));
2922extern void syms_of_search P_ ((void)); 2922extern void syms_of_search P_ ((void));
2923extern void clear_regexp_cache P_ ((void));
2923 2924
2924/* defined in minibuf.c */ 2925/* defined in minibuf.c */
2925 2926
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
index 0d3acd34d97..716dd44c727 100644
--- a/src/m/ibms390x.h
+++ b/src/m/ibms390x.h
@@ -159,5 +159,11 @@ NOTE-END */
159 159
160#define XPNTR(a) XUINT (a) 160#define XPNTR(a) XUINT (a)
161 161
162#undef START_FILES
163#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
164
165#undef LIB_STANDARD
166#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
167
162/* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 168/* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519
163 (do not change this comment) */ 169 (do not change this comment) */
diff --git a/src/mac.c b/src/mac.c
index 67fd5e4f5e0..be6953a0d55 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -2413,75 +2413,69 @@ sys_fopen (const char *name, const char *mode)
2413} 2413}
2414 2414
2415 2415
2416#include "keyboard.h" 2416extern Boolean mac_wait_next_event P_ ((EventRecord *, UInt32, Boolean));
2417extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean);
2418 2417
2419int 2418int
2420select (n, rfds, wfds, efds, timeout) 2419select (nfds, rfds, wfds, efds, timeout)
2421 int n; 2420 int nfds;
2422 SELECT_TYPE *rfds; 2421 SELECT_TYPE *rfds, *wfds, *efds;
2423 SELECT_TYPE *wfds; 2422 EMACS_TIME *timeout;
2424 SELECT_TYPE *efds;
2425 struct timeval *timeout;
2426{ 2423{
2427 OSStatus err; 2424 OSStatus err = noErr;
2428#if TARGET_API_MAC_CARBON
2429 EventTimeout timeout_sec =
2430 (timeout
2431 ? (EMACS_SECS (*timeout) * kEventDurationSecond
2432 + EMACS_USECS (*timeout) * kEventDurationMicrosecond)
2433 : kEventDurationForever);
2434
2435 BLOCK_INPUT;
2436 err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL);
2437 UNBLOCK_INPUT;
2438#else /* not TARGET_API_MAC_CARBON */
2439 EventRecord e;
2440 UInt32 sleep_time = EMACS_SECS (*timeout) * 60 +
2441 ((EMACS_USECS (*timeout) * 60) / 1000000);
2442 2425
2443 /* Can only handle wait for keyboard input. */ 2426 /* Can only handle wait for keyboard input. */
2444 if (n > 1 || wfds || efds) 2427 if (nfds > 1 || wfds || efds)
2445 return -1; 2428 return -1;
2446 2429
2447 /* Also return true if an event other than a keyDown has occurred. 2430 /* Try detect_input_pending before ReceiveNextEvent in the same
2448 This causes kbd_buffer_get_event in keyboard.c to call 2431 BLOCK_INPUT block, in case that some input has already been read
2449 read_avail_input which in turn calls XTread_socket to poll for 2432 asynchronously. */
2450 these events. Otherwise these never get processed except but a 2433 BLOCK_INPUT;
2451 very slow poll timer. */ 2434 if (!detect_input_pending ())
2452 if (mac_wait_next_event (&e, sleep_time, false)) 2435 {
2453 err = noErr; 2436#if TARGET_API_MAC_CARBON
2454 else 2437 EventTimeout timeoutval =
2455 err = -9875; /* eventLoopTimedOutErr */ 2438 (timeout
2439 ? (EMACS_SECS (*timeout) * kEventDurationSecond
2440 + EMACS_USECS (*timeout) * kEventDurationMicrosecond)
2441 : kEventDurationForever);
2442
2443 if (timeoutval == 0.0)
2444 err = eventLoopTimedOutErr;
2445 else
2446 err = ReceiveNextEvent (0, NULL, timeoutval,
2447 kEventLeaveInQueue, NULL);
2448#else /* not TARGET_API_MAC_CARBON */
2449 EventRecord e;
2450 UInt32 sleep_time = EMACS_SECS (*timeout) * 60 +
2451 ((EMACS_USECS (*timeout) * 60) / 1000000);
2452
2453 if (sleep_time == 0)
2454 err = -9875; /* eventLoopTimedOutErr */
2455 else
2456 {
2457 if (mac_wait_next_event (&e, sleep_time, false))
2458 err = noErr;
2459 else
2460 err = -9875; /* eventLoopTimedOutErr */
2461 }
2456#endif /* not TARGET_API_MAC_CARBON */ 2462#endif /* not TARGET_API_MAC_CARBON */
2463 }
2464 UNBLOCK_INPUT;
2457 2465
2458 if (FD_ISSET (0, rfds)) 2466 if (err == noErr)
2459 if (err == noErr) 2467 {
2460 return 1; 2468 /* Pretend that `select' is interrupted by a signal. */
2461 else 2469 detect_input_pending ();
2462 { 2470 errno = EINTR;
2463 FD_ZERO (rfds); 2471 return -1;
2464 return 0; 2472 }
2465 }
2466 else 2473 else
2467 if (err == noErr) 2474 {
2468 { 2475 if (rfds)
2469 if (input_polling_used ()) 2476 FD_ZERO (rfds);
2470 {
2471 /* It could be confusing if a real alarm arrives while
2472 processing the fake one. Turn it off and let the
2473 handler reset it. */
2474 extern void poll_for_input_1 P_ ((void));
2475 int old_poll_suppress_count = poll_suppress_count;
2476 poll_suppress_count = 1;
2477 poll_for_input_1 ();
2478 poll_suppress_count = old_poll_suppress_count;
2479 }
2480 errno = EINTR;
2481 return -1;
2482 }
2483 else
2484 return 0; 2477 return 0;
2478 }
2485} 2479}
2486 2480
2487 2481
@@ -4904,6 +4898,30 @@ On successful conversion, return the result string, else return nil. */)
4904 4898
4905 return result; 4899 return result;
4906} 4900}
4901
4902DEFUN ("mac-process-hi-command", Fmac_process_hi_command, Smac_process_hi_command, 1, 1, 0,
4903 doc: /* Send a HI command whose ID is COMMAND-ID to the command chain.
4904COMMAND-ID must be a 4-character string. Some common command IDs are
4905defined in the Carbon Event Manager. */)
4906 (command_id)
4907 Lisp_Object command_id;
4908{
4909 OSStatus err;
4910 HICommand command;
4911
4912 bzero (&command, sizeof (HICommand));
4913 command.commandID = mac_get_code_from_arg (command_id, 0);
4914
4915 BLOCK_INPUT;
4916 err = ProcessHICommand (&command);
4917 UNBLOCK_INPUT;
4918
4919 if (err != noErr)
4920 error ("HI command (command ID: '%s') not handled.", SDATA (command_id));
4921
4922 return Qnil;
4923}
4924
4907#endif /* TARGET_API_MAC_CARBON */ 4925#endif /* TARGET_API_MAC_CARBON */
4908 4926
4909 4927
@@ -4944,23 +4962,26 @@ extern int noninteractive;
4944 -> Use `select'. 4962 -> Use `select'.
4945 2. Sockets are not involved. 4963 2. Sockets are not involved.
4946 -> Use ReceiveNextEvent. 4964 -> Use ReceiveNextEvent.
4947 3. [If SELECT_USE_CFSOCKET is defined] 4965 3. [If SELECT_USE_CFSOCKET is set]
4948 Only the window event channel and socket read channels are 4966 Only the window event channel and socket read/write channels are
4949 involved, and timeout is not too short (greater than 4967 involved, and timeout is not too short (greater than
4950 SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). 4968 SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds).
4951 -> Create CFSocket for each socket and add it into the current 4969 -> Create CFSocket for each socket and add it into the current
4952 event RunLoop so that a `ready-to-read' event can be posted 4970 event RunLoop so that the current event loop gets quit when
4953 to the event queue that is also used for window events. Then 4971 the socket becomes ready. Then ReceiveNextEvent can wait for
4954 ReceiveNextEvent can wait for both kinds of inputs. 4972 both kinds of inputs.
4955 4. Otherwise. 4973 4. Otherwise.
4956 -> Periodically poll the window input channel while repeatedly 4974 -> Periodically poll the window input channel while repeatedly
4957 executing `select' with a short timeout 4975 executing `select' with a short timeout
4958 (SELECT_POLLING_PERIOD_USEC microseconds). */ 4976 (SELECT_POLLING_PERIOD_USEC microseconds). */
4959 4977
4960#define SELECT_POLLING_PERIOD_USEC 20000 4978#ifndef SELECT_USE_CFSOCKET
4961#ifdef SELECT_USE_CFSOCKET 4979#define SELECT_USE_CFSOCKET 1
4980#endif
4981
4982#define SELECT_POLLING_PERIOD_USEC 100000
4983#if SELECT_USE_CFSOCKET
4962#define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 4984#define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2
4963#define EVENT_CLASS_SOCK 'Sock'
4964 4985
4965static void 4986static void
4966socket_callback (s, type, address, data, info) 4987socket_callback (s, type, address, data, info)
@@ -4970,196 +4991,211 @@ socket_callback (s, type, address, data, info)
4970 const void *data; 4991 const void *data;
4971 void *info; 4992 void *info;
4972{ 4993{
4973 EventRef event; 4994 int fd = CFSocketGetNative (s);
4995 SELECT_TYPE *ofds = (SELECT_TYPE *)info;
4974 4996
4975 CreateEvent (NULL, EVENT_CLASS_SOCK, 0, 0, kEventAttributeNone, &event); 4997 if ((type == kCFSocketReadCallBack && FD_ISSET (fd, &ofds[0]))
4976 PostEventToQueue (GetCurrentEventQueue (), event, kEventPriorityStandard); 4998 || (type == kCFSocketConnectCallBack && FD_ISSET (fd, &ofds[1])))
4977 ReleaseEvent (event); 4999 QuitEventLoop (GetCurrentEventLoop ());
4978} 5000}
4979#endif /* SELECT_USE_CFSOCKET */ 5001#endif /* SELECT_USE_CFSOCKET */
4980 5002
4981static int 5003static int
4982select_and_poll_event (n, rfds, wfds, efds, timeout) 5004select_and_poll_event (nfds, rfds, wfds, efds, timeout)
4983 int n; 5005 int nfds;
4984 SELECT_TYPE *rfds; 5006 SELECT_TYPE *rfds, *wfds, *efds;
4985 SELECT_TYPE *wfds; 5007 EMACS_TIME *timeout;
4986 SELECT_TYPE *efds;
4987 struct timeval *timeout;
4988{ 5008{
4989 int r; 5009 OSStatus err = noErr;
4990 OSStatus err; 5010 int r = 0;
4991 5011
4992 r = select (n, rfds, wfds, efds, timeout); 5012 /* Try detect_input_pending before ReceiveNextEvent in the same
4993 if (r != -1) 5013 BLOCK_INPUT block, in case that some input has already been read
5014 asynchronously. */
5015 BLOCK_INPUT;
5016 if (!detect_input_pending ())
4994 { 5017 {
4995 BLOCK_INPUT; 5018 EMACS_TIME select_timeout;
4996 err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, 5019 EventTimeout timeoutval =
4997 kEventLeaveInQueue, NULL); 5020 (timeout
4998 UNBLOCK_INPUT; 5021 ? (EMACS_SECS (*timeout) * kEventDurationSecond
4999 if (err == noErr) 5022 + EMACS_USECS (*timeout) * kEventDurationMicrosecond)
5023 : kEventDurationForever);
5024
5025 EMACS_SET_SECS_USECS (select_timeout, 0, 0);
5026 r = select (nfds, rfds, wfds, efds, &select_timeout);
5027 if (timeoutval == 0.0)
5028 err = eventLoopTimedOutErr;
5029 else if (r == 0)
5000 { 5030 {
5001 FD_SET (0, rfds); 5031#if USE_CG_DRAWING
5002 r++; 5032 mac_prepare_for_quickdraw (NULL);
5033#endif
5034 err = ReceiveNextEvent (0, NULL, timeoutval,
5035 kEventLeaveInQueue, NULL);
5003 } 5036 }
5004 } 5037 }
5005 return r; 5038 UNBLOCK_INPUT;
5006}
5007 5039
5008#if MAC_OS_X_VERSION_MAX_ALLOWED < 1020 5040 if (r != 0)
5009#undef SELECT_INVALIDATE_CFSOCKET 5041 return r;
5010#endif 5042 else if (err == noErr)
5043 {
5044 /* Pretend that `select' is interrupted by a signal. */
5045 detect_input_pending ();
5046 errno = EINTR;
5047 return -1;
5048 }
5049 else
5050 return 0;
5051}
5011 5052
5012int 5053int
5013sys_select (n, rfds, wfds, efds, timeout) 5054sys_select (nfds, rfds, wfds, efds, timeout)
5014 int n; 5055 int nfds;
5015 SELECT_TYPE *rfds; 5056 SELECT_TYPE *rfds, *wfds, *efds;
5016 SELECT_TYPE *wfds; 5057 EMACS_TIME *timeout;
5017 SELECT_TYPE *efds;
5018 struct timeval *timeout;
5019{ 5058{
5020 OSStatus err; 5059 OSStatus err = noErr;
5021 int i, r; 5060 int r;
5022 EMACS_TIME select_timeout; 5061 EMACS_TIME select_timeout;
5062 static SELECT_TYPE ofds[3];
5023 5063
5024 if (inhibit_window_system || noninteractive 5064 if (inhibit_window_system || noninteractive
5025 || rfds == NULL || !FD_ISSET (0, rfds)) 5065 || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds))
5026 return select (n, rfds, wfds, efds, timeout); 5066 return select (nfds, rfds, wfds, efds, timeout);
5027 5067
5028 FD_CLR (0, rfds); 5068 FD_CLR (0, rfds);
5069 ofds[0] = *rfds;
5029 5070
5030 if (wfds == NULL && efds == NULL) 5071 if (wfds)
5031 { 5072 ofds[1] = *wfds;
5032 int nsocks = 0; 5073 else
5033 SELECT_TYPE orfds = *rfds; 5074 FD_ZERO (&ofds[1]);
5034 5075
5035 EventTimeout timeout_sec = 5076 if (efds)
5077 ofds[2] = *efds;
5078 else
5079 {
5080 EventTimeout timeoutval =
5036 (timeout 5081 (timeout
5037 ? (EMACS_SECS (*timeout) * kEventDurationSecond 5082 ? (EMACS_SECS (*timeout) * kEventDurationSecond
5038 + EMACS_USECS (*timeout) * kEventDurationMicrosecond) 5083 + EMACS_USECS (*timeout) * kEventDurationMicrosecond)
5039 : kEventDurationForever); 5084 : kEventDurationForever);
5040 5085
5041 for (i = 1; i < n; i++) 5086 FD_SET (0, rfds); /* sentinel */
5042 if (FD_ISSET (i, rfds)) 5087 do
5043 nsocks++;
5044
5045 if (nsocks == 0)
5046 { 5088 {
5047 BLOCK_INPUT; 5089 nfds--;
5048 err = ReceiveNextEvent (0, NULL, timeout_sec,
5049 kEventLeaveInQueue, NULL);
5050 UNBLOCK_INPUT;
5051 if (err == noErr)
5052 {
5053 FD_SET (0, rfds);
5054 return 1;
5055 }
5056 else
5057 return 0;
5058 } 5090 }
5091 while (!(FD_ISSET (nfds, rfds) || (wfds && FD_ISSET (nfds, wfds))));
5092 nfds++;
5093 FD_CLR (0, rfds);
5094
5095 if (nfds == 1)
5096 return select_and_poll_event (nfds, rfds, wfds, efds, timeout);
5059 5097
5060#if USE_CG_DRAWING
5061 mac_prepare_for_quickdraw (NULL);
5062#endif
5063 /* Avoid initial overhead of RunLoop setup for the case that 5098 /* Avoid initial overhead of RunLoop setup for the case that
5064 some input is already available. */ 5099 some input is already available. */
5065 EMACS_SET_SECS_USECS (select_timeout, 0, 0); 5100 EMACS_SET_SECS_USECS (select_timeout, 0, 0);
5066 r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); 5101 r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout);
5067 if (r != 0 || timeout_sec == 0.0) 5102 if (r != 0 || timeoutval == 0.0)
5068 return r; 5103 return r;
5069 5104
5070 *rfds = orfds; 5105 *rfds = ofds[0];
5106 if (wfds)
5107 *wfds = ofds[1];
5071 5108
5072#ifdef SELECT_USE_CFSOCKET 5109#if SELECT_USE_CFSOCKET
5073 if (timeout_sec > 0 && timeout_sec <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) 5110 if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP)
5074 goto poll_periodically; 5111 goto poll_periodically;
5075 5112
5076 { 5113 /* Try detect_input_pending before ReceiveNextEvent in the same
5077 CFRunLoopRef runloop = 5114 BLOCK_INPUT block, in case that some input has already been
5078 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); 5115 read asynchronously. */
5079 EventTypeSpec specs[] = {{EVENT_CLASS_SOCK, 0}}; 5116 BLOCK_INPUT;
5080#ifdef SELECT_INVALIDATE_CFSOCKET 5117 if (!detect_input_pending ())
5081 CFSocketRef *shead, *s; 5118 {
5082#else 5119 int minfd, fd;
5083 CFRunLoopSourceRef *shead, *s; 5120 CFRunLoopRef runloop =
5084#endif 5121 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ());
5085 5122 static CFSocketContext context = {0, ofds, NULL, NULL, NULL};
5086 BLOCK_INPUT; 5123 static CFMutableDictionaryRef sources;
5087 5124
5088#ifdef SELECT_INVALIDATE_CFSOCKET 5125 if (sources == NULL)
5089 shead = xmalloc (sizeof (CFSocketRef) * nsocks); 5126 sources =
5090#else 5127 CFDictionaryCreateMutable (NULL, 0, NULL,
5091 shead = xmalloc (sizeof (CFRunLoopSourceRef) * nsocks); 5128 &kCFTypeDictionaryValueCallBacks);
5092#endif 5129
5093 s = shead; 5130 for (minfd = 1; ; minfd++) /* nfds-1 works as a sentinel. */
5094 for (i = 1; i < n; i++) 5131 if (FD_ISSET (minfd, rfds) || (wfds && FD_ISSET (minfd, wfds)))
5095 if (FD_ISSET (i, rfds)) 5132 break;
5096 {
5097 CFSocketRef socket =
5098 CFSocketCreateWithNative (NULL, i, kCFSocketReadCallBack,
5099 socket_callback, NULL);
5100 CFRunLoopSourceRef source =
5101 CFSocketCreateRunLoopSource (NULL, socket, 0);
5102
5103#ifdef SELECT_INVALIDATE_CFSOCKET
5104 CFSocketSetSocketFlags (socket, 0);
5105#endif
5106 CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode);
5107#ifdef SELECT_INVALIDATE_CFSOCKET
5108 CFRelease (source);
5109 *s = socket;
5110#else
5111 CFRelease (socket);
5112 *s = source;
5113#endif
5114 s++;
5115 }
5116 5133
5117 err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); 5134 for (fd = minfd; fd < nfds; fd++)
5135 if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds)))
5136 {
5137 void *key = (void *) fd;
5138 CFRunLoopSourceRef source =
5139 (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key);
5140
5141 if (source == NULL)
5142 {
5143 CFSocketRef socket =
5144 CFSocketCreateWithNative (NULL, fd,
5145 (kCFSocketReadCallBack
5146 | kCFSocketConnectCallBack),
5147 socket_callback, &context);
5148
5149 if (socket == NULL)
5150 continue;
5151 source = CFSocketCreateRunLoopSource (NULL, socket, 0);
5152 CFRelease (socket);
5153 if (source == NULL)
5154 continue;
5155 CFDictionaryAddValue (sources, key, source);
5156 CFRelease (source);
5157 }
5158 CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode);
5159 }
5118 5160
5119 do 5161#if USE_CG_DRAWING
5120 { 5162 mac_prepare_for_quickdraw (NULL);
5121 --s;
5122#ifdef SELECT_INVALIDATE_CFSOCKET
5123 CFSocketInvalidate (*s);
5124#else
5125 CFRunLoopRemoveSource (runloop, *s, kCFRunLoopDefaultMode);
5126#endif 5163#endif
5127 CFRelease (*s); 5164 err = ReceiveNextEvent (0, NULL, timeoutval,
5128 } 5165 kEventLeaveInQueue, NULL);
5129 while (s != shead);
5130
5131 xfree (shead);
5132 5166
5133 if (err) 5167 for (fd = minfd; fd < nfds; fd++)
5134 { 5168 if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds)))
5135 FD_ZERO (rfds); 5169 {
5136 r = 0; 5170 void *key = (void *) fd;
5137 } 5171 CFRunLoopSourceRef source =
5138 else 5172 (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key);
5139 {
5140 FlushEventsMatchingListFromQueue (GetCurrentEventQueue (),
5141 GetEventTypeCount (specs),
5142 specs);
5143 EMACS_SET_SECS_USECS (select_timeout, 0, 0);
5144 r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout);
5145 }
5146 5173
5147 UNBLOCK_INPUT; 5174 CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode);
5175 }
5176 }
5177 UNBLOCK_INPUT;
5148 5178
5149 return r; 5179 if (err == noErr || err == eventLoopQuitErr)
5150 } 5180 {
5181 EMACS_SET_SECS_USECS (select_timeout, 0, 0);
5182 return select_and_poll_event (nfds, rfds, wfds, efds,
5183 &select_timeout);
5184 }
5185 else
5186 {
5187 FD_ZERO (rfds);
5188 if (wfds)
5189 FD_ZERO (wfds);
5190 return 0;
5191 }
5151#endif /* SELECT_USE_CFSOCKET */ 5192#endif /* SELECT_USE_CFSOCKET */
5152 } 5193 }
5153 5194
5154 poll_periodically: 5195 poll_periodically:
5155 { 5196 {
5156 EMACS_TIME end_time, now, remaining_time; 5197 EMACS_TIME end_time, now, remaining_time;
5157 SELECT_TYPE orfds = *rfds, owfds, oefds;
5158 5198
5159 if (wfds)
5160 owfds = *wfds;
5161 if (efds)
5162 oefds = *efds;
5163 if (timeout) 5199 if (timeout)
5164 { 5200 {
5165 remaining_time = *timeout; 5201 remaining_time = *timeout;
@@ -5172,15 +5208,15 @@ sys_select (n, rfds, wfds, efds, timeout)
5172 EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC); 5208 EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC);
5173 if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) 5209 if (timeout && EMACS_TIME_LT (remaining_time, select_timeout))
5174 select_timeout = remaining_time; 5210 select_timeout = remaining_time;
5175 r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); 5211 r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout);
5176 if (r != 0) 5212 if (r != 0)
5177 return r; 5213 return r;
5178 5214
5179 *rfds = orfds; 5215 *rfds = ofds[0];
5180 if (wfds) 5216 if (wfds)
5181 *wfds = owfds; 5217 *wfds = ofds[1];
5182 if (efds) 5218 if (efds)
5183 *efds = oefds; 5219 *efds = ofds[2];
5184 5220
5185 if (timeout) 5221 if (timeout)
5186 { 5222 {
@@ -5190,12 +5226,8 @@ sys_select (n, rfds, wfds, efds, timeout)
5190 } 5226 }
5191 while (!timeout || EMACS_TIME_LT (now, end_time)); 5227 while (!timeout || EMACS_TIME_LT (now, end_time));
5192 5228
5193 FD_ZERO (rfds); 5229 EMACS_SET_SECS_USECS (select_timeout, 0, 0);
5194 if (wfds) 5230 return select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout);
5195 FD_ZERO (wfds);
5196 if (efds)
5197 FD_ZERO (efds);
5198 return 0;
5199 } 5231 }
5200} 5232}
5201 5233
@@ -5387,6 +5419,7 @@ syms_of_mac ()
5387#if TARGET_API_MAC_CARBON 5419#if TARGET_API_MAC_CARBON
5388 defsubr (&Smac_get_preference); 5420 defsubr (&Smac_get_preference);
5389 defsubr (&Smac_code_convert_string); 5421 defsubr (&Smac_code_convert_string);
5422 defsubr (&Smac_process_hi_command);
5390#endif 5423#endif
5391 5424
5392 defsubr (&Smac_set_file_creator); 5425 defsubr (&Smac_set_file_creator);
diff --git a/src/macfns.c b/src/macfns.c
index 2d004be9962..e18d6089df7 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4342,13 +4342,14 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4342 (prompt, dir, default_filename, mustmatch, only_dir_p) 4342 (prompt, dir, default_filename, mustmatch, only_dir_p)
4343 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; 4343 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
4344{ 4344{
4345 struct frame *f = SELECTED_FRAME ();
4346 Lisp_Object file = Qnil; 4345 Lisp_Object file = Qnil;
4347 int count = SPECPDL_INDEX (); 4346 int count = SPECPDL_INDEX ();
4348 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 4347 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
4349 char filename[MAXPATHLEN]; 4348 char filename[MAXPATHLEN];
4350 static NavEventUPP mac_nav_event_callbackUPP = NULL; 4349 static NavEventUPP mac_nav_event_callbackUPP = NULL;
4351 4350
4351 check_mac ();
4352
4352 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); 4353 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
4353 CHECK_STRING (prompt); 4354 CHECK_STRING (prompt);
4354 CHECK_STRING (dir); 4355 CHECK_STRING (dir);
diff --git a/src/macmenu.c b/src/macmenu.c
index e7d69d5657c..1a1525eafb7 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -64,7 +64,8 @@ Boston, MA 02110-1301, USA. */
64 64
65enum mac_menu_kind { /* Menu ID range */ 65enum mac_menu_kind { /* Menu ID range */
66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */ 66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */
67 MAC_MENU_MENU_BAR, /* 1 .. 234 */ 67 MAC_MENU_MENU_BAR, /* 1 .. 233 */
68 MAC_MENU_M_APPLE, /* 234 (== M_APPLE) */
68 MAC_MENU_POPUP, /* 235 */ 69 MAC_MENU_POPUP, /* 235 */
69 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */ 70 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */
70 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */ 71 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */
@@ -72,7 +73,7 @@ enum mac_menu_kind { /* Menu ID range */
72 MAC_MENU_END /* 32768 */ 73 MAC_MENU_END /* 32768 */
73}; 74};
74 75
75static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768}; 76static const int min_menu_id[] = {0, 1, 234, 235, 236, 256, 16384, 32768};
76 77
77#define DIALOG_WINDOW_RESOURCE 130 78#define DIALOG_WINDOW_RESOURCE 130
78 79
@@ -158,10 +159,10 @@ typedef struct _widget_value
158#define FALSE 0 159#define FALSE 0
159#endif /* no TRUE */ 160#endif /* no TRUE */
160 161
161Lisp_Object Vmenu_updating_frame;
162
163Lisp_Object Qdebug_on_next_call; 162Lisp_Object Qdebug_on_next_call;
164 163
164extern Lisp_Object Vmenu_updating_frame;
165
165extern Lisp_Object Qmenu_bar, Qmac_apple_event; 166extern Lisp_Object Qmenu_bar, Qmac_apple_event;
166 167
167extern Lisp_Object QCtoggle, QCradio; 168extern Lisp_Object QCtoggle, QCradio;
@@ -196,6 +197,8 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
196static void list_of_panes P_ ((Lisp_Object)); 197static void list_of_panes P_ ((Lisp_Object));
197static void list_of_items P_ ((Lisp_Object)); 198static void list_of_items P_ ((Lisp_Object));
198 199
200static void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object,
201 void *));
199static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int)); 202static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int));
200static void fill_menubar P_ ((widget_value *, int)); 203static void fill_menubar P_ ((widget_value *, int));
201static void dispose_menus P_ ((enum mac_menu_kind, int)); 204static void dispose_menus P_ ((enum mac_menu_kind, int));
@@ -1015,39 +1018,63 @@ x_activate_menubar (f)
1015 FRAME_PTR f; 1018 FRAME_PTR f;
1016{ 1019{
1017 SInt32 menu_choice; 1020 SInt32 menu_choice;
1021 SInt16 menu_id, menu_item;
1018 extern Point saved_menu_event_location; 1022 extern Point saved_menu_event_location;
1019 1023
1020 set_frame_menubar (f, 0, 1); 1024 set_frame_menubar (f, 0, 1);
1021 BLOCK_INPUT; 1025 BLOCK_INPUT;
1022 1026
1023 menu_choice = MenuSelect (saved_menu_event_location); 1027 menu_choice = MenuSelect (saved_menu_event_location);
1024 do_menu_choice (menu_choice); 1028 menu_id = HiWord (menu_choice);
1029 menu_item = LoWord (menu_choice);
1030
1031#if !TARGET_API_MAC_CARBON
1032 if (menu_id == min_menu_id[MAC_MENU_M_APPLE])
1033 do_apple_menu (menu_item);
1034 else
1035#endif
1036 if (menu_id)
1037 {
1038 MenuHandle menu = GetMenuHandle (menu_id);
1039
1040 if (menu)
1041 {
1042 UInt32 refcon;
1043
1044 GetMenuItemRefCon (menu, menu_item, &refcon);
1045 find_and_call_menu_selection (f, f->menu_bar_items_used,
1046 f->menu_bar_vector, (void *) refcon);
1047 }
1048 }
1049
1050 HiliteMenu (0);
1025 1051
1026 UNBLOCK_INPUT; 1052 UNBLOCK_INPUT;
1027} 1053}
1028 1054
1029/* This callback is called from the menu bar pulldown menu 1055/* Find the menu selection and store it in the keyboard buffer.
1030 when the user makes a selection. 1056 F is the frame the menu is on.
1031 Figure out what the user chose 1057 MENU_BAR_ITEMS_USED is the length of VECTOR.
1032 and put the appropriate events into the keyboard buffer. */ 1058 VECTOR is an array of menu events for the whole menu. */
1033 1059
1034void 1060static void
1035menubar_selection_callback (FRAME_PTR f, int client_data) 1061find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data)
1062 FRAME_PTR f;
1063 int menu_bar_items_used;
1064 Lisp_Object vector;
1065 void *client_data;
1036{ 1066{
1037 Lisp_Object prefix, entry; 1067 Lisp_Object prefix, entry;
1038 Lisp_Object vector;
1039 Lisp_Object *subprefix_stack; 1068 Lisp_Object *subprefix_stack;
1040 int submenu_depth = 0; 1069 int submenu_depth = 0;
1041 int i; 1070 int i;
1042 1071
1043 if (!f)
1044 return;
1045 entry = Qnil; 1072 entry = Qnil;
1046 subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); 1073 subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object));
1047 vector = f->menu_bar_vector;
1048 prefix = Qnil; 1074 prefix = Qnil;
1049 i = 0; 1075 i = 0;
1050 while (i < f->menu_bar_items_used) 1076
1077 while (i < menu_bar_items_used)
1051 { 1078 {
1052 if (EQ (XVECTOR (vector)->contents[i], Qnil)) 1079 if (EQ (XVECTOR (vector)->contents[i], Qnil))
1053 { 1080 {
@@ -1105,13 +1132,11 @@ menubar_selection_callback (FRAME_PTR f, int client_data)
1105 buf.arg = entry; 1132 buf.arg = entry;
1106 kbd_buffer_store_event (&buf); 1133 kbd_buffer_store_event (&buf);
1107 1134
1108 f->output_data.mac->menubar_active = 0;
1109 return; 1135 return;
1110 } 1136 }
1111 i += MENU_ITEMS_ITEM_LENGTH; 1137 i += MENU_ITEMS_ITEM_LENGTH;
1112 } 1138 }
1113 } 1139 }
1114 f->output_data.mac->menubar_active = 0;
1115} 1140}
1116 1141
1117/* Allocate a widget_value, blocking input. */ 1142/* Allocate a widget_value, blocking input. */
@@ -1508,10 +1533,6 @@ set_frame_menubar (f, first_time, deep_p)
1508 int *submenu_start, *submenu_end; 1533 int *submenu_start, *submenu_end;
1509 int *submenu_top_level_items, *submenu_n_panes; 1534 int *submenu_top_level_items, *submenu_n_panes;
1510 1535
1511 /* We must not change the menubar when actually in use. */
1512 if (f->output_data.mac->menubar_active)
1513 return;
1514
1515 XSETFRAME (Vmenu_updating_frame, f); 1536 XSETFRAME (Vmenu_updating_frame, f);
1516 1537
1517 if (! menubar_widget) 1538 if (! menubar_widget)
@@ -2630,11 +2651,6 @@ syms_of_macmenu ()
2630 Qdebug_on_next_call = intern ("debug-on-next-call"); 2651 Qdebug_on_next_call = intern ("debug-on-next-call");
2631 staticpro (&Qdebug_on_next_call); 2652 staticpro (&Qdebug_on_next_call);
2632 2653
2633 DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame,
2634 doc: /* Frame for which we are updating a menu.
2635The enable predicate for a menu command should check this variable. */);
2636 Vmenu_updating_frame = Qnil;
2637
2638 defsubr (&Sx_popup_menu); 2654 defsubr (&Sx_popup_menu);
2639#ifdef HAVE_MENUS 2655#ifdef HAVE_MENUS
2640 defsubr (&Sx_popup_dialog); 2656 defsubr (&Sx_popup_dialog);
diff --git a/src/macterm.c b/src/macterm.c
index 76efa80d606..6902ac72304 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -108,6 +108,10 @@ static Lisp_Object last_window;
108 (Not yet supported.) */ 108 (Not yet supported.) */
109int x_use_underline_position_properties; 109int x_use_underline_position_properties;
110 110
111/* Non-zero means to draw the underline at the same place as the descent line. */
112
113int x_underline_at_descent_line;
114
111/* This is a chain of structures for all the X displays currently in 115/* This is a chain of structures for all the X displays currently in
112 use. */ 116 use. */
113 117
@@ -261,9 +265,6 @@ static int is_emacs_window P_ ((WindowPtr));
261static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); 265static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
262static void XSetFont P_ ((Display *, GC, XFontStruct *)); 266static void XSetFont P_ ((Display *, GC, XFontStruct *));
263 267
264/* Defined in macmenu.h. */
265extern void menubar_selection_callback (FRAME_PTR, int);
266
267#define GC_FORE_COLOR(gc) (&(gc)->fore_color) 268#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
268#define GC_BACK_COLOR(gc) (&(gc)->back_color) 269#define GC_BACK_COLOR(gc) (&(gc)->back_color)
269#define GC_FONT(gc) ((gc)->xgcv.font) 270#define GC_FONT(gc) ((gc)->xgcv.font)
@@ -890,12 +891,13 @@ mac_invert_rectangle (f, x, y, width, height)
890 891
891 892
892static void 893static void
893mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) 894mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
895 overstrike_p, bytes_per_char)
894 struct frame *f; 896 struct frame *f;
895 GC gc; 897 GC gc;
896 int x, y; 898 int x, y;
897 char *buf; 899 char *buf;
898 int nchars, bg_width, bytes_per_char; 900 int nchars, bg_width, overstrike_p, bytes_per_char;
899{ 901{
900 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 902 SetPortWindowPort (FRAME_MAC_WINDOW (f));
901 903
@@ -945,6 +947,13 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
945 ATSUDrawText (text_layout, 947 ATSUDrawText (text_layout,
946 kATSUFromTextBeginning, kATSUToTextEnd, 948 kATSUFromTextBeginning, kATSUToTextEnd,
947 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); 949 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
950 if (overstrike_p)
951 {
952 MoveTo (x + 1, y);
953 ATSUDrawText (text_layout,
954 kATSUFromTextBeginning, kATSUToTextEnd,
955 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
956 }
948 mac_end_clip (gc); 957 mac_end_clip (gc);
949#ifdef MAC_OSX 958#ifdef MAC_OSX
950 } 959 }
@@ -988,9 +997,15 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
988 sizeof (tags) / sizeof (tags[0]), 997 sizeof (tags) / sizeof (tags[0]),
989 tags, sizes, values); 998 tags, sizes, values);
990 if (err == noErr) 999 if (err == noErr)
991 ATSUDrawText (text_layout, 1000 {
992 kATSUFromTextBeginning, kATSUToTextEnd, 1001 ATSUDrawText (text_layout,
993 Long2Fix (x), Long2Fix (port_height - y)); 1002 kATSUFromTextBeginning, kATSUToTextEnd,
1003 Long2Fix (x), Long2Fix (port_height - y));
1004 if (overstrike_p)
1005 ATSUDrawText (text_layout,
1006 kATSUFromTextBeginning, kATSUToTextEnd,
1007 Long2Fix (x + 1), Long2Fix (port_height - y));
1008 }
994#if USE_CG_DRAWING 1009#if USE_CG_DRAWING
995 mac_end_cg_clip (f); 1010 mac_end_cg_clip (f);
996 context = NULL; 1011 context = NULL;
@@ -1056,6 +1071,12 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
1056 TextFace (GC_FONT (gc)->mac_fontface); 1071 TextFace (GC_FONT (gc)->mac_fontface);
1057 MoveTo (x, y); 1072 MoveTo (x, y);
1058 DrawText (buf, 0, nchars * bytes_per_char); 1073 DrawText (buf, 0, nchars * bytes_per_char);
1074 if (overstrike_p)
1075 {
1076 TextMode (srcOr);
1077 MoveTo (x + 1, y);
1078 DrawText (buf, 0, nchars * bytes_per_char);
1079 }
1059 if (bg_width) 1080 if (bg_width)
1060 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1081 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1061 mac_end_clip (gc); 1082 mac_end_clip (gc);
@@ -1068,59 +1089,33 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
1068} 1089}
1069 1090
1070 1091
1071/* Mac replacement for XDrawString. */
1072
1073static void
1074mac_draw_string (f, gc, x, y, buf, nchars)
1075 struct frame *f;
1076 GC gc;
1077 int x, y;
1078 char *buf;
1079 int nchars;
1080{
1081 mac_draw_string_common (f, gc, x, y, buf, nchars, 0, 1);
1082}
1083
1084
1085/* Mac replacement for XDrawString16. */
1086
1087static void
1088mac_draw_string_16 (f, gc, x, y, buf, nchars)
1089 struct frame *f;
1090 GC gc;
1091 int x, y;
1092 XChar2b *buf;
1093 int nchars;
1094{
1095 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, 0, 2);
1096}
1097
1098
1099/* Mac replacement for XDrawImageString. */ 1092/* Mac replacement for XDrawImageString. */
1100 1093
1101static void 1094static void
1102mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width) 1095mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1103 struct frame *f; 1096 struct frame *f;
1104 GC gc; 1097 GC gc;
1105 int x, y; 1098 int x, y;
1106 char *buf; 1099 char *buf;
1107 int nchars, bg_width; 1100 int nchars, bg_width, overstrike_p;
1108{ 1101{
1109 mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, 1); 1102 mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
1103 overstrike_p, 1);
1110} 1104}
1111 1105
1112 1106
1113/* Mac replacement for XDrawString16. */ 1107/* Mac replacement for XDrawImageString16. */
1114 1108
1115static void 1109static void
1116mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width) 1110mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1117 struct frame *f; 1111 struct frame *f;
1118 GC gc; 1112 GC gc;
1119 int x, y; 1113 int x, y;
1120 XChar2b *buf; 1114 XChar2b *buf;
1121 int nchars, bg_width; 1115 int nchars, bg_width, overstrike_p;
1122{ 1116{
1123 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, 2); 1117 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width,
1118 overstrike_p, 2);
1124} 1119}
1125 1120
1126 1121
@@ -1294,12 +1289,12 @@ init_cg_text_anti_aliasing_threshold ()
1294} 1289}
1295 1290
1296static int 1291static int
1297mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width) 1292mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1298 struct frame *f; 1293 struct frame *f;
1299 GC gc; 1294 GC gc;
1300 int x, y; 1295 int x, y;
1301 XChar2b *buf; 1296 XChar2b *buf;
1302 int nchars, bg_width; 1297 int nchars, bg_width, overstrike_p;
1303{ 1298{
1304 CGrafPtr port; 1299 CGrafPtr port;
1305 float port_height, gx, gy; 1300 float port_height, gx, gy;
@@ -1361,10 +1356,17 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width)
1361#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 1356#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
1362 CGContextSetTextPosition (context, gx, gy); 1357 CGContextSetTextPosition (context, gx, gy);
1363 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); 1358 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
1359 if (overstrike_p)
1360 {
1361 CGContextSetTextPosition (context, gx + 1.0f, gy);
1362 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
1363 }
1364#else 1364#else
1365 for (i = 0; i < nchars; i++) 1365 for (i = 0; i < nchars; i++)
1366 { 1366 {
1367 CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1); 1367 CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1);
1368 if (overstrike_p)
1369 CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1);
1368 gx += advances[i].width; 1370 gx += advances[i].width;
1369 } 1371 }
1370#endif 1372#endif
@@ -2633,6 +2635,11 @@ mac_compute_glyph_string_overhangs (s)
2633 Rect r; 2635 Rect r;
2634 MacFontStruct *font = s->font; 2636 MacFontStruct *font = s->font;
2635 2637
2638#if USE_CG_DRAWING
2639 mac_prepare_for_quickdraw (s->f);
2640#endif
2641 SetPortWindowPort (FRAME_MAC_WINDOW (s->f));
2642
2636 TextFont (font->mac_fontnum); 2643 TextFont (font->mac_fontnum);
2637 TextSize (font->mac_fontsize); 2644 TextSize (font->mac_fontsize);
2638 TextFace (font->mac_fontface); 2645 TextFace (font->mac_fontface);
@@ -2765,15 +2772,18 @@ x_draw_glyph_string_foreground (s)
2765#if USE_CG_TEXT_DRAWING 2772#if USE_CG_TEXT_DRAWING
2766 if (!s->two_byte_p 2773 if (!s->two_byte_p
2767 && mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff, 2774 && mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff,
2768 s->char2b, s->nchars, bg_width)) 2775 s->char2b, s->nchars, bg_width,
2776 s->face->overstrike))
2769 ; 2777 ;
2770 else 2778 else
2771#endif 2779#endif
2772 mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff, 2780 mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff,
2773 s->char2b, s->nchars, bg_width); 2781 s->char2b, s->nchars, bg_width,
2782 s->face->overstrike);
2774 else 2783 else
2775 mac_draw_image_string (s->f, s->gc, x, s->ybase - boff, 2784 mac_draw_image_string (s->f, s->gc, x, s->ybase - boff,
2776 char1b, s->nchars, bg_width); 2785 char1b, s->nchars, bg_width,
2786 s->face->overstrike);
2777 } 2787 }
2778} 2788}
2779 2789
@@ -2809,10 +2819,10 @@ x_draw_composite_glyph_string_foreground (s)
2809 else 2819 else
2810 { 2820 {
2811 for (i = 0; i < s->nchars; i++, ++s->gidx) 2821 for (i = 0; i < s->nchars; i++, ++s->gidx)
2812 mac_draw_string_16 (s->f, s->gc, 2822 mac_draw_image_string_16 (s->f, s->gc,
2813 x + s->cmp->offsets[s->gidx * 2], 2823 x + s->cmp->offsets[s->gidx * 2],
2814 s->ybase - s->cmp->offsets[s->gidx * 2 + 1], 2824 s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
2815 s->char2b + i, 1); 2825 s->char2b + i, 1, 0, s->face->overstrike);
2816 } 2826 }
2817} 2827}
2818 2828
@@ -3674,18 +3684,45 @@ x_draw_glyph_string (s)
3674 /* Draw underline. */ 3684 /* Draw underline. */
3675 if (s->face->underline_p) 3685 if (s->face->underline_p)
3676 { 3686 {
3677 unsigned long h = 1; 3687 unsigned long tem, h;
3678 unsigned long dy = s->height - h; 3688 int y;
3689
3690#if 0
3691 /* Get the underline thickness. Default is 1 pixel. */
3692 if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
3693#endif
3694 h = 1;
3695
3696 y = s->y + s->height - h;
3697 if (!x_underline_at_descent_line)
3698 {
3699 /* Get the underline position. This is the recommended
3700 vertical offset in pixels from the baseline to the top of
3701 the underline. This is a signed value according to the
3702 specs, and its default is
3703
3704 ROUND ((maximum descent) / 2), with
3705 ROUND(x) = floor (x + 0.5) */
3706
3707#if 0
3708 if (x_use_underline_position_properties
3709 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
3710 y = s->ybase + (long) tem;
3711 else
3712#endif
3713 if (s->face->font)
3714 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
3715 }
3679 3716
3680 if (s->face->underline_defaulted_p) 3717 if (s->face->underline_defaulted_p)
3681 mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, 3718 mac_fill_rectangle (s->f, s->gc, s->x, y,
3682 s->background_width, h); 3719 s->background_width, h);
3683 else 3720 else
3684 { 3721 {
3685 XGCValues xgcv; 3722 XGCValues xgcv;
3686 XGetGCValues (s->display, s->gc, GCForeground, &xgcv); 3723 XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
3687 XSetForeground (s->display, s->gc, s->face->underline_color); 3724 XSetForeground (s->display, s->gc, s->face->underline_color);
3688 mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, 3725 mac_fill_rectangle (s->f, s->gc, s->x, y,
3689 s->background_width, h); 3726 s->background_width, h);
3690 XSetForeground (s->display, s->gc, xgcv.foreground); 3727 XSetForeground (s->display, s->gc, xgcv.foreground);
3691 } 3728 }
@@ -5805,6 +5842,57 @@ mac_get_window_bounds (f, inner, outer)
5805#endif /* not TARGET_API_MAC_CARBON */ 5842#endif /* not TARGET_API_MAC_CARBON */
5806} 5843}
5807 5844
5845static void
5846mac_handle_origin_change (f)
5847 struct frame *f;
5848{
5849 x_real_positions (f, &f->left_pos, &f->top_pos);
5850}
5851
5852static void
5853mac_handle_size_change (f, pixelwidth, pixelheight)
5854 struct frame *f;
5855 int pixelwidth, pixelheight;
5856{
5857 int cols, rows;
5858
5859 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
5860 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
5861
5862 if (cols != FRAME_COLS (f)
5863 || rows != FRAME_LINES (f)
5864 || pixelwidth != FRAME_PIXEL_WIDTH (f)
5865 || pixelheight != FRAME_PIXEL_HEIGHT (f))
5866 {
5867 /* We pass 1 for DELAY since we can't run Lisp code inside of
5868 a BLOCK_INPUT. */
5869 change_frame_size (f, rows, cols, 0, 1, 0);
5870 FRAME_PIXEL_WIDTH (f) = pixelwidth;
5871 FRAME_PIXEL_HEIGHT (f) = pixelheight;
5872 SET_FRAME_GARBAGED (f);
5873
5874 /* If cursor was outside the new size, mark it as off. */
5875 mark_window_cursors_off (XWINDOW (f->root_window));
5876
5877 /* Clear out any recollection of where the mouse highlighting
5878 was, since it might be in a place that's outside the new
5879 frame size. Actually checking whether it is outside is a
5880 pain in the neck, so don't try--just let the highlighting be
5881 done afresh with new size. */
5882 cancel_mouse_face (f);
5883
5884#if TARGET_API_MAC_CARBON
5885 if (f->output_data.mac->hourglass_control)
5886 {
5887#if USE_CG_DRAWING
5888 mac_prepare_for_quickdraw (f);
5889#endif
5890 MoveControl (f->output_data.mac->hourglass_control,
5891 pixelwidth - HOURGLASS_WIDTH, 0);
5892 }
5893#endif
5894 }
5895}
5808 5896
5809 5897
5810/* Calculate the absolute position in frame F 5898/* Calculate the absolute position in frame F
@@ -5885,7 +5973,10 @@ x_set_offset (f, xoff, yoff, change_gravity)
5885 ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, 5973 ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
5886 kWindowConstrainMoveRegardlessOfFit 5974 kWindowConstrainMoveRegardlessOfFit
5887 | kWindowConstrainAllowPartial, NULL, NULL); 5975 | kWindowConstrainAllowPartial, NULL, NULL);
5888 x_real_positions (f, &f->left_pos, &f->top_pos); 5976#if USE_CARBON_EVENTS
5977 if (!NILP (tip_frame) && XFRAME (tip_frame) == f)
5978#endif
5979 mac_handle_origin_change (f);
5889#else 5980#else
5890 { 5981 {
5891 Rect inner, outer, screen_rect, dummy; 5982 Rect inner, outer, screen_rect, dummy;
@@ -5959,50 +6050,11 @@ x_set_window_size (f, change_gravity, cols, rows)
5959 x_wm_set_size_hint (f, (long) 0, 0); 6050 x_wm_set_size_hint (f, (long) 0, 0);
5960 6051
5961 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); 6052 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
5962#if TARGET_API_MAC_CARBON
5963 if (f->output_data.mac->hourglass_control)
5964 {
5965#if USE_CG_DRAWING
5966 mac_prepare_for_quickdraw (f);
5967#endif
5968 MoveControl (f->output_data.mac->hourglass_control,
5969 pixelwidth - HOURGLASS_WIDTH, 0);
5970 }
5971#endif
5972
5973 /* Now, strictly speaking, we can't be sure that this is accurate,
5974 but the window manager will get around to dealing with the size
5975 change request eventually, and we'll hear how it went when the
5976 ConfigureNotify event gets here.
5977
5978 We could just not bother storing any of this information here,
5979 and let the ConfigureNotify event set everything up, but that
5980 might be kind of confusing to the Lisp code, since size changes
5981 wouldn't be reported in the frame parameters until some random
5982 point in the future when the ConfigureNotify event arrives.
5983
5984 We pass 1 for DELAY since we can't run Lisp code inside of
5985 a BLOCK_INPUT. */
5986 change_frame_size (f, rows, cols, 0, 1, 0);
5987 FRAME_PIXEL_WIDTH (f) = pixelwidth;
5988 FRAME_PIXEL_HEIGHT (f) = pixelheight;
5989
5990 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
5991 receive in the ConfigureNotify event; if we get what we asked
5992 for, then the event won't cause the screen to become garbaged, so
5993 we have to make sure to do it here. */
5994 SET_FRAME_GARBAGED (f);
5995
5996 XFlush (FRAME_X_DISPLAY (f));
5997
5998 /* If cursor was outside the new size, mark it as off. */
5999 mark_window_cursors_off (XWINDOW (f->root_window));
6000 6053
6001 /* Clear out any recollection of where the mouse highlighting was, 6054#if USE_CARBON_EVENTS
6002 since it might be in a place that's outside the new frame size. 6055 if (!NILP (tip_frame) && f == XFRAME (tip_frame))
6003 Actually checking whether it is outside is a pain in the neck, 6056#endif
6004 so don't try--just let the highlighting be done afresh with new size. */ 6057 mac_handle_size_change (f, pixelwidth, pixelheight);
6005 cancel_mouse_face (f);
6006 6058
6007 UNBLOCK_INPUT; 6059 UNBLOCK_INPUT;
6008} 6060}
@@ -6213,7 +6265,10 @@ x_make_frame_visible (f)
6213 kWindowCascadeOnParentWindowScreen 6265 kWindowCascadeOnParentWindowScreen
6214#endif 6266#endif
6215 ); 6267 );
6216 x_real_positions (f, &f->left_pos, &f->top_pos); 6268#if USE_CARBON_EVENTS
6269 if (!NILP (tip_frame) && f == XFRAME (tip_frame))
6270#endif
6271 mac_handle_origin_change (f);
6217 } 6272 }
6218 else 6273 else
6219#endif 6274#endif
@@ -7731,14 +7786,16 @@ is_fully_specified_xlfd (char *p)
7731} 7786}
7732 7787
7733 7788
7734/* XLoadQueryFont creates and returns an internal representation for a 7789/* mac_load_query_font creates and returns an internal representation
7735 font in a MacFontStruct struct. There is really no concept 7790 for a font in a MacFontStruct struct. There is really no concept
7736 corresponding to "loading" a font on the Mac. But we check its 7791 corresponding to "loading" a font on the Mac. But we check its
7737 existence and find the font number and all other information for it 7792 existence and find the font number and all other information for it
7738 and store them in the returned MacFontStruct. */ 7793 and store them in the returned MacFontStruct. */
7739 7794
7740static MacFontStruct * 7795static MacFontStruct *
7741XLoadQueryFont (Display *dpy, char *fontname) 7796mac_load_query_font (f, fontname)
7797 struct frame *f;
7798 char *fontname;
7742{ 7799{
7743 int size; 7800 int size;
7744 char *name; 7801 char *name;
@@ -7949,23 +8006,13 @@ XLoadQueryFont (Display *dpy, char *fontname)
7949 else 8006 else
7950#endif 8007#endif
7951 { 8008 {
7952 GrafPtr port;
7953 SInt16 old_fontnum, old_fontsize;
7954 Style old_fontface;
7955 FontInfo the_fontinfo; 8009 FontInfo the_fontinfo;
7956 int is_two_byte_font; 8010 int is_two_byte_font;
7957 8011
7958 /* Save the current font number used. */ 8012#if USE_CG_DRAWING
7959 GetPort (&port); 8013 mac_prepare_for_quickdraw (f);
7960#if TARGET_API_MAC_CARBON
7961 old_fontnum = GetPortTextFont (port);
7962 old_fontsize = GetPortTextSize (port);
7963 old_fontface = GetPortTextFace (port);
7964#else
7965 old_fontnum = port->txFont;
7966 old_fontsize = port->txSize;
7967 old_fontface = port->txFace;
7968#endif 8014#endif
8015 SetPortWindowPort (FRAME_MAC_WINDOW (f));
7969 8016
7970 TextFont (fontnum); 8017 TextFont (fontnum);
7971 TextSize (size); 8018 TextSize (size);
@@ -8047,11 +8094,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
8047 for (c = 0x21, pcm = space_bounds + 1; c <= 0xff; c++, pcm++) 8094 for (c = 0x21, pcm = space_bounds + 1; c <= 0xff; c++, pcm++)
8048 mac_query_char_extents (NULL, c, NULL, NULL, pcm, NULL); 8095 mac_query_char_extents (NULL, c, NULL, NULL, pcm, NULL);
8049 } 8096 }
8050
8051 /* Restore previous font number, size and face. */
8052 TextFont (old_fontnum);
8053 TextSize (old_fontsize);
8054 TextFace (old_fontface);
8055 } 8097 }
8056 8098
8057 if (space_bounds) 8099 if (space_bounds)
@@ -8070,6 +8112,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
8070 pcm->width); 8112 pcm->width);
8071 font->min_bounds.ascent = min (font->min_bounds.ascent, 8113 font->min_bounds.ascent = min (font->min_bounds.ascent,
8072 pcm->ascent); 8114 pcm->ascent);
8115 font->min_bounds.descent = min (font->min_bounds.descent,
8116 pcm->descent);
8073 8117
8074 font->max_bounds.lbearing = max (font->max_bounds.lbearing, 8118 font->max_bounds.lbearing = max (font->max_bounds.lbearing,
8075 pcm->lbearing); 8119 pcm->lbearing);
@@ -8079,6 +8123,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
8079 pcm->width); 8123 pcm->width);
8080 font->max_bounds.ascent = max (font->max_bounds.ascent, 8124 font->max_bounds.ascent = max (font->max_bounds.ascent,
8081 pcm->ascent); 8125 pcm->ascent);
8126 font->max_bounds.descent = max (font->max_bounds.descent,
8127 pcm->descent);
8082 } 8128 }
8083 if ( 8129 if (
8084#if USE_ATSUI 8130#if USE_ATSUI
@@ -8187,7 +8233,7 @@ x_load_font (f, fontname, size)
8187 fontname = (char *) SDATA (XCAR (font_names)); 8233 fontname = (char *) SDATA (XCAR (font_names));
8188 8234
8189 BLOCK_INPUT; 8235 BLOCK_INPUT;
8190 font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); 8236 font = mac_load_query_font (f, fontname);
8191 UNBLOCK_INPUT; 8237 UNBLOCK_INPUT;
8192 if (!font) 8238 if (!font)
8193 return NULL; 8239 return NULL;
@@ -8474,7 +8520,7 @@ mac_set_font_info_for_selection (f, face_id, c)
8474#endif 8520#endif
8475#endif /* ! TARGET_API_MAC_CARBON */ 8521#endif /* ! TARGET_API_MAC_CARBON */
8476 8522
8477#define M_APPLE 128 8523#define M_APPLE 234
8478#define I_ABOUT 1 8524#define I_ABOUT 1
8479 8525
8480#define WINDOW_RESOURCE 128 8526#define WINDOW_RESOURCE 128
@@ -9064,10 +9110,10 @@ mac_tsm_suspend ()
9064} 9110}
9065#endif 9111#endif
9066 9112
9067static void 9113#if !TARGET_API_MAC_CARBON
9114void
9068do_apple_menu (SInt16 menu_item) 9115do_apple_menu (SInt16 menu_item)
9069{ 9116{
9070#if !TARGET_API_MAC_CARBON
9071 Str255 item_name; 9117 Str255 item_name;
9072 SInt16 da_driver_refnum; 9118 SInt16 da_driver_refnum;
9073 9119
@@ -9078,43 +9124,8 @@ do_apple_menu (SInt16 menu_item)
9078 GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name); 9124 GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name);
9079 da_driver_refnum = OpenDeskAcc (item_name); 9125 da_driver_refnum = OpenDeskAcc (item_name);
9080 } 9126 }
9081#endif /* !TARGET_API_MAC_CARBON */
9082}
9083
9084void
9085do_menu_choice (SInt32 menu_choice)
9086{
9087 SInt16 menu_id, menu_item;
9088
9089 menu_id = HiWord (menu_choice);
9090 menu_item = LoWord (menu_choice);
9091
9092 switch (menu_id)
9093 {
9094 case 0:
9095 break;
9096
9097 case M_APPLE:
9098 do_apple_menu (menu_item);
9099 break;
9100
9101 default:
9102 {
9103 struct frame *f = mac_focus_frame (&one_mac_display_info);
9104 MenuHandle menu = GetMenuHandle (menu_id);
9105 if (menu)
9106 {
9107 UInt32 refcon;
9108
9109 GetMenuItemRefCon (menu, menu_item, &refcon);
9110 menubar_selection_callback (f, refcon);
9111 }
9112 }
9113 }
9114
9115 HiliteMenu (0);
9116} 9127}
9117 9128#endif /* !TARGET_API_MAC_CARBON */
9118 9129
9119/* Handle drags in size box. Based on code contributed by Ben 9130/* Handle drags in size box. Based on code contributed by Ben
9120 Mesander and IM - Window Manager A. */ 9131 Mesander and IM - Window Manager A. */
@@ -9165,6 +9176,32 @@ do_grow_window (WindowPtr w, EventRecord *e)
9165} 9176}
9166 9177
9167 9178
9179#if TARGET_API_MAC_CARBON
9180static Point
9181mac_get_ideal_size (f)
9182 struct frame *f;
9183{
9184 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
9185 WindowPtr w = FRAME_MAC_WINDOW (f);
9186 Point ideal_size;
9187 Rect standard_rect;
9188 int height, width, columns, rows;
9189
9190 ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
9191 ideal_size.v = dpyinfo->height;
9192 IsWindowInStandardState (w, &ideal_size, &standard_rect);
9193 /* Adjust the standard size according to character boundaries. */
9194 width = standard_rect.right - standard_rect.left;
9195 height = standard_rect.bottom - standard_rect.top;
9196 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width);
9197 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height);
9198 ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
9199 ideal_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
9200
9201 return ideal_size;
9202}
9203#endif
9204
9168/* Handle clicks in zoom box. Calculation of "standard state" based 9205/* Handle clicks in zoom box. Calculation of "standard state" based
9169 on code in IM - Window Manager A and code contributed by Ben 9206 on code in IM - Window Manager A and code contributed by Ben
9170 Mesander. The standard state of an Emacs window is 80-characters 9207 Mesander. The standard state of an Emacs window is 80-characters
@@ -9174,39 +9211,28 @@ static void
9174do_zoom_window (WindowPtr w, int zoom_in_or_out) 9211do_zoom_window (WindowPtr w, int zoom_in_or_out)
9175{ 9212{
9176 Rect zoom_rect, port_rect; 9213 Rect zoom_rect, port_rect;
9177 int columns, rows, width, height; 9214 int width, height;
9178 struct frame *f = mac_window_to_frame (w); 9215 struct frame *f = mac_window_to_frame (w);
9179 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
9180#if TARGET_API_MAC_CARBON 9216#if TARGET_API_MAC_CARBON
9181 Point standard_size; 9217 Point ideal_size = mac_get_ideal_size (f);
9182 9218
9183 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 9219 GetWindowBounds (w, kWindowContentRgn, &port_rect);
9184 standard_size.v = dpyinfo->height; 9220 if (IsWindowInStandardState (w, &ideal_size, &zoom_rect)
9185 9221 && port_rect.left == zoom_rect.left
9186 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) 9222 && port_rect.top == zoom_rect.top)
9187 zoom_in_or_out = inZoomIn; 9223 zoom_in_or_out = inZoomIn;
9188 else 9224 else
9189 { 9225 zoom_in_or_out = inZoomOut;
9190 /* Adjust the standard size according to character boundaries. */
9191 9226
9192 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left); 9227#ifdef MAC_OS8
9193 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top); 9228 mac_clear_window (f);
9194 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); 9229#endif
9195 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); 9230 ZoomWindowIdeal (w, zoom_in_or_out, &ideal_size);
9196 GetWindowBounds (w, kWindowContentRgn, &port_rect);
9197 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
9198 && port_rect.left == zoom_rect.left
9199 && port_rect.top == zoom_rect.top)
9200 zoom_in_or_out = inZoomIn;
9201 else
9202 zoom_in_or_out = inZoomOut;
9203 }
9204
9205 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
9206#else /* not TARGET_API_MAC_CARBON */ 9231#else /* not TARGET_API_MAC_CARBON */
9207 GrafPtr save_port; 9232 GrafPtr save_port;
9208 Point top_left; 9233 Point top_left;
9209 int w_title_height; 9234 int w_title_height, rows;
9235 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
9210 9236
9211 GetPort (&save_port); 9237 GetPort (&save_port);
9212 9238
@@ -9245,6 +9271,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
9245 SetPort (save_port); 9271 SetPort (save_port);
9246#endif /* not TARGET_API_MAC_CARBON */ 9272#endif /* not TARGET_API_MAC_CARBON */
9247 9273
9274#if !USE_CARBON_EVENTS
9248 /* retrieve window size and update application values */ 9275 /* retrieve window size and update application values */
9249#if TARGET_API_MAC_CARBON 9276#if TARGET_API_MAC_CARBON
9250 GetWindowPortBounds (w, &port_rect); 9277 GetWindowPortBounds (w, &port_rect);
@@ -9254,20 +9281,9 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
9254 height = port_rect.bottom - port_rect.top; 9281 height = port_rect.bottom - port_rect.top;
9255 width = port_rect.right - port_rect.left; 9282 width = port_rect.right - port_rect.left;
9256 9283
9257 if (width != FRAME_PIXEL_WIDTH (f) 9284 mac_handle_size_change (f, width, height);
9258 || height != FRAME_PIXEL_HEIGHT (f)) 9285 mac_handle_origin_change (f);
9259 { 9286#endif
9260 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height);
9261 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width);
9262
9263 change_frame_size (f, rows, columns, 0, 1, 0);
9264 SET_FRAME_GARBAGED (f);
9265 cancel_mouse_face (f);
9266
9267 FRAME_PIXEL_WIDTH (f) = width;
9268 FRAME_PIXEL_HEIGHT (f) = height;
9269 }
9270 x_real_positions (f, &f->left_pos, &f->top_pos);
9271} 9287}
9272 9288
9273void 9289void
@@ -9406,6 +9422,7 @@ mac_handle_window_event (next_handler, event, data)
9406{ 9422{
9407 WindowPtr wp; 9423 WindowPtr wp;
9408 OSStatus result, err; 9424 OSStatus result, err;
9425 struct frame *f;
9409 UInt32 attributes; 9426 UInt32 attributes;
9410 XSizeHints *size_hints; 9427 XSizeHints *size_hints;
9411 9428
@@ -9414,6 +9431,7 @@ mac_handle_window_event (next_handler, event, data)
9414 if (err != noErr) 9431 if (err != noErr)
9415 return eventNotHandledErr; 9432 return eventNotHandledErr;
9416 9433
9434 f = mac_window_to_frame (wp);
9417 switch (GetEventKind (event)) 9435 switch (GetEventKind (event))
9418 { 9436 {
9419 case kEventWindowUpdate: 9437 case kEventWindowUpdate:
@@ -9424,6 +9442,21 @@ mac_handle_window_event (next_handler, event, data)
9424 do_window_update (wp); 9442 do_window_update (wp);
9425 return noErr; 9443 return noErr;
9426 9444
9445 case kEventWindowGetIdealSize:
9446 result = CallNextEventHandler (next_handler, event);
9447 if (result != eventNotHandledErr)
9448 return result;
9449
9450 {
9451 Point ideal_size = mac_get_ideal_size (f);
9452
9453 err = SetEventParameter (event, kEventParamDimensions,
9454 typeQDPoint, sizeof (Point), &ideal_size);
9455 if (err == noErr)
9456 return noErr;
9457 }
9458 break;
9459
9427 case kEventWindowBoundsChanging: 9460 case kEventWindowBoundsChanging:
9428 result = CallNextEventHandler (next_handler, event); 9461 result = CallNextEventHandler (next_handler, event);
9429 if (result != eventNotHandledErr) 9462 if (result != eventNotHandledErr)
@@ -9434,7 +9467,7 @@ mac_handle_window_event (next_handler, event, data)
9434 if (err != noErr) 9467 if (err != noErr)
9435 break; 9468 break;
9436 9469
9437 size_hints = FRAME_SIZE_HINTS (mac_window_to_frame (wp)); 9470 size_hints = FRAME_SIZE_HINTS (f);
9438 if ((attributes & kWindowBoundsChangeUserResize) 9471 if ((attributes & kWindowBoundsChangeUserResize)
9439 && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize)) 9472 && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize))
9440 == (PResizeInc | PBaseSize | PMinSize))) 9473 == (PResizeInc | PBaseSize | PMinSize)))
@@ -9475,17 +9508,58 @@ mac_handle_window_event (next_handler, event, data)
9475 } 9508 }
9476 break; 9509 break;
9477 9510
9511 case kEventWindowBoundsChanged:
9512 err = GetEventParameter (event, kEventParamAttributes, typeUInt32,
9513 NULL, sizeof (UInt32), NULL, &attributes);
9514 if (err != noErr)
9515 break;
9516
9517 if (attributes & kWindowBoundsChangeSizeChanged)
9518 {
9519 Rect bounds;
9520
9521 err = GetEventParameter (event, kEventParamCurrentBounds,
9522 typeQDRectangle, NULL, sizeof (Rect),
9523 NULL, &bounds);
9524 if (err == noErr)
9525 {
9526 int width, height;
9527
9528 width = bounds.right - bounds.left;
9529 height = bounds.bottom - bounds.top;
9530 mac_handle_size_change (f, width, height);
9531 }
9532 }
9533
9534 if (attributes & kWindowBoundsChangeOriginChanged)
9535 mac_handle_origin_change (f);
9536
9537 return noErr;
9538
9478 case kEventWindowShown: 9539 case kEventWindowShown:
9479 case kEventWindowHidden: 9540 case kEventWindowHidden:
9480 case kEventWindowExpanded: 9541 case kEventWindowExpanded:
9481 case kEventWindowCollapsed: 9542 case kEventWindowCollapsed:
9482 result = CallNextEventHandler (next_handler, event); 9543 result = CallNextEventHandler (next_handler, event);
9483 9544
9484 mac_handle_visibility_change (mac_window_to_frame (wp)); 9545 mac_handle_visibility_change (f);
9485 return noErr; 9546 return noErr;
9486 9547
9487 break; 9548 break;
9488 9549
9550 case kEventWindowClose:
9551 result = CallNextEventHandler (next_handler, event);
9552 {
9553 struct input_event buf;
9554
9555 EVENT_INIT (buf);
9556 buf.kind = DELETE_WINDOW_EVENT;
9557 XSETFRAME (buf.frame_or_window, f);
9558 buf.arg = Qnil;
9559 kbd_buffer_store_event (&buf);
9560 }
9561 return noErr;
9562
9489#ifdef MAC_OSX 9563#ifdef MAC_OSX
9490 case kEventWindowToolbarSwitchMode: 9564 case kEventWindowToolbarSwitchMode:
9491 result = CallNextEventHandler (next_handler, event); 9565 result = CallNextEventHandler (next_handler, event);
@@ -9775,6 +9849,8 @@ mac_handle_text_input_event (next_handler, event, data)
9775 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; 9849 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT;
9776 read_socket_inev->code = code; 9850 read_socket_inev->code = code;
9777 read_socket_inev->modifiers = 9851 read_socket_inev->modifiers =
9852 mac_to_emacs_modifiers (modifiers);
9853 read_socket_inev->modifiers |=
9778 (extra_keyboard_modifiers 9854 (extra_keyboard_modifiers
9779 & (meta_modifier | alt_modifier 9855 & (meta_modifier | alt_modifier
9780 | hyper_modifier | super_modifier)); 9856 | hyper_modifier | super_modifier));
@@ -9894,11 +9970,14 @@ install_window_handler (window)
9894#if USE_CARBON_EVENTS 9970#if USE_CARBON_EVENTS
9895 EventTypeSpec specs_window[] = 9971 EventTypeSpec specs_window[] =
9896 {{kEventClassWindow, kEventWindowUpdate}, 9972 {{kEventClassWindow, kEventWindowUpdate},
9973 {kEventClassWindow, kEventWindowGetIdealSize},
9897 {kEventClassWindow, kEventWindowBoundsChanging}, 9974 {kEventClassWindow, kEventWindowBoundsChanging},
9975 {kEventClassWindow, kEventWindowBoundsChanged},
9898 {kEventClassWindow, kEventWindowShown}, 9976 {kEventClassWindow, kEventWindowShown},
9899 {kEventClassWindow, kEventWindowHidden}, 9977 {kEventClassWindow, kEventWindowHidden},
9900 {kEventClassWindow, kEventWindowExpanded}, 9978 {kEventClassWindow, kEventWindowExpanded},
9901 {kEventClassWindow, kEventWindowCollapsed}, 9979 {kEventClassWindow, kEventWindowCollapsed},
9980 {kEventClassWindow, kEventWindowClose},
9902#ifdef MAC_OSX 9981#ifdef MAC_OSX
9903 {kEventClassWindow, kEventWindowToolbarSwitchMode}, 9982 {kEventClassWindow, kEventWindowToolbarSwitchMode},
9904#endif 9983#endif
@@ -10457,12 +10536,14 @@ XTread_socket (sd, expected, hold_quit)
10457 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); 10536 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
10458#endif /* not TARGET_API_MAC_CARBON */ 10537#endif /* not TARGET_API_MAC_CARBON */
10459 /* Update the frame parameters. */ 10538 /* Update the frame parameters. */
10539#if !USE_CARBON_EVENTS
10460 { 10540 {
10461 struct frame *f = mac_window_to_frame (window_ptr); 10541 struct frame *f = mac_window_to_frame (window_ptr);
10462 10542
10463 if (f && !f->async_iconified) 10543 if (f && !f->async_iconified)
10464 x_real_positions (f, &f->left_pos, &f->top_pos); 10544 mac_handle_origin_change (f);
10465 } 10545 }
10546#endif
10466 break; 10547 break;
10467 10548
10468 case inGoAway: 10549 case inGoAway:
@@ -10561,7 +10642,7 @@ XTread_socket (sd, expected, hold_quit)
10561 else 10642 else
10562 { 10643 {
10563 /* Generate SELECT_WINDOW_EVENTs when needed. */ 10644 /* Generate SELECT_WINDOW_EVENTs when needed. */
10564 if (mouse_autoselect_window) 10645 if (!NILP (Vmouse_autoselect_window))
10565 { 10646 {
10566 Lisp_Object window; 10647 Lisp_Object window;
10567 10648
@@ -11571,6 +11652,14 @@ to 4.1, set this to nil.
11571NOTE: Not supported on Mac yet. */); 11652NOTE: Not supported on Mac yet. */);
11572 x_use_underline_position_properties = 0; 11653 x_use_underline_position_properties = 0;
11573 11654
11655 DEFVAR_BOOL ("x-underline-at-descent-line",
11656 &x_underline_at_descent_line,
11657 doc: /* *Non-nil means to draw the underline at the same place as the descent line.
11658nil means to draw the underline according to the value of the variable
11659`x-use-underline-position-properties', which is usually at the baseline
11660level. The default value is nil. */);
11661 x_underline_at_descent_line = 0;
11662
11574 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 11663 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
11575 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 11664 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
11576#ifdef USE_TOOLKIT_SCROLL_BARS 11665#ifdef USE_TOOLKIT_SCROLL_BARS
diff --git a/src/macterm.h b/src/macterm.h
index 659a13bbb17..e33f939940c 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -226,7 +226,8 @@ struct x_output
226}; 226};
227 227
228/* The collection of data describing a window on the Mac. */ 228/* The collection of data describing a window on the Mac. */
229struct mac_output { 229struct mac_output
230{
230 /* Placeholder for things accessed through output_data.x. Must 231 /* Placeholder for things accessed through output_data.x. Must
231 appear first. */ 232 appear first. */
232 struct x_output x_compatible; 233 struct x_output x_compatible;
@@ -316,9 +317,6 @@ struct mac_output {
316 /* Nonzero means tried already to make this frame visible. */ 317 /* Nonzero means tried already to make this frame visible. */
317 char asked_for_visible; 318 char asked_for_visible;
318 319
319 /* Nonzero means menubar is currently active. */
320 char menubar_active;
321
322 /* Relief GCs, colors etc. */ 320 /* Relief GCs, colors etc. */
323 struct relief 321 struct relief
324 { 322 {
@@ -626,8 +624,10 @@ extern OSStatus mac_show_hide_font_panel P_ ((void));
626extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); 624extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int));
627extern OSStatus install_window_handler P_ ((WindowPtr)); 625extern OSStatus install_window_handler P_ ((WindowPtr));
628extern void remove_window_handler P_ ((WindowPtr)); 626extern void remove_window_handler P_ ((WindowPtr));
629extern void do_menu_choice P_ ((SInt32));
630extern OSStatus mac_post_mouse_moved_event P_ ((void)); 627extern OSStatus mac_post_mouse_moved_event P_ ((void));
628#if !TARGET_API_MAC_CARBON
629extern void do_apple_menu P_ ((SInt16));
630#endif
631#if USE_CG_DRAWING 631#if USE_CG_DRAWING
632extern void mac_prepare_for_quickdraw P_ ((struct frame *)); 632extern void mac_prepare_for_quickdraw P_ ((struct frame *));
633#endif 633#endif
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index a94938a0b80..c2367ba30e4 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -678,6 +678,8 @@ $(BLD)/fns.$(O) : \
678 $(EMACS_ROOT)/src/s/ms-w32.h \ 678 $(EMACS_ROOT)/src/s/ms-w32.h \
679 $(EMACS_ROOT)/src/m/intel386.h \ 679 $(EMACS_ROOT)/src/m/intel386.h \
680 $(EMACS_ROOT)/src/config.h \ 680 $(EMACS_ROOT)/src/config.h \
681 $(EMACS_ROOT)/nt/inc/langinfo.h \
682 $(EMACS_ROOT)/nt/inc/nl_types.h \
681 $(SRC)/atimer.h \ 683 $(SRC)/atimer.h \
682 $(SRC)/blockinput.h \ 684 $(SRC)/blockinput.h \
683 $(SRC)/buffer.h \ 685 $(SRC)/buffer.h \
@@ -993,6 +995,8 @@ $(BLD)/w32proc.$(O) : \
993 $(SRC)/w32proc.c \ 995 $(SRC)/w32proc.c \
994 $(SRC)/s/ms-w32.h \ 996 $(SRC)/s/ms-w32.h \
995 $(SRC)/m/intel386.h \ 997 $(SRC)/m/intel386.h \
998 $(EMACS_ROOT)/nt/inc/langinfo.h \
999 $(EMACS_ROOT)/nt/inc/nl_types.h \
996 $(SRC)/config.h \ 1000 $(SRC)/config.h \
997 $(SRC)/process.h \ 1001 $(SRC)/process.h \
998 $(SRC)/syssignal.h \ 1002 $(SRC)/syssignal.h \
diff --git a/src/marker.c b/src/marker.c
index 20b660ddadd..48685e7d27c 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -460,7 +460,8 @@ Returns nil if MARKER points into a dead buffer. */)
460} 460}
461 461
462DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, 462DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0,
463 doc: /* Return the position MARKER points at, as a character number. */) 463 doc: /* Return the position MARKER points at, as a character number.
464Returns nil if MARKER points nowhere. */)
464 (marker) 465 (marker)
465 Lisp_Object marker; 466 Lisp_Object marker;
466{ 467{
diff --git a/src/md5.c b/src/md5.c
index d3c25b04d3e..0daf2c3ef7c 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -5,17 +5,17 @@
5 This file is part of the GNU Emacs. 5 This file is part of the GNU Emacs.
6 6
7 The GNU C Library is free software; you can redistribute it and/or 7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as 8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the 9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. 10 License, or (at your option) any later version.
11 11
12 The GNU C Library is distributed in the hope that it will be useful, 12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public 17 You should have received a copy of the GNU General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not, 18 License along with the GNU C Library; see the file COPYING. If not,
19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
diff --git a/src/md5.h b/src/md5.h
index 09bf02ff753..202b2749504 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -5,17 +5,17 @@
5 This file is part of GNU Emacs. 5 This file is part of GNU Emacs.
6 6
7 The GNU C Library is free software; you can redistribute it and/or 7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as 8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the 9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. 10 License, or (at your option) any later version.
11 11
12 The GNU C Library is distributed in the hope that it will be useful, 12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public 17 You should have received a copy of the GNU General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not, 18 License along with the GNU C Library; see the file COPYING. If not,
19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
diff --git a/src/minibuf.c b/src/minibuf.c
index e4296ad8cd2..8924668db52 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1027,7 +1027,7 @@ DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0,
1027Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS 1027Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
1028is a string to insert in the minibuffer before reading. 1028is a string to insert in the minibuffer before reading.
1029\(INITIAL-CONTENTS can also be a cons of a string and an integer. Such 1029\(INITIAL-CONTENTS can also be a cons of a string and an integer. Such
1030arguments are used as in `read-from-minibuffer') */) 1030arguments are used as in `read-from-minibuffer'.) */)
1031 (prompt, initial_contents) 1031 (prompt, initial_contents)
1032 Lisp_Object prompt, initial_contents; 1032 Lisp_Object prompt, initial_contents;
1033{ 1033{
@@ -1201,8 +1201,8 @@ The argument PROMPT should be a string ending with a colon and a space. */)
1201 prompt = Fformat (3, args); 1201 prompt = Fformat (3, args);
1202 } 1202 }
1203 1203
1204 return Fcompleting_read (prompt, Vbuffer_alist, Qnil, 1204 return Fcompleting_read (prompt, intern ("internal-complete-buffer"),
1205 require_match, Qnil, Qbuffer_name_history, 1205 Qnil, require_match, Qnil, Qbuffer_name_history,
1206 def, Qnil); 1206 def, Qnil);
1207 } 1207 }
1208 else 1208 else
@@ -1911,6 +1911,24 @@ the values STRING, PREDICATE and `lambda'. */)
1911 return Qt; 1911 return Qt;
1912} 1912}
1913 1913
1914DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0,
1915 doc: /* Perform completion on buffer names.
1916If the argument FLAG is nil, invoke `try-completion', if it's t, invoke
1917`all-completions', otherwise invoke `test-completion'.
1918
1919The arguments STRING and PREDICATE are as in `try-completion',
1920`all-completions', and `test-completion'. */)
1921 (string, predicate, flag)
1922 Lisp_Object string, predicate, flag;
1923{
1924 if (NILP (flag))
1925 return Ftry_completion (string, Vbuffer_alist, predicate);
1926 else if (EQ (flag, Qt))
1927 return Fall_completions (string, Vbuffer_alist, predicate, Qt);
1928 else /* assume `lambda' */
1929 return Ftest_completion (string, Vbuffer_alist, predicate);
1930}
1931
1914/* returns: 1932/* returns:
1915 * 0 no possible completion 1933 * 0 no possible completion
1916 * 1 was already an exact and unique completion 1934 * 1 was already an exact and unique completion
@@ -2399,7 +2417,7 @@ The optional second arg COMMON-SUBSTRING is a string.
2399It is used to put faces, `completions-first-difference' and 2417It is used to put faces, `completions-first-difference' and
2400`completions-common-part' on the completion buffer. The 2418`completions-common-part' on the completion buffer. The
2401`completions-common-part' face is put on the common substring 2419`completions-common-part' face is put on the common substring
2402specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil 2420specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil
2403and the current buffer is not the minibuffer, the faces are not put. 2421and the current buffer is not the minibuffer, the faces are not put.
2404Internally, COMMON-SUBSTRING is bound to `completion-common-substring' 2422Internally, COMMON-SUBSTRING is bound to `completion-common-substring'
2405during running `completion-setup-hook'. */) 2423during running `completion-setup-hook'. */)
@@ -2680,6 +2698,8 @@ If no minibuffer is active, return nil. */)
2680 that has no possible completions, and other quick, unobtrusive 2698 that has no possible completions, and other quick, unobtrusive
2681 messages. */ 2699 messages. */
2682 2700
2701extern Lisp_Object Vminibuffer_message_timeout;
2702
2683void 2703void
2684temp_echo_area_glyphs (string) 2704temp_echo_area_glyphs (string)
2685 Lisp_Object string; 2705 Lisp_Object string;
@@ -2698,7 +2718,12 @@ temp_echo_area_glyphs (string)
2698 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0); 2718 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
2699 SET_PT_BOTH (opoint, opoint_byte); 2719 SET_PT_BOTH (opoint, opoint_byte);
2700 Vinhibit_quit = Qt; 2720 Vinhibit_quit = Qt;
2701 sit_for (make_number (2), 0, 2); 2721
2722 if (NUMBERP (Vminibuffer_message_timeout))
2723 sit_for (Vminibuffer_message_timeout, 0, 2);
2724 else
2725 sit_for (Qt, 0, 2);
2726
2702 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1); 2727 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
2703 SET_PT_BOTH (opoint, opoint_byte); 2728 SET_PT_BOTH (opoint, opoint_byte);
2704 if (!NILP (Vquit_flag)) 2729 if (!NILP (Vquit_flag))
@@ -2921,6 +2946,7 @@ properties. */);
2921 defsubr (&Sread_string); 2946 defsubr (&Sread_string);
2922 defsubr (&Sread_command); 2947 defsubr (&Sread_command);
2923 defsubr (&Sread_variable); 2948 defsubr (&Sread_variable);
2949 defsubr (&Sinternal_complete_buffer);
2924 defsubr (&Sread_buffer); 2950 defsubr (&Sread_buffer);
2925 defsubr (&Sread_no_blanks_input); 2951 defsubr (&Sread_no_blanks_input);
2926 defsubr (&Sminibuffer_depth); 2952 defsubr (&Sminibuffer_depth);
diff --git a/src/msdos.c b/src/msdos.c
index b6f6a75ac60..8595c8f6ce9 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -3381,7 +3381,7 @@ dos_rawgetc ()
3381 } 3381 }
3382 3382
3383 /* Generate SELECT_WINDOW_EVENTs when needed. */ 3383 /* Generate SELECT_WINDOW_EVENTs when needed. */
3384 if (mouse_autoselect_window) 3384 if (!NILP (Vmouse_autoselect_window))
3385 { 3385 {
3386 mouse_window = window_from_coordinates (SELECTED_FRAME(), 3386 mouse_window = window_from_coordinates (SELECTED_FRAME(),
3387 mouse_last_x, 3387 mouse_last_x,
diff --git a/src/print.c b/src/print.c
index d5ff1be6b31..5d650813458 100644
--- a/src/print.c
+++ b/src/print.c
@@ -216,7 +216,7 @@ int print_output_debug_flag = 1;
216 if (MARKERP (printcharfun)) \ 216 if (MARKERP (printcharfun)) \
217 { \ 217 { \
218 EMACS_INT marker_pos; \ 218 EMACS_INT marker_pos; \
219 if (!(XMARKER (printcharfun)->buffer)) \ 219 if (! XMARKER (printcharfun)->buffer) \
220 error ("Marker does not point anywhere"); \ 220 error ("Marker does not point anywhere"); \
221 if (XMARKER (printcharfun)->buffer != current_buffer) \ 221 if (XMARKER (printcharfun)->buffer != current_buffer) \
222 set_buffer_internal (XMARKER (printcharfun)->buffer); \ 222 set_buffer_internal (XMARKER (printcharfun)->buffer); \
@@ -289,7 +289,7 @@ int print_output_debug_flag = 1;
289 SET_PT_BOTH (old_point + (old_point >= start_point \ 289 SET_PT_BOTH (old_point + (old_point >= start_point \
290 ? PT - start_point : 0), \ 290 ? PT - start_point : 0), \
291 old_point_byte + (old_point_byte >= start_point_byte \ 291 old_point_byte + (old_point_byte >= start_point_byte \
292 ? PT_BYTE - start_point_byte : 0)); \ 292 ? PT_BYTE - start_point_byte : 0)); \
293 if (old != current_buffer) \ 293 if (old != current_buffer) \
294 set_buffer_internal (old); 294 set_buffer_internal (old);
295 295
@@ -364,7 +364,10 @@ printchar (ch, fun)
364 print_buffer. PRINTCHARFUN t means output to the echo area or to 364 print_buffer. PRINTCHARFUN t means output to the echo area or to
365 stdout if non-interactive. If neither nil nor t, call Lisp 365 stdout if non-interactive. If neither nil nor t, call Lisp
366 function PRINTCHARFUN for each character printed. MULTIBYTE 366 function PRINTCHARFUN for each character printed. MULTIBYTE
367 non-zero means PTR contains multibyte characters. */ 367 non-zero means PTR contains multibyte characters.
368
369 In the case where PRINTCHARFUN is nil, it is safe for PTR to point
370 to data in a Lisp string. Otherwise that is not safe. */
368 371
369static void 372static void
370strout (ptr, size, size_byte, printcharfun, multibyte) 373strout (ptr, size, size_byte, printcharfun, multibyte)
@@ -413,7 +416,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
413 if (size == size_byte) 416 if (size == size_byte)
414 { 417 {
415 for (i = 0; i < size; ++i) 418 for (i = 0; i < size; ++i)
416 insert_char ((unsigned char )*ptr++); 419 insert_char ((unsigned char) *ptr++);
417 } 420 }
418 else 421 else
419 { 422 {
@@ -497,10 +500,29 @@ print_string (string, printcharfun)
497 else 500 else
498 chars = SBYTES (string); 501 chars = SBYTES (string);
499 502
500 /* strout is safe for output to a frame (echo area) or to print_buffer. */ 503 if (EQ (printcharfun, Qt))
501 strout (SDATA (string), 504 {
502 chars, SBYTES (string), 505 /* Output to echo area. */
503 printcharfun, STRING_MULTIBYTE (string)); 506 int nbytes = SBYTES (string);
507 char *buffer;
508
509 /* Copy the string contents so that relocation of STRING by
510 GC does not cause trouble. */
511 USE_SAFE_ALLOCA;
512
513 SAFE_ALLOCA (buffer, char *, nbytes);
514 bcopy (SDATA (string), buffer, nbytes);
515
516 strout (buffer, chars, SBYTES (string),
517 printcharfun, STRING_MULTIBYTE (string));
518
519 SAFE_FREE ();
520 }
521 else
522 /* No need to copy, since output to print_buffer can't GC. */
523 strout (SDATA (string),
524 chars, SBYTES (string),
525 printcharfun, STRING_MULTIBYTE (string));
504 } 526 }
505 else 527 else
506 { 528 {
@@ -934,7 +956,7 @@ debug_output_compilation_hack (x)
934 print_output_debug_flag = x; 956 print_output_debug_flag = x;
935} 957}
936 958
937#if defined(GNU_LINUX) 959#if defined (GNU_LINUX)
938 960
939/* This functionality is not vitally important in general, so we rely on 961/* This functionality is not vitally important in general, so we rely on
940 non-portable ability to use stderr as lvalue. */ 962 non-portable ability to use stderr as lvalue. */
@@ -954,7 +976,7 @@ append to existing target file. */)
954 Lisp_Object file, append; 976 Lisp_Object file, append;
955{ 977{
956 if (initial_stderr_stream != NULL) 978 if (initial_stderr_stream != NULL)
957 fclose(stderr); 979 fclose (stderr);
958 stderr = initial_stderr_stream; 980 stderr = initial_stderr_stream;
959 initial_stderr_stream = NULL; 981 initial_stderr_stream = NULL;
960 982
@@ -962,7 +984,7 @@ append to existing target file. */)
962 { 984 {
963 file = Fexpand_file_name (file, Qnil); 985 file = Fexpand_file_name (file, Qnil);
964 initial_stderr_stream = stderr; 986 initial_stderr_stream = stderr;
965 stderr = fopen(SDATA (file), NILP (append) ? "w" : "a"); 987 stderr = fopen (SDATA (file), NILP (append) ? "w" : "a");
966 if (stderr == NULL) 988 if (stderr == NULL)
967 { 989 {
968 stderr = initial_stderr_stream; 990 stderr = initial_stderr_stream;
@@ -2030,7 +2052,7 @@ print_object (obj, printcharfun, escapeflag)
2030 /* Do you think this is necessary? */ 2052 /* Do you think this is necessary? */
2031 if (XMARKER (obj)->insertion_type != 0) 2053 if (XMARKER (obj)->insertion_type != 0)
2032 strout ("(moves after insertion) ", -1, -1, printcharfun, 0); 2054 strout ("(moves after insertion) ", -1, -1, printcharfun, 0);
2033 if (!(XMARKER (obj)->buffer)) 2055 if (! XMARKER (obj)->buffer)
2034 strout ("in no buffer", -1, -1, printcharfun, 0); 2056 strout ("in no buffer", -1, -1, printcharfun, 0);
2035 else 2057 else
2036 { 2058 {
@@ -2044,7 +2066,7 @@ print_object (obj, printcharfun, escapeflag)
2044 2066
2045 case Lisp_Misc_Overlay: 2067 case Lisp_Misc_Overlay:
2046 strout ("#<overlay ", -1, -1, printcharfun, 0); 2068 strout ("#<overlay ", -1, -1, printcharfun, 0);
2047 if (!(XMARKER (OVERLAY_START (obj))->buffer)) 2069 if (! XMARKER (OVERLAY_START (obj))->buffer)
2048 strout ("in no buffer", -1, -1, printcharfun, 0); 2070 strout ("in no buffer", -1, -1, printcharfun, 0);
2049 else 2071 else
2050 { 2072 {
@@ -2091,8 +2113,8 @@ print_object (obj, printcharfun, escapeflag)
2091 2113
2092 case Lisp_Misc_Kboard_Objfwd: 2114 case Lisp_Misc_Kboard_Objfwd:
2093 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0); 2115 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0);
2094 print_object (*(Lisp_Object *)((char *) current_kboard 2116 print_object (*(Lisp_Object *) ((char *) current_kboard
2095 + XKBOARD_OBJFWD (obj)->offset), 2117 + XKBOARD_OBJFWD (obj)->offset),
2096 printcharfun, escapeflag); 2118 printcharfun, escapeflag);
2097 PRINTCHAR ('>'); 2119 PRINTCHAR ('>');
2098 break; 2120 break;
@@ -2178,7 +2200,7 @@ print_interval (interval, printcharfun)
2178 print_object (make_number (interval->position), printcharfun, 1); 2200 print_object (make_number (interval->position), printcharfun, 1);
2179 PRINTCHAR (' '); 2201 PRINTCHAR (' ');
2180 print_object (make_number (interval->position + LENGTH (interval)), 2202 print_object (make_number (interval->position + LENGTH (interval)),
2181 printcharfun, 1); 2203 printcharfun, 1);
2182 PRINTCHAR (' '); 2204 PRINTCHAR (' ');
2183 print_object (interval->plist, printcharfun, 1); 2205 print_object (interval->plist, printcharfun, 1);
2184} 2206}
diff --git a/src/process.c b/src/process.c
index f8ae50e8652..9062e6c3d6e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -318,6 +318,12 @@ static int read_process_output P_ ((Lisp_Object, int));
318#define POLL_FOR_INPUT 318#define POLL_FOR_INPUT
319#endif 319#endif
320 320
321static Lisp_Object get_process ();
322static void exec_sentinel ();
323
324extern EMACS_TIME timer_check ();
325extern int timers_run;
326
321/* Mask of bits indicating the descriptors that we wait for input on. */ 327/* Mask of bits indicating the descriptors that we wait for input on. */
322 328
323static SELECT_TYPE input_wait_mask; 329static SELECT_TYPE input_wait_mask;
@@ -386,15 +392,13 @@ struct sockaddr_and_len {
386#define DATAGRAM_CONN_P(proc) (0) 392#define DATAGRAM_CONN_P(proc) (0)
387#endif 393#endif
388 394
389static Lisp_Object get_process ();
390static void exec_sentinel ();
391
392extern EMACS_TIME timer_check ();
393extern int timers_run;
394
395/* Maximum number of bytes to send to a pty without an eof. */ 395/* Maximum number of bytes to send to a pty without an eof. */
396static int pty_max_bytes; 396static int pty_max_bytes;
397 397
398/* Nonzero means don't run process sentinels. This is used
399 when exiting. */
400int inhibit_sentinels;
401
398#ifdef HAVE_PTYS 402#ifdef HAVE_PTYS
399#ifdef HAVE_PTY_H 403#ifdef HAVE_PTY_H
400#include <pty.h> 404#include <pty.h>
@@ -1310,6 +1314,7 @@ list_processes_1 (query_only)
1310 register struct Lisp_Process *p; 1314 register struct Lisp_Process *p;
1311 char tembuf[300]; 1315 char tembuf[300];
1312 int w_proc, w_buffer, w_tty; 1316 int w_proc, w_buffer, w_tty;
1317 int exited = 0;
1313 Lisp_Object i_status, i_buffer, i_tty, i_command; 1318 Lisp_Object i_status, i_buffer, i_tty, i_command;
1314 1319
1315 w_proc = 4; /* Proc */ 1320 w_proc = 4; /* Proc */
@@ -1436,8 +1441,8 @@ list_processes_1 (query_only)
1436 } 1441 }
1437 } 1442 }
1438 1443
1439 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) 1444 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) || EQ (symbol, Qclosed))
1440 remove_process (proc); 1445 exited++;
1441 1446
1442 Findent_to (i_buffer, minspace); 1447 Findent_to (i_buffer, minspace);
1443 if (NILP (p->buffer)) 1448 if (NILP (p->buffer))
@@ -1501,6 +1506,8 @@ list_processes_1 (query_only)
1501 insert_string ("\n"); 1506 insert_string ("\n");
1502 } 1507 }
1503 } 1508 }
1509 if (exited)
1510 status_notify (NULL);
1504 return Qnil; 1511 return Qnil;
1505} 1512}
1506 1513
@@ -6564,6 +6571,9 @@ exec_sentinel (proc, reason)
6564 int outer_running_asynch_code = running_asynch_code; 6571 int outer_running_asynch_code = running_asynch_code;
6565 int waiting = waiting_for_user_input_p; 6572 int waiting = waiting_for_user_input_p;
6566 6573
6574 if (inhibit_sentinels)
6575 return;
6576
6567 /* No need to gcpro these, because all we do with them later 6577 /* No need to gcpro these, because all we do with them later
6568 is test them for EQness, and none of them should be a string. */ 6578 is test them for EQness, and none of them should be a string. */
6569 odeactivate = Vdeactivate_mark; 6579 odeactivate = Vdeactivate_mark;
@@ -6885,6 +6895,8 @@ init_process ()
6885{ 6895{
6886 register int i; 6896 register int i;
6887 6897
6898 inhibit_sentinels = 0;
6899
6888#ifdef SIGCHLD 6900#ifdef SIGCHLD
6889#ifndef CANNOT_DUMP 6901#ifndef CANNOT_DUMP
6890 if (! noninteractive || initialized) 6902 if (! noninteractive || initialized)
diff --git a/src/process.h b/src/process.h
index b585515d6b1..fcf8d9b6c1f 100644
--- a/src/process.h
+++ b/src/process.h
@@ -161,5 +161,9 @@ extern int synch_process_retcode;
161#define NULL_DEVICE "/dev/null" 161#define NULL_DEVICE "/dev/null"
162#endif 162#endif
163 163
164/* Nonzero means don't run process sentinels. This is used
165 when exiting. */
166extern int inhibit_sentinels;
167
164/* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72 168/* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72
165 (do not change this comment) */ 169 (do not change this comment) */
diff --git a/src/regex.c b/src/regex.c
index 846c87041b1..ae80ad0cee8 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2530,6 +2530,7 @@ regex_compile (pattern, size, syntax, bufp)
2530 bufp->syntax = syntax; 2530 bufp->syntax = syntax;
2531 bufp->fastmap_accurate = 0; 2531 bufp->fastmap_accurate = 0;
2532 bufp->not_bol = bufp->not_eol = 0; 2532 bufp->not_bol = bufp->not_eol = 0;
2533 bufp->used_syntax = 0;
2533 2534
2534 /* Set `used' to zero, so that if we return an error, the pattern 2535 /* Set `used' to zero, so that if we return an error, the pattern
2535 printer (for debugging) will think there's no pattern. We reset it 2536 printer (for debugging) will think there's no pattern. We reset it
@@ -2942,6 +2943,14 @@ regex_compile (pattern, size, syntax, bufp)
2942 SET_LIST_BIT (translated); 2943 SET_LIST_BIT (translated);
2943 } 2944 }
2944 2945
2946 /* In most cases the matching rule for char classes
2947 only uses the syntax table for multibyte chars,
2948 so that the content of the syntax-table it is not
2949 hardcoded in the range_table. SPACE and WORD are
2950 the two exceptions. */
2951 if ((1 << cc) & ((1 << RECC_SPACE) | (1 << RECC_WORD)))
2952 bufp->used_syntax = 1;
2953
2945 /* Repeat the loop. */ 2954 /* Repeat the loop. */
2946 continue; 2955 continue;
2947 } 2956 }
@@ -3877,11 +3886,13 @@ analyse_first (p, pend, fastmap, multibyte)
3877 if (fastmap) 3886 if (fastmap)
3878 { 3887 {
3879 int c = RE_STRING_CHAR (p + 1, pend - p); 3888 int c = RE_STRING_CHAR (p + 1, pend - p);
3880 3889 /* When fast-scanning, the fastmap can be indexed either with
3890 a char (smaller than 256) or with the first byte of
3891 a char's byte sequence. So we have to conservatively add
3892 both to the table. */
3881 if (SINGLE_BYTE_CHAR_P (c)) 3893 if (SINGLE_BYTE_CHAR_P (c))
3882 fastmap[c] = 1; 3894 fastmap[c] = 1;
3883 else 3895 fastmap[p[1]] = 1;
3884 fastmap[p[1]] = 1;
3885 } 3896 }
3886 break; 3897 break;
3887 3898
@@ -3899,6 +3910,10 @@ analyse_first (p, pend, fastmap, multibyte)
3899 So any that are not listed in the charset 3910 So any that are not listed in the charset
3900 are possible matches, even in multibyte buffers. */ 3911 are possible matches, even in multibyte buffers. */
3901 if (!fastmap) break; 3912 if (!fastmap) break;
3913 /* We don't need to mark LEADING_CODE_8_BIT_CONTROL specially
3914 because it will automatically be set when needed by virtue of
3915 being larger than the highest char of its charset (0xbf) but
3916 smaller than (1<<BYTEWIDTH). */
3902 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH; 3917 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH;
3903 j < (1 << BYTEWIDTH); j++) 3918 j < (1 << BYTEWIDTH); j++)
3904 fastmap[j] = 1; 3919 fastmap[j] = 1;
@@ -3909,7 +3924,13 @@ analyse_first (p, pend, fastmap, multibyte)
3909 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++; 3924 for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++;
3910 j >= 0; j--) 3925 j >= 0; j--)
3911 if (!!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) ^ not) 3926 if (!!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) ^ not)
3912 fastmap[j] = 1; 3927 {
3928 fastmap[j] = 1;
3929#ifdef emacs
3930 if (j >= 0x80 && j < 0xa0)
3931 fastmap[LEADING_CODE_8_BIT_CONTROL] = 1;
3932#endif
3933 }
3913 3934
3914 if ((not && multibyte) 3935 if ((not && multibyte)
3915 /* Any character set can possibly contain a character 3936 /* Any character set can possibly contain a character
@@ -4352,11 +4373,33 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
4352 } 4373 }
4353 } 4374 }
4354 else 4375 else
4355 while (range > lim && !fastmap[*d]) 4376 do
4356 { 4377 {
4357 d++; 4378 re_char *d_start = d;
4358 range--; 4379 while (range > lim && !fastmap[*d])
4359 } 4380 {
4381 d++;
4382 range--;
4383 }
4384#ifdef emacs
4385 if (multibyte && range > lim)
4386 {
4387 /* Check that we are at the beginning of a char. */
4388 int at_boundary;
4389 AT_CHAR_BOUNDARY_P (at_boundary, d, d_start);
4390 if (at_boundary)
4391 break;
4392 else
4393 { /* We have matched an internal byte of a char
4394 rather than the leading byte, so it's a false
4395 positive: we should keep scanning. */
4396 d++; range--;
4397 }
4398 }
4399 else
4400#endif
4401 break;
4402 } while (1);
4360 4403
4361 startpos += irange - range; 4404 startpos += irange - range;
4362 } 4405 }
@@ -6197,6 +6240,10 @@ re_compile_pattern (pattern, length, bufp)
6197{ 6240{
6198 reg_errcode_t ret; 6241 reg_errcode_t ret;
6199 6242
6243#ifdef emacs
6244 gl_state.current_syntax_table = current_buffer->syntax_table;
6245#endif
6246
6200 /* GNU code is written to assume at least RE_NREGS registers will be set 6247 /* GNU code is written to assume at least RE_NREGS registers will be set
6201 (and at least one extra will be -1). */ 6248 (and at least one extra will be -1). */
6202 bufp->regs_allocated = REGS_UNALLOCATED; 6249 bufp->regs_allocated = REGS_UNALLOCATED;
diff --git a/src/regex.h b/src/regex.h
index c850c640b36..14817c35e90 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -392,6 +392,10 @@ struct re_pattern_buffer
392 /* Similarly for an end-of-line anchor. */ 392 /* Similarly for an end-of-line anchor. */
393 unsigned not_eol : 1; 393 unsigned not_eol : 1;
394 394
395 /* If true, the compilation of the pattern had to look up the syntax table,
396 so the compiled pattern is only valid for the current syntax table. */
397 unsigned used_syntax : 1;
398
395#ifdef emacs 399#ifdef emacs
396 /* If true, multi-byte form in the `buffer' should be recognized as a 400 /* If true, multi-byte form in the `buffer' should be recognized as a
397 multibyte character. */ 401 multibyte character. */
@@ -614,13 +618,5 @@ extern void re_set_whitespace_regexp (const char *regexp);
614 618
615#endif /* regex.h */ 619#endif /* regex.h */
616 620
617/*
618Local variables:
619make-backup-files: t
620version-control: t
621trim-versions-without-asking: nil
622End:
623*/
624
625/* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083 621/* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083
626 (do not change this comment) */ 622 (do not change this comment) */
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 817f1facdee..55d9a725293 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -142,8 +142,12 @@ Boston, MA 02110-1301, USA. */
142 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and 142 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
143 HAVE_MAILLOCK_H are defined, so the following appears to be the 143 HAVE_MAILLOCK_H are defined, so the following appears to be the
144 correct logic. -- fx */ 144 correct logic. -- fx */
145/* We must check for HAVE_LIBLOCKFILE too, as movemail does.
146 liblockfile is a Free Software replacement for libmail, used on
147 Debian systems and elsewhere. -rfr */
145 148
146#if !(defined (HAVE_LIBMAIL) && defined (HAVE_MAILLOCK_H)) 149#if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \
150 defined (HAVE_MAILLOCK_H))
147#define MAIL_USE_FLOCK 151#define MAIL_USE_FLOCK
148#endif 152#endif
149 153
diff --git a/src/search.c b/src/search.c
index 5d532a9d8dd..7c3151b76b8 100644
--- a/src/search.c
+++ b/src/search.c
@@ -42,6 +42,10 @@ struct regexp_cache
42{ 42{
43 struct regexp_cache *next; 43 struct regexp_cache *next;
44 Lisp_Object regexp, whitespace_regexp; 44 Lisp_Object regexp, whitespace_regexp;
45 /* Syntax table for which the regexp applies. We need this because
46 of character classes. If this is t, then the compiled pattern is valid
47 for any syntax-table. */
48 Lisp_Object syntax_table;
45 struct re_pattern_buffer buf; 49 struct re_pattern_buffer buf;
46 char fastmap[0400]; 50 char fastmap[0400];
47 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 51 /* Nonzero means regexp was compiled to do full POSIX backtracking. */
@@ -167,7 +171,11 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
167 cp->posix = posix; 171 cp->posix = posix;
168 cp->buf.multibyte = multibyte; 172 cp->buf.multibyte = multibyte;
169 cp->whitespace_regexp = Vsearch_spaces_regexp; 173 cp->whitespace_regexp = Vsearch_spaces_regexp;
170 BLOCK_INPUT; 174 /* rms: I think BLOCK_INPUT is not needed here any more,
175 because regex.c defines malloc to call xmalloc.
176 Using BLOCK_INPUT here means the debugger won't run if an error occurs.
177 So let's turn it off. */
178 /* BLOCK_INPUT; */
171 old = re_set_syntax (RE_SYNTAX_EMACS 179 old = re_set_syntax (RE_SYNTAX_EMACS
172 | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); 180 | (posix ? 0 : RE_NO_POSIX_BACKTRACKING));
173 181
@@ -177,10 +185,14 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
177 val = (char *) re_compile_pattern ((char *)raw_pattern, 185 val = (char *) re_compile_pattern ((char *)raw_pattern,
178 raw_pattern_size, &cp->buf); 186 raw_pattern_size, &cp->buf);
179 187
188 /* If the compiled pattern hard codes some of the contents of the
189 syntax-table, it can only be reused with *this* syntax table. */
190 cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt;
191
180 re_set_whitespace_regexp (NULL); 192 re_set_whitespace_regexp (NULL);
181 193
182 re_set_syntax (old); 194 re_set_syntax (old);
183 UNBLOCK_INPUT; 195 /* UNBLOCK_INPUT; */
184 if (val) 196 if (val)
185 xsignal1 (Qinvalid_regexp, build_string (val)); 197 xsignal1 (Qinvalid_regexp, build_string (val));
186 198
@@ -204,6 +216,24 @@ shrink_regexp_cache ()
204 } 216 }
205} 217}
206 218
219/* Clear the regexp cache w.r.t. a particular syntax table,
220 because it was changed.
221 There is no danger of memory leak here because re_compile_pattern
222 automagically manages the memory in each re_pattern_buffer struct,
223 based on its `allocated' and `buffer' values. */
224void
225clear_regexp_cache ()
226{
227 int i;
228
229 for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
230 /* It's tempting to compare with the syntax-table we've actually changd,
231 but it's not sufficient because char-table inheritance mewans that
232 modifying one syntax-table can change others at the same time. */
233 if (!EQ (searchbufs[i].syntax_table, Qt))
234 searchbufs[i].regexp = Qnil;
235}
236
207/* Compile a regexp if necessary, but first check to see if there's one in 237/* Compile a regexp if necessary, but first check to see if there's one in
208 the cache. 238 the cache.
209 PATTERN is the pattern to compile. 239 PATTERN is the pattern to compile.
@@ -240,6 +270,8 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
240 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 270 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
241 && cp->posix == posix 271 && cp->posix == posix
242 && cp->buf.multibyte == multibyte 272 && cp->buf.multibyte == multibyte
273 && (EQ (cp->syntax_table, Qt)
274 || EQ (cp->syntax_table, current_buffer->syntax_table))
243 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))) 275 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
244 break; 276 break;
245 277
@@ -284,6 +316,10 @@ looking_at_1 (string, posix)
284 if (running_asynch_code) 316 if (running_asynch_code)
285 save_search_regs (); 317 save_search_regs ();
286 318
319 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
320 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
321 = current_buffer->case_eqv_table;
322
287 CHECK_STRING (string); 323 CHECK_STRING (string);
288 bufp = compile_pattern (string, &search_regs, 324 bufp = compile_pattern (string, &search_regs,
289 (!NILP (current_buffer->case_fold_search) 325 (!NILP (current_buffer->case_fold_search)
@@ -391,6 +427,10 @@ string_match_1 (regexp, string, start, posix)
391 pos_byte = string_char_to_byte (string, pos); 427 pos_byte = string_char_to_byte (string, pos);
392 } 428 }
393 429
430 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
431 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
432 = current_buffer->case_eqv_table;
433
394 bufp = compile_pattern (regexp, &search_regs, 434 bufp = compile_pattern (regexp, &search_regs,
395 (!NILP (current_buffer->case_fold_search) 435 (!NILP (current_buffer->case_fold_search)
396 ? current_buffer->case_canon_table : Qnil), 436 ? current_buffer->case_canon_table : Qnil),
@@ -930,6 +970,10 @@ search_command (string, bound, noerror, count, direction, RE, posix)
930 lim_byte = CHAR_TO_BYTE (lim); 970 lim_byte = CHAR_TO_BYTE (lim);
931 } 971 }
932 972
973 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
974 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
975 = current_buffer->case_eqv_table;
976
933 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, 977 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
934 (!NILP (current_buffer->case_fold_search) 978 (!NILP (current_buffer->case_fold_search)
935 ? current_buffer->case_canon_table 979 ? current_buffer->case_canon_table
@@ -3086,8 +3130,10 @@ syms_of_search ()
3086 searchbufs[i].buf.fastmap = searchbufs[i].fastmap; 3130 searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
3087 searchbufs[i].regexp = Qnil; 3131 searchbufs[i].regexp = Qnil;
3088 searchbufs[i].whitespace_regexp = Qnil; 3132 searchbufs[i].whitespace_regexp = Qnil;
3133 searchbufs[i].syntax_table = Qnil;
3089 staticpro (&searchbufs[i].regexp); 3134 staticpro (&searchbufs[i].regexp);
3090 staticpro (&searchbufs[i].whitespace_regexp); 3135 staticpro (&searchbufs[i].whitespace_regexp);
3136 staticpro (&searchbufs[i].syntax_table);
3091 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); 3137 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
3092 } 3138 }
3093 searchbuf_head = &searchbufs[0]; 3139 searchbuf_head = &searchbufs[0];
diff --git a/src/strftime.c b/src/strftime.c
index f46b40f232a..123763d8845 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -7,17 +7,17 @@
7 This file is part of the GNU Emacs. 7 This file is part of the GNU Emacs.
8 8
9 This program is free software; you can redistribute it and/or 9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public License 10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2, or 11 as published by the Free Software Foundation; either version 2, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details. 17 General Public License for more details.
18 18
19 You should have received a copy of the GNU Library General Public 19 You should have received a copy of the GNU General Public
20 License along with the GNU C Library; see the file COPYING.LIB. If not, 20 License along with the GNU C Library; see the file COPYING. If not,
21 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */ 22 Boston, MA 02110-1301, USA. */
23 23
diff --git a/src/syntax.c b/src/syntax.c
index eee9151f878..052191d5fef 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1039,6 +1039,11 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
1039 check_syntax_table (syntax_table); 1039 check_syntax_table (syntax_table);
1040 1040
1041 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Fstring_to_syntax (newentry)); 1041 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Fstring_to_syntax (newentry));
1042
1043 /* We clear the regexp cache, since character classes can now have
1044 different values from those in the compiled regexps.*/
1045 clear_regexp_cache ();
1046
1042 return Qnil; 1047 return Qnil;
1043} 1048}
1044 1049
diff --git a/src/textprop.c b/src/textprop.c
index fd70f039d22..a039c17ae64 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1001,17 +1001,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
1001 && (NILP (limit) || next->position < XFASTINT (limit))) 1001 && (NILP (limit) || next->position < XFASTINT (limit)))
1002 next = next_interval (next); 1002 next = next_interval (next);
1003 1003
1004 if (NULL_INTERVAL_P (next)) 1004 if (NULL_INTERVAL_P (next)
1005 return limit; 1005 || (next->position
1006 if (NILP (limit)) 1006 >= (INTEGERP (limit)
1007 XSETFASTINT (limit, (STRINGP (object) 1007 ? XFASTINT (limit)
1008 ? SCHARS (object) 1008 : (STRINGP (object)
1009 : BUF_ZV (XBUFFER (object)))); 1009 ? SCHARS (object)
1010 if (!(next->position < XFASTINT (limit))) 1010 : BUF_ZV (XBUFFER (object))))))
1011 return limit; 1011 return limit;
1012 1012 else
1013 XSETFASTINT (position, next->position); 1013 return make_number (next->position);
1014 return position;
1015} 1014}
1016 1015
1017/* Return 1 if there's a change in some property between BEG and END. */ 1016/* Return 1 if there's a change in some property between BEG and END. */
@@ -1083,16 +1082,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
1083 && (NILP (limit) || next->position < XFASTINT (limit))) 1082 && (NILP (limit) || next->position < XFASTINT (limit)))
1084 next = next_interval (next); 1083 next = next_interval (next);
1085 1084
1086 if (NULL_INTERVAL_P (next)) 1085 if (NULL_INTERVAL_P (next)
1087 return limit; 1086 || (next->position
1088 if (NILP (limit)) 1087 >= (INTEGERP (limit)
1089 XSETFASTINT (limit, (STRINGP (object) 1088 ? XFASTINT (limit)
1090 ? SCHARS (object) 1089 : (STRINGP (object)
1091 : BUF_ZV (XBUFFER (object)))); 1090 ? SCHARS (object)
1092 if (!(next->position < XFASTINT (limit))) 1091 : BUF_ZV (XBUFFER (object))))))
1093 return limit; 1092 return limit;
1094 1093 else
1095 return make_number (next->position); 1094 return make_number (next->position);
1096} 1095}
1097 1096
1098DEFUN ("previous-property-change", Fprevious_property_change, 1097DEFUN ("previous-property-change", Fprevious_property_change,
@@ -1132,14 +1131,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */)
1132 && (NILP (limit) 1131 && (NILP (limit)
1133 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) 1132 || (previous->position + LENGTH (previous) > XFASTINT (limit))))
1134 previous = previous_interval (previous); 1133 previous = previous_interval (previous);
1135 if (NULL_INTERVAL_P (previous))
1136 return limit;
1137 if (NILP (limit))
1138 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
1139 if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
1140 return limit;
1141 1134
1142 return make_number (previous->position + LENGTH (previous)); 1135 if (NULL_INTERVAL_P (previous)
1136 || (previous->position + LENGTH (previous)
1137 <= (INTEGERP (limit)
1138 ? XFASTINT (limit)
1139 : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
1140 return limit;
1141 else
1142 return make_number (previous->position + LENGTH (previous));
1143} 1143}
1144 1144
1145DEFUN ("previous-single-property-change", Fprevious_single_property_change, 1145DEFUN ("previous-single-property-change", Fprevious_single_property_change,
@@ -1184,14 +1184,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */)
1184 && (NILP (limit) 1184 && (NILP (limit)
1185 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) 1185 || (previous->position + LENGTH (previous) > XFASTINT (limit))))
1186 previous = previous_interval (previous); 1186 previous = previous_interval (previous);
1187 if (NULL_INTERVAL_P (previous))
1188 return limit;
1189 if (NILP (limit))
1190 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))));
1191 if (!(previous->position + LENGTH (previous) > XFASTINT (limit)))
1192 return limit;
1193 1187
1194 return make_number (previous->position + LENGTH (previous)); 1188 if (NULL_INTERVAL_P (previous)
1189 || (previous->position + LENGTH (previous)
1190 <= (INTEGERP (limit)
1191 ? XFASTINT (limit)
1192 : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
1193 return limit;
1194 else
1195 return make_number (previous->position + LENGTH (previous));
1195} 1196}
1196 1197
1197/* Callers note, this can GC when OBJECT is a buffer (or nil). */ 1198/* Callers note, this can GC when OBJECT is a buffer (or nil). */
@@ -1253,7 +1254,7 @@ Return t if any property value actually changed, nil otherwise. */)
1253 } 1254 }
1254 1255
1255 if (BUFFERP (object)) 1256 if (BUFFERP (object))
1256 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1257 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1257 1258
1258 /* We are at the beginning of interval I, with LEN chars to scan. */ 1259 /* We are at the beginning of interval I, with LEN chars to scan. */
1259 for (;;) 1260 for (;;)
@@ -1393,7 +1394,7 @@ set_text_properties (start, end, properties, object, signal_after_change_p)
1393 } 1394 }
1394 1395
1395 if (BUFFERP (object)) 1396 if (BUFFERP (object))
1396 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1397 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1397 1398
1398 set_text_properties_1 (start, end, properties, object, i); 1399 set_text_properties_1 (start, end, properties, object, i);
1399 1400
@@ -1541,7 +1542,7 @@ Use set-text-properties if you want to remove all text properties. */)
1541 } 1542 }
1542 1543
1543 if (BUFFERP (object)) 1544 if (BUFFERP (object))
1544 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1545 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1545 1546
1546 /* We are at the beginning of an interval, with len to scan */ 1547 /* We are at the beginning of an interval, with len to scan */
1547 for (;;) 1548 for (;;)
@@ -1655,7 +1656,7 @@ Return t if any property was actually removed, nil otherwise. */)
1655 if (LENGTH (i) == len) 1656 if (LENGTH (i) == len)
1656 { 1657 {
1657 if (!modified && BUFFERP (object)) 1658 if (!modified && BUFFERP (object))
1658 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1659 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1659 remove_properties (Qnil, properties, i, object); 1660 remove_properties (Qnil, properties, i, object);
1660 if (BUFFERP (object)) 1661 if (BUFFERP (object))
1661 signal_after_change (XINT (start), XINT (end) - XINT (start), 1662 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1668,7 +1669,7 @@ Return t if any property was actually removed, nil otherwise. */)
1668 i = split_interval_left (i, len); 1669 i = split_interval_left (i, len);
1669 copy_properties (unchanged, i); 1670 copy_properties (unchanged, i);
1670 if (!modified && BUFFERP (object)) 1671 if (!modified && BUFFERP (object))
1671 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1672 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1672 remove_properties (Qnil, properties, i, object); 1673 remove_properties (Qnil, properties, i, object);
1673 if (BUFFERP (object)) 1674 if (BUFFERP (object))
1674 signal_after_change (XINT (start), XINT (end) - XINT (start), 1675 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1679,7 +1680,7 @@ Return t if any property was actually removed, nil otherwise. */)
1679 if (interval_has_some_properties_list (properties, i)) 1680 if (interval_has_some_properties_list (properties, i))
1680 { 1681 {
1681 if (!modified && BUFFERP (object)) 1682 if (!modified && BUFFERP (object))
1682 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1683 modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
1683 remove_properties (Qnil, properties, i, object); 1684 remove_properties (Qnil, properties, i, object);
1684 modified = 1; 1685 modified = 1;
1685 } 1686 }
diff --git a/src/w32.c b/src/w32.c
index 0da908ff932..cbc78f8a5d5 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4113,6 +4113,25 @@ init_ntproc ()
4113} 4113}
4114 4114
4115/* 4115/*
4116 shutdown_handler ensures that buffers' autosave files are
4117 up to date when the user logs off, or the system shuts down.
4118*/
4119BOOL WINAPI shutdown_handler(DWORD type)
4120{
4121 /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */
4122 if (type == CTRL_CLOSE_EVENT /* User closes console window. */
4123 || type == CTRL_LOGOFF_EVENT /* User logs off. */
4124 || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */
4125 {
4126 /* Shut down cleanly, making sure autosave files are up to date. */
4127 shut_down_emacs (0, 0, Qnil);
4128 }
4129
4130 /* Allow other handlers to handle this signal. */
4131 return FALSE;
4132}
4133
4134/*
4116 globals_of_w32 is used to initialize those global variables that 4135 globals_of_w32 is used to initialize those global variables that
4117 must always be initialized on startup even when the global variable 4136 must always be initialized on startup even when the global variable
4118 initialized is non zero (see the function main in emacs.c). 4137 initialized is non zero (see the function main in emacs.c).
@@ -4124,6 +4143,11 @@ void globals_of_w32 ()
4124 g_b_init_get_token_information = 0; 4143 g_b_init_get_token_information = 0;
4125 g_b_init_lookup_account_sid = 0; 4144 g_b_init_lookup_account_sid = 0;
4126 g_b_init_get_sid_identifier_authority = 0; 4145 g_b_init_get_sid_identifier_authority = 0;
4146 /* The following sets a handler for shutdown notifications for
4147 console apps. This actually applies to Emacs in both console and
4148 GUI modes, since we had to fool windows into thinking emacs is a
4149 console application to get console mode to work. */
4150 SetConsoleCtrlHandler(shutdown_handler, TRUE);
4127} 4151}
4128 4152
4129/* end of nt.c */ 4153/* end of nt.c */
diff --git a/src/w32fns.c b/src/w32fns.c
index 8c6a60d47bf..f7e211649e0 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2108,7 +2108,12 @@ w32_createwindow (f)
2108 } 2108 }
2109 } 2109 }
2110 2110
2111 if (EQ (left, Qunbound) && EQ (top, Qunbound)) 2111 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)
2112 {
2113 XSETINT (left, f->left_pos);
2114 XSETINT (top, f->top_pos);
2115 }
2116 else if (EQ (left, Qunbound) && EQ (top, Qunbound))
2112 { 2117 {
2113 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero 2118 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
2114 for anything that is not a number and is not Qunbound. */ 2119 for anything that is not a number and is not Qunbound. */
@@ -8609,14 +8614,15 @@ syms_of_w32fns ()
8609 Vw32_color_map = Qnil; 8614 Vw32_color_map = Qnil;
8610 8615
8611 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system, 8616 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system,
8612 doc: /* Non-nil if alt key presses are passed on to Windows. 8617 doc: /* Non-nil if Alt key presses are passed on to Windows.
8613When non-nil, for example, alt pressed and released and then space will 8618When non-nil, for example, Alt pressed and released and then space will
8614open the System menu. When nil, Emacs silently swallows alt key events. */); 8619open the System menu. When nil, Emacs processes the Alt key events, and
8620then silently swallows them. */);
8615 Vw32_pass_alt_to_system = Qnil; 8621 Vw32_pass_alt_to_system = Qnil;
8616 8622
8617 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta, 8623 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta,
8618 doc: /* Non-nil if the alt key is to be considered the same as the meta key. 8624 doc: /* Non-nil if the Alt key is to be considered the same as the META key.
8619When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */); 8625When nil, Emacs will translate the Alt key to the ALT modifier, not to META. */);
8620 Vw32_alt_is_meta = Qt; 8626 Vw32_alt_is_meta = Qt;
8621 8627
8622 DEFVAR_INT ("w32-quit-key", &w32_quit_key, 8628 DEFVAR_INT ("w32-quit-key", &w32_quit_key,
@@ -8625,14 +8631,32 @@ When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. *
8625 8631
8626 DEFVAR_LISP ("w32-pass-lwindow-to-system", 8632 DEFVAR_LISP ("w32-pass-lwindow-to-system",
8627 &Vw32_pass_lwindow_to_system, 8633 &Vw32_pass_lwindow_to_system,
8628 doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. 8634 doc: /* If non-nil, the left \"Windows\" key is passed on to Windows.
8629When non-nil, the Start menu is opened by tapping the key. */); 8635
8636When non-nil, the Start menu is opened by tapping the key.
8637If you set this to nil, the left \"Windows\" key is processed by Emacs
8638according to the value of `w32-lwindow-modifier', which see.
8639
8640Note that some combinations of the left \"Windows\" key with other keys are
8641caught by Windows at low level, and so binding them in Emacs will have no
8642effect. For example, <lwindow>-r always pops up the Windows Run dialog,
8643<lwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see
8644the doc string of `w32-phantom-key-code'. */);
8630 Vw32_pass_lwindow_to_system = Qt; 8645 Vw32_pass_lwindow_to_system = Qt;
8631 8646
8632 DEFVAR_LISP ("w32-pass-rwindow-to-system", 8647 DEFVAR_LISP ("w32-pass-rwindow-to-system",
8633 &Vw32_pass_rwindow_to_system, 8648 &Vw32_pass_rwindow_to_system,
8634 doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. 8649 doc: /* If non-nil, the right \"Windows\" key is passed on to Windows.
8635When non-nil, the Start menu is opened by tapping the key. */); 8650
8651When non-nil, the Start menu is opened by tapping the key.
8652If you set this to nil, the right \"Windows\" key is processed by Emacs
8653according to the value of `w32-rwindow-modifier', which see.
8654
8655Note that some combinations of the right \"Windows\" key with other keys are
8656caught by Windows at low level, and so binding them in Emacs will have no
8657effect. For example, <rwindow>-r always pops up the Windows Run dialog,
8658<rwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see
8659the doc string of `w32-phantom-key-code'. */);
8636 Vw32_pass_rwindow_to_system = Qt; 8660 Vw32_pass_rwindow_to_system = Qt;
8637 8661
8638 DEFVAR_LISP ("w32-phantom-key-code", 8662 DEFVAR_LISP ("w32-phantom-key-code",
@@ -8649,29 +8673,29 @@ acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or
8649 8673
8650 DEFVAR_LISP ("w32-enable-num-lock", 8674 DEFVAR_LISP ("w32-enable-num-lock",
8651 &Vw32_enable_num_lock, 8675 &Vw32_enable_num_lock,
8652 doc: /* Non-nil if Num Lock should act normally. 8676 doc: /* If non-nil, the Num Lock key acts normally.
8653Set to nil to see Num Lock as the key `kp-numlock'. */); 8677Set to nil to handle Num Lock as the `kp-numlock' key. */);
8654 Vw32_enable_num_lock = Qt; 8678 Vw32_enable_num_lock = Qt;
8655 8679
8656 DEFVAR_LISP ("w32-enable-caps-lock", 8680 DEFVAR_LISP ("w32-enable-caps-lock",
8657 &Vw32_enable_caps_lock, 8681 &Vw32_enable_caps_lock,
8658 doc: /* Non-nil if Caps Lock should act normally. 8682 doc: /* If non-nil, the Caps Lock key acts normally.
8659Set to nil to see Caps Lock as the key `capslock'. */); 8683Set to nil to handle Caps Lock as the `capslock' key. */);
8660 Vw32_enable_caps_lock = Qt; 8684 Vw32_enable_caps_lock = Qt;
8661 8685
8662 DEFVAR_LISP ("w32-scroll-lock-modifier", 8686 DEFVAR_LISP ("w32-scroll-lock-modifier",
8663 &Vw32_scroll_lock_modifier, 8687 &Vw32_scroll_lock_modifier,
8664 doc: /* Modifier to use for the Scroll Lock on state. 8688 doc: /* Modifier to use for the Scroll Lock ON state.
8665The value can be hyper, super, meta, alt, control or shift for the 8689The value can be hyper, super, meta, alt, control or shift for the
8666respective modifier, or nil to see Scroll Lock as the key `scroll'. 8690respective modifier, or nil to handle Scroll Lock as the `scroll' key.
8667Any other value will cause the key to be ignored. */); 8691Any other value will cause the Scroll Lock key to be ignored. */);
8668 Vw32_scroll_lock_modifier = Qt; 8692 Vw32_scroll_lock_modifier = Qt;
8669 8693
8670 DEFVAR_LISP ("w32-lwindow-modifier", 8694 DEFVAR_LISP ("w32-lwindow-modifier",
8671 &Vw32_lwindow_modifier, 8695 &Vw32_lwindow_modifier,
8672 doc: /* Modifier to use for the left \"Windows\" key. 8696 doc: /* Modifier to use for the left \"Windows\" key.
8673The value can be hyper, super, meta, alt, control or shift for the 8697The value can be hyper, super, meta, alt, control or shift for the
8674respective modifier, or nil to appear as the key `lwindow'. 8698respective modifier, or nil to appear as the `lwindow' key.
8675Any other value will cause the key to be ignored. */); 8699Any other value will cause the key to be ignored. */);
8676 Vw32_lwindow_modifier = Qnil; 8700 Vw32_lwindow_modifier = Qnil;
8677 8701
@@ -8679,7 +8703,7 @@ Any other value will cause the key to be ignored. */);
8679 &Vw32_rwindow_modifier, 8703 &Vw32_rwindow_modifier,
8680 doc: /* Modifier to use for the right \"Windows\" key. 8704 doc: /* Modifier to use for the right \"Windows\" key.
8681The value can be hyper, super, meta, alt, control or shift for the 8705The value can be hyper, super, meta, alt, control or shift for the
8682respective modifier, or nil to appear as the key `rwindow'. 8706respective modifier, or nil to appear as the `rwindow' key.
8683Any other value will cause the key to be ignored. */); 8707Any other value will cause the key to be ignored. */);
8684 Vw32_rwindow_modifier = Qnil; 8708 Vw32_rwindow_modifier = Qnil;
8685 8709
@@ -8687,7 +8711,7 @@ Any other value will cause the key to be ignored. */);
8687 &Vw32_apps_modifier, 8711 &Vw32_apps_modifier,
8688 doc: /* Modifier to use for the \"Apps\" key. 8712 doc: /* Modifier to use for the \"Apps\" key.
8689The value can be hyper, super, meta, alt, control or shift for the 8713The value can be hyper, super, meta, alt, control or shift for the
8690respective modifier, or nil to appear as the key `apps'. 8714respective modifier, or nil to appear as the `apps' key.
8691Any other value will cause the key to be ignored. */); 8715Any other value will cause the key to be ignored. */);
8692 Vw32_apps_modifier = Qnil; 8716 Vw32_apps_modifier = Qnil;
8693 8717
@@ -8703,7 +8727,7 @@ Any other value will cause the key to be ignored. */);
8703 &w32_mouse_button_tolerance, 8727 &w32_mouse_button_tolerance,
8704 doc: /* Analogue of double click interval for faking middle mouse events. 8728 doc: /* Analogue of double click interval for faking middle mouse events.
8705The value is the minimum time in milliseconds that must elapse between 8729The value is the minimum time in milliseconds that must elapse between
8706left/right button down events before they are considered distinct events. 8730left and right button down events before they are considered distinct events.
8707If both mouse buttons are depressed within this interval, a middle mouse 8731If both mouse buttons are depressed within this interval, a middle mouse
8708button down event is generated instead. */); 8732button down event is generated instead. */);
8709 w32_mouse_button_tolerance = GetDoubleClickTime () / 2; 8733 w32_mouse_button_tolerance = GetDoubleClickTime () / 2;
@@ -8718,7 +8742,7 @@ reported as lisp events. */);
8718 8742
8719 DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system", 8743 DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system",
8720 &w32_pass_extra_mouse_buttons_to_system, 8744 &w32_pass_extra_mouse_buttons_to_system,
8721 doc: /* Non-nil if the fourth and fifth mouse buttons are passed to Windows. 8745 doc: /* If non-nil, the fourth and fifth mouse buttons are passed to Windows.
8722Recent versions of Windows support mice with up to five buttons. 8746Recent versions of Windows support mice with up to five buttons.
8723Since most applications don't support these extra buttons, most mouse 8747Since most applications don't support these extra buttons, most mouse
8724drivers will allow you to map them to functions at the system level. 8748drivers will allow you to map them to functions at the system level.
diff --git a/src/w32menu.c b/src/w32menu.c
index 11af1d66b6f..3a4dc20fc15 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -149,10 +149,10 @@ GetMenuItemInfoA_Proc get_menu_item_info = NULL;
149SetMenuItemInfoA_Proc set_menu_item_info = NULL; 149SetMenuItemInfoA_Proc set_menu_item_info = NULL;
150AppendMenuW_Proc unicode_append_menu = NULL; 150AppendMenuW_Proc unicode_append_menu = NULL;
151 151
152Lisp_Object Vmenu_updating_frame;
153
154Lisp_Object Qdebug_on_next_call; 152Lisp_Object Qdebug_on_next_call;
155 153
154extern Lisp_Object Vmenu_updating_frame;
155
156extern Lisp_Object Qmenu_bar; 156extern Lisp_Object Qmenu_bar;
157 157
158extern Lisp_Object QCtoggle, QCradio; 158extern Lisp_Object QCtoggle, QCradio;
@@ -2548,11 +2548,6 @@ void syms_of_w32menu ()
2548 Qdebug_on_next_call = intern ("debug-on-next-call"); 2548 Qdebug_on_next_call = intern ("debug-on-next-call");
2549 staticpro (&Qdebug_on_next_call); 2549 staticpro (&Qdebug_on_next_call);
2550 2550
2551 DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame,
2552 doc: /* Frame for which we are updating a menu.
2553The enable predicate for a menu command should check this variable. */);
2554 Vmenu_updating_frame = Qnil;
2555
2556 defsubr (&Sx_popup_menu); 2551 defsubr (&Sx_popup_menu);
2557#ifdef HAVE_MENUS 2552#ifdef HAVE_MENUS
2558 defsubr (&Sx_popup_dialog); 2553 defsubr (&Sx_popup_dialog);
diff --git a/src/w32proc.c b/src/w32proc.c
index d874d183b17..29491931015 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -49,6 +49,11 @@ Boston, MA 02110-1301, USA.
49extern BOOL WINAPI IsValidLocale(LCID, DWORD); 49extern BOOL WINAPI IsValidLocale(LCID, DWORD);
50#endif 50#endif
51 51
52#ifdef HAVE_LANGINFO_CODESET
53#include <nl_types.h>
54#include <langinfo.h>
55#endif
56
52#include "lisp.h" 57#include "lisp.h"
53#include "w32.h" 58#include "w32.h"
54#include "w32heap.h" 59#include "w32heap.h"
@@ -1817,6 +1822,69 @@ If successful, the return value is t, otherwise nil. */)
1817 return result; 1822 return result;
1818} 1823}
1819 1824
1825#ifdef HAVE_LANGINFO_CODESET
1826/* Emulation of nl_langinfo. Used in fns.c:Flocale_info. */
1827char *nl_langinfo (nl_item item)
1828{
1829 /* Conversion of Posix item numbers to their Windows equivalents. */
1830 static const LCTYPE w32item[] = {
1831 LOCALE_IDEFAULTANSICODEPAGE,
1832 LOCALE_SDAYNAME1, LOCALE_SDAYNAME2, LOCALE_SDAYNAME3,
1833 LOCALE_SDAYNAME4, LOCALE_SDAYNAME5, LOCALE_SDAYNAME6, LOCALE_SDAYNAME7,
1834 LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3,
1835 LOCALE_SMONTHNAME4, LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6,
1836 LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9,
1837 LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12
1838 };
1839
1840 static char *nl_langinfo_buf = NULL;
1841 static int nl_langinfo_len = 0;
1842
1843 if (nl_langinfo_len <= 0)
1844 nl_langinfo_buf = xmalloc (nl_langinfo_len = 1);
1845
1846 if (item < 0 || item >= _NL_NUM)
1847 nl_langinfo_buf[0] = 0;
1848 else
1849 {
1850 LCID cloc = GetThreadLocale ();
1851 int need_len = GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP,
1852 NULL, 0);
1853
1854 if (need_len <= 0)
1855 nl_langinfo_buf[0] = 0;
1856 else
1857 {
1858 if (item == CODESET)
1859 {
1860 need_len += 2; /* for the "cp" prefix */
1861 if (need_len < 8) /* for the case we call GetACP */
1862 need_len = 8;
1863 }
1864 if (nl_langinfo_len <= need_len)
1865 nl_langinfo_buf = xrealloc (nl_langinfo_buf,
1866 nl_langinfo_len = need_len);
1867 if (!GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP,
1868 nl_langinfo_buf, nl_langinfo_len))
1869 nl_langinfo_buf[0] = 0;
1870 else if (item == CODESET)
1871 {
1872 if (strcmp (nl_langinfo_buf, "0") == 0 /* CP_ACP */
1873 || strcmp (nl_langinfo_buf, "1") == 0) /* CP_OEMCP */
1874 sprintf (nl_langinfo_buf, "cp%u", GetACP ());
1875 else
1876 {
1877 memmove (nl_langinfo_buf + 2, nl_langinfo_buf,
1878 strlen (nl_langinfo_buf) + 1);
1879 nl_langinfo_buf[0] = 'c';
1880 nl_langinfo_buf[1] = 'p';
1881 }
1882 }
1883 }
1884 }
1885 return nl_langinfo_buf;
1886}
1887#endif /* HAVE_LANGINFO_CODESET */
1820 1888
1821DEFUN ("w32-get-locale-info", Fw32_get_locale_info, 1889DEFUN ("w32-get-locale-info", Fw32_get_locale_info,
1822 Sw32_get_locale_info, 1, 2, 0, 1890 Sw32_get_locale_info, 1, 2, 0,
diff --git a/src/w32term.c b/src/w32term.c
index 2870955b94f..9a6142925fd 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4298,7 +4298,7 @@ w32_read_socket (sd, expected, hold_quit)
4298 if (f) 4298 if (f)
4299 { 4299 {
4300 /* Generate SELECT_WINDOW_EVENTs when needed. */ 4300 /* Generate SELECT_WINDOW_EVENTs when needed. */
4301 if (mouse_autoselect_window) 4301 if (!NILP (Vmouse_autoselect_window))
4302 { 4302 {
4303 Lisp_Object window; 4303 Lisp_Object window;
4304 int x = LOWORD (msg.msg.lParam); 4304 int x = LOWORD (msg.msg.lParam);
diff --git a/src/window.c b/src/window.c
index a3e7b93e878..0233c6bf79e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -335,13 +335,16 @@ Return nil if that position is scrolled vertically out of view.
335If a character is only partially visible, nil is returned, unless the 335If a character is only partially visible, nil is returned, unless the
336optional argument PARTIALLY is non-nil. 336optional argument PARTIALLY is non-nil.
337If POS is only out of view because of horizontal scrolling, return non-nil. 337If POS is only out of view because of horizontal scrolling, return non-nil.
338If POS is t, it specifies the position of the last visible glyph in WINDOW.
338POS defaults to point in WINDOW; WINDOW defaults to the selected window. 339POS defaults to point in WINDOW; WINDOW defaults to the selected window.
339 340
340If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 341If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
341return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates 342return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
342relative to the top left corner of the window. PARTIAL is nil if the character 343where X and Y are the pixel coordinates relative to the top left corner
343after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP 344of the window. The remaining elements are omitted if the character after
344and RBOT are the number of pixels invisible at the top and bottom of the row. */) 345POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
346off-window at the top and bottom of the row, ROWH is the height of the
347display row, and VPOS is the row number (0-based) containing POS. */)
345 (pos, window, partially) 348 (pos, window, partially)
346 Lisp_Object pos, window, partially; 349 Lisp_Object pos, window, partially;
347{ 350{
@@ -350,14 +353,16 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. *
350 register struct buffer *buf; 353 register struct buffer *buf;
351 struct text_pos top; 354 struct text_pos top;
352 Lisp_Object in_window = Qnil; 355 Lisp_Object in_window = Qnil;
353 int rtop, rbot, fully_p = 1; 356 int rtop, rbot, rowh, vpos, fully_p = 1;
354 int x, y; 357 int x, y;
355 358
356 w = decode_window (window); 359 w = decode_window (window);
357 buf = XBUFFER (w->buffer); 360 buf = XBUFFER (w->buffer);
358 SET_TEXT_POS_FROM_MARKER (top, w->start); 361 SET_TEXT_POS_FROM_MARKER (top, w->start);
359 362
360 if (!NILP (pos)) 363 if (EQ (pos, Qt))
364 posint = -1;
365 else if (!NILP (pos))
361 { 366 {
362 CHECK_NUMBER_COERCE_MARKER (pos); 367 CHECK_NUMBER_COERCE_MARKER (pos);
363 posint = XINT (pos); 368 posint = XINT (pos);
@@ -369,24 +374,138 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. *
369 374
370 /* If position is above window start or outside buffer boundaries, 375 /* If position is above window start or outside buffer boundaries,
371 or if window start is out of range, position is not visible. */ 376 or if window start is out of range, position is not visible. */
372 if (posint >= CHARPOS (top) 377 if ((EQ (pos, Qt)
373 && posint <= BUF_ZV (buf) 378 || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf)))
374 && CHARPOS (top) >= BUF_BEGV (buf) 379 && CHARPOS (top) >= BUF_BEGV (buf)
375 && CHARPOS (top) <= BUF_ZV (buf) 380 && CHARPOS (top) <= BUF_ZV (buf)
376 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially)) 381 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos)
377 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) 382 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
378 in_window = Qt; 383 in_window = Qt;
379 384
380 if (!NILP (in_window) && !NILP (partially)) 385 if (!NILP (in_window) && !NILP (partially))
381 in_window = Fcons (make_number (x), 386 {
382 Fcons (make_number (y), 387 Lisp_Object part = Qnil;
383 Fcons ((fully_p ? Qnil 388 if (!fully_p)
384 : Fcons (make_number (rtop), 389 part = list4 (make_number (rtop), make_number (rbot),
385 make_number (rbot))), 390 make_number (rowh), make_number (vpos));
386 Qnil))); 391 in_window = Fcons (make_number (x),
392 Fcons (make_number (y), part));
393 }
394
387 return in_window; 395 return in_window;
388} 396}
389 397
398DEFUN ("window-line-height", Fwindow_line_height,
399 Swindow_line_height, 0, 2, 0,
400 doc: /* Return height in pixels of text line LINE in window WINDOW.
401If WINDOW is nil or omitted, use selected window.
402
403Return height of current line if LINE is omitted or nil. Return height of
404header or mode line if LINE is `header-line' and `mode-line'.
405Otherwise, LINE is a text line number starting from 0. A negative number
406counts from the end of the window.
407
408Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height
409in pixels of the visible part of the line, VPOS and YPOS are the
410vertical position in lines and pixels of the line, relative to the top
411of the first text line, and OFFBOT is the number of off-window pixels at
412the bottom of the text line. If there are off-window pixels at the top
413of the (first) text line, YPOS is negative.
414
415Return nil if window display is not up-to-date. In that case, use
416`pos-visible-in-window-p' to obtain the information. */)
417 (line, window)
418 Lisp_Object line, window;
419{
420 register struct window *w;
421 register struct buffer *b;
422 struct glyph_row *row, *end_row;
423 int max_y, crop, i, n;
424
425 w = decode_window (window);
426
427 if (noninteractive
428 || w->pseudo_window_p)
429 return Qnil;
430
431 CHECK_BUFFER (w->buffer);
432 b = XBUFFER (w->buffer);
433
434 /* Fail if current matrix is not up-to-date. */
435 if (NILP (w->window_end_valid)
436 || current_buffer->clip_changed
437 || current_buffer->prevent_redisplay_optimizations_p
438 || XFASTINT (w->last_modified) < BUF_MODIFF (b)
439 || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
440 return Qnil;
441
442 if (NILP (line))
443 {
444 i = w->cursor.vpos;
445 if (i < 0 || i >= w->current_matrix->nrows
446 || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p))
447 return Qnil;
448 max_y = window_text_bottom_y (w);
449 goto found_row;
450 }
451
452 if (EQ (line, Qheader_line))
453 {
454 if (!WINDOW_WANTS_HEADER_LINE_P (w))
455 return Qnil;
456 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
457 if (!row->enabled_p)
458 return Qnil;
459 return list4 (make_number (row->height),
460 make_number (0), make_number (0),
461 make_number (0));
462 }
463
464 if (EQ (line, Qmode_line))
465 {
466 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
467 if (!row->enabled_p)
468 return Qnil;
469 return list4 (make_number (row->height),
470 make_number (0), /* not accurate */
471 make_number (WINDOW_HEADER_LINE_HEIGHT (w)
472 + window_text_bottom_y (w)),
473 make_number (0));
474 }
475
476 CHECK_NUMBER (line);
477 n = XINT (line);
478
479 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
480 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
481 max_y = window_text_bottom_y (w);
482 i = 0;
483
484 while ((n < 0 || i < n)
485 && row <= end_row && row->enabled_p
486 && row->y + row->height < max_y)
487 row++, i++;
488
489 if (row > end_row || !row->enabled_p)
490 return Qnil;
491
492 if (++n < 0)
493 {
494 if (-n > i)
495 return Qnil;
496 row += n;
497 i += n;
498 }
499
500 found_row:
501 crop = max (0, (row->y + row->height) - max_y);
502 return list4 (make_number (row->height + min (0, row->y) - crop),
503 make_number (i),
504 make_number (row->y),
505 make_number (crop));
506}
507
508
390 509
391static struct window * 510static struct window *
392decode_window (window) 511decode_window (window)
@@ -451,7 +570,7 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
451Return NCOL. NCOL should be zero or positive. 570Return NCOL. NCOL should be zero or positive.
452 571
453Note that if `automatic-hscrolling' is non-nil, you cannot scroll the 572Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
454window so that the location of point becomes invisible. */) 573window so that the location of point moves off-window. */)
455 (window, ncol) 574 (window, ncol)
456 Lisp_Object window, ncol; 575 Lisp_Object window, ncol;
457{ 576{
@@ -1048,9 +1167,11 @@ if it isn't already recorded. */)
1048 Lisp_Object value; 1167 Lisp_Object value;
1049 struct window *w = decode_window (window); 1168 struct window *w = decode_window (window);
1050 Lisp_Object buf; 1169 Lisp_Object buf;
1170 struct buffer *b;
1051 1171
1052 buf = w->buffer; 1172 buf = w->buffer;
1053 CHECK_BUFFER (buf); 1173 CHECK_BUFFER (buf);
1174 b = XBUFFER (buf);
1054 1175
1055#if 0 /* This change broke some things. We should make it later. */ 1176#if 0 /* This change broke some things. We should make it later. */
1056 /* If we don't know the end position, return nil. 1177 /* If we don't know the end position, return nil.
@@ -1063,12 +1184,20 @@ if it isn't already recorded. */)
1063 1184
1064 if (! NILP (update) 1185 if (! NILP (update)
1065 && ! (! NILP (w->window_end_valid) 1186 && ! (! NILP (w->window_end_valid)
1066 && XFASTINT (w->last_modified) >= MODIFF) 1187 && XFASTINT (w->last_modified) >= BUF_MODIFF (b))
1067 && !noninteractive) 1188 && !noninteractive)
1068 { 1189 {
1069 struct text_pos startp; 1190 struct text_pos startp;
1070 struct it it; 1191 struct it it;
1071 struct buffer *old_buffer = NULL, *b = XBUFFER (buf); 1192 struct buffer *old_buffer = NULL;
1193
1194 /* Cannot use Fvertical_motion because that function doesn't
1195 cope with variable-height lines. */
1196 if (b != current_buffer)
1197 {
1198 old_buffer = current_buffer;
1199 set_buffer_internal (b);
1200 }
1072 1201
1073 /* In case W->start is out of the range, use something 1202 /* In case W->start is out of the range, use something
1074 reasonable. This situation occurred when loading a file with 1203 reasonable. This situation occurred when loading a file with
@@ -1082,14 +1211,6 @@ if it isn't already recorded. */)
1082 else 1211 else
1083 SET_TEXT_POS_FROM_MARKER (startp, w->start); 1212 SET_TEXT_POS_FROM_MARKER (startp, w->start);
1084 1213
1085 /* Cannot use Fvertical_motion because that function doesn't
1086 cope with variable-height lines. */
1087 if (b != current_buffer)
1088 {
1089 old_buffer = current_buffer;
1090 set_buffer_internal (b);
1091 }
1092
1093 start_display (&it, w, startp); 1214 start_display (&it, w, startp);
1094 move_it_vertically (&it, window_box_height (w)); 1215 move_it_vertically (&it, window_box_height (w));
1095 if (it.current_y < it.last_visible_y) 1216 if (it.current_y < it.last_visible_y)
@@ -1100,7 +1221,7 @@ if it isn't already recorded. */)
1100 set_buffer_internal (old_buffer); 1221 set_buffer_internal (old_buffer);
1101 } 1222 }
1102 else 1223 else
1103 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); 1224 XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos));
1104 1225
1105 return value; 1226 return value;
1106} 1227}
@@ -4820,10 +4941,10 @@ window_scroll_pixel_based (window, n, whole, noerror)
4820 struct it it; 4941 struct it it;
4821 struct window *w = XWINDOW (window); 4942 struct window *w = XWINDOW (window);
4822 struct text_pos start; 4943 struct text_pos start;
4823 Lisp_Object tem;
4824 int this_scroll_margin; 4944 int this_scroll_margin;
4825 /* True if we fiddled the window vscroll field without really scrolling. */ 4945 /* True if we fiddled the window vscroll field without really scrolling. */
4826 int vscrolled = 0; 4946 int vscrolled = 0;
4947 int x, y, rtop, rbot, rowh, vpos;
4827 4948
4828 SET_TEXT_POS_FROM_MARKER (start, w->start); 4949 SET_TEXT_POS_FROM_MARKER (start, w->start);
4829 4950
@@ -4831,8 +4952,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4831 the screen. Allow PT to be partially visible, otherwise 4952 the screen. Allow PT to be partially visible, otherwise
4832 something like (scroll-down 1) with PT in the line before 4953 something like (scroll-down 1) with PT in the line before
4833 the partially visible one would recenter. */ 4954 the partially visible one would recenter. */
4834 tem = Fpos_visible_in_window_p (make_number (PT), window, Qt); 4955
4835 if (NILP (tem)) 4956 if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos))
4836 { 4957 {
4837 /* Move backward half the height of the window. Performance note: 4958 /* Move backward half the height of the window. Performance note:
4838 vmotion used here is about 10% faster, but would give wrong 4959 vmotion used here is about 10% faster, but would give wrong
@@ -4857,7 +4978,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4857 } 4978 }
4858 else if (auto_window_vscroll_p) 4979 else if (auto_window_vscroll_p)
4859 { 4980 {
4860 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) 4981 if (rtop || rbot) /* partially visible */
4861 { 4982 {
4862 int px; 4983 int px;
4863 int dy = WINDOW_FRAME_LINE_HEIGHT (w); 4984 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
@@ -4867,19 +4988,52 @@ window_scroll_pixel_based (window, n, whole, noerror)
4867 dy); 4988 dy);
4868 dy *= n; 4989 dy *= n;
4869 4990
4870 if (n < 0 && (px = XINT (XCAR (tem))) > 0) 4991 if (n < 0)
4871 { 4992 {
4872 px = max (0, -w->vscroll - min (px, -dy)); 4993 /* Only vscroll backwards if already vscrolled forwards. */
4873 Fset_window_vscroll (window, make_number (px), Qt); 4994 if (w->vscroll < 0 && rtop > 0)
4874 return; 4995 {
4996 px = max (0, -w->vscroll - min (rtop, -dy));
4997 Fset_window_vscroll (window, make_number (px), Qt);
4998 return;
4999 }
4875 } 5000 }
4876 if (n > 0 && (px = XINT (XCDR (tem))) > 0) 5001 if (n > 0)
4877 { 5002 {
4878 px = max (0, -w->vscroll + min (px, dy)); 5003 /* Do vscroll if already vscrolled or only display line. */
4879 Fset_window_vscroll (window, make_number (px), Qt); 5004 if (rbot > 0 && (w->vscroll < 0 || vpos == 0))
4880 return; 5005 {
5006 px = max (0, -w->vscroll + min (rbot, dy));
5007 Fset_window_vscroll (window, make_number (px), Qt);
5008 return;
5009 }
5010
5011 /* Maybe modify window start instead of scrolling. */
5012 if (rbot > 0 || w->vscroll < 0)
5013 {
5014 int spos;
5015
5016 Fset_window_vscroll (window, make_number (0), Qt);
5017 /* If there are other text lines above the current row,
5018 move window start to current row. Else to next row. */
5019 if (rbot > 0)
5020 spos = XINT (Fline_beginning_position (Qnil));
5021 else
5022 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
5023 set_marker_restricted (w->start, make_number (spos),
5024 w->buffer);
5025 w->start_at_line_beg = Qt;
5026 w->update_mode_line = Qt;
5027 XSETFASTINT (w->last_modified, 0);
5028 XSETFASTINT (w->last_overlay_modified, 0);
5029 /* Set force_start so that redisplay_window will run the
5030 window-scroll-functions. */
5031 w->force_start = Qt;
5032 return;
5033 }
4881 } 5034 }
4882 } 5035 }
5036 /* Cancel previous vscroll. */
4883 Fset_window_vscroll (window, make_number (0), Qt); 5037 Fset_window_vscroll (window, make_number (0), Qt);
4884 } 5038 }
4885 5039
@@ -4920,7 +5074,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4920 if (dy <= 0) 5074 if (dy <= 0)
4921 { 5075 {
4922 move_it_vertically_backward (&it, -dy); 5076 move_it_vertically_backward (&it, -dy);
4923 /* Ensure we actually does move, e.g. in case we are currently 5077 /* Ensure we actually do move, e.g. in case we are currently
4924 looking at an image that is taller that the window height. */ 5078 looking at an image that is taller that the window height. */
4925 while (start_pos == IT_CHARPOS (it) 5079 while (start_pos == IT_CHARPOS (it)
4926 && start_pos > BEGV) 5080 && start_pos > BEGV)
@@ -4930,7 +5084,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4930 { 5084 {
4931 move_it_to (&it, ZV, -1, it.current_y + dy, -1, 5085 move_it_to (&it, ZV, -1, it.current_y + dy, -1,
4932 MOVE_TO_POS | MOVE_TO_Y); 5086 MOVE_TO_POS | MOVE_TO_Y);
4933 /* Ensure we actually does move, e.g. in case we are currently 5087 /* Ensure we actually do move, e.g. in case we are currently
4934 looking at an image that is taller that the window height. */ 5088 looking at an image that is taller that the window height. */
4935 while (start_pos == IT_CHARPOS (it) 5089 while (start_pos == IT_CHARPOS (it)
4936 && start_pos < ZV) 5090 && start_pos < ZV)
@@ -6658,7 +6812,7 @@ display marginal areas and the text area. */)
6658 CHECK_NATNUM (left_width); 6812 CHECK_NATNUM (left_width);
6659 if (!NILP (right_width)) 6813 if (!NILP (right_width))
6660 CHECK_NATNUM (right_width); 6814 CHECK_NATNUM (right_width);
6661 6815
6662 /* Do nothing on a tty. */ 6816 /* Do nothing on a tty. */
6663 if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) 6817 if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
6664 && (!EQ (w->left_fringe_width, left_width) 6818 && (!EQ (w->left_fringe_width, left_width)
@@ -7292,16 +7446,18 @@ See also `same-window-buffer-names'. */);
7292 next_screen_context_lines = 2; 7446 next_screen_context_lines = 2;
7293 7447
7294 DEFVAR_INT ("split-height-threshold", &split_height_threshold, 7448 DEFVAR_INT ("split-height-threshold", &split_height_threshold,
7295 doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'. 7449 doc: /* *A window must be at least this tall to be eligible for splitting
7450by `display-buffer'. The value is in line units.
7296If there is only one window, it is split regardless of this value. */); 7451If there is only one window, it is split regardless of this value. */);
7297 split_height_threshold = 500; 7452 split_height_threshold = 500;
7298 7453
7299 DEFVAR_INT ("window-min-height", &window_min_height, 7454 DEFVAR_INT ("window-min-height", &window_min_height,
7300 doc: /* *Delete any window less than this tall (including its mode line). */); 7455 doc: /* *Delete any window less than this tall (including its mode line).
7456The value is in line units. */);
7301 window_min_height = 4; 7457 window_min_height = 4;
7302 7458
7303 DEFVAR_INT ("window-min-width", &window_min_width, 7459 DEFVAR_INT ("window-min-width", &window_min_width,
7304 doc: /* *Delete any window less than this wide. */); 7460 doc: /* *Delete any window less than this wide (measured in characters). */);
7305 window_min_width = 10; 7461 window_min_width = 10;
7306 7462
7307 DEFVAR_LISP ("scroll-preserve-screen-position", 7463 DEFVAR_LISP ("scroll-preserve-screen-position",
@@ -7327,6 +7483,7 @@ The selected frame is the one whose configuration has changed. */);
7327 defsubr (&Swindowp); 7483 defsubr (&Swindowp);
7328 defsubr (&Swindow_live_p); 7484 defsubr (&Swindow_live_p);
7329 defsubr (&Spos_visible_in_window_p); 7485 defsubr (&Spos_visible_in_window_p);
7486 defsubr (&Swindow_line_height);
7330 defsubr (&Swindow_buffer); 7487 defsubr (&Swindow_buffer);
7331 defsubr (&Swindow_height); 7488 defsubr (&Swindow_height);
7332 defsubr (&Swindow_width); 7489 defsubr (&Swindow_width);
diff --git a/src/xdisp.c b/src/xdisp.c
index 7e65b91fd13..fe22c55dc35 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -256,9 +256,9 @@ Lisp_Object list_of_error;
256Lisp_Object Vfontification_functions; 256Lisp_Object Vfontification_functions;
257Lisp_Object Qfontification_functions; 257Lisp_Object Qfontification_functions;
258 258
259/* Non-zero means automatically select any window when the mouse 259/* Non-nil means automatically select any window when the mouse
260 cursor moves into it. */ 260 cursor moves into it. */
261int mouse_autoselect_window; 261Lisp_Object Vmouse_autoselect_window;
262 262
263/* Non-zero means draw tool bar buttons raised when the mouse moves 263/* Non-zero means draw tool bar buttons raised when the mouse moves
264 over them. */ 264 over them. */
@@ -606,6 +606,11 @@ int message_buf_print;
606Lisp_Object Qinhibit_menubar_update; 606Lisp_Object Qinhibit_menubar_update;
607int inhibit_menubar_update; 607int inhibit_menubar_update;
608 608
609/* When evaluating expressions from menu bar items (enable conditions,
610 for instance), this is the frame they are being processed for. */
611
612Lisp_Object Vmenu_updating_frame;
613
609/* Maximum height for resizing mini-windows. Either a float 614/* Maximum height for resizing mini-windows. Either a float
610 specifying a fraction of the available height, or an integer 615 specifying a fraction of the available height, or an integer
611 specifying a number of lines. */ 616 specifying a number of lines. */
@@ -1257,15 +1262,15 @@ line_bottom_y (it)
1257 1262
1258 1263
1259/* Return 1 if position CHARPOS is visible in window W. 1264/* Return 1 if position CHARPOS is visible in window W.
1265 CHARPOS < 0 means return info about WINDOW_END position.
1260 If visible, set *X and *Y to pixel coordinates of top left corner. 1266 If visible, set *X and *Y to pixel coordinates of top left corner.
1261 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. 1267 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
1262 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line 1268 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */
1263 and header-lines heights. */
1264 1269
1265int 1270int
1266pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) 1271pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
1267 struct window *w; 1272 struct window *w;
1268 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; 1273 int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos;
1269{ 1274{
1270 struct it it; 1275 struct it it;
1271 struct text_pos top; 1276 struct text_pos top;
@@ -1283,26 +1288,23 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1283 1288
1284 SET_TEXT_POS_FROM_MARKER (top, w->start); 1289 SET_TEXT_POS_FROM_MARKER (top, w->start);
1285 1290
1286 /* Compute exact mode line heights, if requested. */ 1291 /* Compute exact mode line heights. */
1287 if (exact_mode_line_heights_p) 1292 if (WINDOW_WANTS_MODELINE_P (w))
1288 { 1293 current_mode_line_height
1289 if (WINDOW_WANTS_MODELINE_P (w)) 1294 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1290 current_mode_line_height 1295 current_buffer->mode_line_format);
1291 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1292 current_buffer->mode_line_format);
1293 1296
1294 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1297 if (WINDOW_WANTS_HEADER_LINE_P (w))
1295 current_header_line_height 1298 current_header_line_height
1296 = display_mode_line (w, HEADER_LINE_FACE_ID, 1299 = display_mode_line (w, HEADER_LINE_FACE_ID,
1297 current_buffer->header_line_format); 1300 current_buffer->header_line_format);
1298 }
1299 1301
1300 start_display (&it, w, top); 1302 start_display (&it, w, top);
1301 move_it_to (&it, charpos, -1, it.last_visible_y, -1, 1303 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
1302 MOVE_TO_POS | MOVE_TO_Y); 1304 (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y);
1303 1305
1304 /* Note that we may overshoot because of invisible text. */ 1306 /* Note that we may overshoot because of invisible text. */
1305 if (IT_CHARPOS (it) >= charpos) 1307 if (charpos >= 0 && IT_CHARPOS (it) >= charpos)
1306 { 1308 {
1307 int top_x = it.current_x; 1309 int top_x = it.current_x;
1308 int top_y = it.current_y; 1310 int top_y = it.current_y;
@@ -1319,6 +1321,9 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1319 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); 1321 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
1320 *rtop = max (0, window_top_y - top_y); 1322 *rtop = max (0, window_top_y - top_y);
1321 *rbot = max (0, bottom_y - it.last_visible_y); 1323 *rbot = max (0, bottom_y - it.last_visible_y);
1324 *rowh = max (0, (min (bottom_y, it.last_visible_y)
1325 - max (top_y, window_top_y)));
1326 *vpos = it.vpos;
1322 } 1327 }
1323 } 1328 }
1324 else 1329 else
@@ -1328,7 +1333,8 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1328 it2 = it; 1333 it2 = it;
1329 if (IT_CHARPOS (it) < ZV && FETCH_BYTE (IT_BYTEPOS (it)) != '\n') 1334 if (IT_CHARPOS (it) < ZV && FETCH_BYTE (IT_BYTEPOS (it)) != '\n')
1330 move_it_by_lines (&it, 1, 0); 1335 move_it_by_lines (&it, 1, 0);
1331 if (charpos < IT_CHARPOS (it)) 1336 if (charpos < IT_CHARPOS (it)
1337 || (it.what == IT_EOB && charpos == IT_CHARPOS (it)))
1332 { 1338 {
1333 visible_p = 1; 1339 visible_p = 1;
1334 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); 1340 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
@@ -1337,6 +1343,11 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1337 *rtop = max (0, -it2.current_y); 1343 *rtop = max (0, -it2.current_y);
1338 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) 1344 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
1339 - it.last_visible_y)); 1345 - it.last_visible_y));
1346 *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent,
1347 it.last_visible_y)
1348 - max (it2.current_y,
1349 WINDOW_HEADER_LINE_HEIGHT (w))));
1350 *vpos = it2.vpos;
1340 } 1351 }
1341 } 1352 }
1342 1353
@@ -1348,6 +1359,15 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1348 if (visible_p && XFASTINT (w->hscroll) > 0) 1359 if (visible_p && XFASTINT (w->hscroll) > 0)
1349 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); 1360 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
1350 1361
1362#if 0
1363 /* Debugging code. */
1364 if (visible_p)
1365 fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n",
1366 charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos);
1367 else
1368 fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll);
1369#endif
1370
1351 return visible_p; 1371 return visible_p;
1352} 1372}
1353 1373
@@ -3214,7 +3234,9 @@ handle_fontified_prop (it)
3214 && !NILP (Vrun_hooks) 3234 && !NILP (Vrun_hooks)
3215 && (pos = make_number (IT_CHARPOS (*it)), 3235 && (pos = make_number (IT_CHARPOS (*it)),
3216 prop = Fget_char_property (pos, Qfontified, Qnil), 3236 prop = Fget_char_property (pos, Qfontified, Qnil),
3217 NILP (prop))) 3237 /* Ignore the special cased nil value always present at EOB since
3238 no amount of fontifying will be able to change it. */
3239 NILP (prop) && IT_CHARPOS (*it) < Z))
3218 { 3240 {
3219 int count = SPECPDL_INDEX (); 3241 int count = SPECPDL_INDEX ();
3220 Lisp_Object val; 3242 Lisp_Object val;
@@ -9132,7 +9154,7 @@ update_menu_bar (f, save_match_data, hooks_run)
9132 happen when, for instance, an activate-menubar-hook causes a 9154 happen when, for instance, an activate-menubar-hook causes a
9133 redisplay. */ 9155 redisplay. */
9134 if (inhibit_menubar_update) 9156 if (inhibit_menubar_update)
9135 return; 9157 return hooks_run;
9136 9158
9137 window = FRAME_SELECTED_WINDOW (f); 9159 window = FRAME_SELECTED_WINDOW (f);
9138 w = XWINDOW (window); 9160 w = XWINDOW (window);
@@ -9203,6 +9225,7 @@ update_menu_bar (f, save_match_data, hooks_run)
9203 hooks_run = 1; 9225 hooks_run = 1;
9204 } 9226 }
9205 9227
9228 XSETFRAME (Vmenu_updating_frame, f);
9206 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 9229 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
9207 9230
9208 /* Redisplay the menu bar in case we changed it. */ 9231 /* Redisplay the menu bar in case we changed it. */
@@ -10786,13 +10809,13 @@ redisplay_internal (preserve_echo_area)
10786 int preserve_echo_area; 10809 int preserve_echo_area;
10787{ 10810{
10788 struct window *w = XWINDOW (selected_window); 10811 struct window *w = XWINDOW (selected_window);
10789 struct frame *f = XFRAME (w->frame); 10812 struct frame *f;
10790 int pause; 10813 int pause;
10791 int must_finish = 0; 10814 int must_finish = 0;
10792 struct text_pos tlbufpos, tlendpos; 10815 struct text_pos tlbufpos, tlendpos;
10793 int number_of_visible_frames; 10816 int number_of_visible_frames;
10794 int count; 10817 int count;
10795 struct frame *sf = SELECTED_FRAME (); 10818 struct frame *sf;
10796 int polling_stopped_here = 0; 10819 int polling_stopped_here = 0;
10797 10820
10798 /* Non-zero means redisplay has to consider all windows on all 10821 /* Non-zero means redisplay has to consider all windows on all
@@ -10805,8 +10828,16 @@ redisplay_internal (preserve_echo_area)
10805 initialized, or redisplay is explicitly turned off by setting 10828 initialized, or redisplay is explicitly turned off by setting
10806 Vinhibit_redisplay. */ 10829 Vinhibit_redisplay. */
10807 if (noninteractive 10830 if (noninteractive
10808 || !NILP (Vinhibit_redisplay) 10831 || !NILP (Vinhibit_redisplay))
10809 || !f->glyphs_initialized_p) 10832 return;
10833
10834 /* Don't examine these until after testing Vinhibit_redisplay.
10835 When Emacs is shutting down, perhaps because its connection to
10836 X has dropped, we should not look at them at all. */
10837 f = XFRAME (w->frame);
10838 sf = SELECTED_FRAME ();
10839
10840 if (!f->glyphs_initialized_p)
10810 return; 10841 return;
10811 10842
10812 /* The flag redisplay_performed_directly_p is set by 10843 /* The flag redisplay_performed_directly_p is set by
@@ -12030,7 +12061,8 @@ cursor_row_fully_visible_p (w, force_p, current_matrix_p)
12030 window_height = window_box_height (w); 12061 window_height = window_box_height (w);
12031 if (row->height >= window_height) 12062 if (row->height >= window_height)
12032 { 12063 {
12033 if (!force_p || MINI_WINDOW_P (w) || w->vscroll) 12064 if (!force_p || MINI_WINDOW_P (w)
12065 || w->vscroll || w->cursor.vpos == 0)
12034 return 1; 12066 return 1;
12035 } 12067 }
12036 return 0; 12068 return 0;
@@ -13519,7 +13551,8 @@ try_window (window, pos, check_margins)
13519 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); 13551 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
13520 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 13552 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
13521 13553
13522 if ((w->cursor.y < this_scroll_margin 13554 if ((w->cursor.y >= 0 /* not vscrolled */
13555 && w->cursor.y < this_scroll_margin
13523 && CHARPOS (pos) > BEGV 13556 && CHARPOS (pos) > BEGV
13524 && IT_CHARPOS (it) < ZV) 13557 && IT_CHARPOS (it) < ZV)
13525 /* rms: considering make_cursor_line_fully_visible_p here 13558 /* rms: considering make_cursor_line_fully_visible_p here
@@ -17659,12 +17692,20 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
17659 break; 17692 break;
17660 17693
17661 case 'c': 17694 case 'c':
17662 { 17695 /* %c and %l are ignored in `frame-title-format'.
17663 int col = (int) current_column (); /* iftc */ 17696 (In redisplay_internal, the frame title is drawn _before_ the
17664 w->column_number_displayed = make_number (col); 17697 windows are updated, so the stuff which depends on actual
17665 pint2str (decode_mode_spec_buf, field_width, col); 17698 window contents (such as %l) may fail to render properly, or
17666 return decode_mode_spec_buf; 17699 even crash emacs.) */
17667 } 17700 if (mode_line_target == MODE_LINE_TITLE)
17701 return "";
17702 else
17703 {
17704 int col = (int) current_column (); /* iftc */
17705 w->column_number_displayed = make_number (col);
17706 pint2str (decode_mode_spec_buf, field_width, col);
17707 return decode_mode_spec_buf;
17708 }
17668 17709
17669 case 'e': 17710 case 'e':
17670#ifndef SYSTEM_MALLOC 17711#ifndef SYSTEM_MALLOC
@@ -17706,11 +17747,16 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
17706 17747
17707 case 'l': 17748 case 'l':
17708 { 17749 {
17709 int startpos = XMARKER (w->start)->charpos; 17750 int startpos, startpos_byte, line, linepos, linepos_byte;
17710 int startpos_byte = marker_byte_position (w->start); 17751 int topline, nlines, junk, height;
17711 int line, linepos, linepos_byte, topline; 17752
17712 int nlines, junk; 17753 /* %c and %l are ignored in `frame-title-format'. */
17713 int height = WINDOW_TOTAL_LINES (w); 17754 if (mode_line_target == MODE_LINE_TITLE)
17755 return "";
17756
17757 startpos = XMARKER (w->start)->charpos;
17758 startpos_byte = marker_byte_position (w->start);
17759 height = WINDOW_TOTAL_LINES (w);
17714 17760
17715 /* If we decided that this buffer isn't suitable for line numbers, 17761 /* If we decided that this buffer isn't suitable for line numbers,
17716 don't forget that too fast. */ 17762 don't forget that too fast. */
@@ -19772,7 +19818,7 @@ produce_image_glyph (it)
19772{ 19818{
19773 struct image *img; 19819 struct image *img;
19774 struct face *face; 19820 struct face *face;
19775 int glyph_ascent; 19821 int glyph_ascent, crop;
19776 struct glyph_slice slice; 19822 struct glyph_slice slice;
19777 19823
19778 xassert (it->what == IT_IMAGE); 19824 xassert (it->what == IT_IMAGE);
@@ -19880,6 +19926,15 @@ produce_image_glyph (it)
19880 19926
19881 take_vertical_position_into_account (it); 19927 take_vertical_position_into_account (it);
19882 19928
19929 /* Automatically crop wide image glyphs at right edge so we can
19930 draw the cursor on same display row. */
19931 if ((crop = it->pixel_width - (it->last_visible_x - it->current_x), crop > 0)
19932 && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4))
19933 {
19934 it->pixel_width -= crop;
19935 slice.width -= crop;
19936 }
19937
19883 if (it->glyph_row) 19938 if (it->glyph_row)
19884 { 19939 {
19885 struct glyph *glyph; 19940 struct glyph *glyph;
@@ -21228,10 +21283,35 @@ get_window_cursor_type (w, glyph, width, active_cursor)
21228 /* Use normal cursor if not blinked off. */ 21283 /* Use normal cursor if not blinked off. */
21229 if (!w->cursor_off_p) 21284 if (!w->cursor_off_p)
21230 { 21285 {
21231 if (glyph != NULL && glyph->type == IMAGE_GLYPH) { 21286#ifdef HAVE_WINDOW_SYSTEM
21232 if (cursor_type == FILLED_BOX_CURSOR) 21287 if (glyph != NULL && glyph->type == IMAGE_GLYPH)
21233 cursor_type = HOLLOW_BOX_CURSOR; 21288 {
21289 if (cursor_type == FILLED_BOX_CURSOR)
21290 {
21291 /* Using a block cursor on large images can be very annoying.
21292 So use a hollow cursor for "large" images.
21293 If image is not transparent (no mask), also use hollow cursor. */
21294 struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id);
21295 if (img != NULL && IMAGEP (img->spec))
21296 {
21297 /* Arbitrarily, interpret "Large" as >32x32 and >NxN
21298 where N = size of default frame font size.
21299 This should cover most of the "tiny" icons people may use. */
21300 if (!img->mask
21301 || img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w))
21302 || img->height > max (32, WINDOW_FRAME_LINE_HEIGHT (w)))
21303 cursor_type = HOLLOW_BOX_CURSOR;
21304 }
21305 }
21306 else if (cursor_type != NO_CURSOR)
21307 {
21308 /* Display current only supports BOX and HOLLOW cursors for images.
21309 So for now, unconditionally use a HOLLOW cursor when cursor is
21310 not a solid box cursor. */
21311 cursor_type = HOLLOW_BOX_CURSOR;
21312 }
21234 } 21313 }
21314#endif
21235 return cursor_type; 21315 return cursor_type;
21236 } 21316 }
21237 21317
@@ -23935,9 +24015,10 @@ This variable is not guaranteed to be accurate except while processing
23935 DEFVAR_LISP ("frame-title-format", &Vframe_title_format, 24015 DEFVAR_LISP ("frame-title-format", &Vframe_title_format,
23936 doc: /* Template for displaying the title bar of visible frames. 24016 doc: /* Template for displaying the title bar of visible frames.
23937\(Assuming the window manager supports this feature.) 24017\(Assuming the window manager supports this feature.)
23938This variable has the same structure as `mode-line-format' (which see), 24018
23939and is used only on frames for which no explicit name has been set 24019This variable has the same structure as `mode-line-format', except that
23940\(see `modify-frame-parameters'). */); 24020the %c and %l constructs are ignored. It is used only on frames for
24021which no explicit name has been set \(see `modify-frame-parameters'). */);
23941 24022
23942 DEFVAR_LISP ("icon-title-format", &Vicon_title_format, 24023 DEFVAR_LISP ("icon-title-format", &Vicon_title_format,
23943 doc: /* Template for displaying the title bar of an iconified frame. 24024 doc: /* Template for displaying the title bar of an iconified frame.
@@ -23983,9 +24064,22 @@ Each function is called with two arguments, the window and the end trigger value
23983See `set-window-redisplay-end-trigger'. */); 24064See `set-window-redisplay-end-trigger'. */);
23984 Vredisplay_end_trigger_functions = Qnil; 24065 Vredisplay_end_trigger_functions = Qnil;
23985 24066
23986 DEFVAR_BOOL ("mouse-autoselect-window", &mouse_autoselect_window, 24067 DEFVAR_LISP ("mouse-autoselect-window", &Vmouse_autoselect_window,
23987 doc: /* *Non-nil means autoselect window with mouse pointer. */); 24068 doc: /* *Non-nil means autoselect window with mouse pointer.
23988 mouse_autoselect_window = 0; 24069If nil, do not autoselect windows.
24070A positive number means delay autoselection by that many seconds: a
24071window is autoselected only after the mouse has remained in that
24072window for the duration of the delay.
24073A negative number has a similar effect, but causes windows to be
24074autoselected only after the mouse has stopped moving. \(Because of
24075the way Emacs compares mouse events, you will occasionally wait twice
24076that time before the window gets selected.\)
24077Any other value means to autoselect window instantaneously when the
24078mouse pointer enters it.
24079
24080Autoselection selects the minibuffer only if it is active, and never
24081unselects the minibuffer if it is active. */);
24082 Vmouse_autoselect_window = Qnil;
23989 24083
23990 DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p, 24084 DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p,
23991 doc: /* *Non-nil means automatically resize tool-bars. 24085 doc: /* *Non-nil means automatically resize tool-bars.
@@ -24105,6 +24199,11 @@ This is used to update submenus such as Buffers,
24105whose contents depend on various data. */); 24199whose contents depend on various data. */);
24106 Vmenu_bar_update_hook = Qnil; 24200 Vmenu_bar_update_hook = Qnil;
24107 24201
24202 DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame,
24203 doc: /* Frame for which we are updating a menu.
24204The enable predicate for a menu binding should check this variable. */);
24205 Vmenu_updating_frame = Qnil;
24206
24108 DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update, 24207 DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update,
24109 doc: /* Non-nil means don't update menu bars. Internal use only. */); 24208 doc: /* Non-nil means don't update menu bars. Internal use only. */);
24110 inhibit_menubar_update = 0; 24209 inhibit_menubar_update = 0;
diff --git a/src/xfns.c b/src/xfns.c
index d5b8a01cf20..066996628e2 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -153,12 +153,16 @@ int display_hourglass_p;
153 153
154/* Non-zero means prompt with the old GTK file selection dialog. */ 154/* Non-zero means prompt with the old GTK file selection dialog. */
155 155
156int x_use_old_gtk_file_dialog; 156int x_gtk_use_old_file_dialog;
157 157
158/* If non-zero, by default show hidden files in the GTK file chooser. */ 158/* If non-zero, by default show hidden files in the GTK file chooser. */
159 159
160int x_gtk_show_hidden_files; 160int x_gtk_show_hidden_files;
161 161
162/* If non-zero, don't show additional help text in the GTK file chooser. */
163
164int x_gtk_file_dialog_help_text;
165
162/* If non-zero, don't collapse to tool bar when it is detached. */ 166/* If non-zero, don't collapse to tool bar when it is detached. */
163 167
164int x_gtk_whole_detached_tool_bar; 168int x_gtk_whole_detached_tool_bar;
@@ -5338,6 +5342,8 @@ or directory must exist. ONLY-DIR-P is ignored." */)
5338 int count = SPECPDL_INDEX (); 5342 int count = SPECPDL_INDEX ();
5339 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 5343 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
5340 5344
5345 check_x ();
5346
5341 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); 5347 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
5342 5348
5343 if (popup_activated ()) 5349 if (popup_activated ())
@@ -5505,6 +5511,8 @@ directories. */)
5505 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 5511 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
5506 char *cdef_file; 5512 char *cdef_file;
5507 5513
5514 check_x ();
5515
5508 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); 5516 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
5509 5517
5510 if (popup_activated ()) 5518 if (popup_activated ())
@@ -5803,12 +5811,12 @@ Chinese, Japanese, and Korean. */);
5803 Vx_pixel_size_width_font_regexp = Qnil; 5811 Vx_pixel_size_width_font_regexp = Qnil;
5804 5812
5805/* This is not ifdef:ed, so other builds than GTK can customize it. */ 5813/* This is not ifdef:ed, so other builds than GTK can customize it. */
5806 DEFVAR_BOOL ("x-use-old-gtk-file-dialog", &x_use_old_gtk_file_dialog, 5814 DEFVAR_BOOL ("x-gtk-use-old-file-dialog", &x_gtk_use_old_file_dialog,
5807 doc: /* *Non-nil means prompt with the old GTK file selection dialog. 5815 doc: /* *Non-nil means prompt with the old GTK file selection dialog.
5808If nil or if the file selection dialog is not available, the new GTK file 5816If nil or if the file selection dialog is not available, the new GTK file
5809chooser is used instead. To turn off all file dialogs set the 5817chooser is used instead. To turn off all file dialogs set the
5810variable `use-file-dialog'. */); 5818variable `use-file-dialog'. */);
5811 x_use_old_gtk_file_dialog = 0; 5819 x_gtk_use_old_file_dialog = 0;
5812 5820
5813 DEFVAR_BOOL ("x-gtk-show-hidden-files", &x_gtk_show_hidden_files, 5821 DEFVAR_BOOL ("x-gtk-show-hidden-files", &x_gtk_show_hidden_files,
5814 doc: /* *If non-nil, the GTK file chooser will by default show hidden files. 5822 doc: /* *If non-nil, the GTK file chooser will by default show hidden files.
@@ -5816,6 +5824,12 @@ Note that this is just the default, there is a toggle button on the file
5816chooser to show or not show hidden files on a case by case basis. */); 5824chooser to show or not show hidden files on a case by case basis. */);
5817 x_gtk_show_hidden_files = 0; 5825 x_gtk_show_hidden_files = 0;
5818 5826
5827 DEFVAR_BOOL ("x-gtk-file-dialog-help-text", &x_gtk_file_dialog_help_text,
5828 doc: /* *If non-nil, the GTK file chooser will show additional help text.
5829If more space for files in the file chooser dialog is wanted, set this to nil
5830to turn the additional text off. */);
5831 x_gtk_file_dialog_help_text = 1;
5832
5819 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", &x_gtk_whole_detached_tool_bar, 5833 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", &x_gtk_whole_detached_tool_bar,
5820 doc: /* *If non-nil, a detached tool bar is shown in full. 5834 doc: /* *If non-nil, a detached tool bar is shown in full.
5821The default is to just show an arrow and pressing on that arrow shows 5835The default is to just show an arrow and pressing on that arrow shows
diff --git a/src/xmenu.c b/src/xmenu.c
index 1650222ae84..b615d321cc7 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -97,10 +97,10 @@ Boston, MA 02110-1301, USA. */
97#define FALSE 0 97#define FALSE 0
98#endif /* no TRUE */ 98#endif /* no TRUE */
99 99
100Lisp_Object Vmenu_updating_frame;
101
102Lisp_Object Qdebug_on_next_call; 100Lisp_Object Qdebug_on_next_call;
103 101
102extern Lisp_Object Vmenu_updating_frame;
103
104extern Lisp_Object Qmenu_bar; 104extern Lisp_Object Qmenu_bar;
105 105
106extern Lisp_Object QCtoggle, QCradio; 106extern Lisp_Object QCtoggle, QCradio;
@@ -1191,6 +1191,10 @@ x_menu_set_in_use (in_use)
1191{ 1191{
1192 menu_items_inuse = in_use ? Qt : Qnil; 1192 menu_items_inuse = in_use ? Qt : Qnil;
1193 popup_activated_flag = in_use; 1193 popup_activated_flag = in_use;
1194#ifdef USE_X_TOOLKIT
1195 if (popup_activated_flag)
1196 x_activate_timeout_atimer ();
1197#endif
1194} 1198}
1195 1199
1196/* Wait for an X event to arrive or for a timer to expire. */ 1200/* Wait for an X event to arrive or for a timer to expire. */
@@ -1310,7 +1314,7 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers)
1310 } 1314 }
1311} 1315}
1312 1316
1313DEFUN ("x-menu-bar-open", Fx_menu_bar_open, Sx_menu_bar_open, 0, 1, "i", 1317DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_internal, 0, 1, "i",
1314 doc: /* Start key navigation of the menu bar in FRAME. 1318 doc: /* Start key navigation of the menu bar in FRAME.
1315This initially opens the first menu bar item and you can then navigate with the 1319This initially opens the first menu bar item and you can then navigate with the
1316arrow keys, select a menu entry with the return key or cancel with the 1320arrow keys, select a menu entry with the return key or cancel with the
@@ -1389,7 +1393,7 @@ If FRAME is nil or not given, use the selected frame. */)
1389 1393
1390 1394
1391#ifdef USE_GTK 1395#ifdef USE_GTK
1392DEFUN ("x-menu-bar-open", Fx_menu_bar_open, Sx_menu_bar_open, 0, 1, "i", 1396DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_internal, 0, 1, "i",
1393 doc: /* Start key navigation of the menu bar in FRAME. 1397 doc: /* Start key navigation of the menu bar in FRAME.
1394This initially opens the first menu bar item and you can then navigate with the 1398This initially opens the first menu bar item and you can then navigate with the
1395arrow keys, select a menu entry with the return key or cancel with the 1399arrow keys, select a menu entry with the return key or cancel with the
@@ -1510,6 +1514,9 @@ popup_activate_callback (widget, id, client_data)
1510 XtPointer client_data; 1514 XtPointer client_data;
1511{ 1515{
1512 popup_activated_flag = 1; 1516 popup_activated_flag = 1;
1517#ifdef USE_X_TOOLKIT
1518 x_activate_timeout_atimer ();
1519#endif
1513} 1520}
1514#endif 1521#endif
1515 1522
@@ -2828,6 +2835,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2828 /* Display the menu. */ 2835 /* Display the menu. */
2829 lw_popup_menu (menu, (XEvent *) &dummy); 2836 lw_popup_menu (menu, (XEvent *) &dummy);
2830 popup_activated_flag = 1; 2837 popup_activated_flag = 1;
2838 x_activate_timeout_atimer ();
2831 2839
2832 { 2840 {
2833 int fact = 4 * sizeof (LWLIB_ID); 2841 int fact = 4 * sizeof (LWLIB_ID);
@@ -3214,6 +3222,7 @@ create_and_show_dialog (f, first_wv)
3214 /* Display the dialog box. */ 3222 /* Display the dialog box. */
3215 lw_pop_up_all_widgets (dialog_id); 3223 lw_pop_up_all_widgets (dialog_id);
3216 popup_activated_flag = 1; 3224 popup_activated_flag = 1;
3225 x_activate_timeout_atimer ();
3217 3226
3218 /* Process events that apply to the dialog box. 3227 /* Process events that apply to the dialog box.
3219 Also handle timers. */ 3228 Also handle timers. */
@@ -3803,11 +3812,6 @@ syms_of_xmenu ()
3803 Qdebug_on_next_call = intern ("debug-on-next-call"); 3812 Qdebug_on_next_call = intern ("debug-on-next-call");
3804 staticpro (&Qdebug_on_next_call); 3813 staticpro (&Qdebug_on_next_call);
3805 3814
3806 DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame,
3807 doc: /* Frame for which we are updating a menu.
3808The enable predicate for a menu command should check this variable. */);
3809 Vmenu_updating_frame = Qnil;
3810
3811#ifdef USE_X_TOOLKIT 3815#ifdef USE_X_TOOLKIT
3812 widget_id_tick = (1<<16); 3816 widget_id_tick = (1<<16);
3813 next_menubar_widget_id = 1; 3817 next_menubar_widget_id = 1;
@@ -3816,10 +3820,9 @@ The enable predicate for a menu command should check this variable. */);
3816 defsubr (&Sx_popup_menu); 3820 defsubr (&Sx_popup_menu);
3817 3821
3818#if defined (USE_GTK) || defined (USE_X_TOOLKIT) 3822#if defined (USE_GTK) || defined (USE_X_TOOLKIT)
3819 defsubr (&Sx_menu_bar_open); 3823 defsubr (&Sx_menu_bar_open_internal);
3820 Fdefalias (intern ("accelerate-menu"), 3824 Ffset (intern ("accelerate-menu"),
3821 intern (Sx_menu_bar_open.symbol_name), 3825 intern (Sx_menu_bar_open_internal.symbol_name));
3822 Qnil);
3823#endif 3826#endif
3824 3827
3825#ifdef HAVE_MENUS 3828#ifdef HAVE_MENUS
diff --git a/src/xterm.c b/src/xterm.c
index 466037c75a2..95b2a87fd4b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2701,9 +2701,8 @@ x_draw_glyph_string (s)
2701 if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h)) 2701 if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
2702 h = 1; 2702 h = 1;
2703 2703
2704 if (x_underline_at_descent_line) 2704 y = s->y + s->height - h;
2705 y = s->y + s->height - h; 2705 if (!x_underline_at_descent_line)
2706 else
2707 { 2706 {
2708 /* Get the underline position. This is the recommended 2707 /* Get the underline position. This is the recommended
2709 vertical offset in pixels from the baseline to the top of 2708 vertical offset in pixels from the baseline to the top of
@@ -4105,6 +4104,9 @@ x_send_scroll_bar_event (window, part, portion, whole)
4105 4104
4106 /* Make Xt timeouts work while the scroll bar is active. */ 4105 /* Make Xt timeouts work while the scroll bar is active. */
4107 toolkit_scroll_bar_interaction = 1; 4106 toolkit_scroll_bar_interaction = 1;
4107#ifdef USE_X_TOOLKIT
4108 x_activate_timeout_atimer ();
4109#endif
4108 4110
4109 /* Setting the event mask to zero means that the message will 4111 /* Setting the event mask to zero means that the message will
4110 be sent to the client that created the window, and if that 4112 be sent to the client that created the window, and if that
@@ -6597,7 +6599,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6597 { 6599 {
6598 6600
6599 /* Generate SELECT_WINDOW_EVENTs when needed. */ 6601 /* Generate SELECT_WINDOW_EVENTs when needed. */
6600 if (mouse_autoselect_window) 6602 if (!NILP (Vmouse_autoselect_window))
6601 { 6603 {
6602 Lisp_Object window; 6604 Lisp_Object window;
6603 6605
@@ -7517,7 +7519,7 @@ struct x_error_message_stack {
7517static struct x_error_message_stack *x_error_message; 7519static struct x_error_message_stack *x_error_message;
7518 7520
7519/* An X error handler which stores the error message in 7521/* An X error handler which stores the error message in
7520 x_error_message_string. This is called from x_error_handler if 7522 *x_error_message. This is called from x_error_handler if
7521 x_catch_errors is in effect. */ 7523 x_catch_errors is in effect. */
7522 7524
7523static void 7525static void
@@ -7536,7 +7538,7 @@ x_error_catcher (display, error)
7536 7538
7537 After calling this function, X protocol errors no longer cause 7539 After calling this function, X protocol errors no longer cause
7538 Emacs to exit; instead, they are recorded in the string 7540 Emacs to exit; instead, they are recorded in the string
7539 stored in x_error_message_string. 7541 stored in *x_error_message.
7540 7542
7541 Calling x_check_errors signals an Emacs error if an X error has 7543 Calling x_check_errors signals an Emacs error if an X error has
7542 occurred since the last call to x_catch_errors or x_check_errors. 7544 occurred since the last call to x_catch_errors or x_check_errors.
@@ -7819,7 +7821,7 @@ x_connection_closed (dpy, error_message)
7819 7821
7820/* We specifically use it before defining it, so that gcc doesn't inline it, 7822/* We specifically use it before defining it, so that gcc doesn't inline it,
7821 otherwise gdb doesn't know how to properly put a breakpoint on it. */ 7823 otherwise gdb doesn't know how to properly put a breakpoint on it. */
7822static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN; 7824static void x_error_quitter P_ ((Display *, XErrorEvent *));
7823 7825
7824/* This is the first-level handler for X protocol errors. 7826/* This is the first-level handler for X protocol errors.
7825 It calls x_error_quitter or x_error_catcher. */ 7827 It calls x_error_quitter or x_error_catcher. */
@@ -7864,6 +7866,12 @@ x_error_quitter (display, error)
7864{ 7866{
7865 char buf[256], buf1[356]; 7867 char buf[256], buf1[356];
7866 7868
7869 /* Ignore BadName errors. They can happen because of fonts
7870 or colors that are not defined. */
7871
7872 if (error->error_code == BadName)
7873 return;
7874
7867 /* Note that there is no real way portable across R3/R4 to get the 7875 /* Note that there is no real way portable across R3/R4 to get the
7868 original error handler. */ 7876 original error handler. */
7869 7877
@@ -8372,7 +8380,7 @@ x_check_expected_move (f, expected_left, expected_top)
8372 int expected_left; 8380 int expected_left;
8373 int expected_top; 8381 int expected_top;
8374{ 8382{
8375 int count = 0, current_left = 0, current_top = 0; 8383 int current_left = 0, current_top = 0;
8376 8384
8377 /* x_real_positions returns the left and top offsets of the outermost 8385 /* x_real_positions returns the left and top offsets of the outermost
8378 window manager window around the frame. */ 8386 window manager window around the frame. */
@@ -10169,6 +10177,11 @@ static XrmOptionDescRec emacs_options[] = {
10169 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, 10177 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL},
10170 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} 10178 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL}
10171}; 10179};
10180
10181/* Whether atimer for Xt timeouts is activated or not. */
10182
10183static int x_timeout_atimer_activated_flag;
10184
10172#endif /* USE_X_TOOLKIT */ 10185#endif /* USE_X_TOOLKIT */
10173 10186
10174static int x_initialized; 10187static int x_initialized;
@@ -10882,13 +10895,39 @@ static void
10882x_process_timeouts (timer) 10895x_process_timeouts (timer)
10883 struct atimer *timer; 10896 struct atimer *timer;
10884{ 10897{
10898 BLOCK_INPUT;
10899 x_timeout_atimer_activated_flag = 0;
10885 if (toolkit_scroll_bar_interaction || popup_activated ()) 10900 if (toolkit_scroll_bar_interaction || popup_activated ())
10886 { 10901 {
10887 BLOCK_INPUT;
10888 while (XtAppPending (Xt_app_con) & XtIMTimer) 10902 while (XtAppPending (Xt_app_con) & XtIMTimer)
10889 XtAppProcessEvent (Xt_app_con, XtIMTimer); 10903 XtAppProcessEvent (Xt_app_con, XtIMTimer);
10890 UNBLOCK_INPUT; 10904 /* Reactivate the atimer for next time. */
10905 x_activate_timeout_atimer ();
10891 } 10906 }
10907 UNBLOCK_INPUT;
10908}
10909
10910/* Install an asynchronous timer that processes Xt timeout events
10911 every 0.1s as long as either `toolkit_scroll_bar_interaction' or
10912 `popup_activated_flag' (in xmenu.c) is set. Make sure to call this
10913 function whenever these variables are set. This is necessary
10914 because some widget sets use timeouts internally, for example the
10915 LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't
10916 processed, these widgets don't behave normally. */
10917
10918void
10919x_activate_timeout_atimer ()
10920{
10921 BLOCK_INPUT;
10922 if (!x_timeout_atimer_activated_flag)
10923 {
10924 EMACS_TIME interval;
10925
10926 EMACS_SET_SECS_USECS (interval, 0, 100000);
10927 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
10928 x_timeout_atimer_activated_flag = 1;
10929 }
10930 UNBLOCK_INPUT;
10892} 10931}
10893 10932
10894#endif /* USE_X_TOOLKIT */ 10933#endif /* USE_X_TOOLKIT */
@@ -10957,15 +10996,15 @@ x_delete_terminal (struct terminal *terminal)
10957 x_destroy_all_bitmaps (dpyinfo); 10996 x_destroy_all_bitmaps (dpyinfo);
10958 XSetCloseDownMode (dpyinfo->display, DestroyAll); 10997 XSetCloseDownMode (dpyinfo->display, DestroyAll);
10959 10998
10960#ifdef USE_X_TOOLKIT
10961 XtCloseDisplay (dpyinfo->display);
10962#else
10963#ifdef USE_GTK 10999#ifdef USE_GTK
10964 xg_display_close (dpyinfo->display); 11000 xg_display_close (dpyinfo->display);
10965#else 11001#else
11002#ifdef USE_X_TOOLKIT
11003 XtCloseDisplay (dpyinfo->display);
11004#else
10966 XCloseDisplay (dpyinfo->display); 11005 XCloseDisplay (dpyinfo->display);
10967#endif 11006#endif
10968#endif 11007#endif /* ! USE_GTK */
10969 11008
10970 x_delete_display (dpyinfo); 11009 x_delete_display (dpyinfo);
10971 UNBLOCK_INPUT; 11010 UNBLOCK_INPUT;
@@ -11052,17 +11091,6 @@ x_initialize ()
11052 XtCacheByDisplay, cvt_pixel_dtor); 11091 XtCacheByDisplay, cvt_pixel_dtor);
11053 11092
11054 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); 11093 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources);
11055
11056 /* Install an asynchronous timer that processes Xt timeout events
11057 every 0.1s. This is necessary because some widget sets use
11058 timeouts internally, for example the LessTif menu bar, or the
11059 Xaw3d scroll bar. When Xt timouts aren't processed, these
11060 widgets don't behave normally. */
11061 {
11062 EMACS_TIME interval;
11063 EMACS_SET_SECS_USECS (interval, 0, 100000);
11064 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
11065 }
11066#endif 11094#endif
11067 11095
11068#ifdef USE_TOOLKIT_SCROLL_BARS 11096#ifdef USE_TOOLKIT_SCROLL_BARS
diff --git a/src/xterm.h b/src/xterm.h
index 8f7055d95d5..3c4bdab33c9 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1003,6 +1003,7 @@ extern XtAppContext Xt_app_con;
1003extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, 1003extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap,
1004 unsigned long *, 1004 unsigned long *,
1005 double, int)); 1005 double, int));
1006extern void x_activate_timeout_atimer P_ ((void));
1006#endif 1007#endif
1007extern void x_query_colors P_ ((struct frame *f, XColor *, int)); 1008extern void x_query_colors P_ ((struct frame *f, XColor *, int));
1008extern void x_query_color P_ ((struct frame *f, XColor *)); 1009extern void x_query_color P_ ((struct frame *f, XColor *));