aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2007-08-13 13:48:35 +0000
committerMiles Bader2007-08-13 13:48:35 +0000
commitb2e6b10fe2d40020a75ab0025af98a4abf339cd2 (patch)
treedb265e5ea93cdc13f8e3b54ed5c7ad2869d50ec9 /src
parent905350bef3ebc514a418658dd155c1d062664b56 (diff)
parent37cc095b6a175fb5a2fb18fa029eaf3aa3b3fa53 (diff)
downloademacs-b2e6b10fe2d40020a75ab0025af98a4abf339cd2.tar.gz
emacs-b2e6b10fe2d40020a75ab0025af98a4abf339cd2.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 846-851) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 88-92) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 242-244) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-246
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog128
-rw-r--r--src/buffer.h2
-rw-r--r--src/callproc.c2
-rw-r--r--src/casetab.c2
-rw-r--r--src/category.c2
-rw-r--r--src/ccl.c4
-rw-r--r--src/charset.h12
-rw-r--r--src/coding.h4
-rw-r--r--src/composite.h4
-rw-r--r--src/dired.c2
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs.c7
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c167
-rw-r--r--src/fontset.c2
-rw-r--r--src/fontset.h2
-rw-r--r--src/getloadavg.c2
-rw-r--r--src/gmalloc.c115
-rw-r--r--src/gtkutil.c12
-rw-r--r--src/image.c12
-rw-r--r--src/indent.c2
-rw-r--r--src/indent.h2
-rw-r--r--src/insdel.c99
-rw-r--r--src/intervals.c2
-rw-r--r--src/keyboard.c4
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h4
-rw-r--r--src/lread.c6
-rw-r--r--src/m/7300.h2
-rw-r--r--src/m/acorn.h2
-rw-r--r--src/m/alliant-2800.h2
-rw-r--r--src/m/alliant.h2
-rw-r--r--src/m/alpha.h2
-rw-r--r--src/m/altos.h2
-rw-r--r--src/m/amdahl.h2
-rw-r--r--src/m/amdx86-64.h2
-rw-r--r--src/m/apollo.h2
-rw-r--r--src/m/arm.h2
-rw-r--r--src/m/att3b.h2
-rw-r--r--src/m/aviion.h2
-rw-r--r--src/m/celerity.h2
-rw-r--r--src/m/clipper.h2
-rw-r--r--src/m/cnvrgnt.h2
-rw-r--r--src/m/convex.h2
-rw-r--r--src/m/cydra5.h2
-rw-r--r--src/m/delta88k.h2
-rw-r--r--src/m/dpx2.h2
-rw-r--r--src/m/dual.h2
-rw-r--r--src/m/elxsi.h2
-rw-r--r--src/m/gould.h2
-rw-r--r--src/m/hp800.h2
-rw-r--r--src/m/hp9000s300.h2
-rw-r--r--src/m/i860.h2
-rw-r--r--src/m/ia64.h2
-rw-r--r--src/m/ibm370aix.h2
-rw-r--r--src/m/ibmps2-aix.h2
-rw-r--r--src/m/ibmrs6000.h2
-rw-r--r--src/m/ibmrt-aix.h2
-rw-r--r--src/m/ibmrt.h2
-rw-r--r--src/m/ibms390.h2
-rw-r--r--src/m/ibms390x.h2
-rw-r--r--src/m/intel386.h2
-rw-r--r--src/m/iris4d.h2
-rw-r--r--src/m/irist.h2
-rw-r--r--src/m/isi-ov.h2
-rw-r--r--src/m/m68k.h2
-rw-r--r--src/m/macppc.h2
-rw-r--r--src/m/masscomp.h2
-rw-r--r--src/m/mega68.h2
-rw-r--r--src/m/mg1.h2
-rw-r--r--src/m/mips-siemens.h2
-rw-r--r--src/m/mips.h2
-rw-r--r--src/m/news.h2
-rw-r--r--src/m/next.h2
-rw-r--r--src/m/ns16000.h2
-rw-r--r--src/m/ns32000.h2
-rw-r--r--src/m/nu.h2
-rw-r--r--src/m/orion.h2
-rw-r--r--src/m/orion105.h2
-rw-r--r--src/m/pfa50.h2
-rw-r--r--src/m/plexus.h2
-rw-r--r--src/m/powermac.h2
-rw-r--r--src/m/powerpcle.h2
-rw-r--r--src/m/pyramid.h2
-rw-r--r--src/m/sequent.h2
-rw-r--r--src/m/sh3el.h2
-rw-r--r--src/m/sparc.h2
-rw-r--r--src/m/sps7.h2
-rw-r--r--src/m/sr2k.h2
-rw-r--r--src/m/stride.h2
-rw-r--r--src/m/sun1.h2
-rw-r--r--src/m/sun2.h2
-rw-r--r--src/m/tad68k.h2
-rw-r--r--src/m/tahoe.h2
-rw-r--r--src/m/targon31.h2
-rw-r--r--src/m/tek4300.h2
-rw-r--r--src/m/tekxd88.h2
-rw-r--r--src/m/template.h2
-rw-r--r--src/m/tower32.h2
-rw-r--r--src/m/tower32v3.h2
-rw-r--r--src/m/ustation.h2
-rw-r--r--src/m/vax.h2
-rw-r--r--src/m/wicat.h2
-rw-r--r--src/m/windowsnt.h2
-rw-r--r--src/m/xps100.h2
-rw-r--r--src/mac.c13
-rw-r--r--src/macmenu.c21
-rw-r--r--src/macselect.c404
-rw-r--r--src/macterm.c106
-rw-r--r--src/macterm.h2
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c20
-rw-r--r--src/process.c12
-rw-r--r--src/process.h2
-rw-r--r--src/regex.c2
-rw-r--r--src/search.c2
-rw-r--r--src/systime.h4
-rw-r--r--src/systty.h2
-rw-r--r--src/termhooks.h2
-rw-r--r--src/textprop.c4
-rw-r--r--src/w32term.c2
-rw-r--r--src/w32term.h2
-rw-r--r--src/window.c10
-rw-r--r--src/window.h3
-rw-r--r--src/xdisp.c15
-rw-r--r--src/xterm.c4
-rw-r--r--src/xterm.h2
128 files changed, 840 insertions, 558 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b0857fd63d0..1a4e8c113e8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,131 @@
12007-08-13 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (update_frame_tool_bar): Use -1 as index
4 to gtk_toolbar_insert.
5
62007-08-13 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * fileio.c (Finsert_file_contents): Yet Another Int/Lisp_Object Mixup.
9
10 * insdel.c (reset_var_on_error): New fun.
11 (signal_before_change, signal_after_change):
12 Use it to reset (after|before)-change-functions to nil in case of error.
13 Bind inhibit-modification-hooks to t.
14 Don't bind (after|before)-change-functions to nil while they run.
15
162007-08-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
17
18 * xterm.c (x_draw_image_glyph_string): Adjust stipple origin when
19 filling pixmap with stippled background.
20
212007-08-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
22
23 * macterm.c [TARGET_API_MAC_CARBON] (mac_handle_window_event):
24 Don't use invisible frame as parent window for repositioning.
25
262007-08-10 Stefan Monnier <monnier@iro.umontreal.ca>
27
28 * print.c (new_backquote_output): Rename from old_backquote_output.
29 (print): Inverse its logic (according to its name) so as to match the
30 behavior of new_backquote_flag in lread.c.
31
322007-08-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
33
34 * gmalloc.c (posix_memalign): New function.
35
36 * macterm.c (frame_highlight, frame_unhighlight): Don't call
37 ActivateControl/DeactivateControl here.
38 [USE_MAC_TOOLBAR] (free_frame_tool_bar): Suppress animation when
39 frame-notice-user-settings is non-nil.
40 [USE_MAC_FONT_PANEL] (mac_handle_font_event): Also record parameter
41 for kEventParamFMFontStyle.
42 [TARGET_API_MAC_CARBON] (mac_handle_keyboard_event): Don't check
43 mac_pass_command_to_system and mac_pass_control_to_system here.
44 (XTread_socket): Call ActivateControl/DeactivateControl here.
45 (XTread_socket) [TARGET_API_MAC_CARBON]:
46 Check mac_pass_command_to_system and mac_pass_control_to_system here.
47 (mac_handle_window_event) [USE_MAC_TOOLBAR]: Add further workaround
48 for window repositioning.
49
502007-08-08 Glenn Morris <rgm@gnu.org>
51
52 * Replace `iff' in doc-strings and comments.
53
542007-08-07 Chong Yidong <cyd@stupidchicken.com>
55
56 * xdisp.c (move_it_by_lines): Remove incorrect optimization.
57
582007-08-07 Martin Rudalics <rudalics@gmx.at>
59
60 * fileio.c (Finsert_file_contents): Run format-decode and
61 after_insert_file_functions on entire buffer when REPLACE is
62 non-nil and inhibit modification_hooks and point_motion_hooks.
63 For consistency, run after_insert_file_functions iff something
64 got inserted. Move signal_after_change and update_compositions
65 after code running after_insert_file_functions. Make sure that
66 undo_list doesn't record intermediate steps of the decoding
67 process.
68
692007-08-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
70
71 * emacs.c (main)
72 [HAVE_GTK_AND_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
73 Call malloc_enable_thread on interactive startup.
74
75 * gmalloc.c (_malloc_thread_enabled_p) [USE_PTHREAD]: New variable.
76 (LOCK, UNLOCK, LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS)
77 [USE_PTHREAD]: Conditionalize with it.
78 (malloc_atfork_handler_prepare, malloc_atfork_handler_parent)
79 (malloc_atfork_handler_child, malloc_enable_thread) [USE_PTHREAD]:
80 New functions.
81
822007-08-06 Chong Yidong <cyd@stupidchicken.com>
83
84 * xdisp.c (redisplay_window): When restoring original buffer
85 position, make sure it is still valid.
86
87 * image.c (png_load): Ignore png-supplied background color.
88
892007-08-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
90
91 * mac.c [TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value.
92 Use kCFAbsoluteTimeIntervalSince1970.
93
94 * macmenu.c (quit_dialog_event_loop) [TARGET_API_MAC_CARBON]:
95 New variable.
96 [TARGET_API_MAC_CARBON] (mac_handle_dialog_event): Set it if dialog
97 event loop should be quit.
98 [TARGET_API_MAC_CARBON] (create_and_show_dialog) [!MAC_OSX]:
99 Quit dialog event loop if quit_dialog_event_loop is set.
100
101 * macselect.c [!TARGET_API_MAC_CARBON]: Include Scrap.h.
102 (Selection): New typedef. Use instead of ScrapRef.
103 (mac_get_selection_from_symbol): Rename from get_scrap_from_symbol.
104 (mac_valid_selection_target_p): Rename from valid_scrap_target_type_p.
105 (mac_clear_selection): Rename from clear_scrap.
106 (get_flavor_type_from_symbol): New argument SEL and subsume function of
107 scrap_has_target_type. All uses changed.
108 (mac_get_selection_ownership_info, mac_valid_selection_value_p)
109 (mac_selection_has_target_p): New functions.
110 (mac_put_selection_value): Rename from put_scrap_string.
111 (mac_get_selection_value): Rename from get_scrap_string.
112 (mac_get_selection_target_list): Rename from get_scrap_target_type_list.
113 (put_scrap_private_timestamp, scrap_has_target_type)
114 (get_scrap_private_timestamp): Remove functions.
115 (SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP): Remove define.
116 (x_own_selection, x_get_local_selection):
117 Use mac_valid_selection_value_p.
118 (x_own_selection): Don't use put_scrap_private_timestamp.
119 Record OWNERSHIP-INFO into Vselection_alist instead.
120 (x_get_local_selection): Don't check type if request is local.
121 (Fx_selection_owner_p): Don't use get_scrap_private_timestamp.
122 Detect ownership change with OWNERSHIP-INFO in Vselection_alist instead.
123
1242007-08-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
125
126 * gtkutil.c (xg_tool_bar_callback): Generate two TOOL_BAR_EVENT:s,
127 add comment explaining why.
128
12007-08-03 Richard Stallman <rms@gnu.org> 1292007-08-03 Richard Stallman <rms@gnu.org>
2 130
3 * fileio.c (Fvisited_file_modtime): Use make_time. 131 * fileio.c (Fvisited_file_modtime): Use make_time.
diff --git a/src/buffer.h b/src/buffer.h
index 2f63fe30614..3935a675c42 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -570,7 +570,7 @@ struct buffer
570 Lisp_Object filename; 570 Lisp_Object filename;
571 /* Dir for expanding relative file names. */ 571 /* Dir for expanding relative file names. */
572 Lisp_Object directory; 572 Lisp_Object directory;
573 /* True iff this buffer has been backed up (if you write to the 573 /* True if this buffer has been backed up (if you write to the
574 visited file and it hasn't been backed up, then a backup will 574 visited file and it hasn't been backed up, then a backup will
575 be made). */ 575 be made). */
576 /* This isn't really used by the C code, so could be deleted. */ 576 /* This isn't really used by the C code, so could be deleted. */
diff --git a/src/callproc.c b/src/callproc.c
index ecc8643f630..d86113cfdba 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -117,7 +117,7 @@ Lisp_Object Vprocess_environment;
117Lisp_Object Qbuffer_file_type; 117Lisp_Object Qbuffer_file_type;
118#endif /* DOS_NT */ 118#endif /* DOS_NT */
119 119
120/* True iff we are about to fork off a synchronous process or if we 120/* True if we are about to fork off a synchronous process or if we
121 are waiting for it. */ 121 are waiting for it. */
122int synch_process_alive; 122int synch_process_alive;
123 123
diff --git a/src/casetab.c b/src/casetab.c
index b5db07d52b5..bcd8e63cc7a 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -40,7 +40,7 @@ static void set_identity ();
40static void shuffle (); 40static void shuffle ();
41 41
42DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0, 42DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0,
43 doc: /* Return t iff OBJECT is a case table. 43 doc: /* Return t if OBJECT is a case table.
44See `set-case-table' for more information on these data structures. */) 44See `set-case-table' for more information on these data structures. */)
45 (object) 45 (object)
46 Lisp_Object object; 46 Lisp_Object object;
diff --git a/src/category.c b/src/category.c
index 8a9de1577f2..708131d8e41 100644
--- a/src/category.c
+++ b/src/category.c
@@ -469,7 +469,7 @@ syms_of_category ()
469 doc: /* List of pair (cons) of categories to determine word boundary. 469 doc: /* List of pair (cons) of categories to determine word boundary.
470 470
471Emacs treats a sequence of word constituent characters as a single 471Emacs treats a sequence of word constituent characters as a single
472word (i.e. finds no word boundary between them) iff they belongs to 472word (i.e. finds no word boundary between them) only if they belong to
473the same charset. But, exceptions are allowed in the following cases. 473the same charset. But, exceptions are allowed in the following cases.
474 474
475\(1) The case that characters are in different charsets is controlled 475\(1) The case that characters are in different charsets is controlled
diff --git a/src/ccl.c b/src/ccl.c
index 1920154eb40..d51743c243a 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -673,13 +673,13 @@ while (0)
673 673
674#define CCL_LookupIntConstTbl 0x13 /* Lookup multibyte character by 674#define CCL_LookupIntConstTbl 0x13 /* Lookup multibyte character by
675 integer key. Afterwards R7 set 675 integer key. Afterwards R7 set
676 to 1 iff lookup succeeded. 676 to 1 if lookup succeeded.
677 1:ExtendedCOMMNDRrrRRRXXXXXXXX 677 1:ExtendedCOMMNDRrrRRRXXXXXXXX
678 2:ARGUMENT(Hash table ID) */ 678 2:ARGUMENT(Hash table ID) */
679 679
680#define CCL_LookupCharConstTbl 0x14 /* Lookup integer by multibyte 680#define CCL_LookupCharConstTbl 0x14 /* Lookup integer by multibyte
681 character key. Afterwards R7 set 681 character key. Afterwards R7 set
682 to 1 iff lookup succeeded. 682 to 1 if lookup succeeded.
683 1:ExtendedCOMMNDRrrRRRrrrXXXXX 683 1:ExtendedCOMMNDRrrRRRrrrXXXXX
684 2:ARGUMENT(Hash table ID) */ 684 2:ARGUMENT(Hash table ID) */
685 685
diff --git a/src/charset.h b/src/charset.h
index 1b5fba67064..6d34a5feea3 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -192,13 +192,13 @@ struct charset
192 version. Otherwise, -1. */ 192 version. Otherwise, -1. */
193 int emacs_mule_id; 193 int emacs_mule_id;
194 194
195 /* Nonzero iff the charset is compatible with ASCII. */ 195 /* Nonzero if the charset is compatible with ASCII. */
196 int ascii_compatible_p; 196 int ascii_compatible_p;
197 197
198 /* Nonzero iff the charset is supplementary. */ 198 /* Nonzero if the charset is supplementary. */
199 int supplementary_p; 199 int supplementary_p;
200 200
201 /* Nonzero iff all the code points are representable by Lisp_Int. */ 201 /* Nonzero if all the code points are representable by Lisp_Int. */
202 int compact_codes_p; 202 int compact_codes_p;
203 203
204 /* The method for encoding/decoding characters of the charset. */ 204 /* The method for encoding/decoding characters of the charset. */
@@ -332,7 +332,7 @@ extern struct charset *emacs_mule_charset[256];
332 (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset))) 332 (CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset)))
333 333
334 334
335/* Nonzero iff OBJ is a valid charset symbol. */ 335/* Nonzero if OBJ is a valid charset symbol. */
336#define CHARSETP(obj) (CHARSET_SYMBOL_HASH_INDEX (obj) >= 0) 336#define CHARSETP(obj) (CHARSET_SYMBOL_HASH_INDEX (obj) >= 0)
337 337
338/* Check if X is a valid charset symbol. If not, signal an error. */ 338/* Check if X is a valid charset symbol. If not, signal an error. */
@@ -479,7 +479,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
479#define ISO_CHARSET_TABLE(dimension, chars_96, final) \ 479#define ISO_CHARSET_TABLE(dimension, chars_96, final) \
480 iso_charset_table[(dimension) - 1][(chars_96)][(final)] 480 iso_charset_table[(dimension) - 1][(chars_96)][(final)]
481 481
482/* Nonzero iff the charset who has FAST_MAP may contain C. */ 482/* Nonzero if the charset who has FAST_MAP may contain C. */
483#define CHARSET_FAST_MAP_REF(c, fast_map) \ 483#define CHARSET_FAST_MAP_REF(c, fast_map) \
484 ((c) < 0x10000 \ 484 ((c) < 0x10000 \
485 ? fast_map[(c) >> 10] & (1 << (((c) >> 7) & 7)) \ 485 ? fast_map[(c) >> 10] & (1 << (((c) >> 7) & 7)) \
@@ -495,7 +495,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
495 495
496 496
497 497
498/* 1 iff CHARSET may contain the character C. */ 498/* 1 if CHARSET may contain the character C. */
499#define CHAR_CHARSET_P(c, charset) \ 499#define CHAR_CHARSET_P(c, charset) \
500 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \ 500 ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
501 || ((CHARSET_UNIFIED_P (charset) \ 501 || ((CHARSET_UNIFIED_P (charset) \
diff --git a/src/coding.h b/src/coding.h
index d4b159c3dfa..134402f3256 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -212,7 +212,7 @@ enum coding_attr_index
212 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ 212 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \
213 coding_system_symbol, NULL) 213 coding_system_symbol, NULL)
214 214
215/* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system. */ 215/* Return 1 if CODING_SYSTEM_SYMBOL is a coding system. */
216 216
217#define CODING_SYSTEM_P(coding_system_symbol) \ 217#define CODING_SYSTEM_P(coding_system_symbol) \
218 (CODING_SYSTEM_ID (coding_system_symbol) >= 0 \ 218 (CODING_SYSTEM_ID (coding_system_symbol) >= 0 \
@@ -421,7 +421,7 @@ struct coding_system
421 Lisp_Object dst_object; 421 Lisp_Object dst_object;
422 unsigned char *destination; 422 unsigned char *destination;
423 423
424 /* Set to 1 iff the source of conversion is not in the member 424 /* Set to 1 if the source of conversion is not in the member
425 `charbuf', but at `src_object'. */ 425 `charbuf', but at `src_object'. */
426 int chars_at_source; 426 int chars_at_source;
427 427
diff --git a/src/composite.h b/src/composite.h
index 4eb9276cd7a..5a426826bcc 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -61,7 +61,7 @@ enum composition_method {
61/* Temporary variable used only in the following macros. */ 61/* Temporary variable used only in the following macros. */
62extern Lisp_Object composition_temp; 62extern Lisp_Object composition_temp;
63 63
64/* Return 1 iff the composition is already registered. */ 64/* Return 1 if the composition is already registered. */
65#define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop)) 65#define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop))
66 66
67/* Return ID number of the already registered composition. */ 67/* Return ID number of the already registered composition. */
@@ -96,7 +96,7 @@ extern Lisp_Object composition_temp;
96 ? COMPOSITION_WITH_ALTCHARS \ 96 ? COMPOSITION_WITH_ALTCHARS \
97 : COMPOSITION_WITH_RULE_ALTCHARS)))) 97 : COMPOSITION_WITH_RULE_ALTCHARS))))
98 98
99/* Return 1 iff the composition is valid. It is valid if length of 99/* Return 1 if the composition is valid. It is valid if length of
100 the composition equals to (END - START). */ 100 the composition equals to (END - START). */
101#define COMPOSITION_VALID_P(start, end, prop) \ 101#define COMPOSITION_VALID_P(start, end, prop) \
102 (CONSP (prop) \ 102 (CONSP (prop) \
diff --git a/src/dired.c b/src/dired.c
index c471fb96f66..b362eec62b5 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -917,7 +917,7 @@ Elements of the attribute list are:
917 7. Size in bytes. 917 7. Size in bytes.
918 This is a floating point number if the size is too large for an integer. 918 This is a floating point number if the size is too large for an integer.
919 8. File modes, as a string of ten letters or dashes as in ls -l. 919 8. File modes, as a string of ten letters or dashes as in ls -l.
920 9. t iff file's gid would change if file were deleted and recreated. 920 9. t if file's gid would change if file were deleted and recreated.
92110. inode number. If inode number is larger than the Emacs integer, 92110. inode number. If inode number is larger than the Emacs integer,
922 this is a cons cell containing two integers: first the high part, 922 this is a cons cell containing two integers: first the high part,
923 then the low 16 bits. 923 then the low 16 bits.
diff --git a/src/editfns.c b/src/editfns.c
index f73ef0a2c05..152c5b669d9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3646,7 +3646,7 @@ usage: (format STRING &rest OBJECTS) */)
3646 precision ::= '.' [0-9]* 3646 precision ::= '.' [0-9]*
3647 3647
3648 If a field-width is specified, it specifies to which width 3648 If a field-width is specified, it specifies to which width
3649 the output should be padded with blanks, iff the output 3649 the output should be padded with blanks, if the output
3650 string is shorter than field-width. 3650 string is shorter than field-width.
3651 3651
3652 If precision is specified, it specifies the number of 3652 If precision is specified, it specifies the number of
diff --git a/src/emacs.c b/src/emacs.c
index cbc80fe15dd..9f4fe9dc0de 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1167,6 +1167,13 @@ main (argc, argv
1167 setpgrp (); 1167 setpgrp ();
1168#endif 1168#endif
1169#endif 1169#endif
1170#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
1171 {
1172 extern void malloc_enable_thread P_ ((void));
1173
1174 malloc_enable_thread ();
1175 }
1176#endif
1170 } 1177 }
1171 1178
1172 init_signals (); 1179 init_signals ();
diff --git a/src/eval.c b/src/eval.c
index 78316eb1a3c..6ce64bc4d8c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1783,7 +1783,7 @@ signal_error (s, arg)
1783} 1783}
1784 1784
1785 1785
1786/* Return nonzero iff LIST is a non-nil atom or 1786/* Return nonzero if LIST is a non-nil atom or
1787 a list containing one of CONDITIONS. */ 1787 a list containing one of CONDITIONS. */
1788 1788
1789static int 1789static int
diff --git a/src/fileio.c b/src/fileio.c
index 6af3386b82a..983bd72d282 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3695,27 +3695,25 @@ DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
3695 1, 5, 0, 3695 1, 5, 0,
3696 doc: /* Insert contents of file FILENAME after point. 3696 doc: /* Insert contents of file FILENAME after point.
3697Returns list of absolute file name and number of characters inserted. 3697Returns list of absolute file name and number of characters inserted.
3698If second argument VISIT is non-nil, the buffer's visited filename 3698If second argument VISIT is non-nil, the buffer's visited filename and
3699and last save file modtime are set, and it is marked unmodified. 3699last save file modtime are set, and it is marked unmodified. If
3700If visiting and the file does not exist, visiting is completed 3700visiting and the file does not exist, visiting is completed before the
3701before the error is signaled. 3701error is signaled.
3702The optional third and fourth arguments BEG and END 3702
3703specify what portion of the file to insert. 3703The optional third and fourth arguments BEG and END specify what portion
3704These arguments count bytes in the file, not characters in the buffer. 3704of the file to insert. These arguments count bytes in the file, not
3705If VISIT is non-nil, BEG and END must be nil. 3705characters in the buffer. If VISIT is non-nil, BEG and END must be nil.
3706 3706
3707If optional fifth argument REPLACE is non-nil, 3707If optional fifth argument REPLACE is non-nil, replace the current
3708it means replace the current buffer contents (in the accessible portion) 3708buffer contents (in the accessible portion) with the file contents.
3709with the file contents. This is better than simply deleting and inserting 3709This is better than simply deleting and inserting the whole thing
3710the whole thing because (1) it preserves some marker positions 3710because (1) it preserves some marker positions and (2) it puts less data
3711and (2) it puts less data in the undo list. 3711in the undo list. When REPLACE is non-nil, the second return value is
3712When REPLACE is non-nil, the value is the number of characters actually read, 3712the number of characters that replace previous buffer contents.
3713which is often less than the number of characters to be read. 3713
3714 3714This function does code conversion according to the value of
3715This does code conversion according to the value of 3715`coding-system-for-read' or `file-coding-system-alist', and sets the
3716`coding-system-for-read' or `file-coding-system-alist', 3716variable `last-coding-system-used' to the coding system actually used. */)
3717and sets the variable `last-coding-system-used' to the coding system
3718actually used. */)
3719 (filename, visit, beg, end, replace) 3717 (filename, visit, beg, end, replace)
3720 Lisp_Object filename, visit, beg, end, replace; 3718 Lisp_Object filename, visit, beg, end, replace;
3721{ 3719{
@@ -3725,8 +3723,8 @@ actually used. */)
3725 register int how_much; 3723 register int how_much;
3726 register int unprocessed; 3724 register int unprocessed;
3727 int count = SPECPDL_INDEX (); 3725 int count = SPECPDL_INDEX ();
3728 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 3726 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
3729 Lisp_Object handler, val, insval, orig_filename; 3727 Lisp_Object handler, val, insval, orig_filename, old_undo;
3730 Lisp_Object p; 3728 Lisp_Object p;
3731 int total = 0; 3729 int total = 0;
3732 int not_regular = 0; 3730 int not_regular = 0;
@@ -3749,8 +3747,9 @@ actually used. */)
3749 val = Qnil; 3747 val = Qnil;
3750 p = Qnil; 3748 p = Qnil;
3751 orig_filename = Qnil; 3749 orig_filename = Qnil;
3750 old_undo = Qnil;
3752 3751
3753 GCPRO4 (filename, val, p, orig_filename); 3752 GCPRO5 (filename, val, p, orig_filename, old_undo);
3754 3753
3755 CHECK_STRING (filename); 3754 CHECK_STRING (filename);
3756 filename = Fexpand_file_name (filename, Qnil); 3755 filename = Fexpand_file_name (filename, Qnil);
@@ -4681,24 +4680,103 @@ actually used. */)
4681 /* Decode file format */ 4680 /* Decode file format */
4682 if (inserted > 0) 4681 if (inserted > 0)
4683 { 4682 {
4684 int empty_undo_list_p = 0; 4683 /* Don't run point motion or modification hooks when decoding. */
4684 int count = SPECPDL_INDEX ();
4685 specbind (Qinhibit_point_motion_hooks, Qt);
4686 specbind (Qinhibit_modification_hooks, Qt);
4687
4688 /* Save old undo list and don't record undo for decoding. */
4689 old_undo = current_buffer->undo_list;
4690 current_buffer->undo_list = Qt;
4685 4691
4686 /* If we're anyway going to discard undo information, don't 4692 if (NILP (replace))
4687 record it in the first place. The buffer's undo list at this
4688 point is either nil or t when visiting a file. */
4689 if (!NILP (visit))
4690 { 4693 {
4691 empty_undo_list_p = NILP (current_buffer->undo_list); 4694 insval = call3 (Qformat_decode,
4692 current_buffer->undo_list = Qt; 4695 Qnil, make_number (inserted), visit);
4696 CHECK_NUMBER (insval);
4697 inserted = XFASTINT (insval);
4698 }
4699 else
4700 {
4701 /* If REPLACE is non-nil and we succeeded in not replacing the
4702 beginning or end of the buffer text with the file's contents,
4703 call format-decode with `point' positioned at the beginning of
4704 the buffer and `inserted' equalling the number of characters
4705 in the buffer. Otherwise, format-decode might fail to
4706 correctly analyze the beginning or end of the buffer. Hence
4707 we temporarily save `point' and `inserted' here and restore
4708 `point' iff format-decode did not insert or delete any text.
4709 Otherwise we leave `point' at point-min. */
4710 int opoint = PT;
4711 int opoint_byte = PT_BYTE;
4712 int oinserted = ZV - BEGV;
4713
4714 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4715 insval = call3 (Qformat_decode,
4716 Qnil, make_number (oinserted), visit);
4717 CHECK_NUMBER (insval);
4718 if (XINT (insval) == oinserted)
4719 SET_PT_BOTH (opoint, opoint_byte);
4720 inserted = XFASTINT (insval);
4693 } 4721 }
4694 4722
4695 insval = call3 (Qformat_decode, 4723 /* For consistency with format-decode call these now iff inserted > 0
4696 Qnil, make_number (inserted), visit); 4724 (martin 2007-06-28) */
4697 CHECK_NUMBER (insval); 4725 p = Vafter_insert_file_functions;
4698 inserted = XFASTINT (insval); 4726 while (CONSP (p))
4727 {
4728 if (NILP (replace))
4729 {
4730 insval = call1 (XCAR (p), make_number (inserted));
4731 if (!NILP (insval))
4732 {
4733 CHECK_NUMBER (insval);
4734 inserted = XFASTINT (insval);
4735 }
4736 }
4737 else
4738 {
4739 /* For the rationale of this see the comment on format-decode above. */
4740 int opoint = PT;
4741 int opoint_byte = PT_BYTE;
4742 int oinserted = ZV - BEGV;
4743
4744 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4745 insval = call1 (XCAR (p), make_number (oinserted));
4746 if (!NILP (insval))
4747 {
4748 CHECK_NUMBER (insval);
4749 if (XINT (insval) == oinserted)
4750 SET_PT_BOTH (opoint, opoint_byte);
4751 inserted = XFASTINT (insval);
4752 }
4753 }
4754
4755 QUIT;
4756 p = XCDR (p);
4757 }
4758
4759 if (NILP (visit))
4760 {
4761 Lisp_Object lbeg, lend;
4762 XSETINT (lbeg, PT);
4763 XSETINT (lend, PT + inserted);
4764 if (CONSP (old_undo))
4765 {
4766 Lisp_Object tem = XCAR (old_undo);
4767 if (CONSP (tem) && INTEGERP (XCAR (tem)) &&
4768 INTEGERP (XCDR (tem)) && EQ (XCAR (tem), lbeg))
4769 /* In the non-visiting case record only the final insertion. */
4770 current_buffer->undo_list =
4771 Fcons (Fcons (lbeg, lend), Fcdr (old_undo));
4772 }
4773 }
4774 else
4775 /* If undo_list was Qt before, keep it that way.
4776 Otherwise start with an empty undo_list. */
4777 current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil;
4699 4778
4700 if (!NILP (visit)) 4779 unbind_to (count, Qnil);
4701 current_buffer->undo_list = empty_undo_list_p ? Qnil : Qt;
4702 } 4780 }
4703 4781
4704 /* Call after-change hooks for the inserted text, aside from the case 4782 /* Call after-change hooks for the inserted text, aside from the case
@@ -4711,19 +4789,6 @@ actually used. */)
4711 update_compositions (PT, PT, CHECK_BORDER); 4789 update_compositions (PT, PT, CHECK_BORDER);
4712 } 4790 }
4713 4791
4714 p = Vafter_insert_file_functions;
4715 while (CONSP (p))
4716 {
4717 insval = call1 (XCAR (p), make_number (inserted));
4718 if (!NILP (insval))
4719 {
4720 CHECK_NUMBER (insval);
4721 inserted = XFASTINT (insval);
4722 }
4723 QUIT;
4724 p = XCDR (p);
4725 }
4726
4727 if (!NILP (visit) 4792 if (!NILP (visit)
4728 && current_buffer->modtime == -1) 4793 && current_buffer->modtime == -1)
4729 { 4794 {
@@ -5144,7 +5209,7 @@ This does code conversion according to the value of
5144 * if we do writes that don't end with a carriage return. Furthermore 5209 * if we do writes that don't end with a carriage return. Furthermore
5145 * it cannot handle writes of more then 16K. The modified 5210 * it cannot handle writes of more then 16K. The modified
5146 * version of "sys_write" in SYSDEP.C (see comment there) copes with 5211 * version of "sys_write" in SYSDEP.C (see comment there) copes with
5147 * this EXCEPT for the last record (iff it doesn't end with a carriage 5212 * this EXCEPT for the last record (if it doesn't end with a carriage
5148 * return). This implies that if your buffer doesn't end with a carriage 5213 * return). This implies that if your buffer doesn't end with a carriage
5149 * return, you get one free... tough. However it also means that if 5214 * return, you get one free... tough. However it also means that if
5150 * we make two calls to sys_write (a la the following code) you can 5215 * we make two calls to sys_write (a la the following code) you can
diff --git a/src/fontset.c b/src/fontset.c
index 26b412804ca..47a682cc975 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -971,7 +971,7 @@ free_face_fontset (f, face)
971} 971}
972 972
973 973
974/* Return 1 iff FACE is suitable for displaying character C. 974/* Return 1 if FACE is suitable for displaying character C.
975 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P 975 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
976 when C is not an ASCII character. */ 976 when C is not an ASCII character. */
977 977
diff --git a/src/fontset.h b/src/fontset.h
index 1c0ef456486..353f01b27b0 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -70,7 +70,7 @@ struct font_info
70 /* Average width of glyphs in the font. */ 70 /* Average width of glyphs in the font. */
71 int average_width; 71 int average_width;
72 72
73 /* 1 iff `vertical-centering-font-regexp' matches this font name. 73 /* 1 if `vertical-centering-font-regexp' matches this font name.
74 In this case, we render characters at vartical center positions 74 In this case, we render characters at vartical center positions
75 of lines. */ 75 of lines. */
76 int vertical_centering; 76 int vertical_centering;
diff --git a/src/getloadavg.c b/src/getloadavg.c
index f40149a8c47..6d66cbfd8a1 100644
--- a/src/getloadavg.c
+++ b/src/getloadavg.c
@@ -484,7 +484,7 @@ static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
484#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE) 484#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
485/* File descriptor open to /dev/kmem or VMS load ave driver. */ 485/* File descriptor open to /dev/kmem or VMS load ave driver. */
486static int channel; 486static int channel;
487/* Nonzero iff channel is valid. */ 487/* Nonzero if channel is valid. */
488static int getloadavg_initialized; 488static int getloadavg_initialized;
489/* Offset in kmem to seek to read load average, or 0 means invalid. */ 489/* Offset in kmem to seek to read load average, or 0 means invalid. */
490static long offset; 490static long offset;
diff --git a/src/gmalloc.c b/src/gmalloc.c
index cf79b9159f2..ccc08e1ff68 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -129,6 +129,8 @@ extern FREE_RETURN_TYPE free PP ((__ptr_t __ptr));
129#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */ 129#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */
130extern __ptr_t memalign PP ((__malloc_size_t __alignment, 130extern __ptr_t memalign PP ((__malloc_size_t __alignment,
131 __malloc_size_t __size)); 131 __malloc_size_t __size));
132extern int posix_memalign PP ((__ptr_t *, __malloc_size_t,
133 __malloc_size_t size));
132#endif 134#endif
133 135
134/* Allocate SIZE bytes on a page boundary. */ 136/* Allocate SIZE bytes on a page boundary. */
@@ -136,6 +138,10 @@ extern __ptr_t memalign PP ((__malloc_size_t __alignment,
136extern __ptr_t valloc PP ((__malloc_size_t __size)); 138extern __ptr_t valloc PP ((__malloc_size_t __size));
137#endif 139#endif
138 140
141#ifdef USE_PTHREAD
142/* Set up mutexes and make malloc etc. thread-safe. */
143extern void malloc_enable_thread PP ((void));
144#endif
139 145
140#ifdef _MALLOC_INTERNAL 146#ifdef _MALLOC_INTERNAL
141 147
@@ -242,10 +248,27 @@ extern void _free_internal_nolock PP ((__ptr_t __ptr));
242 248
243#ifdef USE_PTHREAD 249#ifdef USE_PTHREAD
244extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex; 250extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex;
245#define LOCK() pthread_mutex_lock (&_malloc_mutex) 251extern int _malloc_thread_enabled_p;
246#define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) 252#define LOCK() \
247#define LOCK_ALIGNED_BLOCKS() pthread_mutex_lock (&_aligned_blocks_mutex) 253 do { \
248#define UNLOCK_ALIGNED_BLOCKS() pthread_mutex_unlock (&_aligned_blocks_mutex) 254 if (_malloc_thread_enabled_p) \
255 pthread_mutex_lock (&_malloc_mutex); \
256 } while (0)
257#define UNLOCK() \
258 do { \
259 if (_malloc_thread_enabled_p) \
260 pthread_mutex_unlock (&_malloc_mutex); \
261 } while (0)
262#define LOCK_ALIGNED_BLOCKS() \
263 do { \
264 if (_malloc_thread_enabled_p) \
265 pthread_mutex_lock (&_aligned_blocks_mutex); \
266 } while (0)
267#define UNLOCK_ALIGNED_BLOCKS() \
268 do { \
269 if (_malloc_thread_enabled_p) \
270 pthread_mutex_unlock (&_aligned_blocks_mutex); \
271 } while (0)
249#else 272#else
250#define LOCK() 273#define LOCK()
251#define UNLOCK() 274#define UNLOCK()
@@ -563,6 +586,47 @@ register_heapinfo ()
563#ifdef USE_PTHREAD 586#ifdef USE_PTHREAD
564pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; 587pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER;
565pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; 588pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER;
589int _malloc_thread_enabled_p;
590
591static void
592malloc_atfork_handler_prepare ()
593{
594 LOCK ();
595 LOCK_ALIGNED_BLOCKS ();
596}
597
598static void
599malloc_atfork_handler_parent ()
600{
601 UNLOCK_ALIGNED_BLOCKS ();
602 UNLOCK ();
603}
604
605static void
606malloc_atfork_handler_child ()
607{
608 UNLOCK_ALIGNED_BLOCKS ();
609 UNLOCK ();
610}
611
612/* Set up mutexes and make malloc etc. thread-safe. */
613void
614malloc_enable_thread ()
615{
616 if (_malloc_thread_enabled_p)
617 return;
618
619 /* Some pthread implementations call malloc for statically
620 initialized mutexes when they are used first. To avoid such a
621 situation, we initialize mutexes here while their use is
622 disabled in malloc etc. */
623 pthread_mutex_init (&_malloc_mutex, NULL);
624 pthread_mutex_init (&_aligned_blocks_mutex, NULL);
625 pthread_atfork (malloc_atfork_handler_prepare,
626 malloc_atfork_handler_parent,
627 malloc_atfork_handler_child);
628 _malloc_thread_enabled_p = 1;
629}
566#endif 630#endif
567 631
568static void 632static void
@@ -575,19 +639,6 @@ malloc_initialize_1 ()
575 if (__malloc_initialize_hook) 639 if (__malloc_initialize_hook)
576 (*__malloc_initialize_hook) (); 640 (*__malloc_initialize_hook) ();
577 641
578 /* We don't use recursive mutex because pthread_mutexattr_init may
579 call malloc internally. */
580#if 0 /* defined (USE_PTHREAD) */
581 {
582 pthread_mutexattr_t attr;
583
584 pthread_mutexattr_init (&attr);
585 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
586 pthread_mutex_init (&_malloc_mutex, &attr);
587 pthread_mutexattr_destroy (&attr);
588 }
589#endif
590
591 heapsize = HEAP / BLOCKSIZE; 642 heapsize = HEAP / BLOCKSIZE;
592 _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info)); 643 _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info));
593 if (_heapinfo == NULL) 644 if (_heapinfo == NULL)
@@ -1808,6 +1859,36 @@ memalign (alignment, size)
1808 return result; 1859 return result;
1809} 1860}
1810 1861
1862#ifndef ENOMEM
1863#define ENOMEM 12
1864#endif
1865
1866#ifndef EINVAL
1867#define EINVAL 22
1868#endif
1869
1870int
1871posix_memalign (memptr, alignment, size)
1872 __ptr_t *memptr;
1873 __malloc_size_t alignment;
1874 __malloc_size_t size;
1875{
1876 __ptr_t mem;
1877
1878 if (alignment == 0
1879 || alignment % sizeof (__ptr_t) != 0
1880 || (alignment & (alignment - 1)) != 0)
1881 return EINVAL;
1882
1883 mem = memalign (alignment, size);
1884 if (mem == NULL)
1885 return ENOMEM;
1886
1887 *memptr = mem;
1888
1889 return 0;
1890}
1891
1811#endif /* Not DJGPP v1 */ 1892#endif /* Not DJGPP v1 */
1812/* Allocate memory on a page boundary. 1893/* Allocate memory on a page boundary.
1813 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. 1894 Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f52e68b1230..7dc451a5d04 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3372,8 +3372,16 @@ xg_tool_bar_callback (w, client_data)
3372 3372
3373 key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); 3373 key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY);
3374 XSETFRAME (frame, f); 3374 XSETFRAME (frame, f);
3375
3376 /* We generate two events here. The first one is to set the prefix
3377 to `(tool_bar)', see keyboard.c. */
3375 event.kind = TOOL_BAR_EVENT; 3378 event.kind = TOOL_BAR_EVENT;
3376 event.frame_or_window = frame; 3379 event.frame_or_window = frame;
3380 event.arg = frame;
3381 kbd_buffer_store_event (&event);
3382
3383 event.kind = TOOL_BAR_EVENT;
3384 event.frame_or_window = frame;
3377 event.arg = key; 3385 event.arg = key;
3378 /* Convert between the modifier bits GDK uses and the modifier bits 3386 /* Convert between the modifier bits GDK uses and the modifier bits
3379 Emacs uses. This assumes GDK an X masks are the same, which they are when 3387 Emacs uses. This assumes GDK an X masks are the same, which they are when
@@ -3794,7 +3802,7 @@ update_frame_tool_bar (f)
3794 gtk_container_add (GTK_CONTAINER (weventbox), wbutton); 3802 gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
3795 ti = gtk_tool_item_new (); 3803 ti = gtk_tool_item_new ();
3796 gtk_container_add (GTK_CONTAINER (ti), weventbox); 3804 gtk_container_add (GTK_CONTAINER (ti), weventbox);
3797 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, i); 3805 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
3798 } 3806 }
3799 continue; 3807 continue;
3800 } 3808 }
@@ -3811,7 +3819,7 @@ update_frame_tool_bar (f)
3811 gtk_container_add (GTK_CONTAINER (weventbox), wbutton); 3819 gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
3812 ti = gtk_tool_item_new (); 3820 ti = gtk_tool_item_new ();
3813 gtk_container_add (GTK_CONTAINER (ti), weventbox); 3821 gtk_container_add (GTK_CONTAINER (ti), weventbox);
3814 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, i); 3822 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
3815 3823
3816 3824
3817 /* The EMACS_INT cast avoids a warning. */ 3825 /* The EMACS_INT cast avoids a warning. */
diff --git a/src/image.c b/src/image.c
index 74bb1d75451..a3cd3195217 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1644,6 +1644,8 @@ search_image_cache (f, spec, hash)
1644 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); 1644 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
1645 int i = hash % IMAGE_CACHE_BUCKETS_SIZE; 1645 int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
1646 1646
1647 if (!c) return NULL;
1648
1647 /* If the image spec does not specify a background color, the cached 1649 /* If the image spec does not specify a background color, the cached
1648 image must have the same background color as the current frame. 1650 image must have the same background color as the current frame.
1649 The foreground color must also match, for the sake of monochrome 1651 The foreground color must also match, for the sake of monochrome
@@ -1655,13 +1657,10 @@ search_image_cache (f, spec, hash)
1655 for formats that don't use transparency (such as jpeg), or if the 1657 for formats that don't use transparency (such as jpeg), or if the
1656 image spec specifies :background. However, the extra memory 1658 image spec specifies :background. However, the extra memory
1657 usage is probably negligible in practice, so we don't bother. */ 1659 usage is probably negligible in practice, so we don't bother. */
1658 if (!c) return NULL;
1659 1660
1660 for (img = c->buckets[i]; img; img = img->next) 1661 for (img = c->buckets[i]; img; img = img->next)
1661 if (img->hash == hash 1662 if (img->hash == hash
1662 && !NILP (Fequal (img->spec, spec)) 1663 && !NILP (Fequal (img->spec, spec))
1663 /* If the image spec specifies a background, it doesn't matter
1664 what the frame background is. */
1665 && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) 1664 && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f)
1666 && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) 1665 && img->frame_background == FRAME_BACKGROUND_PIXEL (f))
1667 break; 1666 break;
@@ -6359,11 +6358,14 @@ png_load (f, img)
6359 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); 6358 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
6360 } 6359 }
6361 } 6360 }
6361 /* The commented-out code checked if the png specifies a default
6362 background color, and uses that. Since we use the current
6363 frame background, it is OK for us to ignore this.
6364
6362 else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg)) 6365 else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg))
6363 /* Image contains a background color with which to
6364 combine the image. */
6365 fn_png_set_background (png_ptr, image_bg, 6366 fn_png_set_background (png_ptr, image_bg,
6366 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); 6367 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
6368 */
6367 else 6369 else
6368 { 6370 {
6369 /* Image does not contain a background color with which 6371 /* Image does not contain a background color with which
diff --git a/src/indent.c b/src/indent.c
index d0c50b6bb7e..95afa031485 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -116,7 +116,7 @@ character_width (c, dp)
116 return 0; 116 return 0;
117} 117}
118 118
119/* Return true iff the display table DISPTAB specifies the same widths 119/* Return true if the display table DISPTAB specifies the same widths
120 for characters as WIDTHTAB. We use this to decide when to 120 for characters as WIDTHTAB. We use this to decide when to
121 invalidate the buffer's width_run_cache. */ 121 invalidate the buffer's width_run_cache. */
122 122
diff --git a/src/indent.h b/src/indent.h
index 2d3c158b069..2e873769603 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -61,7 +61,7 @@ extern int last_known_column_point;
61 61
62/* Functions for dealing with the column cache. */ 62/* Functions for dealing with the column cache. */
63 63
64/* Return true iff the display table DISPTAB specifies the same widths 64/* Return true if the display table DISPTAB specifies the same widths
65 for characters as WIDTHTAB. We use this to decide when to 65 for characters as WIDTHTAB. We use this to decide when to
66 invalidate the buffer's column_cache. */ 66 invalidate the buffer's column_cache. */
67int disptab_matches_widthtab P_ ((struct Lisp_Char_Table *disptab, 67int disptab_matches_widthtab P_ ((struct Lisp_Char_Table *disptab,
diff --git a/src/insdel.c b/src/insdel.c
index 3c7bc4b8bd8..6736b22e2be 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2170,6 +2170,20 @@ prepare_to_modify_buffer (start, end, preserve_ptr)
2170#define FETCH_END \ 2170#define FETCH_END \
2171 (! NILP (end_marker) ? Fmarker_position (end_marker) : end) 2171 (! NILP (end_marker) ? Fmarker_position (end_marker) : end)
2172 2172
2173/* Set a variable to nil if an error occurred.
2174 VAL is a cons-cell whose car is the variable name, and whose cdr is
2175 either nil (to mean that there was indeed an error), or non-nil to mean
2176 that the was no error (which thus causes this function to do
2177 nothing). */
2178Lisp_Object
2179reset_var_on_error (val)
2180 Lisp_Object val;
2181{
2182 if (NILP (XCDR (val)))
2183 Fset (XCAR (val), Qnil);
2184 return Qnil;
2185}
2186
2173/* Signal a change to the buffer immediately before it happens. 2187/* Signal a change to the buffer immediately before it happens.
2174 START_INT and END_INT are the bounds of the text to be changed. 2188 START_INT and END_INT are the bounds of the text to be changed.
2175 2189
@@ -2185,6 +2199,7 @@ signal_before_change (start_int, end_int, preserve_ptr)
2185 Lisp_Object start_marker, end_marker; 2199 Lisp_Object start_marker, end_marker;
2186 Lisp_Object preserve_marker; 2200 Lisp_Object preserve_marker;
2187 struct gcpro gcpro1, gcpro2, gcpro3; 2201 struct gcpro gcpro1, gcpro2, gcpro3;
2202 int count = SPECPDL_INDEX ();
2188 2203
2189 if (inhibit_modification_hooks) 2204 if (inhibit_modification_hooks)
2190 return; 2205 return;
@@ -2196,6 +2211,8 @@ signal_before_change (start_int, end_int, preserve_ptr)
2196 end_marker = Qnil; 2211 end_marker = Qnil;
2197 GCPRO3 (preserve_marker, start_marker, end_marker); 2212 GCPRO3 (preserve_marker, start_marker, end_marker);
2198 2213
2214 specbind (Qinhibit_modification_hooks, Qt);
2215
2199 /* If buffer is unmodified, run a special hook for that case. */ 2216 /* If buffer is unmodified, run a special hook for that case. */
2200 if (SAVE_MODIFF >= MODIFF 2217 if (SAVE_MODIFF >= MODIFF
2201 && !NILP (Vfirst_change_hook) 2218 && !NILP (Vfirst_change_hook)
@@ -2210,46 +2227,22 @@ signal_before_change (start_int, end_int, preserve_ptr)
2210 if (!NILP (Vbefore_change_functions)) 2227 if (!NILP (Vbefore_change_functions))
2211 { 2228 {
2212 Lisp_Object args[3]; 2229 Lisp_Object args[3];
2213 Lisp_Object before_change_functions; 2230 Lisp_Object rvoe_arg = Fcons (Qbefore_change_functions, Qnil);
2214 Lisp_Object after_change_functions;
2215 struct gcpro gcpro1, gcpro2;
2216 struct buffer *old = current_buffer;
2217 struct buffer *new;
2218 2231
2219 PRESERVE_VALUE; 2232 PRESERVE_VALUE;
2220 PRESERVE_START_END; 2233 PRESERVE_START_END;
2221 2234
2222 /* "Bind" before-change-functions and after-change-functions 2235 /* Mark before-change-functions to be reset to nil in case of error. */
2223 to nil--but in a way that errors don't know about. 2236 record_unwind_protect (reset_var_on_error, rvoe_arg);
2224 That way, if there's an error in them, they will stay nil. */
2225 before_change_functions = Vbefore_change_functions;
2226 after_change_functions = Vafter_change_functions;
2227 Vbefore_change_functions = Qnil;
2228 Vafter_change_functions = Qnil;
2229 GCPRO2 (before_change_functions, after_change_functions);
2230 2237
2231 /* Actually run the hook functions. */ 2238 /* Actually run the hook functions. */
2232 args[0] = Qbefore_change_functions; 2239 args[0] = Qbefore_change_functions;
2233 args[1] = FETCH_START; 2240 args[1] = FETCH_START;
2234 args[2] = FETCH_END; 2241 args[2] = FETCH_END;
2235 run_hook_list_with_args (before_change_functions, 3, args); 2242 Frun_hook_with_args (3, args);
2236 2243
2237 /* "Unbind" the variables we "bound" to nil. Beware a 2244 /* There was no error: unarm the reset_on_error. */
2238 buffer-local hook which changes the buffer when run (e.g. W3). */ 2245 XSETCDR (rvoe_arg, Qt);
2239 if (old != current_buffer)
2240 {
2241 new = current_buffer;
2242 set_buffer_internal (old);
2243 Vbefore_change_functions = before_change_functions;
2244 Vafter_change_functions = after_change_functions;
2245 set_buffer_internal (new);
2246 }
2247 else
2248 {
2249 Vbefore_change_functions = before_change_functions;
2250 Vafter_change_functions = after_change_functions;
2251 }
2252 UNGCPRO;
2253 } 2246 }
2254 2247
2255 if (current_buffer->overlays_before || current_buffer->overlays_after) 2248 if (current_buffer->overlays_before || current_buffer->overlays_after)
@@ -2265,6 +2258,8 @@ signal_before_change (start_int, end_int, preserve_ptr)
2265 free_marker (end_marker); 2258 free_marker (end_marker);
2266 RESTORE_VALUE; 2259 RESTORE_VALUE;
2267 UNGCPRO; 2260 UNGCPRO;
2261
2262 unbind_to (count, Qnil);
2268} 2263}
2269 2264
2270/* Signal a change immediately after it happens. 2265/* Signal a change immediately after it happens.
@@ -2278,6 +2273,7 @@ void
2278signal_after_change (charpos, lendel, lenins) 2273signal_after_change (charpos, lendel, lenins)
2279 int charpos, lendel, lenins; 2274 int charpos, lendel, lenins;
2280{ 2275{
2276 int count = SPECPDL_INDEX ();
2281 if (inhibit_modification_hooks) 2277 if (inhibit_modification_hooks)
2282 return; 2278 return;
2283 2279
@@ -2308,48 +2304,25 @@ signal_after_change (charpos, lendel, lenins)
2308 if (!NILP (combine_after_change_list)) 2304 if (!NILP (combine_after_change_list))
2309 Fcombine_after_change_execute (); 2305 Fcombine_after_change_execute ();
2310 2306
2307 specbind (Qinhibit_modification_hooks, Qt);
2308
2311 if (!NILP (Vafter_change_functions)) 2309 if (!NILP (Vafter_change_functions))
2312 { 2310 {
2313 Lisp_Object args[4]; 2311 Lisp_Object args[4];
2314 Lisp_Object before_change_functions; 2312 Lisp_Object rvoe_arg = Fcons (Qafter_change_functions, Qnil);
2315 Lisp_Object after_change_functions; 2313
2316 struct buffer *old = current_buffer; 2314 /* Mark after-change-functions to be reset to nil in case of error. */
2317 struct buffer *new; 2315 record_unwind_protect (reset_var_on_error, rvoe_arg);
2318 struct gcpro gcpro1, gcpro2;
2319
2320 /* "Bind" before-change-functions and after-change-functions
2321 to nil--but in a way that errors don't know about.
2322 That way, if there's an error in them, they will stay nil. */
2323 before_change_functions = Vbefore_change_functions;
2324 after_change_functions = Vafter_change_functions;
2325 Vbefore_change_functions = Qnil;
2326 Vafter_change_functions = Qnil;
2327 GCPRO2 (before_change_functions, after_change_functions);
2328 2316
2329 /* Actually run the hook functions. */ 2317 /* Actually run the hook functions. */
2330 args[0] = Qafter_change_functions; 2318 args[0] = Qafter_change_functions;
2331 XSETFASTINT (args[1], charpos); 2319 XSETFASTINT (args[1], charpos);
2332 XSETFASTINT (args[2], charpos + lenins); 2320 XSETFASTINT (args[2], charpos + lenins);
2333 XSETFASTINT (args[3], lendel); 2321 XSETFASTINT (args[3], lendel);
2334 run_hook_list_with_args (after_change_functions, 2322 Frun_hook_with_args (4, args);
2335 4, args);
2336 2323
2337 /* "Unbind" the variables we "bound" to nil. Beware a 2324 /* There was no error: unarm the reset_on_error. */
2338 buffer-local hook which changes the buffer when run (e.g. W3). */ 2325 XSETCDR (rvoe_arg, Qt);
2339 if (old != current_buffer)
2340 {
2341 new = current_buffer;
2342 set_buffer_internal (old);
2343 Vbefore_change_functions = before_change_functions;
2344 Vafter_change_functions = after_change_functions;
2345 set_buffer_internal (new);
2346 }
2347 else
2348 {
2349 Vbefore_change_functions = before_change_functions;
2350 Vafter_change_functions = after_change_functions;
2351 }
2352 UNGCPRO;
2353 } 2326 }
2354 2327
2355 if (current_buffer->overlays_before || current_buffer->overlays_after) 2328 if (current_buffer->overlays_before || current_buffer->overlays_after)
@@ -2365,6 +2338,8 @@ signal_after_change (charpos, lendel, lenins)
2365 if (lendel == 0) 2338 if (lendel == 0)
2366 report_interval_modification (make_number (charpos), 2339 report_interval_modification (make_number (charpos),
2367 make_number (charpos + lenins)); 2340 make_number (charpos + lenins));
2341
2342 unbind_to (count, Qnil);
2368} 2343}
2369 2344
2370Lisp_Object 2345Lisp_Object
diff --git a/src/intervals.c b/src/intervals.c
index 3547e62d2bf..74269c7d406 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -2200,7 +2200,7 @@ set_point_both (buffer, charpos, bytepos)
2200 2200
2201 temp_set_point_both (buffer, charpos, bytepos); 2201 temp_set_point_both (buffer, charpos, bytepos);
2202 2202
2203 /* We run point-left and point-entered hooks here, iff the 2203 /* We run point-left and point-entered hooks here, if the
2204 two intervals are not equivalent. These hooks take 2204 two intervals are not equivalent. These hooks take
2205 (old_point, new_point) as arguments. */ 2205 (old_point, new_point) as arguments. */
2206 if (NILP (Vinhibit_point_motion_hooks) 2206 if (NILP (Vinhibit_point_motion_hooks)
diff --git a/src/keyboard.c b/src/keyboard.c
index 28403792fb0..c55faba6f7f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -500,7 +500,7 @@ static struct input_event * volatile kbd_store_ptr;
500/* The above pair of variables forms a "queue empty" flag. When we 500/* The above pair of variables forms a "queue empty" flag. When we
501 enqueue a non-hook event, we increment kbd_store_ptr. When we 501 enqueue a non-hook event, we increment kbd_store_ptr. When we
502 dequeue a non-hook event, we increment kbd_fetch_ptr. We say that 502 dequeue a non-hook event, we increment kbd_fetch_ptr. We say that
503 there is input available iff the two pointers are not equal. 503 there is input available if the two pointers are not equal.
504 504
505 Why not just have a flag set and cleared by the enqueuing and 505 Why not just have a flag set and cleared by the enqueuing and
506 dequeuing functions? Such a flag could be screwed up by interrupts 506 dequeuing functions? Such a flag could be screwed up by interrupts
@@ -3590,7 +3590,7 @@ restore_getcjmp (temp)
3590 kbd_buffer_store_event places events in kbd_buffer, and 3590 kbd_buffer_store_event places events in kbd_buffer, and
3591 kbd_buffer_get_event retrieves them. */ 3591 kbd_buffer_get_event retrieves them. */
3592 3592
3593/* Return true iff there are any events in the queue that read-char 3593/* Return true if there are any events in the queue that read-char
3594 would return. If this returns false, a read-char would block. */ 3594 would return. If this returns false, a read-char would block. */
3595static int 3595static int
3596readable_events (flags) 3596readable_events (flags)
diff --git a/src/keyboard.h b/src/keyboard.h
index e24f9a133ae..15e55ad4e67 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -240,7 +240,7 @@ extern Lisp_Object item_properties;
240 240
241/* Macros for dealing with lispy events. */ 241/* Macros for dealing with lispy events. */
242 242
243/* True iff EVENT has data fields describing it (i.e. a mouse click). */ 243/* True if EVENT has data fields describing it (i.e. a mouse click). */
244#define EVENT_HAS_PARAMETERS(event) (CONSP (event)) 244#define EVENT_HAS_PARAMETERS(event) (CONSP (event))
245 245
246/* Extract the head from an event. 246/* Extract the head from an event.
diff --git a/src/keymap.c b/src/keymap.c
index 7a1fc998758..bfc81614245 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3898,7 +3898,7 @@ don't alter it yourself. */);
3898 DEFVAR_LISP ("minor-mode-map-alist", &Vminor_mode_map_alist, 3898 DEFVAR_LISP ("minor-mode-map-alist", &Vminor_mode_map_alist,
3899 doc: /* Alist of keymaps to use for minor modes. 3899 doc: /* Alist of keymaps to use for minor modes.
3900Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read 3900Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
3901key sequences and look up bindings iff VARIABLE's value is non-nil. 3901key sequences and look up bindings if VARIABLE's value is non-nil.
3902If two active keymaps bind the same key, the keymap appearing earlier 3902If two active keymaps bind the same key, the keymap appearing earlier
3903in the list takes precedence. */); 3903in the list takes precedence. */);
3904 Vminor_mode_map_alist = Qnil; 3904 Vminor_mode_map_alist = Qnil;
diff --git a/src/lisp.h b/src/lisp.h
index b26e7768ebb..c047355b21c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1428,7 +1428,7 @@ typedef unsigned char UCHAR;
1428#define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g)) 1428#define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g))
1429#define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g)) 1429#define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g))
1430 1430
1431/* Return 1 iff GLYPH contains valid character code. */ 1431/* Return 1 if GLYPH contains valid character code. */
1432#define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1) 1432#define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1)
1433 1433
1434/* The ID of the mode line highlighting face. */ 1434/* The ID of the mode line highlighting face. */
@@ -1536,7 +1536,7 @@ typedef unsigned char UCHAR;
1536 "dead", which is what we want; this is an argument-checking macro, and 1536 "dead", which is what we want; this is an argument-checking macro, and
1537 the user should never get access to interior windows. 1537 the user should never get access to interior windows.
1538 1538
1539 A window of any sort, leaf or interior, is dead iff the buffer, 1539 A window of any sort, leaf or interior, is dead if the buffer,
1540 vchild, and hchild members are all nil. */ 1540 vchild, and hchild members are all nil. */
1541 1541
1542#define CHECK_LIVE_WINDOW(x) \ 1542#define CHECK_LIVE_WINDOW(x) \
diff --git a/src/lread.c b/src/lread.c
index 6ca7121b363..fcc344d5875 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -101,7 +101,7 @@ static Lisp_Object Qload_force_doc_strings;
101extern Lisp_Object Qevent_symbol_element_mask; 101extern Lisp_Object Qevent_symbol_element_mask;
102extern Lisp_Object Qfile_exists_p; 102extern Lisp_Object Qfile_exists_p;
103 103
104/* non-zero iff inside `load' */ 104/* non-zero if inside `load' */
105int load_in_progress; 105int load_in_progress;
106 106
107/* Directory in which the sources were found. */ 107/* Directory in which the sources were found. */
@@ -1324,7 +1324,7 @@ in which case file-name-handlers are ignored. */)
1324 On success, returns a file descriptor. On failure, returns -1. 1324 On success, returns a file descriptor. On failure, returns -1.
1325 1325
1326 SUFFIXES is a list of strings containing possible suffixes. 1326 SUFFIXES is a list of strings containing possible suffixes.
1327 The empty suffix is automatically added iff the list is empty. 1327 The empty suffix is automatically added if the list is empty.
1328 1328
1329 PREDICATE non-nil means don't open the files, 1329 PREDICATE non-nil means don't open the files,
1330 just look for one that satisfies the predicate. In this case, 1330 just look for one that satisfies the predicate. In this case,
@@ -4208,7 +4208,7 @@ customize `jka-compr-load-suffixes' rather than the present variable. */);
4208 Vload_file_rep_suffixes = Fcons (empty_unibyte_string, Qnil); 4208 Vload_file_rep_suffixes = Fcons (empty_unibyte_string, Qnil);
4209 4209
4210 DEFVAR_BOOL ("load-in-progress", &load_in_progress, 4210 DEFVAR_BOOL ("load-in-progress", &load_in_progress,
4211 doc: /* Non-nil iff inside of `load'. */); 4211 doc: /* Non-nil if inside of `load'. */);
4212 4212
4213 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, 4213 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist,
4214 doc: /* An alist of expressions to be evalled when particular files are loaded. 4214 doc: /* An alist of expressions to be evalled when particular files are loaded.
diff --git a/src/m/7300.h b/src/m/7300.h
index b590593abc8..6e439a829cc 100644
--- a/src/m/7300.h
+++ b/src/m/7300.h
@@ -30,7 +30,7 @@ Boston, MA 02110-1301, USA. */
30/* # define SHORTNAMES */ 30/* # define SHORTNAMES */
31 31
32 32
33/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 33/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
34 is the most significant byte. */ 34 is the most significant byte. */
35 35
36#define WORDS_BIG_ENDIAN 36#define WORDS_BIG_ENDIAN
diff --git a/src/m/acorn.h b/src/m/acorn.h
index 7fa5991e28b..148d46454ab 100644
--- a/src/m/acorn.h
+++ b/src/m/acorn.h
@@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA. */
21 21
22 22
23 23
24/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 24/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
25 is the most significant byte. */ 25 is the most significant byte. */
26 26
27#undef WORDS_BIG_ENDIAN 27#undef WORDS_BIG_ENDIAN
diff --git a/src/m/alliant-2800.h b/src/m/alliant-2800.h
index 3d65f9d1f12..405267afb2b 100644
--- a/src/m/alliant-2800.h
+++ b/src/m/alliant-2800.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-3" */ 25 USUAL-OPSYS="bsd4-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#undef WORDS_BIG_ENDIAN 30#undef WORDS_BIG_ENDIAN
diff --git a/src/m/alliant.h b/src/m/alliant.h
index b871d4a2385..7cad4bfb0c1 100644
--- a/src/m/alliant.h
+++ b/src/m/alliant.h
@@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */
26 operating system this machine is likely to run. 26 operating system this machine is likely to run.
27 USUAL-OPSYS="bsd4-2" */ 27 USUAL-OPSYS="bsd4-2" */
28 28
29/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 30 is the most significant byte. */
31 31
32#define WORDS_BIG_ENDIAN 32#define WORDS_BIG_ENDIAN
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 84e74d581d1..5e46a05ab68 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -35,7 +35,7 @@ NOTE-END
35 on OSF 4/5 -- fx. */ 35 on OSF 4/5 -- fx. */
36#endif 36#endif
37 37
38/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 38/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
39 is the most significant byte. */ 39 is the most significant byte. */
40 40
41#undef WORDS_BIG_ENDIAN 41#undef WORDS_BIG_ENDIAN
diff --git a/src/m/altos.h b/src/m/altos.h
index 8a1cb138345..0f4bb9b810f 100644
--- a/src/m/altos.h
+++ b/src/m/altos.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/amdahl.h b/src/m/amdahl.h
index 3d9ee17e91f..486e2925a55 100644
--- a/src/m/amdahl.h
+++ b/src/m/amdahl.h
@@ -31,7 +31,7 @@ This file works with the Amdahl uts native C compiler. The 5.2u370
31compiler is so brain damaged that it is not even worth trying to use it. 31compiler is so brain damaged that it is not even worth trying to use it.
32*/ 32*/
33 33
34/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 34/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
35 is the most significant byte. */ 35 is the most significant byte. */
36 36
37#define WORDS_BIG_ENDIAN 37#define WORDS_BIG_ENDIAN
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index fbd53a955a2..681be8b0647 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */
26#define BITS_PER_LONG 64 26#define BITS_PER_LONG 64
27#define BITS_PER_EMACS_INT 64 27#define BITS_PER_EMACS_INT 64
28 28
29/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 30 is the most significant byte. */
31 31
32#undef WORDS_BIG_ENDIAN 32#undef WORDS_BIG_ENDIAN
diff --git a/src/m/apollo.h b/src/m/apollo.h
index b769c24c294..2eac3098db9 100644
--- a/src/m/apollo.h
+++ b/src/m/apollo.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-3" */ 25 USUAL-OPSYS="bsd4-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/arm.h b/src/m/arm.h
index b1df83f9b70..697179723f7 100644
--- a/src/m/arm.h
+++ b/src/m/arm.h
@@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA. */
21 21
22 22
23 23
24/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 24/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
25 is the most significant byte. */ 25 is the most significant byte. */
26 26
27#undef WORDS_BIG_ENDIAN 27#undef WORDS_BIG_ENDIAN
diff --git a/src/m/att3b.h b/src/m/att3b.h
index 3344aabc2a9..8e9a589bcd2 100644
--- a/src/m/att3b.h
+++ b/src/m/att3b.h
@@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */
26 operating system this machine is likely to run. 26 operating system this machine is likely to run.
27 USUAL-OPSYS="usg5-2-2" */ 27 USUAL-OPSYS="usg5-2-2" */
28 28
29/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 30 is the most significant byte. */
31 31
32#define WORDS_BIG_ENDIAN 32#define WORDS_BIG_ENDIAN
diff --git a/src/m/aviion.h b/src/m/aviion.h
index 7f3f7f253d5..832feb79a00 100644
--- a/src/m/aviion.h
+++ b/src/m/aviion.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22 22
23/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 23/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
24 is the most significant byte. */ 24 is the most significant byte. */
25 25
26#define WORDS_BIG_ENDIAN 26#define WORDS_BIG_ENDIAN
diff --git a/src/m/celerity.h b/src/m/celerity.h
index 76f1e1729b3..556c2765883 100644
--- a/src/m/celerity.h
+++ b/src/m/celerity.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-2" */ 25 USUAL-OPSYS="bsd4-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/clipper.h b/src/m/clipper.h
index de99ba97eb5..c0006f48eab 100644
--- a/src/m/clipper.h
+++ b/src/m/clipper.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22 22
23/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 23/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
24 is the most significant byte. */ 24 is the most significant byte. */
25 25
26#undef WORDS_BIG_ENDIAN 26#undef WORDS_BIG_ENDIAN
diff --git a/src/m/cnvrgnt.h b/src/m/cnvrgnt.h
index f64fc86b08b..22478a273b6 100644
--- a/src/m/cnvrgnt.h
+++ b/src/m/cnvrgnt.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22 22
23/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 23/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
24 is the most significant byte. */ 24 is the most significant byte. */
25 25
26#define WORDS_BIG_ENDIAN 26#define WORDS_BIG_ENDIAN
diff --git a/src/m/convex.h b/src/m/convex.h
index 7f90d22117c..c8f447cf2fa 100644
--- a/src/m/convex.h
+++ b/src/m/convex.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-3" */ 25 USUAL-OPSYS="bsd4-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/cydra5.h b/src/m/cydra5.h
index 2361fb4b589..4c95f226371 100644
--- a/src/m/cydra5.h
+++ b/src/m/cydra5.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-3" */ 25 USUAL-OPSYS="usg5-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/delta88k.h b/src/m/delta88k.h
index c767e1db1ca..b5d0c8f190b 100644
--- a/src/m/delta88k.h
+++ b/src/m/delta88k.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-3" */ 25 USUAL-OPSYS="usg5-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/dpx2.h b/src/m/dpx2.h
index 1c1d146a08a..b39ef93ee34 100644
--- a/src/m/dpx2.h
+++ b/src/m/dpx2.h
@@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA. */
32/* #define ncl_el /* DPX/2 210,220 etc */ 32/* #define ncl_el /* DPX/2 210,220 etc */
33/* #define ncl_mr 1 /* DPX/2 320,340 (and 360,380 ?) */ 33/* #define ncl_mr 1 /* DPX/2 320,340 (and 360,380 ?) */
34 34
35/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 35/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
36 is the most significant byte. */ 36 is the most significant byte. */
37 37
38#define WORDS_BIG_ENDIAN 38#define WORDS_BIG_ENDIAN
diff --git a/src/m/dual.h b/src/m/dual.h
index 4fda7a8a96c..d287f9502d2 100644
--- a/src/m/dual.h
+++ b/src/m/dual.h
@@ -35,7 +35,7 @@ Dual running Uniplus (-machine=dual -opsystem=unipl5-2)
35NOTE-END */ 35NOTE-END */
36 36
37 37
38/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 38/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
39 is the most significant byte. */ 39 is the most significant byte. */
40 40
41#define WORDS_BIG_ENDIAN 41#define WORDS_BIG_ENDIAN
diff --git a/src/m/elxsi.h b/src/m/elxsi.h
index 81689e66e52..07a00bbf714 100644
--- a/src/m/elxsi.h
+++ b/src/m/elxsi.h
@@ -27,7 +27,7 @@ Boston, MA 02110-1301, USA. */
27/* This file was modified by Matt Crawford <matt@tank.uchicago.edu> 27/* This file was modified by Matt Crawford <matt@tank.uchicago.edu>
28 to work under Elxsi's 12.0 release of BSD unix. */ 28 to work under Elxsi's 12.0 release of BSD unix. */
29 29
30/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 30/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
31 is the most significant byte. */ 31 is the most significant byte. */
32 32
33#undef WORDS_BIG_ENDIAN 33#undef WORDS_BIG_ENDIAN
diff --git a/src/m/gould.h b/src/m/gould.h
index c31f50249e7..cd16e09b785 100644
--- a/src/m/gould.h
+++ b/src/m/gould.h
@@ -49,7 +49,7 @@ Gould Power Node (-machine=gould -opsystem=bsd4-2 or bsd4-3)
49 A site running a pre-release of 2.1 should #define RELEASE2_1 in config.h. 49 A site running a pre-release of 2.1 should #define RELEASE2_1 in config.h.
50NOTE-END */ 50NOTE-END */
51 51
52/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 52/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
53 is the most significant byte. */ 53 is the most significant byte. */
54 54
55#define WORDS_BIG_ENDIAN 55#define WORDS_BIG_ENDIAN
diff --git a/src/m/hp800.h b/src/m/hp800.h
index d54690104b5..83465052478 100644
--- a/src/m/hp800.h
+++ b/src/m/hp800.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="hpux" */ 25 USUAL-OPSYS="hpux" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/hp9000s300.h b/src/m/hp9000s300.h
index 3718bb3f3ae..9a27065f866 100644
--- a/src/m/hp9000s300.h
+++ b/src/m/hp9000s300.h
@@ -59,7 +59,7 @@ NOTE-END */
59 59
60/* #define HPUX_5 */ 60/* #define HPUX_5 */
61 61
62/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 62/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
63 is the most significant byte. */ 63 is the most significant byte. */
64 64
65#define WORDS_BIG_ENDIAN 65#define WORDS_BIG_ENDIAN
diff --git a/src/m/i860.h b/src/m/i860.h
index 1255f2f1576..6d79c5c8d38 100644
--- a/src/m/i860.h
+++ b/src/m/i860.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ 25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#undef WORDS_BIG_ENDIAN 30#undef WORDS_BIG_ENDIAN
diff --git a/src/m/ia64.h b/src/m/ia64.h
index b6fea6b8fd7..8f7fed8d69e 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */
23#define BITS_PER_LONG 64 23#define BITS_PER_LONG 64
24#define BITS_PER_EMACS_INT 64 24#define BITS_PER_EMACS_INT 64
25 25
26/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 26/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
27 is the most significant byte. */ 27 is the most significant byte. */
28 28
29#undef WORDS_BIG_ENDIAN 29#undef WORDS_BIG_ENDIAN
diff --git a/src/m/ibm370aix.h b/src/m/ibm370aix.h
index f632a30780b..0195ec141ab 100644
--- a/src/m/ibm370aix.h
+++ b/src/m/ibm370aix.h
@@ -30,7 +30,7 @@ Boston, MA 02110-1301, USA. */
30#undef INTEL386 30#undef INTEL386
31#undef aix386 31#undef aix386
32 32
33/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 33/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
34 is the most significant byte. */ 34 is the most significant byte. */
35 35
36#define WORDS_BIG_ENDIAN 36#define WORDS_BIG_ENDIAN
diff --git a/src/m/ibmps2-aix.h b/src/m/ibmps2-aix.h
index 8882052b006..8c975b81bb9 100644
--- a/src/m/ibmps2-aix.h
+++ b/src/m/ibmps2-aix.h
@@ -30,7 +30,7 @@ NOTE-START
30 work with certain new X window managers, and may be suboptimal. 30 work with certain new X window managers, and may be suboptimal.
31NOTE-END */ 31NOTE-END */
32 32
33/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 33/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
34 is the most significant byte. */ 34 is the most significant byte. */
35 35
36#undef WORDS_BIG_ENDIAN 36#undef WORDS_BIG_ENDIAN
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h
index 2a298e7f760..d542c07ad0a 100644
--- a/src/m/ibmrs6000.h
+++ b/src/m/ibmrs6000.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="aix3-1" */ 25 USUAL-OPSYS="aix3-1" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#ifdef USG5_4 30#ifdef USG5_4
diff --git a/src/m/ibmrt-aix.h b/src/m/ibmrt-aix.h
index d24e99fe6d6..57a9dbc4df1 100644
--- a/src/m/ibmrt-aix.h
+++ b/src/m/ibmrt-aix.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2-2" */ 25 USUAL-OPSYS="usg5-2-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/ibmrt.h b/src/m/ibmrt.h
index 55cbfd88371..ca32db94518 100644
--- a/src/m/ibmrt.h
+++ b/src/m/ibmrt.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-2" */ 25 USUAL-OPSYS="bsd4-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index aece0f7599e..1c7165e04c0 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ 25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
index fb1f210c634..64ede365d0c 100644
--- a/src/m/ibms390x.h
+++ b/src/m/ibms390x.h
@@ -36,7 +36,7 @@ NOTE-END */
36#define BITS_PER_LONG 64 36#define BITS_PER_LONG 64
37#define BITS_PER_EMACS_INT 64 37#define BITS_PER_EMACS_INT 64
38 38
39/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 39/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
40 is the most significant byte. */ 40 is the most significant byte. */
41 41
42#define WORDS_BIG_ENDIAN 42#define WORDS_BIG_ENDIAN
diff --git a/src/m/intel386.h b/src/m/intel386.h
index 7c6c2106d17..22205ed762c 100644
--- a/src/m/intel386.h
+++ b/src/m/intel386.h
@@ -50,7 +50,7 @@ Prime EXL (-machine=intel386 -opsystem=usg5-3)
50 Minor changes merged in 19.1. 50 Minor changes merged in 19.1.
51NOTE-END */ 51NOTE-END */
52 52
53/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 53/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
54 is the most significant byte. */ 54 is the most significant byte. */
55 55
56#undef WORDS_BIG_ENDIAN 56#undef WORDS_BIG_ENDIAN
diff --git a/src/m/iris4d.h b/src/m/iris4d.h
index d918c25aede..4c15131e595 100644
--- a/src/m/iris4d.h
+++ b/src/m/iris4d.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22 22
23/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 23/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
24 is the most significant byte. */ 24 is the most significant byte. */
25 25
26#define WORDS_BIG_ENDIAN 26#define WORDS_BIG_ENDIAN
diff --git a/src/m/irist.h b/src/m/irist.h
index 0b33bd964aa..c0d55f96d0f 100644
--- a/src/m/irist.h
+++ b/src/m/irist.h
@@ -58,7 +58,7 @@ NOTE-END */
58 (copy-file), it would say that it is non-critical... 58 (copy-file), it would say that it is non-critical...
59#endif /* 0 */ 59#endif /* 0 */
60 60
61/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 61/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
62 is the most significant byte. */ 62 is the most significant byte. */
63 63
64#define WORDS_BIG_ENDIAN 64#define WORDS_BIG_ENDIAN
diff --git a/src/m/isi-ov.h b/src/m/isi-ov.h
index 7e25ed9d277..6706ee9981b 100644
--- a/src/m/isi-ov.h
+++ b/src/m/isi-ov.h
@@ -30,7 +30,7 @@ NOTE-END */
30 30
31#define ISI68K 31#define ISI68K
32 32
33/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 33/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
34 is the most significant byte. */ 34 is the most significant byte. */
35 35
36#define WORDS_BIG_ENDIAN 36#define WORDS_BIG_ENDIAN
diff --git a/src/m/m68k.h b/src/m/m68k.h
index c771e863711..4c600a44d8c 100644
--- a/src/m/m68k.h
+++ b/src/m/m68k.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 the size of various data types. */ 24 the size of various data types. */
25 25
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/macppc.h b/src/m/macppc.h
index cc4afe31519..d4561c0289f 100644
--- a/src/m/macppc.h
+++ b/src/m/macppc.h
@@ -19,7 +19,7 @@ along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
23 is the most significant byte. */ 23 is the most significant byte. */
24 24
25#define WORDS_BIG_ENDIAN 25#define WORDS_BIG_ENDIAN
diff --git a/src/m/masscomp.h b/src/m/masscomp.h
index ac753de1537..4e95c268860 100644
--- a/src/m/masscomp.h
+++ b/src/m/masscomp.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="rtu" */ 25 USUAL-OPSYS="rtu" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/mega68.h b/src/m/mega68.h
index 6d991ba06a2..0d22b572fc5 100644
--- a/src/m/mega68.h
+++ b/src/m/mega68.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-2" */ 25 USUAL-OPSYS="bsd4-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/mg1.h b/src/m/mg1.h
index 647544e21e4..515e9e23a96 100644
--- a/src/m/mg1.h
+++ b/src/m/mg1.h
@@ -34,7 +34,7 @@ own configuration files, please let the Free Software Foundation in on
34your work; we'd like to distribute this information. 34your work; we'd like to distribute this information.
35NOTE-END */ 35NOTE-END */
36 36
37/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 37/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
38 is the most significant byte. */ 38 is the most significant byte. */
39 39
40#undef WORDS_BIG_ENDIAN 40#undef WORDS_BIG_ENDIAN
diff --git a/src/m/mips-siemens.h b/src/m/mips-siemens.h
index d90a651d361..53366a1332e 100644
--- a/src/m/mips-siemens.h
+++ b/src/m/mips-siemens.h
@@ -36,7 +36,7 @@ This is the m- file for SNI RM*00 machines. Use s- sinix5-4.h file!
36With this the file mips-siemens.h is obsolete. 36With this the file mips-siemens.h is obsolete.
37NOTE-END */ 37NOTE-END */
38 38
39/* Define BIG_ENDIAN iff lowest-numbered byte in a word 39/* Define BIG_ENDIAN if lowest-numbered byte in a word
40 is the most significant byte. */ 40 is the most significant byte. */
41 41
42#define BIG_ENDIAN 42#define BIG_ENDIAN
diff --git a/src/m/mips.h b/src/m/mips.h
index b18324fb8b7..6c039c5e14c 100644
--- a/src/m/mips.h
+++ b/src/m/mips.h
@@ -29,7 +29,7 @@ Use mips4.h for RISCOS version 4; use s-bsd4-3.h with the BSD world.
29Note that the proper m file for the Decstation is pmax.h. 29Note that the proper m file for the Decstation is pmax.h.
30NOTE-END */ 30NOTE-END */
31 31
32/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 32/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
33 is the most significant byte. */ 33 is the most significant byte. */
34 34
35#if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL)) 35#if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL))
diff --git a/src/m/news.h b/src/m/news.h
index 419015dd150..084c5abb92c 100644
--- a/src/m/news.h
+++ b/src/m/news.h
@@ -34,7 +34,7 @@ NOTE-END */
34#define m68000 34#define m68000
35#endif 35#endif
36 36
37/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 37/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
38 is the most significant byte. */ 38 is the most significant byte. */
39 39
40#define WORDS_BIG_ENDIAN 40#define WORDS_BIG_ENDIAN
diff --git a/src/m/next.h b/src/m/next.h
index ef92607d957..bca8ac39d47 100644
--- a/src/m/next.h
+++ b/src/m/next.h
@@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */
26#define NeXT 26#define NeXT
27#endif 27#endif
28 28
29/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 30 is the most significant byte. */
31 31
32/* Let the compiler tell us. */ 32/* Let the compiler tell us. */
diff --git a/src/m/ns16000.h b/src/m/ns16000.h
index c64bfa32482..6feddd97610 100644
--- a/src/m/ns16000.h
+++ b/src/m/ns16000.h
@@ -30,7 +30,7 @@ For a Tektronix 16000 box (a 6130, perhaps?), use `-opsystem=bsd4-2'.
30Use `-machine=ns16000' for both. 30Use `-machine=ns16000' for both.
31NOTE-END */ 31NOTE-END */
32 32
33/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 33/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
34 is the most significant byte. */ 34 is the most significant byte. */
35 35
36#undef WORDS_BIG_ENDIAN 36#undef WORDS_BIG_ENDIAN
diff --git a/src/m/ns32000.h b/src/m/ns32000.h
index 0b776115ca8..b6484b4b219 100644
--- a/src/m/ns32000.h
+++ b/src/m/ns32000.h
@@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */
25 operating system this machine is likely to run. 25 operating system this machine is likely to run.
26 USUAL-OPSYS="usg5-2" */ 26 USUAL-OPSYS="usg5-2" */
27 27
28/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 28/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
29 is the most significant byte. */ 29 is the most significant byte. */
30 30
31#undef WORDS_BIG_ENDIAN 31#undef WORDS_BIG_ENDIAN
diff --git a/src/m/nu.h b/src/m/nu.h
index 347606a6c01..279d14ff915 100644
--- a/src/m/nu.h
+++ b/src/m/nu.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/orion.h b/src/m/orion.h
index 36a74b3cc3b..cc3a7e395fc 100644
--- a/src/m/orion.h
+++ b/src/m/orion.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-2" */ 25 USUAL-OPSYS="bsd4-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#undef WORDS_BIG_ENDIAN 30#undef WORDS_BIG_ENDIAN
diff --git a/src/m/orion105.h b/src/m/orion105.h
index 73408ed1b2f..fabcf67e2a9 100644
--- a/src/m/orion105.h
+++ b/src/m/orion105.h
@@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */
25 operating system this machine is likely to run. 25 operating system this machine is likely to run.
26 USUAL-OPSYS="bsd4-2" */ 26 USUAL-OPSYS="bsd4-2" */
27 27
28/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 28/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
29 is the most significant byte. */ 29 is the most significant byte. */
30 30
31#undef WORDS_BIG_ENDIAN 31#undef WORDS_BIG_ENDIAN
diff --git a/src/m/pfa50.h b/src/m/pfa50.h
index 8f1f146000e..5f98dc993c7 100644
--- a/src/m/pfa50.h
+++ b/src/m/pfa50.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22 22
23/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 23/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
24 is the most significant byte. */ 24 is the most significant byte. */
25 25
26#define WORDS_BIG_ENDIAN 26#define WORDS_BIG_ENDIAN
diff --git a/src/m/plexus.h b/src/m/plexus.h
index 4a4e6a32f7f..51961977904 100644
--- a/src/m/plexus.h
+++ b/src/m/plexus.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/powermac.h b/src/m/powermac.h
index 729bbb0358b..2dde47bd6cf 100644
--- a/src/m/powermac.h
+++ b/src/m/powermac.h
@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */
23 operating system this machine is likely to run. 23 operating system this machine is likely to run.
24 USUAL-OPSYS="darwin" */ 24 USUAL-OPSYS="darwin" */
25 25
26/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 26/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
27 is the most significant byte. */ 27 is the most significant byte. */
28 28
29#define WORDS_BIG_ENDIAN 29#define WORDS_BIG_ENDIAN
diff --git a/src/m/powerpcle.h b/src/m/powerpcle.h
index 403d6986bf8..5be26e93b17 100644
--- a/src/m/powerpcle.h
+++ b/src/m/powerpcle.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 USUAL-OPSYS="Solaris2.5.1 Windows/NT AIX 4.1.2" 24 USUAL-OPSYS="Solaris2.5.1 Windows/NT AIX 4.1.2"
25*/ 25*/
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#undef WORDS_BIG_ENDIAN 30#undef WORDS_BIG_ENDIAN
diff --git a/src/m/pyramid.h b/src/m/pyramid.h
index 9ee3fefe387..1b834c60ba0 100644
--- a/src/m/pyramid.h
+++ b/src/m/pyramid.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-2" */ 25 USUAL-OPSYS="bsd4-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/sequent.h b/src/m/sequent.h
index be5d3f19bd1..3c06d854b41 100644
--- a/src/m/sequent.h
+++ b/src/m/sequent.h
@@ -31,7 +31,7 @@ NOTE-END */
31/* NOTE: this file works for DYNIX release 2.0 31/* NOTE: this file works for DYNIX release 2.0
32 (not tested on 1.3) on NS32000's */ 32 (not tested on 1.3) on NS32000's */
33 33
34/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 34/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
35 is the most significant byte. */ 35 is the most significant byte. */
36 36
37#undef WORDS_BIG_ENDIAN 37#undef WORDS_BIG_ENDIAN
diff --git a/src/m/sh3el.h b/src/m/sh3el.h
index 5851ade1523..eefcccea6de 100644
--- a/src/m/sh3el.h
+++ b/src/m/sh3el.h
@@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. */
23 operating system this machine is likely to run. 23 operating system this machine is likely to run.
24 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ 24 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
25 25
26/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 26/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
27 is the most significant byte. */ 27 is the most significant byte. */
28 28
29#undef WORDS_BIG_ENDIAN 29#undef WORDS_BIG_ENDIAN
diff --git a/src/m/sparc.h b/src/m/sparc.h
index f59c2c2b969..8df81ee91aa 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -28,7 +28,7 @@ Use -opsystem=sunos4 for operating system version 4, and
28-opsystem=bsd4-2 for earlier versions. 28-opsystem=bsd4-2 for earlier versions.
29NOTE-END */ 29NOTE-END */
30 30
31/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 31/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
32 is the most significant byte. */ 32 is the most significant byte. */
33 33
34#define WORDS_BIG_ENDIAN 34#define WORDS_BIG_ENDIAN
diff --git a/src/m/sps7.h b/src/m/sps7.h
index 68acf2c6c52..67fc60c1b6a 100644
--- a/src/m/sps7.h
+++ b/src/m/sps7.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/sr2k.h b/src/m/sr2k.h
index ba4a9a905ab..6c17795e058 100644
--- a/src/m/sr2k.h
+++ b/src/m/sr2k.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="hpux" */ 25 USUAL-OPSYS="hpux" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/stride.h b/src/m/stride.h
index cb0380024a1..d846a6c9843 100644
--- a/src/m/stride.h
+++ b/src/m/stride.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/sun1.h b/src/m/sun1.h
index fda451a9310..03cb4e803ff 100644
--- a/src/m/sun1.h
+++ b/src/m/sun1.h
@@ -40,7 +40,7 @@ Sun 1, 2 and 3 (-machine=sun1, -machine=sun2, -machine=sun3;
40 problems caused by bugs in the "export" version of SunOS 4. 40 problems caused by bugs in the "export" version of SunOS 4.
41NOTE-END */ 41NOTE-END */
42 42
43/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 43/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
44 is the most significant byte. */ 44 is the most significant byte. */
45 45
46#define WORDS_BIG_ENDIAN 46#define WORDS_BIG_ENDIAN
diff --git a/src/m/sun2.h b/src/m/sun2.h
index 00b7ae97c4d..e764ded3ce7 100644
--- a/src/m/sun2.h
+++ b/src/m/sun2.h
@@ -42,7 +42,7 @@ Sun 1, 2 and 3 (-machine=sun1, -machine=sun2, -machine=sun3;
42 problems caused by bugs in the "export" version of SunOS 4. 42 problems caused by bugs in the "export" version of SunOS 4.
43NOTE-END */ 43NOTE-END */
44 44
45/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 45/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
46 is the most significant byte. */ 46 is the most significant byte. */
47 47
48#define WORDS_BIG_ENDIAN 48#define WORDS_BIG_ENDIAN
diff --git a/src/m/tad68k.h b/src/m/tad68k.h
index 5e982a314ab..c8be8763fb5 100644
--- a/src/m/tad68k.h
+++ b/src/m/tad68k.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-3" */ 25 USUAL-OPSYS="usg5-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/tahoe.h b/src/m/tahoe.h
index 8fe41cd4109..9b9271577fc 100644
--- a/src/m/tahoe.h
+++ b/src/m/tahoe.h
@@ -29,7 +29,7 @@ Use -opsystem=bsd4-2 or -opsystem=bsd4-3, depending on the version of
29Berkeley you are running. 29Berkeley you are running.
30NOTE-END */ 30NOTE-END */
31 31
32/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 32/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
33 is the most significant byte. */ 33 is the most significant byte. */
34 34
35#define WORDS_BIG_ENDIAN 35#define WORDS_BIG_ENDIAN
diff --git a/src/m/targon31.h b/src/m/targon31.h
index 0c657e0ea5d..39e995b076d 100644
--- a/src/m/targon31.h
+++ b/src/m/targon31.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2-2" */ 25 USUAL-OPSYS="usg5-2-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/tek4300.h b/src/m/tek4300.h
index be43210212a..6498238461d 100644
--- a/src/m/tek4300.h
+++ b/src/m/tek4300.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="bsd4-3" */ 25 USUAL-OPSYS="bsd4-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/tekxd88.h b/src/m/tekxd88.h
index 1d46bb9bb55..f351229292f 100644
--- a/src/m/tekxd88.h
+++ b/src/m/tekxd88.h
@@ -22,7 +22,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22Boston, MA 02110-1301, USA. */ 22Boston, MA 02110-1301, USA. */
23 23
24 24
25/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 25/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
26 is the most significant byte. */ 26 is the most significant byte. */
27 27
28#define WORDS_BIG_ENDIAN 28#define WORDS_BIG_ENDIAN
diff --git a/src/m/template.h b/src/m/template.h
index fccc5b0901c..b893ba23df2 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ 25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/tower32.h b/src/m/tower32.h
index 0ce623b7f37..01daada2423 100644
--- a/src/m/tower32.h
+++ b/src/m/tower32.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2-2" */ 25 USUAL-OPSYS="usg5-2-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/tower32v3.h b/src/m/tower32v3.h
index 226c0e2640a..ff209edab41 100644
--- a/src/m/tower32v3.h
+++ b/src/m/tower32v3.h
@@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */
25 operating system this machine is likely to run. 25 operating system this machine is likely to run.
26 USUAL-OPSYS="usg5-3" */ 26 USUAL-OPSYS="usg5-3" */
27 27
28/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 28/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
29 is the most significant byte. */ 29 is the most significant byte. */
30 30
31#define WORDS_BIG_ENDIAN 31#define WORDS_BIG_ENDIAN
diff --git a/src/m/ustation.h b/src/m/ustation.h
index f88cdc5ee63..0ac833c28da 100644
--- a/src/m/ustation.h
+++ b/src/m/ustation.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-3" */ 25 USUAL-OPSYS="usg5-3" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/vax.h b/src/m/vax.h
index 80844ba3ba6..82695074424 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -52,7 +52,7 @@ Vax running VMS (-opsystem=vms)
52 52
53NOTE-END */ 53NOTE-END */
54 54
55/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 55/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
56 is the most significant byte. */ 56 is the most significant byte. */
57 57
58#undef WORDS_BIG_ENDIAN 58#undef WORDS_BIG_ENDIAN
diff --git a/src/m/wicat.h b/src/m/wicat.h
index 67409844666..3ac7b530739 100644
--- a/src/m/wicat.h
+++ b/src/m/wicat.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="usg5-2" */ 25 USUAL-OPSYS="usg5-2" */
26 26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
diff --git a/src/m/windowsnt.h b/src/m/windowsnt.h
index f1efe64a4f5..ddad551c772 100644
--- a/src/m/windowsnt.h
+++ b/src/m/windowsnt.h
@@ -24,7 +24,7 @@ Boston, MA 02110-1301, USA. */
24 operating system this machine is likely to run. 24 operating system this machine is likely to run.
25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */ 25 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
26 26
27/* Define BIG_ENDIAN iff lowest-numbered byte in a word 27/* Define BIG_ENDIAN if lowest-numbered byte in a word
28 is the most significant byte. */ 28 is the most significant byte. */
29 29
30/* #define BIG_ENDIAN */ 30/* #define BIG_ENDIAN */
diff --git a/src/m/xps100.h b/src/m/xps100.h
index 691f5fedbd6..3b378319ceb 100644
--- a/src/m/xps100.h
+++ b/src/m/xps100.h
@@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */
26 operating system this machine is likely to run. 26 operating system this machine is likely to run.
27 USUAL-OPSYS="usg5-2" */ 27 USUAL-OPSYS="usg5-2" */
28 28
29/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word 29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 30 is the most significant byte. */
31 31
32#define WORDS_BIG_ENDIAN 32#define WORDS_BIG_ENDIAN
diff --git a/src/mac.c b/src/mac.c
index e81db1479b9..64af2407ab1 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -1127,18 +1127,15 @@ Lisp_Object
1127cfdate_to_lisp (date) 1127cfdate_to_lisp (date)
1128 CFDateRef date; 1128 CFDateRef date;
1129{ 1129{
1130 static const CFGregorianDate epoch_gdate = {1970, 1, 1, 0, 0, 0.0}; 1130 CFTimeInterval sec;
1131 static CFAbsoluteTime epoch = 0.0, sec; 1131 int high, low, microsec;
1132 int high, low;
1133 1132
1134 if (epoch == 0.0) 1133 sec = CFDateGetAbsoluteTime (date) + kCFAbsoluteTimeIntervalSince1970;
1135 epoch = CFGregorianDateGetAbsoluteTime (epoch_gdate, NULL);
1136
1137 sec = CFDateGetAbsoluteTime (date) - epoch;
1138 high = sec / 65536.0; 1134 high = sec / 65536.0;
1139 low = sec - high * 65536.0; 1135 low = sec - high * 65536.0;
1136 microsec = (sec - floor (sec)) * 1000000.0;
1140 1137
1141 return list3 (make_number (high), make_number (low), make_number (0)); 1138 return list3 (make_number (high), make_number (low), make_number (microsec));
1142} 1139}
1143 1140
1144 1141
diff --git a/src/macmenu.c b/src/macmenu.c
index e2d4ba8be38..883a8463c2d 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -2331,6 +2331,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
2331 ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET) 2331 ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET)
2332 2332
2333extern EMACS_TIME timer_check P_ ((int)); 2333extern EMACS_TIME timer_check P_ ((int));
2334static int quit_dialog_event_loop;
2334 2335
2335static pascal OSStatus 2336static pascal OSStatus
2336mac_handle_dialog_event (next_handler, event, data) 2337mac_handle_dialog_event (next_handler, event, data)
@@ -2340,7 +2341,6 @@ mac_handle_dialog_event (next_handler, event, data)
2340{ 2341{
2341 OSStatus err, result = eventNotHandledErr; 2342 OSStatus err, result = eventNotHandledErr;
2342 WindowRef window = (WindowRef) data; 2343 WindowRef window = (WindowRef) data;
2343 int quit_event_loop_p = 0;
2344 2344
2345 switch (GetEventClass (event)) 2345 switch (GetEventClass (event))
2346 { 2346 {
@@ -2355,7 +2355,7 @@ mac_handle_dialog_event (next_handler, event, data)
2355 if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID)) 2355 if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID))
2356 { 2356 {
2357 SetWRefCon (window, command.commandID); 2357 SetWRefCon (window, command.commandID);
2358 quit_event_loop_p = 1; 2358 quit_dialog_event_loop = 1;
2359 break; 2359 break;
2360 } 2360 }
2361 2361
@@ -2379,7 +2379,7 @@ mac_handle_dialog_event (next_handler, event, data)
2379 switch (char_code) 2379 switch (char_code)
2380 { 2380 {
2381 case kEscapeCharCode: 2381 case kEscapeCharCode:
2382 quit_event_loop_p = 1; 2382 quit_dialog_event_loop = 1;
2383 break; 2383 break;
2384 2384
2385 default: 2385 default:
@@ -2395,7 +2395,7 @@ mac_handle_dialog_event (next_handler, event, data)
2395 NULL, &key_code); 2395 NULL, &key_code);
2396 if (err == noErr) 2396 if (err == noErr)
2397 if (mac_quit_char_key_p (modifiers, key_code)) 2397 if (mac_quit_char_key_p (modifiers, key_code))
2398 quit_event_loop_p = 1; 2398 quit_dialog_event_loop = 1;
2399 } 2399 }
2400 break; 2400 break;
2401 } 2401 }
@@ -2406,7 +2406,7 @@ mac_handle_dialog_event (next_handler, event, data)
2406 abort (); 2406 abort ();
2407 } 2407 }
2408 2408
2409 if (quit_event_loop_p) 2409 if (quit_dialog_event_loop)
2410 { 2410 {
2411 err = QuitEventLoop (GetCurrentEventLoop ()); 2411 err = QuitEventLoop (GetCurrentEventLoop ());
2412 if (err == noErr) 2412 if (err == noErr)
@@ -2733,6 +2733,7 @@ create_and_show_dialog (f, first_wv)
2733 { 2733 {
2734 EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); 2734 EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget ();
2735 2735
2736 quit_dialog_event_loop = 0;
2736 while (1) 2737 while (1)
2737 { 2738 {
2738 EMACS_TIME next_time = timer_check (1); 2739 EMACS_TIME next_time = timer_check (1);
@@ -2758,12 +2759,22 @@ create_and_show_dialog (f, first_wv)
2758 SendEventToEventTarget (event, toolbox_dispatcher); 2759 SendEventToEventTarget (event, toolbox_dispatcher);
2759 ReleaseEvent (event); 2760 ReleaseEvent (event);
2760 } 2761 }
2762#ifdef MAC_OSX
2761 else if (err != eventLoopTimedOutErr) 2763 else if (err != eventLoopTimedOutErr)
2762 { 2764 {
2763 if (err == eventLoopQuitErr) 2765 if (err == eventLoopQuitErr)
2764 err = noErr; 2766 err = noErr;
2765 break; 2767 break;
2766 } 2768 }
2769#else
2770 /* The return value of ReceiveNextEvent seems to be
2771 unreliable. Use our own global variable instead. */
2772 if (quit_dialog_event_loop)
2773 {
2774 err = noErr;
2775 break;
2776 }
2777#endif
2767 } 2778 }
2768 } 2779 }
2769 if (err == noErr) 2780 if (err == noErr)
diff --git a/src/macselect.c b/src/macselect.c
index 04034c499b7..9515a5774ec 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -25,22 +25,27 @@ Boston, MA 02110-1301, USA. */
25#include "blockinput.h" 25#include "blockinput.h"
26#include "keymap.h" 26#include "keymap.h"
27 27
28#if !TARGET_API_MAC_CARBON 28#if TARGET_API_MAC_CARBON
29typedef ScrapRef Selection;
30#else /* !TARGET_API_MAC_CARBON */
31#include <Scrap.h>
29#include <Endian.h> 32#include <Endian.h>
30typedef int ScrapRef; 33typedef int Selection;
31typedef ResType ScrapFlavorType;
32#endif /* !TARGET_API_MAC_CARBON */ 34#endif /* !TARGET_API_MAC_CARBON */
33 35
34static OSStatus get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *)); 36static OSStatus mac_get_selection_from_symbol P_ ((Lisp_Object, int,
35static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object)); 37 Selection *));
36static int valid_scrap_target_type_p P_ ((Lisp_Object)); 38static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object,
37static OSStatus clear_scrap P_ ((ScrapRef *)); 39 Selection));
38static OSStatus put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object)); 40static int mac_valid_selection_target_p P_ ((Lisp_Object));
39static OSStatus put_scrap_private_timestamp P_ ((ScrapRef, unsigned long)); 41static OSStatus mac_clear_selection P_ ((Selection *));
40static ScrapFlavorType scrap_has_target_type P_ ((ScrapRef, Lisp_Object)); 42static Lisp_Object mac_get_selection_ownership_info P_ ((Selection));
41static Lisp_Object get_scrap_string P_ ((ScrapRef, Lisp_Object)); 43static int mac_valid_selection_value_p P_ ((Lisp_Object, Lisp_Object));
42static OSStatus get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *)); 44static OSStatus mac_put_selection_value P_ ((Selection, Lisp_Object,
43static Lisp_Object get_scrap_target_type_list P_ ((ScrapRef)); 45 Lisp_Object));
46static int mac_selection_has_target_p P_ ((Selection, Lisp_Object));
47static Lisp_Object mac_get_selection_value P_ ((Selection, Lisp_Object));
48static Lisp_Object mac_get_selection_target_list P_ ((Selection));
44static void x_own_selection P_ ((Lisp_Object, Lisp_Object)); 49static void x_own_selection P_ ((Lisp_Object, Lisp_Object));
45static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int)); 50static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int));
46static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, 51static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object,
@@ -56,7 +61,7 @@ void init_service_handler P_ ((void));
56Lisp_Object QPRIMARY, QSECONDARY, QTIMESTAMP, QTARGETS; 61Lisp_Object QPRIMARY, QSECONDARY, QTIMESTAMP, QTARGETS;
57 62
58static Lisp_Object Vx_lost_selection_functions; 63static Lisp_Object Vx_lost_selection_functions;
59/* Coding system for communicating with other programs via scrap. */ 64/* Coding system for communicating with other programs via selections. */
60static Lisp_Object Vselection_coding_system; 65static Lisp_Object Vselection_coding_system;
61 66
62/* Coding system for the next communicating with other programs. */ 67/* Coding system for the next communicating with other programs. */
@@ -70,23 +75,24 @@ static Lisp_Object Qforeign_selection;
70extern unsigned long last_event_timestamp; 75extern unsigned long last_event_timestamp;
71 76
72/* This is an association list whose elements are of the form 77/* This is an association list whose elements are of the form
73 ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) 78 ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME OWNERSHIP-INFO)
74 SELECTION-NAME is a lisp symbol. 79 SELECTION-NAME is a lisp symbol.
75 SELECTION-VALUE is the value that emacs owns for that selection. 80 SELECTION-VALUE is the value that emacs owns for that selection.
76 It may be any kind of Lisp object. 81 It may be any kind of Lisp object.
77 SELECTION-TIMESTAMP is the time at which emacs began owning this selection, 82 SELECTION-TIMESTAMP is the time at which emacs began owning this selection,
78 as a cons of two 16-bit numbers (making a 32 bit time.) 83 as a cons of two 16-bit numbers (making a 32 bit time.)
79 FRAME is the frame for which we made the selection. 84 FRAME is the frame for which we made the selection.
80 If there is an entry in this alist, and the data for the flavor 85 OWNERSHIP-INFO is a value saved when emacs owns for that selection.
81 type SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP in the corresponding scrap 86 If another application takes the ownership of that selection
82 (if exists) coincides with SELECTION-TIMESTAMP, then it can be 87 later, then newly examined ownership info value should be
83 assumed that Emacs owns that selection. 88 different from the saved one.
89 If there is an entry in this alist, the current ownership info for
90 the selection coincides with OWNERSHIP-INFO, then it can be
91 assumed that Emacs owns that selection.
84 The only (eq) parts of this list that are visible from Lisp are the 92 The only (eq) parts of this list that are visible from Lisp are the
85 selection-values. */ 93 selection-values. */
86static Lisp_Object Vselection_alist; 94static Lisp_Object Vselection_alist;
87 95
88#define SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP 'Etsp'
89
90/* This is an alist whose CARs are selection-types and whose CDRs are 96/* This is an alist whose CARs are selection-types and whose CDRs are
91 the names of Lisp functions to call to convert the given Emacs 97 the names of Lisp functions to call to convert the given Emacs
92 selection value to a string representing the given selection type. 98 selection value to a string representing the given selection type.
@@ -104,21 +110,22 @@ static Lisp_Object Qmac_scrap_name, Qmac_ostype;
104static Lisp_Object Vmac_service_selection; 110static Lisp_Object Vmac_service_selection;
105#endif 111#endif
106 112
107/* Get a reference to the scrap corresponding to the symbol SYM. The 113/* Get a reference to the selection corresponding to the symbol SYM.
108 reference is set to *SCRAP, and it becomes NULL if there's no 114 The reference is set to *SEL, and it becomes NULL if there's no
109 corresponding scrap. Clear the scrap if CLEAR_P is non-zero. */ 115 corresponding selection. Clear the selection if CLEAR_P is
116 non-zero. */
110 117
111static OSStatus 118static OSStatus
112get_scrap_from_symbol (sym, clear_p, scrap) 119mac_get_selection_from_symbol (sym, clear_p, sel)
113 Lisp_Object sym; 120 Lisp_Object sym;
114 int clear_p; 121 int clear_p;
115 ScrapRef *scrap; 122 Selection *sel;
116{ 123{
117 OSStatus err = noErr; 124 OSStatus err = noErr;
118 Lisp_Object str = Fget (sym, Qmac_scrap_name); 125 Lisp_Object str = Fget (sym, Qmac_scrap_name);
119 126
120 if (!STRINGP (str)) 127 if (!STRINGP (str))
121 *scrap = NULL; 128 *sel = NULL;
122 else 129 else
123 { 130 {
124#if TARGET_API_MAC_CARBON 131#if TARGET_API_MAC_CARBON
@@ -127,19 +134,19 @@ get_scrap_from_symbol (sym, clear_p, scrap)
127 OptionBits options = (clear_p ? kScrapClearNamedScrap 134 OptionBits options = (clear_p ? kScrapClearNamedScrap
128 : kScrapGetNamedScrap); 135 : kScrapGetNamedScrap);
129 136
130 err = GetScrapByName (scrap_name, options, scrap); 137 err = GetScrapByName (scrap_name, options, sel);
131 CFRelease (scrap_name); 138 CFRelease (scrap_name);
132#else /* !MAC_OSX */ 139#else /* !MAC_OSX */
133 if (clear_p) 140 if (clear_p)
134 err = ClearCurrentScrap (); 141 err = ClearCurrentScrap ();
135 if (err == noErr) 142 if (err == noErr)
136 err = GetCurrentScrap (scrap); 143 err = GetCurrentScrap (sel);
137#endif /* !MAC_OSX */ 144#endif /* !MAC_OSX */
138#else /* !TARGET_API_MAC_CARBON */ 145#else /* !TARGET_API_MAC_CARBON */
139 if (clear_p) 146 if (clear_p)
140 err = ZeroScrap (); 147 err = ZeroScrap ();
141 if (err == noErr) 148 if (err == noErr)
142 *scrap = 1; 149 *sel = 1;
143#endif /* !TARGET_API_MAC_CARBON */ 150#endif /* !TARGET_API_MAC_CARBON */
144 } 151 }
145 152
@@ -147,138 +154,154 @@ get_scrap_from_symbol (sym, clear_p, scrap)
147} 154}
148 155
149/* Get a scrap flavor type from the symbol SYM. Return 0 if no 156/* Get a scrap flavor type from the symbol SYM. Return 0 if no
150 corresponding flavor type. */ 157 corresponding flavor type. If SEL is non-zero, the return value is
158 non-zero only when the SEL has the flavor type. */
151 159
152static ScrapFlavorType 160static ScrapFlavorType
153get_flavor_type_from_symbol (sym) 161get_flavor_type_from_symbol (sym, sel)
154 Lisp_Object sym; 162 Lisp_Object sym;
163 Selection sel;
155{ 164{
156 Lisp_Object str = Fget (sym, Qmac_ostype); 165 Lisp_Object str = Fget (sym, Qmac_ostype);
166 ScrapFlavorType flavor_type;
157 167
158 if (STRINGP (str) && SBYTES (str) == 4) 168 if (STRINGP (str) && SBYTES (str) == 4)
159 return EndianU32_BtoN (*((UInt32 *) SDATA (str))); 169 flavor_type = EndianU32_BtoN (*((UInt32 *) SDATA (str)));
170 else
171 flavor_type = 0;
172
173 if (flavor_type && sel)
174 {
175#if TARGET_API_MAC_CARBON
176 OSStatus err;
177 ScrapFlavorFlags flags;
160 178
161 return 0; 179 err = GetScrapFlavorFlags (sel, flavor_type, &flags);
180 if (err != noErr)
181 flavor_type = 0;
182#else /* !TARGET_API_MAC_CARBON */
183 SInt32 size, offset;
184
185 size = GetScrap (NULL, flavor_type, &offset);
186 if (size < 0)
187 flavor_type = 0;
188#endif /* !TARGET_API_MAC_CARBON */
189 }
190
191 return flavor_type;
162} 192}
163 193
164/* Check if the symbol SYM has a corresponding scrap flavor type. */ 194/* Check if the symbol SYM has a corresponding selection target type. */
165 195
166static int 196static int
167valid_scrap_target_type_p (sym) 197mac_valid_selection_target_p (sym)
168 Lisp_Object sym; 198 Lisp_Object sym;
169{ 199{
170 return get_flavor_type_from_symbol (sym) != 0; 200 return get_flavor_type_from_symbol (sym, 0) != 0;
171} 201}
172 202
173/* Clear the scrap whose reference is *SCRAP. */ 203/* Clear the selection whose reference is *SEL. */
174 204
175static INLINE OSStatus 205static OSStatus
176clear_scrap (scrap) 206mac_clear_selection (sel)
177 ScrapRef *scrap; 207 Selection *sel;
178{ 208{
179#if TARGET_API_MAC_CARBON 209#if TARGET_API_MAC_CARBON
180#ifdef MAC_OSX 210#ifdef MAC_OSX
181 return ClearScrap (scrap); 211 return ClearScrap (sel);
182#else 212#else
183 return ClearCurrentScrap (); 213 OSStatus err;
214
215 err = ClearCurrentScrap ();
216 if (err == noErr)
217 err = GetCurrentScrap (sel);
218 return err;
184#endif 219#endif
185#else /* !TARGET_API_MAC_CARBON */ 220#else /* !TARGET_API_MAC_CARBON */
186 return ZeroScrap (); 221 return ZeroScrap ();
187#endif /* !TARGET_API_MAC_CARBON */ 222#endif /* !TARGET_API_MAC_CARBON */
188} 223}
189 224
190/* Put Lisp String STR to the scrap SCRAP. The target type is 225/* Get ownership information for SEL. Emacs can detect a change of
191 specified by TYPE. */ 226 the ownership by comparing saved and current values of the
227 ownership information. */
192 228
193static OSStatus 229static Lisp_Object
194put_scrap_string (scrap, type, str) 230mac_get_selection_ownership_info (sel)
195 ScrapRef scrap; 231 Selection sel;
196 Lisp_Object type, str;
197{ 232{
198 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type);
199
200 if (flavor_type == 0)
201 return noTypeErr;
202
203#if TARGET_API_MAC_CARBON 233#if TARGET_API_MAC_CARBON
204 return PutScrapFlavor (scrap, flavor_type, kScrapFlavorMaskNone, 234 return long_to_cons ((unsigned long) sel);
205 SBYTES (str), SDATA (str));
206#else /* !TARGET_API_MAC_CARBON */ 235#else /* !TARGET_API_MAC_CARBON */
207 return PutScrap (SBYTES (str), flavor_type, SDATA (str)); 236 ScrapStuffPtr scrap_info = InfoScrap ();
237
238 return make_number (scrap_info->scrapCount);
208#endif /* !TARGET_API_MAC_CARBON */ 239#endif /* !TARGET_API_MAC_CARBON */
209} 240}
210 241
211/* Put TIMESTAMP to the scrap SCRAP. The timestamp is used for 242/* Return non-zero if VALUE is a valid selection value for TARGET. */
212 checking if the scrap is owned by the process. */
213 243
214static INLINE OSStatus 244static int
215put_scrap_private_timestamp (scrap, timestamp) 245mac_valid_selection_value_p (value, target)
216 ScrapRef scrap; 246 Lisp_Object value, target;
217 unsigned long timestamp;
218{ 247{
219#if TARGET_API_MAC_CARBON 248 return STRINGP (value);
220 return PutScrapFlavor (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
221 kScrapFlavorMaskSenderOnly,
222 sizeof (timestamp), &timestamp);
223#else /* !TARGET_API_MAC_CARBON */
224 return PutScrap (sizeof (timestamp), SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
225 &timestamp);
226#endif /* !TARGET_API_MAC_CARBON */
227} 249}
228 250
229/* Check if data for the target type TYPE is available in SCRAP. */ 251/* Put Lisp Object VALUE to the selection SEL. The target type is
252 specified by TARGET. */
230 253
231static ScrapFlavorType 254static OSStatus
232scrap_has_target_type (scrap, type) 255mac_put_selection_value (sel, target, value)
233 ScrapRef scrap; 256 Selection sel;
234 Lisp_Object type; 257 Lisp_Object target, value;
235{ 258{
236 OSStatus err; 259 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, 0);
237 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type);
238 260
239 if (flavor_type) 261 if (flavor_type == 0 || !STRINGP (value))
240 { 262 return noTypeErr;
241#if TARGET_API_MAC_CARBON
242 ScrapFlavorFlags flags;
243 263
244 err = GetScrapFlavorFlags (scrap, flavor_type, &flags); 264#if TARGET_API_MAC_CARBON
245 if (err != noErr) 265 return PutScrapFlavor (sel, flavor_type, kScrapFlavorMaskNone,
246 flavor_type = 0; 266 SBYTES (value), SDATA (value));
247#else /* !TARGET_API_MAC_CARBON */ 267#else /* !TARGET_API_MAC_CARBON */
248 SInt32 size, offset; 268 return PutScrap (SBYTES (value), flavor_type, SDATA (value));
249
250 size = GetScrap (NULL, flavor_type, &offset);
251 if (size < 0)
252 flavor_type = 0;
253#endif /* !TARGET_API_MAC_CARBON */ 269#endif /* !TARGET_API_MAC_CARBON */
254 } 270}
255 271
256 return flavor_type; 272/* Check if data for the target type TARGET is available in SEL. */
273
274static int
275mac_selection_has_target_p (sel, target)
276 Selection sel;
277 Lisp_Object target;
278{
279 return get_flavor_type_from_symbol (target, sel) != 0;
257} 280}
258 281
259/* Get data for the target type TYPE from SCRAP and create a Lisp 282/* Get data for the target type TARGET from SEL and create a Lisp
260 string. Return nil if failed to get data. */ 283 string. Return nil if failed to get data. */
261 284
262static Lisp_Object 285static Lisp_Object
263get_scrap_string (scrap, type) 286mac_get_selection_value (sel, target)
264 ScrapRef scrap; 287 Selection sel;
265 Lisp_Object type; 288 Lisp_Object target;
266{ 289{
267 OSStatus err; 290 OSStatus err;
268 Lisp_Object result = Qnil; 291 Lisp_Object result = Qnil;
269 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); 292 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, sel);
270#if TARGET_API_MAC_CARBON 293#if TARGET_API_MAC_CARBON
271 Size size; 294 Size size;
272 295
273 if (flavor_type) 296 if (flavor_type)
274 { 297 {
275 err = GetScrapFlavorSize (scrap, flavor_type, &size); 298 err = GetScrapFlavorSize (sel, flavor_type, &size);
276 if (err == noErr) 299 if (err == noErr)
277 { 300 {
278 do 301 do
279 { 302 {
280 result = make_uninit_string (size); 303 result = make_uninit_string (size);
281 err = GetScrapFlavorData (scrap, flavor_type, 304 err = GetScrapFlavorData (sel, flavor_type,
282 &size, SDATA (result)); 305 &size, SDATA (result));
283 if (err != noErr) 306 if (err != noErr)
284 result = Qnil; 307 result = Qnil;
@@ -308,72 +331,25 @@ get_scrap_string (scrap, type)
308 return result; 331 return result;
309} 332}
310 333
311/* Get timestamp from the scrap SCRAP and set to *TIMPSTAMP. */ 334/* Get the list of target types in SEL. The return value is a list of
312 335 target type symbols possibly followed by scrap flavor type
313static OSStatus
314get_scrap_private_timestamp (scrap, timestamp)
315 ScrapRef scrap;
316 unsigned long *timestamp;
317{
318 OSStatus err = noErr;
319#if TARGET_API_MAC_CARBON
320 ScrapFlavorFlags flags;
321
322 err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags);
323 if (err == noErr)
324 {
325 if (!(flags & kScrapFlavorMaskSenderOnly))
326 err = noTypeErr;
327 else
328 {
329 Size size = sizeof (*timestamp);
330
331 err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
332 &size, timestamp);
333 if (err == noErr && size != sizeof (*timestamp))
334 err = noTypeErr;
335 }
336 }
337#else /* !TARGET_API_MAC_CARBON */
338 Handle handle;
339 SInt32 size, offset;
340
341 size = GetScrap (NULL, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &offset);
342 if (size == sizeof (*timestamp))
343 {
344 handle = NewHandle (size);
345 HLock (handle);
346 size = GetScrap (handle, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &offset);
347 if (size == sizeof (*timestamp))
348 *timestamp = *((unsigned long *) *handle);
349 DisposeHandle (handle);
350 }
351 if (size != sizeof (*timestamp))
352 err = noTypeErr;
353#endif /* !TARGET_API_MAC_CARBON */
354
355 return err;
356}
357
358/* Get the list of target types in SCRAP. The return value is a list
359 of target type symbols possibly followed by scrap flavor type
360 strings. */ 336 strings. */
361 337
362static Lisp_Object 338static Lisp_Object
363get_scrap_target_type_list (scrap) 339mac_get_selection_target_list (sel)
364 ScrapRef scrap; 340 Selection sel;
365{ 341{
366 Lisp_Object result = Qnil, rest, target_type; 342 Lisp_Object result = Qnil, rest, target;
367#if TARGET_API_MAC_CARBON 343#if TARGET_API_MAC_CARBON
368 OSStatus err; 344 OSStatus err;
369 UInt32 count, i, type; 345 UInt32 count, i, type;
370 ScrapFlavorInfo *flavor_info = NULL; 346 ScrapFlavorInfo *flavor_info = NULL;
371 Lisp_Object strings = Qnil; 347 Lisp_Object strings = Qnil;
372 348
373 err = GetScrapFlavorCount (scrap, &count); 349 err = GetScrapFlavorCount (sel, &count);
374 if (err == noErr) 350 if (err == noErr)
375 flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); 351 flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
376 err = GetScrapFlavorInfoList (scrap, &count, flavor_info); 352 err = GetScrapFlavorInfoList (sel, &count, flavor_info);
377 if (err != noErr) 353 if (err != noErr)
378 { 354 {
379 xfree (flavor_info); 355 xfree (flavor_info);
@@ -387,11 +363,11 @@ get_scrap_target_type_list (scrap)
387 ScrapFlavorType flavor_type = 0; 363 ScrapFlavorType flavor_type = 0;
388 364
389 if (CONSP (XCAR (rest)) 365 if (CONSP (XCAR (rest))
390 && (target_type = XCAR (XCAR (rest)), 366 && (target = XCAR (XCAR (rest)),
391 SYMBOLP (target_type)) 367 SYMBOLP (target))
392 && (flavor_type = scrap_has_target_type (scrap, target_type))) 368 && (flavor_type = get_flavor_type_from_symbol (target, sel)))
393 { 369 {
394 result = Fcons (target_type, result); 370 result = Fcons (target, result);
395#if TARGET_API_MAC_CARBON 371#if TARGET_API_MAC_CARBON
396 for (i = 0; i < count; i++) 372 for (i = 0; i < count; i++)
397 if (flavor_info[i].flavorType == flavor_type) 373 if (flavor_info[i].flavorType == flavor_type)
@@ -428,9 +404,9 @@ x_own_selection (selection_name, selection_value)
428 Lisp_Object selection_name, selection_value; 404 Lisp_Object selection_name, selection_value;
429{ 405{
430 OSStatus err; 406 OSStatus err;
431 ScrapRef scrap; 407 Selection sel;
432 struct gcpro gcpro1, gcpro2; 408 struct gcpro gcpro1, gcpro2;
433 Lisp_Object rest, handler_fn, value, type; 409 Lisp_Object rest, handler_fn, value, target_type;
434 int count; 410 int count;
435 411
436 CHECK_SYMBOL (selection_name); 412 CHECK_SYMBOL (selection_name);
@@ -439,8 +415,8 @@ x_own_selection (selection_name, selection_value)
439 415
440 BLOCK_INPUT; 416 BLOCK_INPUT;
441 417
442 err = get_scrap_from_symbol (selection_name, 1, &scrap); 418 err = mac_get_selection_from_symbol (selection_name, 1, &sel);
443 if (err == noErr && scrap) 419 if (err == noErr && sel)
444 { 420 {
445 /* Don't allow a quit within the converter. 421 /* Don't allow a quit within the converter.
446 When the user types C-g, he would be surprised 422 When the user types C-g, he would be surprised
@@ -451,49 +427,56 @@ x_own_selection (selection_name, selection_value)
451 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) 427 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
452 { 428 {
453 if (!(CONSP (XCAR (rest)) 429 if (!(CONSP (XCAR (rest))
454 && (type = XCAR (XCAR (rest)), 430 && (target_type = XCAR (XCAR (rest)),
455 SYMBOLP (type)) 431 SYMBOLP (target_type))
456 && valid_scrap_target_type_p (type) 432 && mac_valid_selection_target_p (target_type)
457 && (handler_fn = XCDR (XCAR (rest)), 433 && (handler_fn = XCDR (XCAR (rest)),
458 SYMBOLP (handler_fn)))) 434 SYMBOLP (handler_fn))))
459 continue; 435 continue;
460 436
461 if (!NILP (handler_fn)) 437 if (!NILP (handler_fn))
462 value = call3 (handler_fn, selection_name, 438 value = call3 (handler_fn, selection_name,
463 type, selection_value); 439 target_type, selection_value);
440
441 if (NILP (value))
442 continue;
464 443
465 if (STRINGP (value)) 444 if (mac_valid_selection_value_p (value, target_type))
466 err = put_scrap_string (scrap, type, value); 445 err = mac_put_selection_value (sel, target_type, value);
467 else if (CONSP (value) 446 else if (CONSP (value)
468 && EQ (XCAR (value), type) 447 && EQ (XCAR (value), target_type)
469 && STRINGP (XCDR (value))) 448 && mac_valid_selection_value_p (XCDR (value), target_type))
470 err = put_scrap_string (scrap, type, XCDR (value)); 449 err = mac_put_selection_value (sel, target_type, XCDR (value));
471 } 450 }
472 451
473 unbind_to (count, Qnil); 452 unbind_to (count, Qnil);
474
475 if (err == noErr)
476 err = put_scrap_private_timestamp (scrap, last_event_timestamp);
477 } 453 }
478 454
479 UNBLOCK_INPUT; 455 UNBLOCK_INPUT;
480 456
481 UNGCPRO; 457 UNGCPRO;
482 458
483 if (scrap && err != noErr) 459 if (sel && err != noErr)
484 error ("Can't set selection"); 460 error ("Can't set selection");
485 461
486 /* Now update the local cache */ 462 /* Now update the local cache */
487 { 463 {
488 Lisp_Object selection_time; 464 Lisp_Object selection_time;
489 Lisp_Object selection_data; 465 Lisp_Object selection_data;
466 Lisp_Object ownership_info;
490 Lisp_Object prev_value; 467 Lisp_Object prev_value;
491 468
492 selection_time = long_to_cons (last_event_timestamp); 469 selection_time = long_to_cons (last_event_timestamp);
470 if (sel)
471 ownership_info = mac_get_selection_ownership_info (sel);
472 else
473 ownership_info = Qnil; /* dummy value for local-only selection */
493 selection_data = Fcons (selection_name, 474 selection_data = Fcons (selection_name,
494 Fcons (selection_value, 475 Fcons (selection_value,
495 Fcons (selection_time, 476 Fcons (selection_time,
496 Fcons (selected_frame, Qnil)))); 477 Fcons (selected_frame,
478 Fcons (ownership_info,
479 Qnil)))));
497 prev_value = assq_no_quit (selection_name, Vselection_alist); 480 prev_value = assq_no_quit (selection_name, Vselection_alist);
498 481
499 Vselection_alist = Fcons (selection_data, Vselection_alist); 482 Vselection_alist = Fcons (selection_data, Vselection_alist);
@@ -574,29 +557,20 @@ x_get_local_selection (selection_symbol, target_type, local_request)
574 unbind_to (count, Qnil); 557 unbind_to (count, Qnil);
575 } 558 }
576 559
560 if (local_request)
561 return value;
562
577 /* Make sure this value is of a type that we could transmit 563 /* Make sure this value is of a type that we could transmit
578 to another X client. */ 564 to another application. */
579 565
566 type = target_type;
580 check = value; 567 check = value;
581 if (CONSP (value) 568 if (CONSP (value)
582 && SYMBOLP (XCAR (value))) 569 && SYMBOLP (XCAR (value)))
583 type = XCAR (value), 570 type = XCAR (value),
584 check = XCDR (value); 571 check = XCDR (value);
585 572
586 if (STRINGP (check) 573 if (NILP (value) || mac_valid_selection_value_p (check, type))
587 || VECTORP (check)
588 || SYMBOLP (check)
589 || INTEGERP (check)
590 || NILP (value))
591 return value;
592 /* Check for a value that cons_to_long could handle. */
593 else if (CONSP (check)
594 && INTEGERP (XCAR (check))
595 && (INTEGERP (XCDR (check))
596 ||
597 (CONSP (XCDR (check))
598 && INTEGERP (XCAR (XCDR (check)))
599 && NILP (XCDR (XCDR (check))))))
600 return value; 574 return value;
601 575
602 signal_error ("Invalid data returned by selection-conversion function", 576 signal_error ("Invalid data returned by selection-conversion function",
@@ -676,22 +650,22 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
676 Lisp_Object selection_symbol, target_type, time_stamp; 650 Lisp_Object selection_symbol, target_type, time_stamp;
677{ 651{
678 OSStatus err; 652 OSStatus err;
679 ScrapRef scrap; 653 Selection sel;
680 Lisp_Object result = Qnil; 654 Lisp_Object result = Qnil;
681 655
682 BLOCK_INPUT; 656 BLOCK_INPUT;
683 657
684 err = get_scrap_from_symbol (selection_symbol, 0, &scrap); 658 err = mac_get_selection_from_symbol (selection_symbol, 0, &sel);
685 if (err == noErr && scrap) 659 if (err == noErr && sel)
686 { 660 {
687 if (EQ (target_type, QTARGETS)) 661 if (EQ (target_type, QTARGETS))
688 { 662 {
689 result = get_scrap_target_type_list (scrap); 663 result = mac_get_selection_target_list (sel);
690 result = Fvconcat (1, &result); 664 result = Fvconcat (1, &result);
691 } 665 }
692 else 666 else
693 { 667 {
694 result = get_scrap_string (scrap, target_type); 668 result = mac_get_selection_value (sel, target_type);
695 if (STRINGP (result)) 669 if (STRINGP (result))
696 Fput_text_property (make_number (0), make_number (SBYTES (result)), 670 Fput_text_property (make_number (0), make_number (SBYTES (result)),
697 Qforeign_selection, target_type, result); 671 Qforeign_selection, target_type, result);
@@ -770,7 +744,7 @@ Disowning it means there is no such selection. */)
770 Lisp_Object time; 744 Lisp_Object time;
771{ 745{
772 OSStatus err; 746 OSStatus err;
773 ScrapRef scrap; 747 Selection sel;
774 Lisp_Object local_selection_data; 748 Lisp_Object local_selection_data;
775 749
776 check_mac (); 750 check_mac ();
@@ -812,9 +786,9 @@ Disowning it means there is no such selection. */)
812 786
813 BLOCK_INPUT; 787 BLOCK_INPUT;
814 788
815 err = get_scrap_from_symbol (selection, 0, &scrap); 789 err = mac_get_selection_from_symbol (selection, 0, &sel);
816 if (err == noErr && scrap) 790 if (err == noErr && sel)
817 clear_scrap (&scrap); 791 mac_clear_selection (&sel);
818 792
819 UNBLOCK_INPUT; 793 UNBLOCK_INPUT;
820 794
@@ -833,7 +807,7 @@ and t is the same as `SECONDARY'. */)
833 Lisp_Object selection; 807 Lisp_Object selection;
834{ 808{
835 OSStatus err; 809 OSStatus err;
836 ScrapRef scrap; 810 Selection sel;
837 Lisp_Object result = Qnil, local_selection_data; 811 Lisp_Object result = Qnil, local_selection_data;
838 812
839 check_mac (); 813 check_mac ();
@@ -848,15 +822,14 @@ and t is the same as `SECONDARY'. */)
848 822
849 BLOCK_INPUT; 823 BLOCK_INPUT;
850 824
851 err = get_scrap_from_symbol (selection, 0, &scrap); 825 err = mac_get_selection_from_symbol (selection, 0, &sel);
852 if (err == noErr && scrap) 826 if (err == noErr && sel)
853 { 827 {
854 unsigned long timestamp; 828 Lisp_Object ownership_info;
855 829
856 err = get_scrap_private_timestamp (scrap, &timestamp); 830 ownership_info = XCAR (XCDR (XCDR (XCDR (XCDR (local_selection_data)))));
857 if (err == noErr 831 if (!NILP (Fequal (ownership_info,
858 && (timestamp 832 mac_get_selection_ownership_info (sel))))
859 == cons_to_long (XCAR (XCDR (XCDR (local_selection_data))))))
860 result = Qt; 833 result = Qt;
861 } 834 }
862 else 835 else
@@ -878,7 +851,7 @@ and t is the same as `SECONDARY'. */)
878 Lisp_Object selection; 851 Lisp_Object selection;
879{ 852{
880 OSStatus err; 853 OSStatus err;
881 ScrapRef scrap; 854 Selection sel;
882 Lisp_Object result = Qnil, rest; 855 Lisp_Object result = Qnil, rest;
883 856
884 /* It should be safe to call this before we have an Mac frame. */ 857 /* It should be safe to call this before we have an Mac frame. */
@@ -893,12 +866,12 @@ and t is the same as `SECONDARY'. */)
893 866
894 BLOCK_INPUT; 867 BLOCK_INPUT;
895 868
896 err = get_scrap_from_symbol (selection, 0, &scrap); 869 err = mac_get_selection_from_symbol (selection, 0, &sel);
897 if (err == noErr && scrap) 870 if (err == noErr && sel)
898 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) 871 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
899 { 872 {
900 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) 873 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))
901 && scrap_has_target_type (scrap, XCAR (XCAR (rest)))) 874 && mac_selection_has_target_p (sel, XCAR (XCAR (rest))))
902 { 875 {
903 result = Qt; 876 result = Qt;
904 break; 877 break;
@@ -1700,7 +1673,7 @@ mac_handle_service_event (call_ref, event, data)
1700 if (!SYMBOLP (Vmac_service_selection)) 1673 if (!SYMBOLP (Vmac_service_selection))
1701 err = eventNotHandledErr; 1674 err = eventNotHandledErr;
1702 else 1675 else
1703 err = get_scrap_from_symbol (Vmac_service_selection, 0, &cur_scrap); 1676 err = mac_get_selection_from_symbol (Vmac_service_selection, 0, &cur_scrap);
1704 if (!(err == noErr && cur_scrap)) 1677 if (!(err == noErr && cur_scrap))
1705 return eventNotHandledErr; 1678 return eventNotHandledErr;
1706 1679
@@ -1719,7 +1692,7 @@ mac_handle_service_event (call_ref, event, data)
1719 rest = XCDR (rest)) 1692 rest = XCDR (rest))
1720 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) 1693 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))
1721 && (flavor_type = 1694 && (flavor_type =
1722 get_flavor_type_from_symbol (XCAR (XCAR (rest))))) 1695 get_flavor_type_from_symbol (XCAR (XCAR (rest)), 0)))
1723 { 1696 {
1724 type = CreateTypeStringWithOSType (flavor_type); 1697 type = CreateTypeStringWithOSType (flavor_type);
1725 if (type) 1698 if (type)
@@ -1804,14 +1777,15 @@ mac_handle_service_event (call_ref, event, data)
1804 NULL, sizeof (ScrapRef), NULL, 1777 NULL, sizeof (ScrapRef), NULL,
1805 &specific_scrap); 1778 &specific_scrap);
1806 if (err == noErr) 1779 if (err == noErr)
1807 err = clear_scrap (&cur_scrap); 1780 err = mac_clear_selection (&cur_scrap);
1808 if (err == noErr) 1781 if (err == noErr)
1809 for (rest = Vselection_converter_alist; CONSP (rest); 1782 for (rest = Vselection_converter_alist; CONSP (rest);
1810 rest = XCDR (rest)) 1783 rest = XCDR (rest))
1811 { 1784 {
1812 if (! (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))))) 1785 if (! (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))))
1813 continue; 1786 continue;
1814 flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest))); 1787 flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest)),
1788 specific_scrap);
1815 if (flavor_type == 0) 1789 if (flavor_type == 0)
1816 continue; 1790 continue;
1817 err = copy_scrap_flavor_data (specific_scrap, cur_scrap, 1791 err = copy_scrap_flavor_data (specific_scrap, cur_scrap,
diff --git a/src/macterm.c b/src/macterm.c
index 11ec9c4d3c1..654afcf6b1a 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -4336,14 +4336,6 @@ static void
4336frame_highlight (f) 4336frame_highlight (f)
4337 struct frame *f; 4337 struct frame *f;
4338{ 4338{
4339 OSErr err;
4340 ControlRef root_control;
4341
4342 BLOCK_INPUT;
4343 err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
4344 if (err == noErr)
4345 ActivateControl (root_control);
4346 UNBLOCK_INPUT;
4347 x_update_cursor (f, 1); 4339 x_update_cursor (f, 1);
4348} 4340}
4349 4341
@@ -4351,14 +4343,6 @@ static void
4351frame_unhighlight (f) 4343frame_unhighlight (f)
4352 struct frame *f; 4344 struct frame *f;
4353{ 4345{
4354 OSErr err;
4355 ControlRef root_control;
4356
4357 BLOCK_INPUT;
4358 err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
4359 if (err == noErr)
4360 DeactivateControl (root_control);
4361 UNBLOCK_INPUT;
4362 x_update_cursor (f, 1); 4346 x_update_cursor (f, 1);
4363} 4347}
4364 4348
@@ -6116,7 +6100,9 @@ free_frame_tool_bar (f)
6116 6100
6117 BLOCK_INPUT; 6101 BLOCK_INPUT;
6118 ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false, 6102 ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false,
6119 f == mac_focus_frame (dpyinfo)); 6103 (NILP (Fsymbol_value
6104 (intern ("frame-notice-user-settings")))
6105 && f == mac_focus_frame (dpyinfo)));
6120 /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events 6106 /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events
6121 on toolbar visibility change. */ 6107 on toolbar visibility change. */
6122 mac_handle_origin_change (f); 6108 mac_handle_origin_change (f);
@@ -9412,11 +9398,13 @@ mac_handle_font_event (next_handler, event, data)
9412 static const EventParamName names_sel[] = {kEventParamATSUFontID, 9398 static const EventParamName names_sel[] = {kEventParamATSUFontID,
9413 kEventParamATSUFontSize, 9399 kEventParamATSUFontSize,
9414 kEventParamFMFontFamily, 9400 kEventParamFMFontFamily,
9401 kEventParamFMFontStyle,
9415 kEventParamFMFontSize, 9402 kEventParamFMFontSize,
9416 kEventParamFontColor}; 9403 kEventParamFontColor};
9417 static const EventParamType types_sel[] = {typeATSUFontID, 9404 static const EventParamType types_sel[] = {typeATSUFontID,
9418 typeATSUSize, 9405 typeATSUSize,
9419 typeFMFontFamily, 9406 typeFMFontFamily,
9407 typeFMFontStyle,
9420 typeFMFontSize, 9408 typeFMFontSize,
9421 typeFontColor}; 9409 typeFontColor};
9422 9410
@@ -10737,7 +10725,7 @@ mac_handle_window_event (next_handler, event, data)
10737 { 10725 {
10738 struct frame *sf = SELECTED_FRAME (); 10726 struct frame *sf = SELECTED_FRAME ();
10739 10727
10740 if (!(FRAME_MAC_P (sf))) 10728 if (!(FRAME_MAC_P (sf) && sf->async_visible))
10741 RepositionWindow (wp, NULL, kWindowCenterOnMainScreen); 10729 RepositionWindow (wp, NULL, kWindowCenterOnMainScreen);
10742 else 10730 else
10743 { 10731 {
@@ -10752,8 +10740,11 @@ mac_handle_window_event (next_handler, event, data)
10752 /* This is a workaround. RepositionWindow fails to put 10740 /* This is a workaround. RepositionWindow fails to put
10753 a window at the cascading position when its parent 10741 a window at the cascading position when its parent
10754 window has a Carbon HIToolbar. */ 10742 window has a Carbon HIToolbar. */
10755 if (f->top_pos == sf->top_pos && f->left_pos == sf->left_pos) 10743 if ((f->left_pos == sf->left_pos
10756 MoveWindowStructure (wp, f->left_pos + 10, f->top_pos + 32); 10744 && f->top_pos == sf->top_pos)
10745 || (f->left_pos == sf->left_pos + 10 * 2
10746 && f->top_pos == sf->top_pos + 32 * 2))
10747 MoveWindowStructure (wp, sf->left_pos + 10, sf->top_pos + 32);
10757#endif 10748#endif
10758 } 10749 }
10759 result = noErr; 10750 result = noErr;
@@ -10978,7 +10969,7 @@ mac_handle_keyboard_event (next_handler, event, data)
10978 void *data; 10969 void *data;
10979{ 10970{
10980 OSStatus err, result = eventNotHandledErr; 10971 OSStatus err, result = eventNotHandledErr;
10981 UInt32 event_kind, key_code, modifiers, mapped_modifiers; 10972 UInt32 event_kind, key_code, modifiers;
10982 unsigned char char_code; 10973 unsigned char char_code;
10983 10974
10984 event_kind = GetEventKind (event); 10975 event_kind = GetEventKind (event);
@@ -10987,32 +10978,16 @@ mac_handle_keyboard_event (next_handler, event, data)
10987 case kEventRawKeyDown: 10978 case kEventRawKeyDown:
10988 case kEventRawKeyRepeat: 10979 case kEventRawKeyRepeat:
10989 case kEventRawKeyUp: 10980 case kEventRawKeyUp:
10990 if (read_socket_inev == NULL)
10991 {
10992 result = CallNextEventHandler (next_handler, event);
10993 break;
10994 }
10995
10996 err = GetEventParameter (event, kEventParamKeyModifiers,
10997 typeUInt32, NULL,
10998 sizeof (UInt32), NULL, &modifiers);
10999 if (err != noErr)
11000 break;
11001
11002 mapped_modifiers = mac_mapped_modifiers (modifiers);
11003
11004 /* When using Carbon Events, we need to pass raw keyboard events 10981 /* When using Carbon Events, we need to pass raw keyboard events
11005 to the TSM ourselves. If TSM handles it, it will pass back 10982 to the TSM ourselves. If TSM handles it, it will pass back
11006 noErr, otherwise it will pass back "eventNotHandledErr" and 10983 noErr, otherwise it will pass back "eventNotHandledErr" and
11007 we can process it normally. */ 10984 we can process it normally. */
11008 if (!(mapped_modifiers 10985 result = CallNextEventHandler (next_handler, event);
11009 & ~(mac_pass_command_to_system ? cmdKey : 0) 10986 if (result != eventNotHandledErr)
11010 & ~(mac_pass_control_to_system ? controlKey : 0))) 10987 break;
11011 { 10988
11012 result = CallNextEventHandler (next_handler, event); 10989 if (read_socket_inev == NULL)
11013 if (result != eventNotHandledErr) 10990 break;
11014 break;
11015 }
11016 10991
11017#if USE_MAC_TSM 10992#if USE_MAC_TSM
11018 if (read_socket_inev->kind != NO_EVENT) 10993 if (read_socket_inev->kind != NO_EVENT)
@@ -11037,6 +11012,12 @@ mac_handle_keyboard_event (next_handler, event, data)
11037 if (err != noErr) 11012 if (err != noErr)
11038 break; 11013 break;
11039 11014
11015 err = GetEventParameter (event, kEventParamKeyModifiers,
11016 typeUInt32, NULL,
11017 sizeof (UInt32), NULL, &modifiers);
11018 if (err != noErr)
11019 break;
11020
11040 do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey), 11021 do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey),
11041 char_code, key_code, modifiers, 11022 char_code, key_code, modifiers,
11042 ((unsigned long) 11023 ((unsigned long)
@@ -12183,7 +12164,7 @@ XTread_socket (sd, expected, hold_quit)
12183 /* Window will be selected only when it is 12164 /* Window will be selected only when it is
12184 not selected now and last mouse movement 12165 not selected now and last mouse movement
12185 event was not in it. Minibuffer window 12166 event was not in it. Minibuffer window
12186 will be selected iff it is active. */ 12167 will be selected only when it is active. */
12187 if (WINDOWP (window) 12168 if (WINDOWP (window)
12188 && !EQ (window, last_window) 12169 && !EQ (window, last_window)
12189 && !EQ (window, selected_window)) 12170 && !EQ (window, selected_window))
@@ -12218,6 +12199,8 @@ XTread_socket (sd, expected, hold_quit)
12218 case activateEvt: 12199 case activateEvt:
12219 { 12200 {
12220 WindowRef window_ptr = (WindowRef) er.message; 12201 WindowRef window_ptr = (WindowRef) er.message;
12202 OSErr err;
12203 ControlRef root_control;
12221 12204
12222 if (window_ptr == tip_window) 12205 if (window_ptr == tip_window)
12223 { 12206 {
@@ -12235,6 +12218,10 @@ XTread_socket (sd, expected, hold_quit)
12235 /* A window has been activated */ 12218 /* A window has been activated */
12236 Point mouse_loc; 12219 Point mouse_loc;
12237 12220
12221 err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
12222 if (err == noErr)
12223 ActivateControl (root_control);
12224
12238 x_detect_focus_change (dpyinfo, &er, &inev); 12225 x_detect_focus_change (dpyinfo, &er, &inev);
12239 12226
12240 mouse_loc.h = (er.where.h 12227 mouse_loc.h = (er.where.h
@@ -12250,6 +12237,10 @@ XTread_socket (sd, expected, hold_quit)
12250 else 12237 else
12251 { 12238 {
12252 /* A window has been deactivated */ 12239 /* A window has been deactivated */
12240 err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
12241 if (err == noErr)
12242 DeactivateControl (root_control);
12243
12253#ifdef USE_TOOLKIT_SCROLL_BARS 12244#ifdef USE_TOOLKIT_SCROLL_BARS
12254 if (dpyinfo->grabbed && tracked_scroll_bar) 12245 if (dpyinfo->grabbed && tracked_scroll_bar)
12255 { 12246 {
@@ -12305,13 +12296,29 @@ XTread_socket (sd, expected, hold_quit)
12305 clear_mouse_face (dpyinfo); 12296 clear_mouse_face (dpyinfo);
12306 dpyinfo->mouse_face_hidden = 1; 12297 dpyinfo->mouse_face_hidden = 1;
12307 } 12298 }
12299
12300 {
12301 UInt32 modifiers = er.modifiers, mapped_modifiers;
12302
12303#ifdef MAC_OSX
12304 GetEventParameter (eventRef, kEventParamKeyModifiers,
12305 typeUInt32, NULL,
12306 sizeof (UInt32), NULL, &modifiers);
12307#endif
12308 mapped_modifiers = mac_mapped_modifiers (modifiers);
12309
12308#if TARGET_API_MAC_CARBON 12310#if TARGET_API_MAC_CARBON
12309 goto OTHER; 12311 if (!(mapped_modifiers
12310#else 12312 & ~(mac_pass_command_to_system ? cmdKey : 0)
12311 do_keystroke (er.what, er.message & charCodeMask, 12313 & ~(mac_pass_control_to_system ? controlKey : 0)))
12312 (er.message & keyCodeMask) >> 8, 12314 goto OTHER;
12313 er.modifiers, timestamp, &inev); 12315 else
12314#endif 12316#endif
12317 if (er.what != keyUp)
12318 do_keystroke (er.what, er.message & charCodeMask,
12319 (er.message & keyCodeMask) >> 8,
12320 modifiers, timestamp, &inev);
12321 }
12315 break; 12322 break;
12316 12323
12317 case kHighLevelEvent: 12324 case kHighLevelEvent:
@@ -12365,7 +12372,6 @@ XTread_socket (sd, expected, hold_quit)
12365 } 12372 }
12366 count++; 12373 count++;
12367 } 12374 }
12368
12369 } 12375 }
12370 12376
12371 /* If the focus was just given to an autoraising frame, 12377 /* If the focus was just given to an autoraising frame,
diff --git a/src/macterm.h b/src/macterm.h
index 2dc13665f67..8a85e714ab5 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -150,7 +150,7 @@ struct mac_display_info
150 char *mac_id_name; 150 char *mac_id_name;
151 151
152 /* The number of fonts actually stored in the font table. 152 /* The number of fonts actually stored in the font table.
153 font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= 153 font_table[n] is used and valid if 0 <= n < n_fonts. 0 <=
154 n_fonts <= font_table_size and font_table[i].name != 0. */ 154 n_fonts <= font_table_size and font_table[i].name != 0. */
155 int n_fonts; 155 int n_fonts;
156 156
diff --git a/src/msdos.c b/src/msdos.c
index 795e8744884..c01755b2790 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -3231,7 +3231,7 @@ dos_rawgetc ()
3231 `dos_get_modifiers', they might have already released the 3231 `dos_get_modifiers', they might have already released the
3232 Alt key, and Emacs gets just `x', which is BAD. 3232 Alt key, and Emacs gets just `x', which is BAD.
3233 However, for keys with the `Map' property set, the ASCII 3233 However, for keys with the `Map' property set, the ASCII
3234 code returns zero iff Alt is pressed. So, when we DON'T 3234 code returns zero only if Alt is pressed. So, when we DON'T
3235 have to support international_keyboard, we don't have to 3235 have to support international_keyboard, we don't have to
3236 distinguish between the left and right Alt keys, and we 3236 distinguish between the left and right Alt keys, and we
3237 can set the META modifier for any keys with the `Map' 3237 can set the META modifier for any keys with the `Map'
diff --git a/src/print.c b/src/print.c
index 9ec615de28f..86fd93a5b30 100644
--- a/src/print.c
+++ b/src/print.c
@@ -94,8 +94,8 @@ Lisp_Object Vfloat_output_format, Qfloat_output_format;
94/* Avoid actual stack overflow in print. */ 94/* Avoid actual stack overflow in print. */
95int print_depth; 95int print_depth;
96 96
97/* Nonzero if inside outputting backquote in old style. */ 97/* Level of nesting inside outputting backquote in new style. */
98int old_backquote_output; 98int new_backquote_output;
99 99
100/* Detect most circularities to print finite output. */ 100/* Detect most circularities to print finite output. */
101#define PRINT_CIRCLE 200 101#define PRINT_CIRCLE 200
@@ -1291,7 +1291,7 @@ print (obj, printcharfun, escapeflag)
1291 register Lisp_Object printcharfun; 1291 register Lisp_Object printcharfun;
1292 int escapeflag; 1292 int escapeflag;
1293{ 1293{
1294 old_backquote_output = 0; 1294 new_backquote_output = 0;
1295 1295
1296 /* Reset print_number_index and Vprint_number_table only when 1296 /* Reset print_number_index and Vprint_number_table only when
1297 the variable Vprint_continuous_numbering is nil. Otherwise, 1297 the variable Vprint_continuous_numbering is nil. Otherwise,
@@ -1849,14 +1849,24 @@ print_object (obj, printcharfun, escapeflag)
1849 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); 1849 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
1850 } 1850 }
1851 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) 1851 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
1852 && ! old_backquote_output 1852 && ((EQ (XCAR (obj), Qbackquote))))
1853 {
1854 print_object (XCAR (obj), printcharfun, 0);
1855 new_backquote_output++;
1856 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
1857 new_backquote_output--;
1858 }
1859 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
1860 && new_backquote_output
1853 && ((EQ (XCAR (obj), Qbackquote) 1861 && ((EQ (XCAR (obj), Qbackquote)
1854 || EQ (XCAR (obj), Qcomma) 1862 || EQ (XCAR (obj), Qcomma)
1855 || EQ (XCAR (obj), Qcomma_at) 1863 || EQ (XCAR (obj), Qcomma_at)
1856 || EQ (XCAR (obj), Qcomma_dot)))) 1864 || EQ (XCAR (obj), Qcomma_dot))))
1857 { 1865 {
1858 print_object (XCAR (obj), printcharfun, 0); 1866 print_object (XCAR (obj), printcharfun, 0);
1867 new_backquote_output--;
1859 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); 1868 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
1869 new_backquote_output++;
1860 } 1870 }
1861 else 1871 else
1862 { 1872 {
@@ -1876,9 +1886,7 @@ print_object (obj, printcharfun, escapeflag)
1876 print_object (Qbackquote, printcharfun, 0); 1886 print_object (Qbackquote, printcharfun, 0);
1877 PRINTCHAR (' '); 1887 PRINTCHAR (' ');
1878 1888
1879 ++old_backquote_output;
1880 print_object (XCAR (XCDR (tem)), printcharfun, 0); 1889 print_object (XCAR (XCDR (tem)), printcharfun, 0);
1881 --old_backquote_output;
1882 PRINTCHAR (')'); 1890 PRINTCHAR (')');
1883 1891
1884 obj = XCDR (obj); 1892 obj = XCDR (obj);
diff --git a/src/process.c b/src/process.c
index 6469654be32..9e9ef6d0772 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2779,7 +2779,7 @@ The stopped state is cleared by `continue-process' and set by
2779 2779
2780:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the 2780:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
2781process filter are multibyte, otherwise they are unibyte. 2781process filter are multibyte, otherwise they are unibyte.
2782If this keyword is not specified, the strings are multibyte iff 2782If this keyword is not specified, the strings are multibyte if
2783`default-enable-multibyte-characters' is non-nil. 2783`default-enable-multibyte-characters' is non-nil.
2784 2784
2785:sentinel SENTINEL -- Install SENTINEL as the process sentinel. 2785:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
@@ -3916,7 +3916,7 @@ it specifies a fractional number of seconds to wait.
3916If optional fourth arg JUST-THIS-ONE is non-nil, only accept output 3916If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
3917from PROCESS, suspending reading output from other processes. 3917from PROCESS, suspending reading output from other processes.
3918If JUST-THIS-ONE is an integer, don't run any timers either. 3918If JUST-THIS-ONE is an integer, don't run any timers either.
3919Return non-nil iff we received any output before the timeout expired. */) 3919Return non-nil if we received any output before the timeout expired. */)
3920 (process, seconds, millisec, just_this_one) 3920 (process, seconds, millisec, just_this_one)
3921 register Lisp_Object process, seconds, millisec, just_this_one; 3921 register Lisp_Object process, seconds, millisec, just_this_one;
3922{ 3922{
@@ -4248,16 +4248,16 @@ select_wrapper (n, rfd, wfd, xfd, tmo)
4248 (and gobble terminal input into the buffer if any arrives). 4248 (and gobble terminal input into the buffer if any arrives).
4249 4249
4250 If WAIT_PROC is specified, wait until something arrives from that 4250 If WAIT_PROC is specified, wait until something arrives from that
4251 process. The return value is true iff we read some input from 4251 process. The return value is true if we read some input from
4252 that process. 4252 that process.
4253 4253
4254 If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC 4254 If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
4255 (suspending output from other processes). A negative value 4255 (suspending output from other processes). A negative value
4256 means don't run any timers either. 4256 means don't run any timers either.
4257 4257
4258 If WAIT_PROC is specified, then the function returns true iff we 4258 If WAIT_PROC is specified, then the function returns true if we
4259 received input from that process before the timeout elapsed. 4259 received input from that process before the timeout elapsed.
4260 Otherwise, return true iff we received input from any process. */ 4260 Otherwise, return true if we received input from any process. */
4261 4261
4262int 4262int
4263wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, 4263wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
@@ -7262,7 +7262,7 @@ Lisp_Object QCtype;
7262 do_display != 0 means redisplay should be done to show subprocess 7262 do_display != 0 means redisplay should be done to show subprocess
7263 output that arrives. 7263 output that arrives.
7264 7264
7265 Return true iff we received input from any process. */ 7265 Return true if we received input from any process. */
7266 7266
7267int 7267int
7268wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, 7268wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
diff --git a/src/process.h b/src/process.h
index 79875564766..eaed95fe4b7 100644
--- a/src/process.h
+++ b/src/process.h
@@ -138,7 +138,7 @@ extern Lisp_Object chan_process[];
138/* Alist of elements (NAME . PROCESS). */ 138/* Alist of elements (NAME . PROCESS). */
139extern Lisp_Object Vprocess_alist; 139extern Lisp_Object Vprocess_alist;
140 140
141/* True iff we are about to fork off a synchronous process or if we 141/* True if we are about to fork off a synchronous process or if we
142 are waiting for it. */ 142 are waiting for it. */
143extern int synch_process_alive; 143extern int synch_process_alive;
144 144
diff --git a/src/regex.c b/src/regex.c
index c6d6c36a0bc..0858378c6e4 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2184,7 +2184,7 @@ re_wctype (str)
2184 else return 0; 2184 else return 0;
2185} 2185}
2186 2186
2187/* True iff CH is in the char class CC. */ 2187/* True if CH is in the char class CC. */
2188boolean 2188boolean
2189re_iswctype (ch, cc) 2189re_iswctype (ch, cc)
2190 int ch; 2190 int ch;
diff --git a/src/search.c b/src/search.c
index aea0f30141d..edcf315b2cd 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1639,7 +1639,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
1639 have nontrivial translation are the same aside from the last byte. 1639 have nontrivial translation are the same aside from the last byte.
1640 This makes it possible to translate just the last byte of a 1640 This makes it possible to translate just the last byte of a
1641 character, and do so after just a simple test of the context. 1641 character, and do so after just a simple test of the context.
1642 CHAR_BASE is nonzero iff there is such a non-ASCII character. 1642 CHAR_BASE is nonzero if there is such a non-ASCII character.
1643 1643
1644 If that criterion is not satisfied, do not call this function. */ 1644 If that criterion is not satisfied, do not call this function. */
1645 1645
diff --git a/src/systime.h b/src/systime.h
index 85c2799f083..8b1b7f56ad6 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -67,7 +67,7 @@ extern time_t timezone;
67 EMACS_SECS (TIME) is an rvalue for the seconds component of TIME. 67 EMACS_SECS (TIME) is an rvalue for the seconds component of TIME.
68 EMACS_SET_SECS (TIME, SECONDS) sets that to SECONDS. 68 EMACS_SET_SECS (TIME, SECONDS) sets that to SECONDS.
69 69
70 EMACS_HAS_USECS is defined iff EMACS_TIME has a usecs component. 70 EMACS_HAS_USECS is defined if EMACS_TIME has a usecs component.
71 EMACS_USECS (TIME) is an rvalue for the microseconds component of TIME. 71 EMACS_USECS (TIME) is an rvalue for the microseconds component of TIME.
72 This returns zero if EMACS_TIME doesn't have a microseconds component. 72 This returns zero if EMACS_TIME doesn't have a microseconds component.
73 EMACS_SET_USECS (TIME, MICROSECONDS) sets that to MICROSECONDS. 73 EMACS_SET_USECS (TIME, MICROSECONDS) sets that to MICROSECONDS.
@@ -83,7 +83,7 @@ extern time_t timezone;
83 83
84 EMACS_SUB_TIME (DEST, SRC1, SRC2) subtracts SRC2 from SRC1 and 84 EMACS_SUB_TIME (DEST, SRC1, SRC2) subtracts SRC2 from SRC1 and
85 stores the result in DEST. SRC should not be negative. 85 stores the result in DEST. SRC should not be negative.
86 EMACS_TIME_NEG_P (TIME) is true iff TIME is negative. 86 EMACS_TIME_NEG_P (TIME) is true if TIME is negative.
87 87
88*/ 88*/
89 89
diff --git a/src/systty.h b/src/systty.h
index 15dd7a4e26c..c89edfc8d93 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -297,7 +297,7 @@ static struct sensemode {
297 written before making the change. 297 written before making the change.
298 Return 0 if all went well, and -1 if anything failed. 298 Return 0 if all went well, and -1 if anything failed.
299 299
300 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel 300 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel
301 expands tabs to spaces upon output; in that case, there is no 301 expands tabs to spaces upon output; in that case, there is no
302 advantage to using tabs over spaces. */ 302 advantage to using tabs over spaces. */
303 303
diff --git a/src/termhooks.h b/src/termhooks.h
index 889c3ab1ab7..eb074608e19 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -201,7 +201,7 @@ extern void (*judge_scroll_bars_hook) P_ ((struct frame *FRAME));
201/* Input queue declarations and hooks. */ 201/* Input queue declarations and hooks. */
202 202
203/* Expedient hack: only provide the below definitions to files that 203/* Expedient hack: only provide the below definitions to files that
204 are prepared to handle lispy things. CONSP is defined iff lisp.h 204 are prepared to handle lispy things. CONSP is defined if lisp.h
205 has been included before this file. */ 205 has been included before this file. */
206#ifdef CONSP 206#ifdef CONSP
207 207
diff --git a/src/textprop.c b/src/textprop.c
index 711ee571af6..8ce5656e5a2 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1633,8 +1633,8 @@ Return t if any property was actually removed, nil otherwise. */)
1633 The flag `modified' records if changes have been made. 1633 The flag `modified' records if changes have been made.
1634 When object is a buffer, we must call modify_region before changes are 1634 When object is a buffer, we must call modify_region before changes are
1635 made and signal_after_change when we are done. 1635 made and signal_after_change when we are done.
1636 We call modify_region before calling remove_properties iff modified == 0, 1636 We call modify_region before calling remove_properties if modified == 0,
1637 and we call signal_after_change before returning iff modified != 0. */ 1637 and we call signal_after_change before returning if modified != 0. */
1638 for (;;) 1638 for (;;)
1639 { 1639 {
1640 if (i == 0) 1640 if (i == 0)
diff --git a/src/w32term.c b/src/w32term.c
index ddb98070b87..0affbcc72af 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4836,7 +4836,7 @@ w32_read_socket (sd, expected, hold_quit)
4836 /* Window will be selected only when it is not 4836 /* Window will be selected only when it is not
4837 selected now and last mouse movement event was 4837 selected now and last mouse movement event was
4838 not in it. Minibuffer window will be selected 4838 not in it. Minibuffer window will be selected
4839 iff it is active. */ 4839 only when it is active. */
4840 if (WINDOWP(window) 4840 if (WINDOWP(window)
4841 && !EQ (window, last_window) 4841 && !EQ (window, last_window)
4842 && !EQ (window, selected_window)) 4842 && !EQ (window, selected_window))
diff --git a/src/w32term.h b/src/w32term.h
index d100cbee222..cea3110ff8f 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -198,7 +198,7 @@ struct w32_display_info
198 char *w32_id_name; 198 char *w32_id_name;
199 199
200 /* The number of fonts actually stored in w32_font_table. 200 /* The number of fonts actually stored in w32_font_table.
201 font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= 201 font_table[n] is used and valid if 0 <= n < n_fonts. 0 <=
202 n_fonts <= font_table_size. and font_table[i].name != 0. */ 202 n_fonts <= font_table_size. and font_table[i].name != 0. */
203 int n_fonts; 203 int n_fonts;
204 204
diff --git a/src/window.c b/src/window.c
index 06cbf8e5f04..43ea423dd9d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -557,6 +557,15 @@ use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */)
557 return make_number (window_box_text_cols (decode_any_window (window))); 557 return make_number (window_box_text_cols (decode_any_window (window)));
558} 558}
559 559
560DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0,
561 doc: /* Return t if WINDOW is as wide as its frame.
562WINDOW defaults to the selected window. */)
563 (window)
564 Lisp_Object window;
565{
566 return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil;
567}
568
560DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 569DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
561 doc: /* Return the number of columns by which WINDOW is scrolled from left margin. 570 doc: /* Return the number of columns by which WINDOW is scrolled from left margin.
562WINDOW defaults to the selected window. */) 571WINDOW defaults to the selected window. */)
@@ -7515,6 +7524,7 @@ The selected frame is the one whose configuration has changed. */);
7515 defsubr (&Swindow_buffer); 7524 defsubr (&Swindow_buffer);
7516 defsubr (&Swindow_height); 7525 defsubr (&Swindow_height);
7517 defsubr (&Swindow_width); 7526 defsubr (&Swindow_width);
7527 defsubr (&Swindow_full_width_p);
7518 defsubr (&Swindow_hscroll); 7528 defsubr (&Swindow_hscroll);
7519 defsubr (&Sset_window_hscroll); 7529 defsubr (&Sset_window_hscroll);
7520 defsubr (&Swindow_redisplay_end_trigger); 7530 defsubr (&Swindow_redisplay_end_trigger);
diff --git a/src/window.h b/src/window.h
index 7fc97448757..ea8965392c4 100644
--- a/src/window.h
+++ b/src/window.h
@@ -777,6 +777,7 @@ extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int,
777EXFUN (Fwindow_dedicated_p, 1); 777EXFUN (Fwindow_dedicated_p, 1);
778extern int window_height P_ ((Lisp_Object)); 778extern int window_height P_ ((Lisp_Object));
779extern int window_width P_ ((Lisp_Object)); 779extern int window_width P_ ((Lisp_Object));
780EXFUN (Fwindow_full_width_p, 1);
780extern void set_window_height P_ ((Lisp_Object, int, int)); 781extern void set_window_height P_ ((Lisp_Object, int, int));
781extern void set_window_width P_ ((Lisp_Object, int, int)); 782extern void set_window_width P_ ((Lisp_Object, int, int));
782extern void change_window_heights P_ ((Lisp_Object, int)); 783extern void change_window_heights P_ ((Lisp_Object, int));
@@ -818,7 +819,7 @@ extern int command_loop_level;
818 819
819extern int minibuf_level; 820extern int minibuf_level;
820 821
821/* true iff we should redraw the mode lines on the next redisplay. */ 822/* true if we should redraw the mode lines on the next redisplay. */
822 823
823extern int update_mode_lines; 824extern int update_mode_lines;
824 825
diff --git a/src/xdisp.c b/src/xdisp.c
index f18bfc020af..a24dea966cf 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7245,18 +7245,22 @@ move_it_by_lines (it, dvpos, need_y_p)
7245{ 7245{
7246 struct position pos; 7246 struct position pos;
7247 7247
7248 if (!FRAME_WINDOW_P (it->f)) 7248 /* The commented-out optimization uses vmotion on terminals. This
7249 gives bad results, because elements like it->what, on which
7250 callers such as pos_visible_p rely, aren't updated. */
7251 /* if (!FRAME_WINDOW_P (it->f))
7249 { 7252 {
7250 struct text_pos textpos; 7253 struct text_pos textpos;
7251 7254
7252 /* We can use vmotion on frames without proportional fonts. */
7253 pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w); 7255 pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w);
7254 SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos); 7256 SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos);
7255 reseat (it, textpos, 1); 7257 reseat (it, textpos, 1);
7256 it->vpos += pos.vpos; 7258 it->vpos += pos.vpos;
7257 it->current_y += pos.vpos; 7259 it->current_y += pos.vpos;
7258 } 7260 }
7259 else if (dvpos == 0) 7261 else */
7262
7263 if (dvpos == 0)
7260 { 7264 {
7261 /* DVPOS == 0 means move to the start of the screen line. */ 7265 /* DVPOS == 0 means move to the start of the screen line. */
7262 move_it_vertically_backward (it, 0); 7266 move_it_vertically_backward (it, 0);
@@ -13669,7 +13673,10 @@ redisplay_window (window, just_this_one_p)
13669 /* Restore current_buffer and value of point in it. */ 13673 /* Restore current_buffer and value of point in it. */
13670 TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint)); 13674 TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
13671 set_buffer_internal_1 (old); 13675 set_buffer_internal_1 (old);
13672 TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); 13676 /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become
13677 shorter. This can be caused by log truncation in *Messages*. */
13678 if (CHARPOS (lpoint) <= ZV)
13679 TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
13673 13680
13674 unbind_to (count, Qnil); 13681 unbind_to (count, Qnil);
13675} 13682}
diff --git a/src/xterm.c b/src/xterm.c
index 9c1e884c5ad..351f90dac79 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2675,9 +2675,11 @@ x_draw_image_glyph_string (s)
2675 { 2675 {
2676 /* Fill background with a stipple pattern. */ 2676 /* Fill background with a stipple pattern. */
2677 XSetFillStyle (s->display, s->gc, FillOpaqueStippled); 2677 XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
2678 XSetTSOrigin (s->display, s->gc, - s->x, - s->y);
2678 XFillRectangle (s->display, pixmap, s->gc, 2679 XFillRectangle (s->display, pixmap, s->gc,
2679 0, 0, s->background_width, s->height); 2680 0, 0, s->background_width, s->height);
2680 XSetFillStyle (s->display, s->gc, FillSolid); 2681 XSetFillStyle (s->display, s->gc, FillSolid);
2682 XSetTSOrigin (s->display, s->gc, 0, 0);
2681 } 2683 }
2682 else 2684 else
2683 { 2685 {
@@ -6910,7 +6912,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6910 6912
6911 /* Window will be selected only when it is not selected now and 6913 /* Window will be selected only when it is not selected now and
6912 last mouse movement event was not in it. Minibuffer window 6914 last mouse movement event was not in it. Minibuffer window
6913 will be selected iff it is active. */ 6915 will be selected only when it is active. */
6914 if (WINDOWP (window) 6916 if (WINDOWP (window)
6915 && !EQ (window, last_window) 6917 && !EQ (window, last_window)
6916 && !EQ (window, selected_window)) 6918 && !EQ (window, selected_window))
diff --git a/src/xterm.h b/src/xterm.h
index a0b4704e13f..0480b0c8053 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -253,7 +253,7 @@ struct x_display_info
253 char *x_id_name; 253 char *x_id_name;
254 254
255 /* The number of fonts actually stored in x_font_table. 255 /* The number of fonts actually stored in x_font_table.
256 font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= 256 font_table[n] is used and valid if 0 <= n < n_fonts. 0 <=
257 n_fonts <= font_table_size and font_table[i].name != 0. */ 257 n_fonts <= font_table_size and font_table[i].name != 0. */
258 int n_fonts; 258 int n_fonts;
259 259