aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-03-28 23:08:20 +0000
committerMiles Bader2006-03-28 23:08:20 +0000
commit1ef7e5599f5aa981399221e657ff34e80cc2c1a3 (patch)
tree539ff4cf9ea84af29a4e8628d049f3a4253a51f4 /src
parent33bd75ec5fb277e58731c8cbbb942cba4d9a9f19 (diff)
parent29314e0fd78063d663bd272787d0ea81cc61e38e (diff)
downloademacs-1ef7e5599f5aa981399221e657ff34e80cc2c1a3.tar.gz
emacs-1ef7e5599f5aa981399221e657ff34e80cc2c1a3.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-49
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 164-184) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: man/mh-e.texi (Folders): Various edits. - Update from erc--emacs--0 * gnus--rel--5.10 (patch 62-70) - Merge from emacs--devo--0 - Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit18
-rw-r--r--src/ChangeLog122
-rw-r--r--src/dispnew.c7
-rw-r--r--src/editfns.c32
-rw-r--r--src/emacs.c12
-rw-r--r--src/fileio.c1
-rw-r--r--src/fns.c6
-rw-r--r--src/fringe.c8
-rw-r--r--src/keymap.c1
-rw-r--r--src/macmenu.c117
-rw-r--r--src/macterm.c3
-rw-r--r--src/print.c12
-rw-r--r--src/process.c74
-rw-r--r--src/term.c6
-rw-r--r--src/w32term.c6
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c13
-rw-r--r--src/xfns.c3
-rw-r--r--src/xterm.c22
19 files changed, 319 insertions, 148 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 408e2ab8b9b..af2114ebd18 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -58,8 +58,14 @@ define xgettype
58end 58end
59 59
60# Set up something to print out s-expressions. 60# Set up something to print out s-expressions.
61# We save and restore print_output_debug_flag to prevent the w32 port
62# from calling OutputDebugString, which causes GDB to display each
63# character twice (yuk!).
61define pr 64define pr
65 set $output_debug = print_output_debug_flag
66 set print_output_debug_flag = 0
62 set debug_print ($) 67 set debug_print ($)
68 set print_output_debug_flag = $output_debug
63end 69end
64document pr 70document pr
65Print the emacs s-expression which is $. 71Print the emacs s-expression which is $.
@@ -69,7 +75,10 @@ end
69# Print out s-expressions 75# Print out s-expressions
70define pp 76define pp
71 set $tmp = $arg0 77 set $tmp = $arg0
78 set $output_debug = print_output_debug_flag
79 set print_output_debug_flag = 0
72 set safe_debug_print ($tmp) 80 set safe_debug_print ($tmp)
81 set print_output_debug_flag = $output_debug
73end 82end
74document pp 83document pp
75Print the argument as an emacs s-expression 84Print the argument as an emacs s-expression
@@ -81,7 +90,10 @@ define pp1
81 set $tmp = $arg0 90 set $tmp = $arg0
82 echo $arg0 91 echo $arg0
83 printf " = " 92 printf " = "
93 set $output_debug = print_output_debug_flag
94 set print_output_debug_flag = 0
84 set safe_debug_print ($tmp) 95 set safe_debug_print ($tmp)
96 set print_output_debug_flag = $output_debug
85end 97end
86document pp1 98document pp1
87Print the argument as an emacs s-expression 99Print the argument as an emacs s-expression
@@ -94,7 +106,10 @@ end
94# Print value of lisp variable 106# Print value of lisp variable
95define pv 107define pv
96 set $tmp = "$arg0" 108 set $tmp = "$arg0"
109 set $output_debug = print_output_debug_flag
110 set print_output_debug_flag = 0
97 set safe_debug_print ( find_symbol_value (intern ($tmp))) 111 set safe_debug_print ( find_symbol_value (intern ($tmp)))
112 set print_output_debug_flag = $output_debug
98end 113end
99document pv 114document pv
100Print the value of the lisp variable given as argument. 115Print the value of the lisp variable given as argument.
@@ -106,7 +121,10 @@ define pv1
106 set $tmp = "$arg0" 121 set $tmp = "$arg0"
107 echo $arg0 122 echo $arg0
108 printf " = " 123 printf " = "
124 set $output_debug = print_output_debug_flag
125 set print_output_debug_flag = 0
109 set safe_debug_print (find_symbol_value (intern ($tmp))) 126 set safe_debug_print (find_symbol_value (intern ($tmp)))
127 set print_output_debug_flag = $output_debug
110end 128end
111document pv1 129document pv1
112Print the value of the lisp variable given as argument. 130Print the value of the lisp variable given as argument.
diff --git a/src/ChangeLog b/src/ChangeLog
index 2081b255094..34b99a65a1c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,110 @@
12006-03-25 Eli Zaretskii <eliz@gnu.org>
2
3 * .gdbinit (pr, pp, pp1, pv, pv1): Force print_output_debug_flag
4 to zero before calling debug_print or safe_debug_print.
5
6 * print.c (print_output_debug_flag): New global variable.
7 (Fexternal_debugging_output) [WINDOWSNT]: Don't call
8 OutputDebugString if print_output_debug_flag is zero.
9
102006-03-24 Paul Eggert <eggert@cs.ucla.edu>
11
12 * editfns.c (TM_YEAR_BASE): Move up, so the changes below can use it.
13 (Fdecode_time, Fencode_time): Use TM_YEAR_BASE instead of 1900.
14 (Fdecode_time): Cast tm_year to EMACS_INT.
15 (Fcurrent_time_string): Report an invalid time specification if
16 the argument is invalid. Also, check for out-of-range time
17 stamps.
18
192006-03-24 Kim F. Storm <storm@cua.dk>
20
21 * xterm.c (handle_one_xevent):
22 * w32term.c (w32_read_socket):
23 * macterm.c (XTread_socket): Don't let key-press clear mouse face
24 on in toolbar window if mouse-highlight is an integer.
25
26 * fns.c (sxhash_list): Include last non-nil CDR in hash.
27
282006-03-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
29
30 * macmenu.c (enum mac_menu_kind): New enum.
31 (min_menu_id): New variable.
32 (POPUP_SUBMENU_ID, MIN_POPUP_SUBMENU_ID, MIN_MENU_ID)
33 (MIN_SUBMENU_ID): Remove defines. All uses are replaced with
34 min_menu_id and enumerators in enum mac_menu_kind.
35 (fill_menu, dispose_menus, install_menu_quit_handler): New arg KIND.
36 All uses changed. Add range check for menu ID.
37 (fill_menubar): Add range check for menu ID.
38 [HAVE_CANCELMENUTRACKING] (menu_quit_handler): Check error code of
39 GetEventParameter.
40 (set_frame_menubar, mac_menu_show): Call install_menu_quit_handler
41 for each menu kind.
42
432006-03-22 Kim F. Storm <storm@cua.dk>
44
45 * xdisp.c: Undo 2006-03-21 change.
46
47 * term.c: Define aliases for append_glyph and produce_stretch_glyph
48 when `static' is defined to avoid name clash with those in xdisp.c.
49
50 * process.c (Faccept_process_output): Fix to comply with lisp reference.
51 Change arg "timeout" to "seconds" and allow both integer and float value.
52 Change arg "timeout-msec" to "millisec" and interpret" as milliseconds
53 rather than microseconds. Fix doc string accordingly.
54
552006-03-21 Ken Raeburn <raeburn@raeburn.org>
56
57 * xdisp.c (store_next_glyph): Renamed from append_glyph.
58 (generate_stretch_glyph): Renamed from produce_stretch_glyph.
59 All callers changed accordingly.
60
612006-03-21 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
62
63 * xterm.c: x_session_initialized new variable.
64 (x_term_init): Use x_session_initialized to check if
65 x_session_initialize should be called.
66 (x_initialize): Initialize x_session_initialized.
67
682006-03-21 Kim F. Storm <storm@cua.dk>
69
70 * fringe.c (draw_fringe_bitmap): Don't calculate default overlay arrow
71 bitmap here, but ...
72 (update_window_fringes): ... here, so we can test if it has changed.
73
742006-03-20 Andreas Schwab <schwab@suse.de>
75
76 * dispnew.c (init_display): Check DISPLAY here.
77
78 * emacs.c (main): Don't check here.
79
80 * xterm.c (x_display_ok): Don't use DISPLAY env var.
81
822006-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
83
84 * window.c (window_scroll_pixel_based): Yet another int/Lisp_Object
85 mixup (YAILOM).
86
872006-03-20 Eli Zaretskii <eliz@gnu.org>
88
89 * emacs.c (main): Fix last change.
90
912006-03-20 Kenichi Handa <handa@m17n.org>
92
93 * fileio.c (Fwrite_region): Set visit_file to Qnil before GCPRO it.
94
95 * keymap.c (map_keymap): Set tail to Qnil before GCPRO it.
96
97 * xfns.c (xg_set_icon): Remove unnecessary GCPRO.
98
99 * xterm.c (x_term_init): Remove unnecessary GCPRO.
100
1012006-03-19 Kim F. Storm <storm@cua.dk>
102
103 * xdisp.c (set_cursor_from_row): Fix cursor property on overlay string,
104 so it doesn't associate overlay string with following glyph by default.
105 Allow integer property value to specify explicit number of buffer
106 positions associate with overlay string.
107
12006-03-18 Chong Yidong <cyd@stupidchicken.com> 1082006-03-18 Chong Yidong <cyd@stupidchicken.com>
2 109
3 * xterm.c (x_display_ok): Fix minor bug and compilation warnings. 110 * xterm.c (x_display_ok): Fix minor bug and compilation warnings.
@@ -41,15 +148,15 @@
41 * image.c [MAC_OS] (XPutPixel, XGetPixel) 148 * image.c [MAC_OS] (XPutPixel, XGetPixel)
42 [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: Don't use specialized 149 [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: Don't use specialized
43 version when depth is 32. 150 version when depth is 32.
44 (mac_create_cg_image_from_image) [MAC_OS && USE_CG_DRAWING]: New 151 (mac_create_cg_image_from_image) [MAC_OS && USE_CG_DRAWING]:
45 function. 152 New function.
46 (prepare_image_for_display) [MAC_OS && USE_CG_DRAWING]: Use it. 153 (prepare_image_for_display) [MAC_OS && USE_CG_DRAWING]: Use it.
47 (x_clear_image_1) [MAC_OS && USE_CG_DRAWING]: Release CGImage. 154 (x_clear_image_1) [MAC_OS && USE_CG_DRAWING]: Release CGImage.
48 155
49 * macterm.c (XCreatePixmap) [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: 156 * macterm.c (XCreatePixmap) [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]:
50 Create GWorld in ARGB pixel format. 157 Create GWorld in ARGB pixel format.
51 (mac_copy_area, mac_copy_area_with_mask) [USE_CG_DRAWING]: Remove 158 (mac_copy_area, mac_copy_area_with_mask) [USE_CG_DRAWING]:
52 functions. 159 Remove functions.
53 (x_draw_image_foreground) [USE_CG_DRAWING]: Use mac_draw_cg_image 160 (x_draw_image_foreground) [USE_CG_DRAWING]: Use mac_draw_cg_image
54 instead of mac_copy_area/mac_copy_area_with_mask. 161 instead of mac_copy_area/mac_copy_area_with_mask.
55 162
@@ -153,8 +260,7 @@
153 260
1542006-03-11 David Ponce <david@dponce.com> 2612006-03-11 David Ponce <david@dponce.com>
155 262
156 * xfns.c (x_create_tip_frame): Preserve received parms by copying 263 * xfns.c (x_create_tip_frame): Preserve received parms by copying them.
157 them.
158 264
1592006-03-11 Eli Zaretskii <eliz@gnu.org> 2652006-03-11 Eli Zaretskii <eliz@gnu.org>
160 266
@@ -175,14 +281,14 @@
175 * keymap.c (describe_map): Shorten string to indicate shadowed binding. 281 * keymap.c (describe_map): Shorten string to indicate shadowed binding.
176 282
177 * vm-limit.c (get_lim_data, lim_data, data_space_start): 283 * vm-limit.c (get_lim_data, lim_data, data_space_start):
178 Moved from mem-limits.h. 284 Move from mem-limits.h.
179 (enum warnlevel): New data type. 285 (enum warnlevel): New data type.
180 (check_memory_limits): Rewrite the logic about warnings. 286 (check_memory_limits): Rewrite the logic about warnings.
181 Use standard `struct rlimit'. Check return values for nonsense. 287 Use standard `struct rlimit'. Check return values for nonsense.
182 (memory_warnings): Always clear lim_data. 288 (memory_warnings): Always clear lim_data.
183 289
184 * mem-limits.h (get_lim_data, lim_data, data_space_start): 290 * mem-limits.h (get_lim_data, lim_data, data_space_start):
185 Moved to vm-limit.c. 291 Move to vm-limit.c.
186 292
187 * xterm.c (x_fully_uncatch_errors, x_catching_errors): New functions. 293 * xterm.c (x_fully_uncatch_errors, x_catching_errors): New functions.
188 294
diff --git a/src/dispnew.c b/src/dispnew.c
index 999877001d2..297125063c7 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6650,6 +6650,13 @@ init_display ()
6650#endif 6650#endif
6651 6651
6652 display_arg = (display != 0 && *display != 0); 6652 display_arg = (display != 0 && *display != 0);
6653
6654 if (display_arg && !x_display_ok (display))
6655 {
6656 fprintf (stderr, "Display %s unavailable, simulating -nw\n",
6657 display);
6658 inhibit_window_system = 1;
6659 }
6653 } 6660 }
6654 6661
6655 if (!inhibit_window_system && display_arg 6662 if (!inhibit_window_system && display_arg
diff --git a/src/editfns.c b/src/editfns.c
index 7c2c2a8edd0..59401fdfecd 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -72,6 +72,8 @@ Boston, MA 02110-1301, USA. */
72extern char **environ; 72extern char **environ;
73#endif 73#endif
74 74
75#define TM_YEAR_BASE 1900
76
75extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, 77extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
76 const struct tm *, int)); 78 const struct tm *, int));
77static int tm_diff P_ ((struct tm *, struct tm *)); 79static int tm_diff P_ ((struct tm *, struct tm *));
@@ -719,7 +721,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
719 int orig_point = 0; 721 int orig_point = 0;
720 int fwd; 722 int fwd;
721 Lisp_Object prev_old, prev_new; 723 Lisp_Object prev_old, prev_new;
722 724
723 if (NILP (new_pos)) 725 if (NILP (new_pos))
724 /* Use the current point, and afterwards, set it. */ 726 /* Use the current point, and afterwards, set it. */
725 { 727 {
@@ -734,7 +736,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
734 736
735 prev_old = make_number (XFASTINT (old_pos) - 1); 737 prev_old = make_number (XFASTINT (old_pos) - 1);
736 prev_new = make_number (XFASTINT (new_pos) - 1); 738 prev_new = make_number (XFASTINT (new_pos) - 1);
737 739
738 if (NILP (Vinhibit_field_text_motion) 740 if (NILP (Vinhibit_field_text_motion)
739 && !EQ (new_pos, old_pos) 741 && !EQ (new_pos, old_pos)
740 && (!NILP (Fget_char_property (new_pos, Qfield, Qnil)) 742 && (!NILP (Fget_char_property (new_pos, Qfield, Qnil))
@@ -1720,7 +1722,9 @@ DOW and ZONE.) */)
1720 XSETFASTINT (list_args[2], decoded_time->tm_hour); 1722 XSETFASTINT (list_args[2], decoded_time->tm_hour);
1721 XSETFASTINT (list_args[3], decoded_time->tm_mday); 1723 XSETFASTINT (list_args[3], decoded_time->tm_mday);
1722 XSETFASTINT (list_args[4], decoded_time->tm_mon + 1); 1724 XSETFASTINT (list_args[4], decoded_time->tm_mon + 1);
1723 XSETINT (list_args[5], decoded_time->tm_year + 1900); 1725 /* On 64-bit machines an int is narrower than EMACS_INT, thus the
1726 cast below avoids overflow in int arithmetics. */
1727 XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) decoded_time->tm_year);
1724 XSETFASTINT (list_args[6], decoded_time->tm_wday); 1728 XSETFASTINT (list_args[6], decoded_time->tm_wday);
1725 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil; 1729 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
1726 1730
@@ -1776,7 +1780,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1776 tm.tm_hour = XINT (args[2]); 1780 tm.tm_hour = XINT (args[2]);
1777 tm.tm_mday = XINT (args[3]); 1781 tm.tm_mday = XINT (args[3]);
1778 tm.tm_mon = XINT (args[4]) - 1; 1782 tm.tm_mon = XINT (args[4]) - 1;
1779 tm.tm_year = XINT (args[5]) - 1900; 1783 tm.tm_year = XINT (args[5]) - TM_YEAR_BASE;
1780 tm.tm_isdst = -1; 1784 tm.tm_isdst = -1;
1781 1785
1782 if (CONSP (zone)) 1786 if (CONSP (zone))
@@ -1842,11 +1846,25 @@ but this is considered obsolete. */)
1842{ 1846{
1843 time_t value; 1847 time_t value;
1844 char buf[30]; 1848 char buf[30];
1849 struct tm *tm;
1845 register char *tem; 1850 register char *tem;
1846 1851
1847 if (! lisp_time_argument (specified_time, &value, NULL)) 1852 if (! lisp_time_argument (specified_time, &value, NULL))
1848 value = -1; 1853 error ("Invalid time specification");
1849 tem = (char *) ctime (&value); 1854 /* Do not use ctime, since it has undefined behavior with
1855 out-of-range time stamps. This avoids a core dump triggered by
1856 (current-time-string '(2814749767106 0)) on 64-bit Solaris 8. See
1857 <http://www.opengroup.org/austin/mailarchives/ag/msg09294.html>
1858 for more details about this portability problem. */
1859 tm = localtime (&value);
1860 /* Checking for out-of-range time stamps avoids buffer overruns that
1861 cause core dump on some systems (e.g., 64-bit Solaris), and also
1862 preserves the historic behavior of always returning a fixed-size
1863 24-character string. */
1864 if (! (tm && -999 - TM_YEAR_BASE <= tm->tm_year
1865 && tm->tm_year <= 9999 - TM_YEAR_BASE))
1866 error ("Specified time is not representable");
1867 tem = asctime (tm);
1850 1868
1851 strncpy (buf, tem, 24); 1869 strncpy (buf, tem, 24);
1852 buf[24] = 0; 1870 buf[24] = 0;
@@ -1854,8 +1872,6 @@ but this is considered obsolete. */)
1854 return build_string (buf); 1872 return build_string (buf);
1855} 1873}
1856 1874
1857#define TM_YEAR_BASE 1900
1858
1859/* Yield A - B, measured in seconds. 1875/* Yield A - B, measured in seconds.
1860 This function is copied from the GNU C Library. */ 1876 This function is copied from the GNU C Library. */
1861static int 1877static int
diff --git a/src/emacs.c b/src/emacs.c
index 5a09f5d762c..41857b7ccb8 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -53,10 +53,6 @@ Boston, MA 02110-1301, USA. */
53#include "buffer.h" 53#include "buffer.h"
54#include "window.h" 54#include "window.h"
55 55
56#ifdef HAVE_X_WINDOWS
57#include "xterm.h"
58#endif
59
60#include "systty.h" 56#include "systty.h"
61#include "blockinput.h" 57#include "blockinput.h"
62#include "syssignal.h" 58#include "syssignal.h"
@@ -1490,14 +1486,6 @@ main (argc, argv
1490 1486
1491 /* Don't actually discard this arg. */ 1487 /* Don't actually discard this arg. */
1492 skip_args = count_before; 1488 skip_args = count_before;
1493
1494 /* Do not be lenient if the user explicitly asked for a named display. */
1495 if (display_arg != 1 && !x_display_ok (displayname))
1496 {
1497 fprintf (stderr, "Display %s unavailable, simulating -nw\n",
1498 displayname);
1499 inhibit_window_system = 1;
1500 }
1501 } 1489 }
1502#endif 1490#endif
1503 1491
diff --git a/src/fileio.c b/src/fileio.c
index b1f9b91654a..cf0d84539d6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4974,6 +4974,7 @@ This does code conversion according to the value of
4974 if (!NILP (start) && !STRINGP (start)) 4974 if (!NILP (start) && !STRINGP (start))
4975 validate_region (&start, &end); 4975 validate_region (&start, &end);
4976 4976
4977 visit_file = Qnil;
4977 GCPRO5 (start, filename, visit, visit_file, lockname); 4978 GCPRO5 (start, filename, visit, visit_file, lockname);
4978 4979
4979 filename = Fexpand_file_name (filename, Qnil); 4980 filename = Fexpand_file_name (filename, Qnil);
diff --git a/src/fns.c b/src/fns.c
index dd496f4c253..c6ae96e8383 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4473,6 +4473,12 @@ sxhash_list (list, depth)
4473 hash = SXHASH_COMBINE (hash, hash2); 4473 hash = SXHASH_COMBINE (hash, hash2);
4474 } 4474 }
4475 4475
4476 if (!NILP (list))
4477 {
4478 unsigned hash2 = sxhash (list, depth + 1);
4479 hash = SXHASH_COMBINE (hash, hash2);
4480 }
4481
4476 return hash; 4482 return hash;
4477} 4483}
4478 4484
diff --git a/src/fringe.c b/src/fringe.c
index 2ce15d27d74..ab55775189f 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -866,10 +866,7 @@ draw_fringe_bitmap (w, row, left_p)
866 draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP); 866 draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP);
867 867
868 if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP) 868 if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP)
869 draw_fringe_bitmap_1 (w, row, 1, 1, 869 draw_fringe_bitmap_1 (w, row, 1, 1, row->overlay_arrow_bitmap);
870 (row->overlay_arrow_bitmap < 0
871 ? get_logical_fringe_bitmap (w, Qoverlay_arrow, 0, 0)
872 : row->overlay_arrow_bitmap));
873} 870}
874 871
875 872
@@ -1151,6 +1148,9 @@ update_window_fringes (w, keep_current_p)
1151 } 1148 }
1152 } 1149 }
1153 1150
1151 if (row->overlay_arrow_bitmap < 0)
1152 row->overlay_arrow_bitmap = get_logical_fringe_bitmap (w, Qoverlay_arrow, 0, 0);
1153
1154 if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap) 1154 if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap)
1155 { 1155 {
1156 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1; 1156 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
diff --git a/src/keymap.c b/src/keymap.c
index 233dff2c6f2..5e01566efaa 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -676,6 +676,7 @@ map_keymap (map, fun, args, data, autoload)
676 struct gcpro gcpro1, gcpro2, gcpro3; 676 struct gcpro gcpro1, gcpro2, gcpro3;
677 Lisp_Object tail; 677 Lisp_Object tail;
678 678
679 tail = Qnil;
679 GCPRO3 (map, args, tail); 680 GCPRO3 (map, args, tail);
680 map = get_keymap (map, 1, autoload); 681 map = get_keymap (map, 1, autoload);
681 for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map; 682 for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
diff --git a/src/macmenu.c b/src/macmenu.c
index 8cce41114de..8610ecafd94 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -62,10 +62,17 @@ Boston, MA 02110-1301, USA. */
62 62
63#include "dispextern.h" 63#include "dispextern.h"
64 64
65#define POPUP_SUBMENU_ID 235 65enum mac_menu_kind { /* Menu ID range */
66#define MIN_POPUP_SUBMENU_ID 512 66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */
67#define MIN_MENU_ID 256 67 MAC_MENU_MENU_BAR, /* 1 .. 234 */
68#define MIN_SUBMENU_ID 1 68 MAC_MENU_POPUP, /* 235 */
69 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */
70 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */
71 MAC_MENU_POPUP_SUB, /* 16384 .. 32767 */
72 MAC_MENU_END /* 32768 */
73};
74
75static const min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
69 76
70#define DIALOG_WINDOW_RESOURCE 130 77#define DIALOG_WINDOW_RESOURCE 130
71 78
@@ -189,9 +196,9 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
189static void list_of_panes P_ ((Lisp_Object)); 196static void list_of_panes P_ ((Lisp_Object));
190static void list_of_items P_ ((Lisp_Object)); 197static void list_of_items P_ ((Lisp_Object));
191 198
192static int fill_menu P_ ((MenuHandle, widget_value *, int)); 199static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int));
193static void fill_menubar P_ ((widget_value *, int)); 200static void fill_menubar P_ ((widget_value *, int));
194static void dispose_menus P_ ((int)); 201static void dispose_menus P_ ((enum mac_menu_kind, int));
195 202
196 203
197/* This holds a Lisp vector that holds the results of decoding 204/* This holds a Lisp vector that holds the results of decoding
@@ -1387,19 +1394,21 @@ menu_quit_handler (nextHandler, theEvent, userData)
1387 EventRef theEvent; 1394 EventRef theEvent;
1388 void* userData; 1395 void* userData;
1389{ 1396{
1397 OSStatus err;
1390 UInt32 keyCode; 1398 UInt32 keyCode;
1391 UInt32 keyModifiers; 1399 UInt32 keyModifiers;
1392 extern int mac_quit_char_modifiers; 1400 extern int mac_quit_char_modifiers;
1393 extern int mac_quit_char_keycode; 1401 extern int mac_quit_char_keycode;
1394 1402
1395 GetEventParameter (theEvent, kEventParamKeyCode, 1403 err = GetEventParameter (theEvent, kEventParamKeyCode,
1396 typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); 1404 typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
1397 1405
1398 GetEventParameter (theEvent, kEventParamKeyModifiers, 1406 if (err == noErr)
1399 typeUInt32, NULL, sizeof(UInt32), 1407 err = GetEventParameter (theEvent, kEventParamKeyModifiers,
1400 NULL, &keyModifiers); 1408 typeUInt32, NULL, sizeof(UInt32),
1409 NULL, &keyModifiers);
1401 1410
1402 if (keyCode == mac_quit_char_keycode 1411 if (err == noErr && keyCode == mac_quit_char_keycode
1403 && keyModifiers == mac_quit_char_modifiers) 1412 && keyModifiers == mac_quit_char_modifiers)
1404 { 1413 {
1405 MenuRef menu = userData != 0 1414 MenuRef menu = userData != 0
@@ -1414,35 +1423,29 @@ menu_quit_handler (nextHandler, theEvent, userData)
1414} 1423}
1415#endif /* HAVE_CANCELMENUTRACKING */ 1424#endif /* HAVE_CANCELMENUTRACKING */
1416 1425
1417/* Add event handler for MENU_HANDLE so we can detect C-g. 1426/* Add event handler to all menus that belong to KIND so we can detect C-g.
1418 If MENU_HANDLE is NULL, install handler for all menus in the menu bar. 1427 MENU_HANDLE is the root menu of the tracking session to dismiss
1428 when C-g is detected. NULL means the menu bar.
1419 If CancelMenuTracking isn't available, do nothing. */ 1429 If CancelMenuTracking isn't available, do nothing. */
1420 1430
1421static void 1431static void
1422install_menu_quit_handler (MenuHandle menu_handle) 1432install_menu_quit_handler (kind, menu_handle)
1433 enum mac_menu_kind kind;
1434 MenuHandle menu_handle;
1423{ 1435{
1424#ifdef HAVE_CANCELMENUTRACKING 1436#ifdef HAVE_CANCELMENUTRACKING
1425 EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } }; 1437 EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } };
1426 int i = MIN_MENU_ID; 1438 int id;
1427 MenuHandle menu = menu_handle ? menu_handle : GetMenuHandle (i);
1428 1439
1429 while (menu != NULL) 1440 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++)
1430 { 1441 {
1431 InstallMenuEventHandler (menu, menu_quit_handler, 1442 MenuHandle menu = GetMenuHandle (id);
1432 GetEventTypeCount (typesList),
1433 typesList, menu_handle, NULL);
1434 if (menu_handle) break;
1435 menu = GetMenuHandle (++i);
1436 }
1437 1443
1438 i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID; 1444 if (menu == NULL)
1439 menu = GetMenuHandle (i); 1445 break;
1440 while (menu != NULL)
1441 {
1442 InstallMenuEventHandler (menu, menu_quit_handler, 1446 InstallMenuEventHandler (menu, menu_quit_handler,
1443 GetEventTypeCount (typesList), 1447 GetEventTypeCount (typesList),
1444 typesList, menu_handle, NULL); 1448 typesList, menu_handle, NULL);
1445 menu = GetMenuHandle (++i);
1446 } 1449 }
1447#endif /* HAVE_CANCELMENUTRACKING */ 1450#endif /* HAVE_CANCELMENUTRACKING */
1448} 1451}
@@ -1677,7 +1680,8 @@ set_frame_menubar (f, first_time, deep_p)
1677 fill_menubar (first_wv->contents, deep_p); 1680 fill_menubar (first_wv->contents, deep_p);
1678 1681
1679 /* Add event handler so we can detect C-g. */ 1682 /* Add event handler so we can detect C-g. */
1680 install_menu_quit_handler (NULL); 1683 install_menu_quit_handler (MAC_MENU_MENU_BAR, NULL);
1684 install_menu_quit_handler (MAC_MENU_MENU_BAR_SUB, NULL);
1681 free_menubar_widget_value_tree (first_wv); 1685 free_menubar_widget_value_tree (first_wv);
1682 1686
1683 UNBLOCK_INPUT; 1687 UNBLOCK_INPUT;
@@ -1700,7 +1704,7 @@ pop_down_menu (arg)
1700{ 1704{
1701 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1705 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1702 FRAME_PTR f = p->pointer; 1706 FRAME_PTR f = p->pointer;
1703 MenuHandle menu = GetMenuHandle (POPUP_SUBMENU_ID); 1707 MenuHandle menu = GetMenuHandle (min_menu_id[MAC_MENU_POPUP]);
1704 1708
1705 BLOCK_INPUT; 1709 BLOCK_INPUT;
1706 1710
@@ -1709,8 +1713,8 @@ pop_down_menu (arg)
1709 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; 1713 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
1710 1714
1711 /* delete all menus */ 1715 /* delete all menus */
1712 dispose_menus (MIN_POPUP_SUBMENU_ID); 1716 dispose_menus (MAC_MENU_POPUP_SUB, 0);
1713 DeleteMenu (POPUP_SUBMENU_ID); 1717 DeleteMenu (min_menu_id[MAC_MENU_POPUP]);
1714 DisposeMenu (menu); 1718 DisposeMenu (menu);
1715 1719
1716 UNBLOCK_INPUT; 1720 UNBLOCK_INPUT;
@@ -1944,9 +1948,10 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1944 } 1948 }
1945 1949
1946 /* Actually create the menu. */ 1950 /* Actually create the menu. */
1947 menu = NewMenu (POPUP_SUBMENU_ID, "\p"); 1951 menu = NewMenu (min_menu_id[MAC_MENU_POPUP], "\p");
1948 InsertMenu (menu, -1); 1952 InsertMenu (menu, -1);
1949 fill_menu (menu, first_wv->contents, MIN_POPUP_SUBMENU_ID); 1953 fill_menu (menu, first_wv->contents, MAC_MENU_POPUP_SUB,
1954 min_menu_id[MAC_MENU_POPUP_SUB]);
1950 1955
1951 /* Free the widget_value objects we used to specify the 1956 /* Free the widget_value objects we used to specify the
1952 contents. */ 1957 contents. */
@@ -1966,7 +1971,8 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1966 record_unwind_protect (pop_down_menu, make_save_value (f, 0)); 1971 record_unwind_protect (pop_down_menu, make_save_value (f, 0));
1967 1972
1968 /* Add event handler so we can detect C-g. */ 1973 /* Add event handler so we can detect C-g. */
1969 install_menu_quit_handler (menu); 1974 install_menu_quit_handler (MAC_MENU_POPUP, menu);
1975 install_menu_quit_handler (MAC_MENU_POPUP_SUB, menu);
1970 1976
1971 /* Display the menu. */ 1977 /* Display the menu. */
1972 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); 1978 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0);
@@ -2437,9 +2443,10 @@ add_menu_item (menu, pos, wv)
2437/* Construct native Mac OS menu based on widget_value tree. */ 2443/* Construct native Mac OS menu based on widget_value tree. */
2438 2444
2439static int 2445static int
2440fill_menu (menu, wv, submenu_id) 2446fill_menu (menu, wv, kind, submenu_id)
2441 MenuHandle menu; 2447 MenuHandle menu;
2442 widget_value *wv; 2448 widget_value *wv;
2449 enum mac_menu_kind kind;
2443 int submenu_id; 2450 int submenu_id;
2444{ 2451{
2445 int pos; 2452 int pos;
@@ -2447,13 +2454,13 @@ fill_menu (menu, wv, submenu_id)
2447 for (pos = 1; wv != NULL; wv = wv->next, pos++) 2454 for (pos = 1; wv != NULL; wv = wv->next, pos++)
2448 { 2455 {
2449 add_menu_item (menu, pos, wv); 2456 add_menu_item (menu, pos, wv);
2450 if (wv->contents) 2457 if (wv->contents && submenu_id < min_menu_id[kind + 1])
2451 { 2458 {
2452 MenuHandle submenu = NewMenu (submenu_id, "\pX"); 2459 MenuHandle submenu = NewMenu (submenu_id, "\pX");
2453 2460
2454 InsertMenu (submenu, -1); 2461 InsertMenu (submenu, -1);
2455 SetMenuItemHierarchicalID (menu, pos, submenu_id); 2462 SetMenuItemHierarchicalID (menu, pos, submenu_id);
2456 submenu_id = fill_menu (submenu, wv->contents, submenu_id + 1); 2463 submenu_id = fill_menu (submenu, wv->contents, kind, submenu_id + 1);
2457 } 2464 }
2458 } 2465 }
2459 2466
@@ -2477,8 +2484,8 @@ fill_menubar (wv, deep_p)
2477 /* Clean up the menu bar when filled by the entire menu trees. */ 2484 /* Clean up the menu bar when filled by the entire menu trees. */
2478 if (deep_p) 2485 if (deep_p)
2479 { 2486 {
2480 dispose_menus (MIN_MENU_ID); 2487 dispose_menus (MAC_MENU_MENU_BAR, 0);
2481 dispose_menus (MIN_SUBMENU_ID); 2488 dispose_menus (MAC_MENU_MENU_BAR_SUB, 0);
2482#if !TARGET_API_MAC_CARBON 2489#if !TARGET_API_MAC_CARBON
2483 title_changed_p = 1; 2490 title_changed_p = 1;
2484#endif 2491#endif
@@ -2486,8 +2493,10 @@ fill_menubar (wv, deep_p)
2486 2493
2487 /* Fill menu bar titles and submenus. Reuse the existing menu bar 2494 /* Fill menu bar titles and submenus. Reuse the existing menu bar
2488 titles as much as possible to minimize redraw (if !deep_p). */ 2495 titles as much as possible to minimize redraw (if !deep_p). */
2489 submenu_id = MIN_SUBMENU_ID; 2496 submenu_id = min_menu_id[MAC_MENU_MENU_BAR_SUB];
2490 for (id = MIN_MENU_ID; wv != NULL; wv = wv->next, id++) 2497 for (id = min_menu_id[MAC_MENU_MENU_BAR];
2498 wv != NULL && id < min_menu_id[MAC_MENU_MENU_BAR + 1];
2499 wv = wv->next, id++)
2491 { 2500 {
2492 strncpy (title, wv->name, 255); 2501 strncpy (title, wv->name, 255);
2493 title[255] = '\0'; 2502 title[255] = '\0';
@@ -2523,12 +2532,13 @@ fill_menubar (wv, deep_p)
2523 } 2532 }
2524 2533
2525 if (wv->contents) 2534 if (wv->contents)
2526 submenu_id = fill_menu (menu, wv->contents, submenu_id); 2535 submenu_id = fill_menu (menu, wv->contents, MAC_MENU_MENU_BAR_SUB,
2536 submenu_id);
2527 } 2537 }
2528 2538
2529 if (GetMenuHandle (id)) 2539 if (id < min_menu_id[MAC_MENU_MENU_BAR + 1] && GetMenuHandle (id))
2530 { 2540 {
2531 dispose_menus (id); 2541 dispose_menus (MAC_MENU_MENU_BAR, id);
2532#if !TARGET_API_MAC_CARBON 2542#if !TARGET_API_MAC_CARBON
2533 title_changed_p = 1; 2543 title_changed_p = 1;
2534#endif 2544#endif
@@ -2540,17 +2550,22 @@ fill_menubar (wv, deep_p)
2540#endif 2550#endif
2541} 2551}
2542 2552
2553/* Dispose of menus that belong to KIND, and remove them from the menu
2554 list. ID is the lower bound of menu IDs that will be processed. */
2555
2543static void 2556static void
2544dispose_menus (id) 2557dispose_menus (kind, id)
2558 enum mac_menu_kind kind;
2545 int id; 2559 int id;
2546{ 2560{
2547 MenuHandle menu; 2561 for (id = max (id, min_menu_id[kind]); id < min_menu_id[kind + 1]; id++)
2548
2549 while ((menu = GetMenuHandle (id)) != NULL)
2550 { 2562 {
2563 MenuHandle menu = GetMenuHandle (id);
2564
2565 if (menu == NULL)
2566 break;
2551 DeleteMenu (id); 2567 DeleteMenu (id);
2552 DisposeMenu (menu); 2568 DisposeMenu (menu);
2553 id++;
2554 } 2569 }
2555} 2570}
2556 2571
diff --git a/src/macterm.c b/src/macterm.c
index b4b096fa541..f09b4918fb9 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -10476,7 +10476,8 @@ XTread_socket (sd, expected, hold_quit)
10476 10476
10477 ObscureCursor (); 10477 ObscureCursor ();
10478 10478
10479 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 10479 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
10480 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
10480 { 10481 {
10481 clear_mouse_face (dpyinfo); 10482 clear_mouse_face (dpyinfo);
10482 dpyinfo->mouse_face_hidden = 1; 10483 dpyinfo->mouse_face_hidden = 1;
diff --git a/src/print.c b/src/print.c
index 5f41f6f7737..cb3378dd2b1 100644
--- a/src/print.c
+++ b/src/print.c
@@ -183,6 +183,9 @@ static int max_print;
183 183
184void print_interval (); 184void print_interval ();
185 185
186/* GDB resets this to zero on W32 to disable OutputDebugString calls. */
187int print_output_debug_flag = 1;
188
186 189
187/* Low level output routines for characters and strings */ 190/* Low level output routines for characters and strings */
188 191
@@ -909,10 +912,11 @@ to make it write to the debugging output. */)
909 912
910#ifdef WINDOWSNT 913#ifdef WINDOWSNT
911 /* Send the output to a debugger (nothing happens if there isn't one). */ 914 /* Send the output to a debugger (nothing happens if there isn't one). */
912 { 915 if (print_output_debug_flag)
913 char buf[2] = {(char) XINT (character), '\0'}; 916 {
914 OutputDebugString (buf); 917 char buf[2] = {(char) XINT (character), '\0'};
915 } 918 OutputDebugString (buf);
919 }
916#endif 920#endif
917 921
918 return character; 922 return character;
diff --git a/src/process.c b/src/process.c
index 159f8001bbc..9b47f1cae31 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3839,62 +3839,60 @@ DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
3839It is read into the process' buffers or given to their filter functions. 3839It is read into the process' buffers or given to their filter functions.
3840Non-nil arg PROCESS means do not return until some output has been received 3840Non-nil arg PROCESS means do not return until some output has been received
3841from PROCESS. 3841from PROCESS.
3842Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of 3842
3843seconds and microseconds to wait; return after that much time whether 3843Non-nil second arg SECONDS and third arg MILLISEC are number of
3844or not there is input. 3844seconds and milliseconds to wait; return after that much time whether
3845or not there is input. If SECONDS is a floating point number,
3846it specifies a fractional number of seconds to wait.
3847
3845If optional fourth arg JUST-THIS-ONE is non-nil, only accept output 3848If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
3846from PROCESS, suspending reading output from other processes. 3849from PROCESS, suspending reading output from other processes.
3847If JUST-THIS-ONE is an integer, don't run any timers either. 3850If JUST-THIS-ONE is an integer, don't run any timers either.
3848Return non-nil iff we received any output before the timeout expired. */) 3851Return non-nil iff we received any output before the timeout expired. */)
3849 (process, timeout, timeout_msecs, just_this_one) 3852 (process, seconds, millisec, just_this_one)
3850 register Lisp_Object process, timeout, timeout_msecs, just_this_one; 3853 register Lisp_Object process, seconds, millisec, just_this_one;
3851{ 3854{
3852 int seconds; 3855 int secs, usecs = 0;
3853 int useconds;
3854 3856
3855 if (! NILP (process)) 3857 if (! NILP (process))
3856 CHECK_PROCESS (process); 3858 CHECK_PROCESS (process);
3857 else 3859 else
3858 just_this_one = Qnil; 3860 just_this_one = Qnil;
3859 3861
3860 if (! NILP (timeout_msecs)) 3862 if (!NILP (seconds))
3861 { 3863 {
3862 CHECK_NUMBER (timeout_msecs); 3864 if (INTEGERP (seconds))
3863 useconds = XINT (timeout_msecs); 3865 secs = XINT (seconds);
3864 if (!INTEGERP (timeout)) 3866 else if (FLOATP (seconds))
3865 XSETINT (timeout, 0); 3867 {
3866 3868 double timeout = XFLOAT_DATA (seconds);
3867 { 3869 secs = (int) timeout;
3868 int carry = useconds / 1000000; 3870 usecs = (int) ((timeout - (double) secs) * 1000000);
3869 3871 }
3870 XSETINT (timeout, XINT (timeout) + carry); 3872 else
3871 useconds -= carry * 1000000; 3873 wrong_type_argument (Qnumberp, seconds);
3872 3874
3873 /* I think this clause is necessary because C doesn't 3875 if (INTEGERP (millisec))
3874 guarantee a particular rounding direction for negative 3876 {
3875 integers. */ 3877 int carry;
3876 if (useconds < 0) 3878 usecs += XINT (millisec) * 1000;
3877 { 3879 carry = usecs / 1000000;
3878 XSETINT (timeout, XINT (timeout) - 1); 3880 secs += carry;
3879 useconds += 1000000; 3881 if ((usecs -= carry * 1000000) < 0)
3880 } 3882 {
3881 } 3883 secs--;
3882 } 3884 usecs += 1000000;
3883 else 3885 }
3884 useconds = 0; 3886 }
3885 3887
3886 if (! NILP (timeout)) 3888 if (secs < 0 || (secs == 0 && usecs == 0))
3887 { 3889 secs = -1, usecs = 0;
3888 CHECK_NUMBER (timeout);
3889 seconds = XINT (timeout);
3890 if (seconds < 0 || (seconds == 0 && useconds == 0))
3891 seconds = -1;
3892 } 3890 }
3893 else 3891 else
3894 seconds = NILP (process) ? -1 : 0; 3892 secs = NILP (process) ? -1 : 0;
3895 3893
3896 return 3894 return
3897 (wait_reading_process_output (seconds, useconds, 0, 0, 3895 (wait_reading_process_output (secs, usecs, 0, 0,
3898 Qnil, 3896 Qnil,
3899 !NILP (process) ? XPROCESS (process) : NULL, 3897 !NILP (process) ? XPROCESS (process) : NULL,
3900 NILP (just_this_one) ? 0 : 3898 NILP (just_this_one) ? 0 :
diff --git a/src/term.c b/src/term.c
index 9f360b70baf..48942a46671 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1654,6 +1654,12 @@ term_get_fkeys_1 ()
1654 Character Display Information 1654 Character Display Information
1655 ***********************************************************************/ 1655 ***********************************************************************/
1656 1656
1657/* Avoid name clash with functions defined in xterm.c */
1658#ifdef static
1659#define append_glyph append_glyph_term
1660#define produce_stretch_glyph produce_stretch_glyph_term
1661#endif
1662
1657static void append_glyph P_ ((struct it *)); 1663static void append_glyph P_ ((struct it *));
1658static void produce_stretch_glyph P_ ((struct it *)); 1664static void produce_stretch_glyph P_ ((struct it *));
1659 1665
diff --git a/src/w32term.c b/src/w32term.c
index 92c03e2bf9f..5681b6ee62f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4411,7 +4411,8 @@ w32_read_socket (sd, expected, hold_quit)
4411 4411
4412 if (f && !f->iconified) 4412 if (f && !f->iconified)
4413 { 4413 {
4414 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4414 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4415 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
4415 { 4416 {
4416 clear_mouse_face (dpyinfo); 4417 clear_mouse_face (dpyinfo);
4417 dpyinfo->mouse_face_hidden = 1; 4418 dpyinfo->mouse_face_hidden = 1;
@@ -4434,7 +4435,8 @@ w32_read_socket (sd, expected, hold_quit)
4434 4435
4435 if (f && !f->iconified) 4436 if (f && !f->iconified)
4436 { 4437 {
4437 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4438 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4439 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
4438 { 4440 {
4439 clear_mouse_face (dpyinfo); 4441 clear_mouse_face (dpyinfo);
4440 dpyinfo->mouse_face_hidden = 1; 4442 dpyinfo->mouse_face_hidden = 1;
diff --git a/src/window.c b/src/window.c
index d4eaa72f579..039e955efd0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4796,8 +4796,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4796 possibility of point becoming "stuck" on a tall line when 4796 possibility of point becoming "stuck" on a tall line when
4797 scrolling by one line. */ 4797 scrolling by one line. */
4798 if (window_scroll_pixel_based_preserve_y < 0 4798 if (window_scroll_pixel_based_preserve_y < 0
4799 || (current_kboard->Vlast_command != Qscroll_up 4799 || (!EQ (current_kboard->Vlast_command, Qscroll_up)
4800 && current_kboard->Vlast_command != Qscroll_down)) 4800 && !EQ (current_kboard->Vlast_command, Qscroll_down)))
4801 { 4801 {
4802 start_display (&it, w, start); 4802 start_display (&it, w, start);
4803 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4803 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
diff --git a/src/xdisp.c b/src/xdisp.c
index 3bc9d9b55b4..a89a11db300 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11699,7 +11699,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11699 x += glyph->pixel_width; 11699 x += glyph->pixel_width;
11700 ++glyph; 11700 ++glyph;
11701 if (cursor_from_overlay_pos 11701 if (cursor_from_overlay_pos
11702 && last_pos > cursor_from_overlay_pos) 11702 && last_pos >= cursor_from_overlay_pos)
11703 { 11703 {
11704 cursor_from_overlay_pos = 0; 11704 cursor_from_overlay_pos = 0;
11705 cursor = 0; 11705 cursor = 0;
@@ -11713,10 +11713,12 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11713 /* Skip all glyphs from string. */ 11713 /* Skip all glyphs from string. */
11714 do 11714 do
11715 { 11715 {
11716 Lisp_Object cprop;
11716 int pos; 11717 int pos;
11717 if ((cursor == NULL || glyph > cursor) 11718 if ((cursor == NULL || glyph > cursor)
11718 && !NILP (Fget_char_property (make_number ((glyph)->charpos), 11719 && (cprop = Fget_char_property (make_number ((glyph)->charpos),
11719 Qcursor, (glyph)->object)) 11720 Qcursor, (glyph)->object),
11721 !NILP (cprop))
11720 && (pos = string_buffer_position (w, glyph->object, 11722 && (pos = string_buffer_position (w, glyph->object,
11721 string_before_pos), 11723 string_before_pos),
11722 (pos == 0 /* From overlay */ 11724 (pos == 0 /* From overlay */
@@ -11727,14 +11729,15 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11727 Add 1 to last_pos so that if point corresponds to the 11729 Add 1 to last_pos so that if point corresponds to the
11728 glyph right after the overlay, we still use a 'cursor' 11730 glyph right after the overlay, we still use a 'cursor'
11729 property found in that overlay. */ 11731 property found in that overlay. */
11730 cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0; 11732 cursor_from_overlay_pos = (pos ? 0 : last_pos
11733 + (INTEGERP (cprop) ? XINT (cprop) : 0));
11731 cursor = glyph; 11734 cursor = glyph;
11732 cursor_x = x; 11735 cursor_x = x;
11733 } 11736 }
11734 x += glyph->pixel_width; 11737 x += glyph->pixel_width;
11735 ++glyph; 11738 ++glyph;
11736 } 11739 }
11737 while (glyph < end && STRINGP (glyph->object)); 11740 while (glyph < end && EQ (glyph->object, string_start->object));
11738 } 11741 }
11739 } 11742 }
11740 11743
diff --git a/src/xfns.c b/src/xfns.c
index c811fba2fc8..60516d5a624 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -789,12 +789,9 @@ xg_set_icon (f, file)
789 FRAME_PTR f; 789 FRAME_PTR f;
790 Lisp_Object file; 790 Lisp_Object file;
791{ 791{
792 struct gcpro gcpro1;
793 int result = 0; 792 int result = 0;
794 Lisp_Object found; 793 Lisp_Object found;
795 794
796 GCPRO1 (found);
797
798 found = x_find_image_file (file); 795 found = x_find_image_file (file);
799 796
800 if (! NILP (found)) 797 if (! NILP (found))
diff --git a/src/xterm.c b/src/xterm.c
index ec6fb395d12..c406268c606 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6165,7 +6165,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6165 6165
6166 f = x_any_window_to_frame (dpyinfo, event.xkey.window); 6166 f = x_any_window_to_frame (dpyinfo, event.xkey.window);
6167 6167
6168 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 6168 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
6169 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
6169 { 6170 {
6170 clear_mouse_face (dpyinfo); 6171 clear_mouse_face (dpyinfo);
6171 dpyinfo->mouse_face_hidden = 1; 6172 dpyinfo->mouse_face_hidden = 1;
@@ -10267,6 +10268,10 @@ static XrmOptionDescRec emacs_options[] = {
10267 10268
10268static int x_initialized; 10269static int x_initialized;
10269 10270
10271#ifdef HAVE_X_SM
10272static int x_session_initialized;
10273#endif
10274
10270#ifdef MULTI_KBOARD 10275#ifdef MULTI_KBOARD
10271/* Test whether two display-name strings agree up to the dot that separates 10276/* Test whether two display-name strings agree up to the dot that separates
10272 the screen number from the server number. */ 10277 the screen number from the server number. */
@@ -10351,12 +10356,8 @@ x_display_ok (display)
10351 int dpy_ok = 1; 10356 int dpy_ok = 1;
10352 Display *dpy; 10357 Display *dpy;
10353 10358
10354 if (!display) 10359 dpy = XOpenDisplay (display);
10355 display = getenv("DISPLAY"); 10360 if (dpy)
10356 if (!display)
10357 return 0;
10358
10359 if ((dpy = XOpenDisplay (display)))
10360 XCloseDisplay (dpy); 10361 XCloseDisplay (dpy);
10361 else 10362 else
10362 dpy_ok = 0; 10363 dpy_ok = 0;
@@ -10432,11 +10433,9 @@ x_term_init (display_name, xrm_option, resource_name)
10432 10433
10433 /* Load our own gtkrc if it exists. */ 10434 /* Load our own gtkrc if it exists. */
10434 { 10435 {
10435 struct gcpro gcpro1, gcpro2;
10436 char *file = "~/.emacs.d/gtkrc"; 10436 char *file = "~/.emacs.d/gtkrc";
10437 Lisp_Object s, abs_file; 10437 Lisp_Object s, abs_file;
10438 10438
10439 GCPRO2 (s, abs_file);
10440 s = make_string (file, strlen (file)); 10439 s = make_string (file, strlen (file));
10441 abs_file = Fexpand_file_name (s, Qnil); 10440 abs_file = Fexpand_file_name (s, Qnil);
10442 10441
@@ -10841,7 +10840,7 @@ x_term_init (display_name, xrm_option, resource_name)
10841 10840
10842#ifdef HAVE_X_SM 10841#ifdef HAVE_X_SM
10843 /* Only do this for the first display. */ 10842 /* Only do this for the first display. */
10844 if (x_initialized == 1) 10843 if (!x_session_initialized++)
10845 x_session_initialize (dpyinfo); 10844 x_session_initialize (dpyinfo);
10846#endif 10845#endif
10847 10846
@@ -11026,6 +11025,9 @@ x_initialize ()
11026 last_tool_bar_item = -1; 11025 last_tool_bar_item = -1;
11027 any_help_event_p = 0; 11026 any_help_event_p = 0;
11028 ignore_next_mouse_click_timeout = 0; 11027 ignore_next_mouse_click_timeout = 0;
11028#ifdef HAVE_X_SM
11029 x_session_initialized = 0;
11030#endif
11029 11031
11030#ifdef USE_GTK 11032#ifdef USE_GTK
11031 current_count = -1; 11033 current_count = -1;