aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2010-04-15 11:20:03 +0200
committerJoakim Verona2010-04-15 11:20:03 +0200
commit998fc3676243277f3b1c73eb91c055c80a7498c7 (patch)
treeba74f989f083982a53e228cbaea6439de17c120a /src
parent245e223a57ac14d168702891f6efbe0eb11b0384 (diff)
parent041b80fcd9e6d7b499f08a6163ead3dc3efa4d3d (diff)
downloademacs-998fc3676243277f3b1c73eb91c055c80a7498c7.tar.gz
emacs-998fc3676243277f3b1c73eb91c055c80a7498c7.zip
merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/.arch-inventory12
-rw-r--r--src/ChangeLog182
-rw-r--r--src/Makefile.in103
-rw-r--r--src/bidi.c12
-rw-r--r--src/buffer.c1
-rw-r--r--src/buffer.h6
-rw-r--r--src/dispextern.h4
-rw-r--r--src/fileio.c29
-rw-r--r--src/frame.h4
-rw-r--r--src/gtkutil.c19
-rw-r--r--src/m/hp800.h32
-rw-r--r--src/m/iris4d.h6
-rw-r--r--src/menu.c18
-rw-r--r--src/process.c83
-rw-r--r--src/s/darwin.h4
-rw-r--r--src/s/hpux10-20.h5
-rw-r--r--src/s/irix6-5.h2
-rw-r--r--src/s/msdos.h2
-rw-r--r--src/sysdep.c17
-rw-r--r--src/term.c30
-rw-r--r--src/window.c28
-rw-r--r--src/xdisp.c35
-rw-r--r--src/xfns.c71
-rw-r--r--src/xmenu.c52
-rw-r--r--src/xsettings.c49
-rw-r--r--src/xsettings.h3
-rw-r--r--src/xterm.c6
27 files changed, 532 insertions, 283 deletions
diff --git a/src/.arch-inventory b/src/.arch-inventory
deleted file mode 100644
index c21e38d47d7..00000000000
--- a/src/.arch-inventory
+++ /dev/null
@@ -1,12 +0,0 @@
1# Source files which don't match the usual naming conventions, mostly dot files
2source ^\.(gdbinit|dbxinit)$
3
4# Auto-generated files, which ignore
5precious ^(config\.stamp|config\.h|epaths\.h|buildobj\.lst)$
6precious ^(TAGS-LISP)$
7precious ^(buildobj\.lst)$
8
9backup ^(stamp-oldxmenu|prefix-args|temacs|emacs|emacs-[0-9.]*)$
10backup ^(bootstrap-emacs)$
11
12# arch-tag: 277cc7ae-b3f5-44af-abf1-84c073164543
diff --git a/src/ChangeLog b/src/ChangeLog
index 6629a29ed9e..a32558a2ac7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,185 @@
12010-04-14 Dan Nicolaescu <dann@ics.uci.edu>
2
3 Reduce cpp use in Makefile.in.
4 * Makefile.in (DBUS_CFLAGS, DBUS_LIBS, GCONF_CFLAGS, GCONF_LIBS)
5 (LIBSOUND, CFLAGS_SOUND, RSVG_LIBS, RSVG_CFLAGS, INTERVALS_H)
6 (GETLOADAVG_LIBS, RUN_TEMACS): Move to the autoconf section.
7 (ORDINARY_LINK): Remove, defined in src/s/gnu.h.
8 (CRT0_COMPILE): Remove, inline it in the only user.
9
102010-04-14 Juri Linkov <juri@jurta.org>
11
12 * window.c (keys_of_window): Rebind `C-v' from `scroll-up' to
13 `scroll-up-command' and `M-v' from `scroll-down' to
14 `scroll-down-command'.
15
162010-04-14 Juri Linkov <juri@jurta.org>
17
18 * window.c (Vscroll_preserve_screen_position_commands): New variable
19 with the default value as the list of Qscroll_down and Qscroll_up.
20 (window_scroll_pixel_based, window_scroll_line_based): Search the
21 last command in the list Vscroll_preserve_screen_position_commands
22 instead of comparing with Qscroll_up and Qscroll_down.
23
242010-04-13 Jan Djärv <jan.h.d@swipnet.se>
25
26 * gtkutil.c (xg_set_geometry): Set geometry for PPosition also.
27 (x_wm_set_size_hint): Dont set position flags, gtk_window_parse_geometry
28 does that.
29
30 * xfns.c (Fx_create_frame, x_create_tip_frame): Set default border width
31 to zero.
32
332010-04-13 Stefan Monnier <monnier@iro.umontreal.ca>
34
35 * term.c (init_tty): Move common text outside of #ifdef TERMINFO.
36
37 Try to solve the problem of spurious EOF chars in long lines of text
38 sent to interactive subprocesses.
39 * sysdep.c (child_setup_tty): Do not enable ICANON any more.
40 (system_process_attributes): Remove unused var `ttotal'.
41 * process.c (send_process): Don't bother breaking long line with EOF
42 chars when talking to ttys any more.
43 (wait_reading_process_output): Output a warning when called in such
44 a way that it could block without being interruptible.
45
46 Try to detect file modification within the same second.
47 * buffer.h (struct buffer): New field modtime_size.
48 * buffer.c (reset_buffer): Initialize it.
49 * fileio.c (Finsert_file_contents, Fwrite_region): Set it.
50 (Fverify_visited_file_modtime): Check it.
51 (Fclear_visited_file_modtime, Fset_visited_file_modtime): Clear it.
52 (Fset_visited_file_modtime): Set (or clear) it.
53
542010-04-12 Stefan Monnier <monnier@iro.umontreal.ca>
55
56 * process.c (status_notify): Remove unused var `ro'.
57
582010-04-12 Jan Djärv <jan.h.d@swipnet.se>
59
60 * xfns.c (select_visual): Don't call error if XGetVisualInfo returns
61 more than one visual (Bug#5938).
62
632010-04-12 Dan Nicolaescu <dann@ics.uci.edu>
64
65 * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): Undefine.
66
672010-04-11 Dan Nicolaescu <dann@ics.uci.edu>
68
69 Remove C_SWITCH_SYSTEM_TEMACS.
70 * s/darwin.h (C_SWITCH_SYSTEM_TEMACS): Remove.
71 (malloc, realloc, free): Use emacs, not temacs for conditional
72 definition.
73
74 * Makefile.in (C_SWITCH_SYSTEM_TEMACS): Remove.
75 (ALL_CFLAGS): Do not use C_SWITCH_SYSTEM_TEMACS.
76
77 Use autoconf, not cpp for some variables.
78 * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE)
79 (C_SWITCH_X_SITE): Define using autoconf, not cpp.
80 (ALL_CFLAGS): Use them as make variables.
81 (really-lwlib, really-oldXMenu): Do not pass them.
82
832010-04-11 Jan Djärv <jan.h.d@swipnet.se>
84
85 * xmenu.c (apply_systemfont_to_dialog): New.
86 (create_and_show_dialog): Call apply_systemfont_to_dialog if HAVE_XFT.
87
882010-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
89
90 * process.c (exec_sentinel): Preserve current-buffer.
91
92 * process.c (read_process_output): Move the save-current-buffer to
93 apply to both the filter and the non-filter branches.
94
952010-04-10 Dan Nicolaescu <dann@ics.uci.edu>
96
97 * s/msdos.h (UNEXEC): New definition.
98
992010-04-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
100
101 * dispextern.h (TRY_WINDOW_CHECK_MARGINS)
102 (TRY_WINDOW_IGNORE_FONTS_CHANGE): New defines.
103
104 * xdisp.c (try_window): Change arg from CHECK_MARGINS to FLAGS.
105 Don't abort with fonts change if TRY_WINDOW_IGNORE_FONTS_CHANGE is
106 set in FLAGS. Callers with non-zero CHECK_MARGINS changed to use
107 TRY_WINDOW_CHECK_MARGINS.
108
109 * xfns.c (Fx_show_tip): Undo last change. Call try_window with
110 TRY_WINDOW_IGNORE_FONTS_CHANGE (Bug#2423). Subtract last glyph's
111 width only when it is for padding.
112
1132010-04-09 Jan Djärv <jan.h.d@swipnet.se>
114
115 * xfns.c (Fx_show_tip): Call try_window in a loop until
116 fonts_changed_p is zero (Bug#2423).
117
1182010-04-08 Eli Zaretskii <eliz@gnu.org>
119
120 * xdisp.c (set_cursor_from_row): Don't dereference glyphs beyond
121 the end of TEXT_AREA. (Bug#5856)
122
1232010-04-08 Jan Djärv <jan.h.d@swipnet.se>
124
125 * xsettings.c (XSETTINGS_FONT_NAME): Move XSETTINGS_FONT_NAME out of
126 HAVE_GCONF.
127
1282010-04-08 Eli Zaretskii <eliz@gnu.org>
129
130 * bidi.c (bidi_resolve_weak): Use prev.type_after_w1, instead of
131 prev.orig_type, for resolving type of NSM. (Bug#5858)
132
1332010-04-08 Jan Djärv <jan.h.d@swipnet.se>
134
135 * xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
136 (parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
137 in current_font.
138 (init_gconf): Read value of SYSTEM_FONT and save it in current_font.
139 (Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
140 functions.
141 (syms_of_xsettings): Initialize current_font. defsubr
142 Sfont_get_system_normal_font.
143
144 * xsettings.h (Ffont_get_system_normal_font,
145 xsettings_get_system_normal_font): Declare.
146
147 * xfns.c (extern xlwmenu_default_font): Remove.
148 (Fx_create_frame): Remove setting of xlwmenu_default_font, moved
149 to xlwmenu.c.
150
151 * menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
152 menu items in UTF-8.
153
154 * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
155 (apply_systemfont_to_menu): New function.
156 (set_frame_menubar, create_and_show_popup_menu): Call
157 apply_systemfont_to_menu.
158
1592010-04-07 Jan Djärv <jan.h.d@swipnet.se>
160
161 * frame.h (FRAME_TEXT_LINES_TO_PIXEL_HEIGHT): Don't use
162 FRAME_LINE_TO_PIXEL_Y.
163
164 * xterm.c (x_set_window_size_1): Don't add border_width/height to
165 pixelwidth/height.
166
1672010-04-07 Dan Nicolaescu <dann@ics.uci.edu>
168
169 Simplify code for HP machines.
170 * m/hp800.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, NO_REMAP): Do not define
171 for GNU_LINUX, not needed.
172 (UNEXEC, NEED_BSDTTY): Move definitions...
173 * s/hpux10-20.h (UNEXEC, NEED_BSDTTY): ... here.
174
175 * m/iris4d.h (UNEXEC): Move definition ...
176 * s/irix6-5.h (UNEXEC): ... here.
177
1782010-04-04 Jan Djärv <jan.h.d@swipnet.se>
179
180 * xfns.c (set_machine_and_pid_properties): New function.
181 (Fx_create_frame): Call set_machine_and_pid_properties.
182
12010-04-03 Eli Zaretskii <eliz@gnu.org> 1832010-04-03 Eli Zaretskii <eliz@gnu.org>
2 184
3 * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check 185 * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check
diff --git a/src/Makefile.in b/src/Makefile.in
index 2d68910667f..dada7164761 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -76,11 +76,32 @@ LIBGIF=@LIBGIF@
76LIBXPM=@LIBXPM@ 76LIBXPM=@LIBXPM@
77XFT_LIBS=@XFT_LIBS@ 77XFT_LIBS=@XFT_LIBS@
78 78
79C_SWITCH_SYSTEM=@c_switch_system@
80C_SWITCH_MACHINE=@c_switch_machine@
81
82C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
83
84DBUS_CFLAGS = @DBUS_CFLAGS@
85DBUS_LIBS = @DBUS_LIBS@
86
87GCONF_CFLAGS = @GCONF_CFLAGS@
88GCONF_LIBS = @GCONF_LIBS@
89
90LIBSOUND= @LIBSOUND@
91CFLAGS_SOUND= @CFLAGS_SOUND@
92
93RSVG_LIBS= @RSVG_LIBS@
94RSVG_CFLAGS= @RSVG_CFLAGS@
95
96INTERVALS_H = dispextern.h intervals.h composite.h
97
98GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
99
100RUN_TEMACS = `/bin/pwd`/temacs
101
79# ========================== start of cpp stuff ======================= 102# ========================== start of cpp stuff =======================
80/* From here on, comments must be done in C syntax. */ 103/* From here on, comments must be done in C syntax. */
81 104
82C_SWITCH_SYSTEM=
83
84/* just to be sure the sh is used */ 105/* just to be sure the sh is used */
85SHELL=/bin/sh 106SHELL=/bin/sh
86 107
@@ -92,6 +113,11 @@ SHELL=/bin/sh
92DEPFLAGS = -MMD -MF deps/$*.d 113DEPFLAGS = -MMD -MF deps/$*.d
93#endif 114#endif
94 115
116/* Undefine until the user can be moved in the non-cpp section. */
117#undef C_SWITCH_SYSTEM
118#undef C_SWITCH_MACHINE
119#undef C_SWITCH_X_SITE
120
95/* Do not let the file name mktime.c get messed up. */ 121/* Do not let the file name mktime.c get messed up. */
96#ifdef mktime 122#ifdef mktime
97#undef mktime 123#undef mktime
@@ -110,14 +136,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
110 do not let it interfere with this file. */ 136 do not let it interfere with this file. */
111#undef register 137#undef register
112 138
113/* GNU libc requires ORDINARY_LINK so that its own crt0 is used.
114 GNU/Linux is an exception because it uses a funny variant of GNU libc. */
115#ifdef __GNU_LIBRARY__
116#ifndef GNU_LINUX
117#define ORDINARY_LINK
118#endif
119#endif
120
121/* Some machines do not find the standard C libraries in the usual place. */ 139/* Some machines do not find the standard C libraries in the usual place. */
122#ifndef ORDINARY_LINK 140#ifndef ORDINARY_LINK
123#ifndef LIB_STANDARD 141#ifndef LIB_STANDARD
@@ -164,12 +182,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
164#define LD_SWITCH_SYSTEM_TEMACS 182#define LD_SWITCH_SYSTEM_TEMACS
165#endif 183#endif
166 184
167/* Some s/SYSTEM.h files define this to request special switches
168 for compiling temacs. */
169#ifndef C_SWITCH_SYSTEM_TEMACS
170#define C_SWITCH_SYSTEM_TEMACS
171#endif
172
173/* Some m/MACHINE.h files define this to request special switches in ld. */ 185/* Some m/MACHINE.h files define this to request special switches in ld. */
174#ifndef LD_SWITCH_MACHINE 186#ifndef LD_SWITCH_MACHINE
175#define LD_SWITCH_MACHINE 187#define LD_SWITCH_MACHINE
@@ -181,16 +193,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
181#define LD_SWITCH_MACHINE_TEMACS 193#define LD_SWITCH_MACHINE_TEMACS
182#endif 194#endif
183 195
184/* Some m/MACHINE.h files define this to request special switches in cc. */
185#ifndef C_SWITCH_MACHINE
186#define C_SWITCH_MACHINE
187#endif
188
189/* Some s/SYSTEM.h files define this to request special switches in cc. */
190#ifndef C_SWITCH_SYSTEM
191#define C_SWITCH_SYSTEM
192#endif
193
194/* These macros are for switches specifically related to X Windows. */ 196/* These macros are for switches specifically related to X Windows. */
195#ifndef C_SWITCH_X_MACHINE 197#ifndef C_SWITCH_X_MACHINE
196#define C_SWITCH_X_MACHINE 198#define C_SWITCH_X_MACHINE
@@ -200,10 +202,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
200#define C_SWITCH_X_SYSTEM 202#define C_SWITCH_X_SYSTEM
201#endif 203#endif
202 204
203#ifndef C_SWITCH_X_SITE
204#define C_SWITCH_X_SITE
205#endif
206
207#ifndef LD_SWITCH_X_SITE 205#ifndef LD_SWITCH_X_SITE
208#define LD_SWITCH_X_SITE 206#define LD_SWITCH_X_SITE
209#endif 207#endif
@@ -214,10 +212,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
214 212
215#ifndef ORDINARY_LINK 213#ifndef ORDINARY_LINK
216 214
217#ifndef CRT0_COMPILE
218#define CRT0_COMPILE $(CC) -c $(ALL_CFLAGS)
219#endif
220
221#ifndef START_FILES 215#ifndef START_FILES
222#ifdef NO_REMAP 216#ifdef NO_REMAP
223#define START_FILES pre-crt0.o /lib/crt0.o 217#define START_FILES pre-crt0.o /lib/crt0.o
@@ -247,16 +241,9 @@ shared=no
247#endif 241#endif
248 242
249#ifdef HAVE_DBUS 243#ifdef HAVE_DBUS
250DBUS_CFLAGS = @DBUS_CFLAGS@
251DBUS_LIBS = @DBUS_LIBS@
252DBUS_OBJ = dbusbind.o 244DBUS_OBJ = dbusbind.o
253#endif 245#endif
254 246
255#ifdef HAVE_GCONF
256GCONF_CFLAGS = @GCONF_CFLAGS@
257GCONF_LIBS = @GCONF_LIBS@
258#endif
259
260/* DO NOT use -R. There is a special hack described in lastfile.c 247/* DO NOT use -R. There is a special hack described in lastfile.c
261 which is used instead. Some initialized data areas are modified 248 which is used instead. Some initialized data areas are modified
262 at initial startup, then labeled as part of the text area when 249 at initial startup, then labeled as part of the text area when
@@ -268,11 +255,13 @@ GCONF_LIBS = @GCONF_LIBS@
268 -DHAVE_CONFIG_H is needed for some other files to take advantage of 255 -DHAVE_CONFIG_H is needed for some other files to take advantage of
269 the information in ``config.h''. */ 256 the information in ``config.h''. */
270 257
258#undef C_SWITCH_MACHINE
259#undef C_SWITCH_SYSTEM
260#undef C_SWITCH_X_SITE
261
271/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM 262/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
272 since it may have -I options that should override those two. */ 263 since it may have -I options that should override those two. */
273 264ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
274ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
275
276ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@ 265ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
277 266
278.SUFFIXES: .m 267.SUFFIXES: .m
@@ -459,15 +448,6 @@ TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_S
459#define YMF_PASS_LDFLAGS(flags) flags 448#define YMF_PASS_LDFLAGS(flags) flags
460#endif 449#endif
461 450
462/* Allow config.h to specify a replacement file for unexec.c. */
463#ifndef UNEXEC
464#define UNEXEC unexec.o
465#endif
466
467INTERVALS_H = dispextern.h intervals.h composite.h
468
469GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
470
471#ifdef MSDOS 451#ifdef MSDOS
472#ifdef HAVE_X_WINDOWS 452#ifdef HAVE_X_WINDOWS
473MSDOS_OBJ = dosfns.o msdos.o xmenu.o 453MSDOS_OBJ = dosfns.o msdos.o xmenu.o
@@ -858,8 +838,6 @@ LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) ${IMAGEMAGICK_LIBS
858 @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \ 838 @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
859 $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR) 839 $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
860 840
861RUN_TEMACS = `/bin/pwd`/temacs
862
863all: emacs${EXEEXT} $(OTHER_FILES) 841all: emacs${EXEEXT} $(OTHER_FILES)
864 842
865emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} 843emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
@@ -930,9 +908,6 @@ stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
930 908
931/* Encode the values of these two macros in Make variables, 909/* Encode the values of these two macros in Make variables,
932 so we can use $(...) to substitute their values within "...". */ 910 so we can use $(...) to substitute their values within "...". */
933C_SWITCH_MACHINE_1 = C_SWITCH_MACHINE
934C_SWITCH_SYSTEM_1 = C_SWITCH_SYSTEM
935C_SWITCH_X_SITE_1 = C_SWITCH_X_SITE
936C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE 911C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
937C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM 912C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
938 913
@@ -942,11 +917,8 @@ $(OLDXMENU): really-lwlib
942really-lwlib: 917really-lwlib:
943 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ 918 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \
944 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ 919 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
945 "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
946 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \ 920 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
947 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \ 921 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)"
948 "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
949 "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
950 @true /* make -t should not create really-lwlib. */ 922 @true /* make -t should not create really-lwlib. */
951.PHONY: really-lwlib 923.PHONY: really-lwlib
952#else /* not USE_X_TOOLKIT */ 924#else /* not USE_X_TOOLKIT */
@@ -955,11 +927,8 @@ $(OLDXMENU): really-oldXMenu
955really-oldXMenu: 927really-oldXMenu:
956 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ 928 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \
957 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ 929 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
958 "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
959 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \ 930 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
960 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \ 931 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)"
961 "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
962 "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
963 @true /* make -t should not create really-oldXMenu. */ 932 @true /* make -t should not create really-oldXMenu. */
964.PHONY: really-oldXMenu 933.PHONY: really-oldXMenu
965#endif /* not USE_X_TOOLKIT */ 934#endif /* not USE_X_TOOLKIT */
@@ -984,7 +953,7 @@ ecrt0.o: ecrt0.c $(config_h)
984#ifdef AUTO_DEPEND 953#ifdef AUTO_DEPEND
985 @-test -d deps || mkdir deps 954 @-test -d deps || mkdir deps
986#endif 955#endif
987 CRT0_COMPILE ${srcdir}/ecrt0.c 956 $(CC) -c $(ALL_CFLAGS) ${srcdir}/ecrt0.c
988doc.o: buildobj.h 957doc.o: buildobj.h
989 958
990#ifndef AUTO_DEPEND 959#ifndef AUTO_DEPEND
diff --git a/src/bidi.c b/src/bidi.c
index 7da8cd4a88c..0c8a3182510 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1347,12 +1347,14 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
1347 if (type == WEAK_NSM) /* W1 */ 1347 if (type == WEAK_NSM) /* W1 */
1348 { 1348 {
1349 /* Note that we don't need to consider the case where the 1349 /* Note that we don't need to consider the case where the
1350 prev character has its type overridden by an RLO or LRO: 1350 prev character has its type overridden by an RLO or LRO,
1351 such characters are outside the current level run, and 1351 because then either the type of this NSM would have been
1352 thus not relevant to this NSM. Thus, NSM gets the 1352 also overridden, or the previous character is outside the
1353 orig_type of the previous character. */ 1353 current level run, and thus not relevant to this NSM.
1354 This is why NSM gets the type_after_w1 of the previous
1355 character. */
1354 if (bidi_it->prev.type != UNKNOWN_BT) 1356 if (bidi_it->prev.type != UNKNOWN_BT)
1355 type = bidi_it->prev.orig_type; 1357 type = bidi_it->prev.type_after_w1;
1356 else if (bidi_it->sor == R2L) 1358 else if (bidi_it->sor == R2L)
1357 type = STRONG_R; 1359 type = STRONG_R;
1358 else if (bidi_it->sor == L2R) 1360 else if (bidi_it->sor == L2R)
diff --git a/src/buffer.c b/src/buffer.c
index 9035a986b4c..0759ce1c43c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -693,6 +693,7 @@ reset_buffer (b)
693 b->file_truename = Qnil; 693 b->file_truename = Qnil;
694 b->directory = (current_buffer) ? current_buffer->directory : Qnil; 694 b->directory = (current_buffer) ? current_buffer->directory : Qnil;
695 b->modtime = 0; 695 b->modtime = 0;
696 b->modtime_size = -1;
696 XSETFASTINT (b->save_length, 0); 697 XSETFASTINT (b->save_length, 0);
697 b->last_window_start = 1; 698 b->last_window_start = 1;
698 /* It is more conservative to start out "changed" than "unchanged". */ 699 /* It is more conservative to start out "changed" than "unchanged". */
diff --git a/src/buffer.h b/src/buffer.h
index 40f03daca90..fa3fc6dafb8 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -513,6 +513,12 @@ struct buffer
513 0 means visited file modtime unknown; in no case complain 513 0 means visited file modtime unknown; in no case complain
514 about any mismatch on next save attempt. */ 514 about any mismatch on next save attempt. */
515 int modtime; 515 int modtime;
516 /* Size of the file when modtime was set. This is used to detect the
517 case where the file grew while we were reading it, so the modtime
518 is still the same (since it's rounded up to seconds) but we're actually
519 not up-to-date. -1 means the size is unknown. Only meaningful if
520 modtime is actually set. */
521 EMACS_INT modtime_size;
516 /* The value of text->modiff at the last auto-save. */ 522 /* The value of text->modiff at the last auto-save. */
517 int auto_save_modified; 523 int auto_save_modified;
518 /* The value of text->modiff at the last display error. 524 /* The value of text->modiff at the last display error.
diff --git a/src/dispextern.h b/src/dispextern.h
index b8f68ec0e70..00da256c43e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2974,6 +2974,10 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2974 XRectangle *)); 2974 XRectangle *));
2975#endif 2975#endif
2976 2976
2977/* Flags passed to try_window. */
2978#define TRY_WINDOW_CHECK_MARGINS (1 << 0)
2979#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1)
2980
2977/* Defined in fringe.c */ 2981/* Defined in fringe.c */
2978 2982
2979int lookup_fringe_bitmap (Lisp_Object); 2983int lookup_fringe_bitmap (Lisp_Object);
diff --git a/src/fileio.c b/src/fileio.c
index c62d5724eff..e9440adabe0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4092,6 +4092,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4092 if (NILP (handler)) 4092 if (NILP (handler))
4093 { 4093 {
4094 current_buffer->modtime = st.st_mtime; 4094 current_buffer->modtime = st.st_mtime;
4095 current_buffer->modtime_size = st.st_size;
4095 current_buffer->filename = orig_filename; 4096 current_buffer->filename = orig_filename;
4096 } 4097 }
4097 4098
@@ -4695,7 +4696,10 @@ This calls `write-region-annotate-functions' at the start, and
4695 to avoid a "file has changed on disk" warning on 4696 to avoid a "file has changed on disk" warning on
4696 next attempt to save. */ 4697 next attempt to save. */
4697 if (visiting) 4698 if (visiting)
4698 current_buffer->modtime = st.st_mtime; 4699 {
4700 current_buffer->modtime = st.st_mtime;
4701 current_buffer->modtime_size = st.st_size;
4702 }
4699 4703
4700 if (failure) 4704 if (failure)
4701 error ("IO error writing %s: %s", SDATA (filename), 4705 error ("IO error writing %s: %s", SDATA (filename),
@@ -5004,11 +5008,13 @@ See Info node `(elisp)Modification Time' for more details. */)
5004 else 5008 else
5005 st.st_mtime = 0; 5009 st.st_mtime = 0;
5006 } 5010 }
5007 if (st.st_mtime == b->modtime 5011 if ((st.st_mtime == b->modtime
5008 /* If both are positive, accept them if they are off by one second. */ 5012 /* If both are positive, accept them if they are off by one second. */
5009 || (st.st_mtime > 0 && b->modtime > 0 5013 || (st.st_mtime > 0 && b->modtime > 0
5010 && (st.st_mtime == b->modtime + 1 5014 && (st.st_mtime == b->modtime + 1
5011 || st.st_mtime == b->modtime - 1))) 5015 || st.st_mtime == b->modtime - 1)))
5016 && (st.st_size == b->modtime_size
5017 || b->modtime_size < 0))
5012 return Qt; 5018 return Qt;
5013 return Qnil; 5019 return Qnil;
5014} 5020}
@@ -5020,6 +5026,7 @@ Next attempt to save will certainly not complain of a discrepancy. */)
5020 () 5026 ()
5021{ 5027{
5022 current_buffer->modtime = 0; 5028 current_buffer->modtime = 0;
5029 current_buffer->modtime_size = -1;
5023 return Qnil; 5030 return Qnil;
5024} 5031}
5025 5032
@@ -5049,7 +5056,10 @@ An argument specifies the modification time value to use
5049 Lisp_Object time_list; 5056 Lisp_Object time_list;
5050{ 5057{
5051 if (!NILP (time_list)) 5058 if (!NILP (time_list))
5052 current_buffer->modtime = cons_to_long (time_list); 5059 {
5060 current_buffer->modtime = cons_to_long (time_list);
5061 current_buffer->modtime_size = -1;
5062 }
5053 else 5063 else
5054 { 5064 {
5055 register Lisp_Object filename; 5065 register Lisp_Object filename;
@@ -5068,7 +5078,10 @@ An argument specifies the modification time value to use
5068 filename = ENCODE_FILE (filename); 5078 filename = ENCODE_FILE (filename);
5069 5079
5070 if (stat (SDATA (filename), &st) >= 0) 5080 if (stat (SDATA (filename), &st) >= 0)
5071 current_buffer->modtime = st.st_mtime; 5081 {
5082 current_buffer->modtime = st.st_mtime;
5083 current_buffer->modtime_size = st.st_size;
5084 }
5072 } 5085 }
5073 5086
5074 return Qnil; 5087 return Qnil;
diff --git a/src/frame.h b/src/frame.h
index 58c59954f15..36b0b6b069c 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -997,8 +997,8 @@ extern Lisp_Object selected_frame;
997 + FRAME_INTERNAL_BORDER_WIDTH (f)) 997 + FRAME_INTERNAL_BORDER_WIDTH (f))
998 998
999#define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \ 999#define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1000 (FRAME_LINE_TO_PIXEL_Y (f, lines) \ 1000 ((lines) * FRAME_LINE_HEIGHT (f) \
1001 + FRAME_INTERNAL_BORDER_WIDTH (f)) 1001 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1002 1002
1003 1003
1004/* Return the row/column (zero-based) of the character cell containing 1004/* Return the row/column (zero-based) of the character cell containing
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2764382e8a1..25da0baec79 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -529,7 +529,7 @@ static void
529xg_set_geometry (f) 529xg_set_geometry (f)
530 FRAME_PTR f; 530 FRAME_PTR f;
531{ 531{
532 if (f->size_hint_flags & USPosition) 532 if (f->size_hint_flags & (USPosition | PPosition))
533 { 533 {
534 int left = f->left_pos; 534 int left = f->left_pos;
535 int xneg = f->size_hint_flags & XNegative; 535 int xneg = f->size_hint_flags & XNegative;
@@ -542,9 +542,7 @@ xg_set_geometry (f)
542 if (yneg) 542 if (yneg)
543 top = -top; 543 top = -top;
544 544
545 sprintf (geom_str, "=%dx%d%c%d%c%d", 545 sprintf (geom_str, "%c%d%c%d",
546 FRAME_PIXEL_WIDTH (f),
547 FRAME_TOTAL_PIXEL_HEIGHT (f),
548 (xneg ? '-' : '+'), left, 546 (xneg ? '-' : '+'), left,
549 (yneg ? '-' : '+'), top); 547 (yneg ? '-' : '+'), top);
550 548
@@ -552,9 +550,6 @@ xg_set_geometry (f)
552 geom_str)) 550 geom_str))
553 fprintf (stderr, "Failed to parse: '%s'\n", geom_str); 551 fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
554 } 552 }
555 else if (f->size_hint_flags & PPosition)
556 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
557 f->left_pos, f->top_pos);
558} 553}
559 554
560/* Clear under internal border if any. As we use a mix of Gtk+ and X calls 555/* Clear under internal border if any. As we use a mix of Gtk+ and X calls
@@ -956,16 +951,6 @@ x_wm_set_size_hint (f, flags, user_position)
956 else if (win_gravity == StaticGravity) 951 else if (win_gravity == StaticGravity)
957 size_hints.win_gravity = GDK_GRAVITY_STATIC; 952 size_hints.win_gravity = GDK_GRAVITY_STATIC;
958 953
959 if (flags & PPosition) hint_flags |= GDK_HINT_POS;
960 if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS;
961 if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE;
962
963 if (user_position)
964 {
965 hint_flags &= ~GDK_HINT_POS;
966 hint_flags |= GDK_HINT_USER_POS;
967 }
968
969 if (hint_flags != f->output_data.x->hint_flags 954 if (hint_flags != f->output_data.x->hint_flags
970 || memcmp (&size_hints, 955 || memcmp (&size_hints,
971 &f->output_data.x->size_hints, 956 &f->output_data.x->size_hints,
diff --git a/src/m/hp800.h b/src/m/hp800.h
index bf684a871a9..d95da6643ab 100644
--- a/src/m/hp800.h
+++ b/src/m/hp800.h
@@ -41,9 +41,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#define EXPLICIT_SIGN_EXTEND 41#define EXPLICIT_SIGN_EXTEND
42 42
43 43
44/* Common definitions for HPUX and GNU/Linux. */ 44/* Stuff for just HPUX. */
45 45
46#if defined (__hpux) || defined (GNU_LINUX) 46#if defined (__hpux)
47 47
48/* Define NO_REMAP if memory segmentation makes it not work well 48/* Define NO_REMAP if memory segmentation makes it not work well
49 to change the boundary between the text section and data section 49 to change the boundary between the text section and data section
@@ -52,26 +52,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
52 52
53#define NO_REMAP 53#define NO_REMAP
54 54
55#endif /* __hpux or GNU_LINUX */
56
57/* Stuff for just GNU/Linux. */
58
59#ifdef GNU_LINUX
60
61/* Data type of load average, as read out of kmem. */
62
63#define LOAD_AVE_TYPE long
64
65/* Convert that into an integer that is 100 for a load average of 1.0 */
66
67#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
68
69#endif /* GNU_LINUX */
70
71/* Stuff for just HPUX. */
72
73#ifdef __hpux
74
75/* Define VIRT_ADDR_VARIES if the virtual addresses of 55/* Define VIRT_ADDR_VARIES if the virtual addresses of
76 pure and impure space as loaded can vary, and even their 56 pure and impure space as loaded can vary, and even their
77 relative order cannot be relied on. 57 relative order cannot be relied on.
@@ -88,14 +68,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
88#define DATA_START 0x40000000 68#define DATA_START 0x40000000
89#define TEXT_START 0x00000000 69#define TEXT_START 0x00000000
90 70
91/* This machine requires completely different unexec code
92 which lives in a separate file. Specify the file name. */
93
94#define UNEXEC unexhp9k800.o
95
96/* Include the file bsdtty.h, since this machine has job control. */
97#define NEED_BSDTTY
98
99/* Data type of load average, as read out of kmem. */ 71/* Data type of load average, as read out of kmem. */
100 72
101#define LOAD_AVE_TYPE double 73#define LOAD_AVE_TYPE double
diff --git a/src/m/iris4d.h b/src/m/iris4d.h
index 794227977be..1c276ecb167 100644
--- a/src/m/iris4d.h
+++ b/src/m/iris4d.h
@@ -36,12 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36 36
37#define EXPLICIT_SIGN_EXTEND 37#define EXPLICIT_SIGN_EXTEND
38 38
39/* This machine requires completely different unexec code
40 which lives in a separate file. Specify the file name. */
41
42#undef UNEXEC
43#define UNEXEC unexelf.o
44
45#define TEXT_START 0x400000 39#define TEXT_START 0x400000
46 40
47/* 41/*
diff --git a/src/menu.c b/src/menu.c
index bfe54a53328..ca00c06a98b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -697,6 +697,12 @@ digest_single_submenu (start, end, top_level_items)
697 697
698 ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name); 698 ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
699 } 699 }
700#elif defined (USE_LUCID) && defined (HAVE_XFT)
701 if (STRINGP (pane_name))
702 {
703 pane_name = ENCODE_UTF_8 (pane_name);
704 ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
705 }
700#elif !defined (HAVE_MULTILINGUAL_MENU) 706#elif !defined (HAVE_MULTILINGUAL_MENU)
701 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) 707 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
702 { 708 {
@@ -770,6 +776,18 @@ digest_single_submenu (start, end, top_level_items)
770 descrip = ENCODE_SYSTEM (descrip); 776 descrip = ENCODE_SYSTEM (descrip);
771 ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip); 777 ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
772 } 778 }
779#elif USE_LUCID
780 if (STRINGP (item_name))
781 {
782 item_name = ENCODE_UTF_8 (item_name);
783 ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
784 }
785
786 if (STRINGP (descrip))
787 {
788 descrip = ENCODE_UTF_8 (descrip);
789 ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
790 }
773#elif !defined (HAVE_MULTILINGUAL_MENU) 791#elif !defined (HAVE_MULTILINGUAL_MENU)
774 if (STRING_MULTIBYTE (item_name)) 792 if (STRING_MULTIBYTE (item_name))
775 { 793 {
diff --git a/src/process.c b/src/process.c
index 3c539024b0a..7e8f4cc57bc 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4643,6 +4643,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4643 FD_ZERO (&Connecting); 4643 FD_ZERO (&Connecting);
4644#endif 4644#endif
4645 4645
4646 if (time_limit == 0 && wait_proc && !NILP (Vinhibit_quit)
4647 && !(CONSP (wait_proc->status) && EQ (XCAR (wait_proc->status), Qexit)))
4648 message ("Blocking call to accept-process-output with quit inhibited!!");
4649
4646 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4650 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4647 if (wait_proc != NULL) 4651 if (wait_proc != NULL)
4648 wait_channel = wait_proc->infd; 4652 wait_channel = wait_proc->infd;
@@ -5314,6 +5318,8 @@ read_process_output (proc, channel)
5314 struct coding_system *coding = proc_decode_coding_system[channel]; 5318 struct coding_system *coding = proc_decode_coding_system[channel];
5315 int carryover = p->decoding_carryover; 5319 int carryover = p->decoding_carryover;
5316 int readmax = 4096; 5320 int readmax = 4096;
5321 int count = SPECPDL_INDEX ();
5322 Lisp_Object odeactivate;
5317 5323
5318 chars = (char *) alloca (carryover + readmax); 5324 chars = (char *) alloca (carryover + readmax);
5319 if (carryover) 5325 if (carryover)
@@ -5386,15 +5392,16 @@ read_process_output (proc, channel)
5386 /* Now set NBYTES how many bytes we must decode. */ 5392 /* Now set NBYTES how many bytes we must decode. */
5387 nbytes += carryover; 5393 nbytes += carryover;
5388 5394
5395 odeactivate = Vdeactivate_mark;
5396 /* There's no good reason to let process filters change the current
5397 buffer, and many callers of accept-process-output, sit-for, and
5398 friends don't expect current-buffer to be changed from under them. */
5399 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
5400
5389 /* Read and dispose of the process output. */ 5401 /* Read and dispose of the process output. */
5390 outstream = p->filter; 5402 outstream = p->filter;
5391 if (!NILP (outstream)) 5403 if (!NILP (outstream))
5392 { 5404 {
5393 /* We inhibit quit here instead of just catching it so that
5394 hitting ^G when a filter happens to be running won't screw
5395 it up. */
5396 int count = SPECPDL_INDEX ();
5397 Lisp_Object odeactivate;
5398 Lisp_Object obuffer, okeymap; 5405 Lisp_Object obuffer, okeymap;
5399 Lisp_Object text; 5406 Lisp_Object text;
5400 int outer_running_asynch_code = running_asynch_code; 5407 int outer_running_asynch_code = running_asynch_code;
@@ -5402,10 +5409,12 @@ read_process_output (proc, channel)
5402 5409
5403 /* No need to gcpro these, because all we do with them later 5410 /* No need to gcpro these, because all we do with them later
5404 is test them for EQness, and none of them should be a string. */ 5411 is test them for EQness, and none of them should be a string. */
5405 odeactivate = Vdeactivate_mark;
5406 XSETBUFFER (obuffer, current_buffer); 5412 XSETBUFFER (obuffer, current_buffer);
5407 okeymap = current_buffer->keymap; 5413 okeymap = current_buffer->keymap;
5408 5414
5415 /* We inhibit quit here instead of just catching it so that
5416 hitting ^G when a filter happens to be running won't screw
5417 it up. */
5409 specbind (Qinhibit_quit, Qt); 5418 specbind (Qinhibit_quit, Qt);
5410 specbind (Qlast_nonmenu_event, Qt); 5419 specbind (Qlast_nonmenu_event, Qt);
5411 5420
@@ -5474,9 +5483,6 @@ read_process_output (proc, channel)
5474 restore_search_regs (); 5483 restore_search_regs ();
5475 running_asynch_code = outer_running_asynch_code; 5484 running_asynch_code = outer_running_asynch_code;
5476 5485
5477 /* Handling the process output should not deactivate the mark. */
5478 Vdeactivate_mark = odeactivate;
5479
5480 /* Restore waiting_for_user_input_p as it was 5486 /* Restore waiting_for_user_input_p as it was
5481 when we were called, in case the filter clobbered it. */ 5487 when we were called, in case the filter clobbered it. */
5482 waiting_for_user_input_p = waiting; 5488 waiting_for_user_input_p = waiting;
@@ -5492,27 +5498,19 @@ read_process_output (proc, channel)
5492 cause trouble (for example it would make sit_for return). */ 5498 cause trouble (for example it would make sit_for return). */
5493 if (waiting_for_user_input_p == -1) 5499 if (waiting_for_user_input_p == -1)
5494 record_asynch_buffer_change (); 5500 record_asynch_buffer_change ();
5495
5496 unbind_to (count, Qnil);
5497 return nbytes;
5498 } 5501 }
5499 5502
5500 /* If no filter, write into buffer if it isn't dead. */ 5503 /* If no filter, write into buffer if it isn't dead. */
5501 if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) 5504 else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
5502 { 5505 {
5503 Lisp_Object old_read_only; 5506 Lisp_Object old_read_only;
5504 int old_begv, old_zv; 5507 int old_begv, old_zv;
5505 int old_begv_byte, old_zv_byte; 5508 int old_begv_byte, old_zv_byte;
5506 Lisp_Object odeactivate;
5507 int before, before_byte; 5509 int before, before_byte;
5508 int opoint_byte; 5510 int opoint_byte;
5509 Lisp_Object text; 5511 Lisp_Object text;
5510 struct buffer *b; 5512 struct buffer *b;
5511 int count = SPECPDL_INDEX ();
5512
5513 odeactivate = Vdeactivate_mark;
5514 5513
5515 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
5516 Fset_buffer (p->buffer); 5514 Fset_buffer (p->buffer);
5517 opoint = PT; 5515 opoint = PT;
5518 opoint_byte = PT_BYTE; 5516 opoint_byte = PT_BYTE;
@@ -5610,13 +5608,14 @@ read_process_output (proc, channel)
5610 if (old_begv != BEGV || old_zv != ZV) 5608 if (old_begv != BEGV || old_zv != ZV)
5611 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5609 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5612 5610
5613 /* Handling the process output should not deactivate the mark. */
5614 Vdeactivate_mark = odeactivate;
5615 5611
5616 current_buffer->read_only = old_read_only; 5612 current_buffer->read_only = old_read_only;
5617 SET_PT_BOTH (opoint, opoint_byte); 5613 SET_PT_BOTH (opoint, opoint_byte);
5618 unbind_to (count, Qnil);
5619 } 5614 }
5615 /* Handling the process output should not deactivate the mark. */
5616 Vdeactivate_mark = odeactivate;
5617
5618 unbind_to (count, Qnil);
5620 return nbytes; 5619 return nbytes;
5621} 5620}
5622 5621
@@ -5773,34 +5772,6 @@ send_process (proc, buf, len, object)
5773 { 5772 {
5774 int this = len; 5773 int this = len;
5775 5774
5776 /* Decide how much data we can send in one batch.
5777 Long lines need to be split into multiple batches. */
5778 if (p->pty_flag)
5779 {
5780 /* Starting this at zero is always correct when not the first
5781 iteration because the previous iteration ended by sending C-d.
5782 It may not be correct for the first iteration
5783 if a partial line was sent in a separate send_process call.
5784 If that proves worth handling, we need to save linepos
5785 in the process object. */
5786 int linepos = 0;
5787 unsigned char *ptr = (unsigned char *) buf;
5788 unsigned char *end = (unsigned char *) buf + len;
5789
5790 /* Scan through this text for a line that is too long. */
5791 while (ptr != end && linepos < pty_max_bytes)
5792 {
5793 if (*ptr == '\n')
5794 linepos = 0;
5795 else
5796 linepos++;
5797 ptr++;
5798 }
5799 /* If we found one, break the line there
5800 and put in a C-d to force the buffer through. */
5801 this = ptr - buf;
5802 }
5803
5804 /* Send this batch, using one or more write calls. */ 5775 /* Send this batch, using one or more write calls. */
5805 while (this > 0) 5776 while (this > 0)
5806 { 5777 {
@@ -5904,11 +5875,6 @@ send_process (proc, buf, len, object)
5904 len -= rv; 5875 len -= rv;
5905 this -= rv; 5876 this -= rv;
5906 } 5877 }
5907
5908 /* If we sent just part of the string, put in an EOF (C-d)
5909 to force it through, before we send the rest. */
5910 if (len > 0)
5911 Fprocess_send_eof (proc);
5912 } 5878 }
5913 } 5879 }
5914 else 5880 else
@@ -6845,6 +6811,11 @@ exec_sentinel (proc, reason)
6845 XSETBUFFER (obuffer, current_buffer); 6811 XSETBUFFER (obuffer, current_buffer);
6846 okeymap = current_buffer->keymap; 6812 okeymap = current_buffer->keymap;
6847 6813
6814 /* There's no good reason to let sentinels change the current
6815 buffer, and many callers of accept-process-output, sit-for, and
6816 friends don't expect current-buffer to be changed from under them. */
6817 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
6818
6848 sentinel = p->sentinel; 6819 sentinel = p->sentinel;
6849 if (NILP (sentinel)) 6820 if (NILP (sentinel))
6850 return; 6821 return;
@@ -6982,13 +6953,11 @@ status_notify (deleting_process)
6982 when a process becomes runnable. */ 6953 when a process becomes runnable. */
6983 else if (!EQ (symbol, Qrun) && !NILP (buffer)) 6954 else if (!EQ (symbol, Qrun) && !NILP (buffer))
6984 { 6955 {
6985 Lisp_Object ro, tem; 6956 Lisp_Object tem;
6986 struct buffer *old = current_buffer; 6957 struct buffer *old = current_buffer;
6987 int opoint, opoint_byte; 6958 int opoint, opoint_byte;
6988 int before, before_byte; 6959 int before, before_byte;
6989 6960
6990 ro = XBUFFER (buffer)->read_only;
6991
6992 /* Avoid error if buffer is deleted 6961 /* Avoid error if buffer is deleted
6993 (probably that's why the process is dead, too) */ 6962 (probably that's why the process is dead, too) */
6994 if (NILP (XBUFFER (buffer)->name)) 6963 if (NILP (XBUFFER (buffer)->name))
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 8813127ffce..e8081c6dd25 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -165,9 +165,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
165 each); under Cocoa 31 commands are required. */ 165 each); under Cocoa 31 commands are required. */
166#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA 166#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA
167 167
168#define C_SWITCH_SYSTEM_TEMACS -Dtemacs 168#ifdef emacs
169
170#ifdef temacs
171#define malloc unexec_malloc 169#define malloc unexec_malloc
172#define realloc unexec_realloc 170#define realloc unexec_realloc
173#define free unexec_free 171#define free unexec_free
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index cf670cd51a0..e56b25ecaee 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -89,6 +89,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
89 89
90#define HAVE_PERROR /* Delete this line for version 6. */ 90#define HAVE_PERROR /* Delete this line for version 6. */
91 91
92#define UNEXEC unexhp9k800.o
93
94/* Include the file bsdtty.h, since this machine has job control. */
95#define NEED_BSDTTY
96
92/* This is how to get the device name of the tty end of a pty. */ 97/* This is how to get the device name of the tty end of a pty. */
93#define PTY_TTY_NAME_SPRINTF \ 98#define PTY_TTY_NAME_SPRINTF \
94 sprintf (pty_name, "/dev/pty/tty%c%x", c, i); 99 sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index 8696aa00fdd..0a0b0d4af26 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -82,6 +82,8 @@ char *_getpty();
82/* Tell process_send_signal to use VSUSP instead of VSWTCH. */ 82/* Tell process_send_signal to use VSUSP instead of VSWTCH. */
83#define PREFER_VSUSP 83#define PREFER_VSUSP
84 84
85#define UNEXEC unexelf.o
86
85/* define MAIL_USE_FLOCK if the mailer uses flock 87/* define MAIL_USE_FLOCK if the mailer uses flock
86 to interlock access to /usr/spool/mail/$USER. 88 to interlock access to /usr/spool/mail/$USER.
87 The alternative is that a lock file named 89 The alternative is that a lock file named
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 15c3c5b1452..115ec05b0a4 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -172,5 +172,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
172 172
173#define NO_REMAP 173#define NO_REMAP
174 174
175#define UNEXEC unexec.o
176
175/* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0 177/* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0
176 (do not change this comment) */ 178 (do not change this comment) */
diff --git a/src/sysdep.c b/src/sysdep.c
index 37e7dfbaf9c..506af23ef30 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -529,8 +529,6 @@ child_setup_tty (out)
529#endif 529#endif
530 s.main.c_oflag &= ~TAB3; /* Disable tab expansion */ 530 s.main.c_oflag &= ~TAB3; /* Disable tab expansion */
531 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */ 531 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */
532 s.main.c_lflag |= ICANON; /* Enable erase/kill and eof processing */
533 s.main.c_cc[VEOF] = 04; /* insure that EOF is Control-D */
534 s.main.c_cc[VERASE] = CDISABLE; /* disable erase processing */ 532 s.main.c_cc[VERASE] = CDISABLE; /* disable erase processing */
535 s.main.c_cc[VKILL] = CDISABLE; /* disable kill processing */ 533 s.main.c_cc[VKILL] = CDISABLE; /* disable kill processing */
536 534
@@ -560,7 +558,6 @@ child_setup_tty (out)
560 /* rms: Formerly it set s.main.c_cc[VINTR] to 0377 here 558 /* rms: Formerly it set s.main.c_cc[VINTR] to 0377 here
561 unconditionally. Then a SIGNALS_VIA_CHARACTERS conditional 559 unconditionally. Then a SIGNALS_VIA_CHARACTERS conditional
562 would force it to 0377. That looks like duplicated code. */ 560 would force it to 0377. That looks like duplicated code. */
563 s.main.c_cc[VEOL] = CDISABLE;
564 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ 561 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
565#endif /* AIX */ 562#endif /* AIX */
566 563
@@ -573,6 +570,18 @@ child_setup_tty (out)
573 s.main.sg_kill = 0377; 570 s.main.sg_kill = 0377;
574 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ 571 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */
575 572
573 /* We used to enable ICANON (and set VEOF to 04), but this leads to
574 problems where process.c wants to send EOFs every once in a while
575 to force the output, which leads to weird effects when the
576 subprocess has disabled ICANON and ends up seeing those spurious
577 extra EOFs. So we don't send EOFs any more in
578 process.c:send_process, and instead we disable ICANON by default,
579 so if a subsprocess sets up ICANON, it's his problem (or the Elisp
580 package that talks to it) to deal with lines that are too long. */
581 s.main.c_lflag &= ~ICANON; /* Disable line editing and eof processing */
582 s.main.c_cc[VMIN] = 1;
583 s.main.c_cc[VTIME] = 0;
584
576#endif /* not HAVE_TERMIO */ 585#endif /* not HAVE_TERMIO */
577 586
578 EMACS_SET_TTY (out, &s, 0); 587 EMACS_SET_TTY (out, &s, 0);
@@ -3344,7 +3353,7 @@ system_process_attributes (Lisp_Object pid)
3344 unsigned long minflt, majflt, cminflt, cmajflt, vsize; 3353 unsigned long minflt, majflt, cminflt, cmajflt, vsize;
3345 time_t sec; 3354 time_t sec;
3346 unsigned usec; 3355 unsigned usec;
3347 EMACS_TIME tnow, tstart, tboot, telapsed,ttotal; 3356 EMACS_TIME tnow, tstart, tboot, telapsed;
3348 double pcpu, pmem; 3357 double pcpu, pmem;
3349 Lisp_Object attrs = Qnil; 3358 Lisp_Object attrs = Qnil;
3350 Lisp_Object cmd_str, decoded_cmd, tem; 3359 Lisp_Object cmd_str, decoded_cmd, tem;
diff --git a/src/term.c b/src/term.c
index 718a20d4164..df7dc9ee464 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3593,25 +3593,18 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3593 } 3593 }
3594 if (status == 0) 3594 if (status == 0)
3595 { 3595 {
3596#ifdef TERMINFO
3597 maybe_fatal (must_succeed, terminal, 3596 maybe_fatal (must_succeed, terminal,
3598 "Terminal type %s is not defined", 3597 "Terminal type %s is not defined",
3599 "Terminal type %s is not defined.\n\ 3598 "Terminal type %s is not defined.\n\
3600If that is not the actual type of terminal you have,\n\ 3599If that is not the actual type of terminal you have,\n\
3601use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ 3600use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3602`setenv TERM ...') to specify the correct type. It may be necessary\n\ 3601`setenv TERM ...') to specify the correct type. It may be necessary\n"
3603to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", 3602#ifdef TERMINFO
3604 terminal_type); 3603"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
3605#else 3604#else
3606 maybe_fatal (must_succeed, terminal, 3605"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3607 "Terminal type %s is not defined",
3608 "Terminal type %s is not defined.\n\
3609If that is not the actual type of terminal you have,\n\
3610use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3611`setenv TERM ...') to specify the correct type. It may be necessary\n\
3612to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3613 terminal_type);
3614#endif 3606#endif
3607 terminal_type);
3615 } 3608 }
3616 3609
3617#ifndef TERMINFO 3610#ifndef TERMINFO
@@ -3878,20 +3871,15 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3878 { 3871 {
3879 maybe_fatal (must_succeed, terminal, 3872 maybe_fatal (must_succeed, terminal,
3880 "Terminal type \"%s\" is not powerful enough to run Emacs", 3873 "Terminal type \"%s\" is not powerful enough to run Emacs",
3881# ifdef TERMINFO
3882 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ 3874 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
3883It lacks the ability to position the cursor.\n\ 3875It lacks the ability to position the cursor.\n\
3884If that is not the actual type of terminal you have,\n\ 3876If that is not the actual type of terminal you have,\n\
3885use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ 3877use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3886`setenv TERM ...') to specify the correct type. It may be necessary\n\ 3878`setenv TERM ...') to specify the correct type. It may be necessary\n"
3887to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", 3879# ifdef TERMINFO
3880"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
3888# else /* TERMCAP */ 3881# else /* TERMCAP */
3889 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ 3882"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3890It lacks the ability to position the cursor.\n\
3891If that is not the actual type of terminal you have,\n\
3892use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3893`setenv TERM ...') to specify the correct type. It may be necessary\n\
3894to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
3895# endif /* TERMINFO */ 3883# endif /* TERMINFO */
3896 terminal_type); 3884 terminal_type);
3897 } 3885 }
diff --git a/src/window.c b/src/window.c
index f17a645f82c..b9683fbbca8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -168,6 +168,10 @@ static Lisp_Object Vwindow_configuration_change_hook;
168 168
169Lisp_Object Vscroll_preserve_screen_position; 169Lisp_Object Vscroll_preserve_screen_position;
170 170
171/* List of commands affected by `Vscroll_preserve_screen_position'. */
172
173Lisp_Object Vscroll_preserve_screen_position_commands;
174
171/* Non-nil means that text is inserted before window's markers. */ 175/* Non-nil means that text is inserted before window's markers. */
172 176
173Lisp_Object Vwindow_point_insertion_type; 177Lisp_Object Vwindow_point_insertion_type;
@@ -4946,8 +4950,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4946 possibility of point becoming "stuck" on a tall line when 4950 possibility of point becoming "stuck" on a tall line when
4947 scrolling by one line. */ 4951 scrolling by one line. */
4948 if (window_scroll_pixel_based_preserve_y < 0 4952 if (window_scroll_pixel_based_preserve_y < 0
4949 || (!EQ (current_kboard->Vlast_command, Qscroll_up) 4953 || NILP (Fmemq (current_kboard->Vlast_command,
4950 && !EQ (current_kboard->Vlast_command, Qscroll_down))) 4954 Vscroll_preserve_screen_position_commands)))
4951 { 4955 {
4952 start_display (&it, w, start); 4956 start_display (&it, w, start);
4953 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4957 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5207,8 +5211,8 @@ window_scroll_line_based (window, n, whole, noerror)
5207 if (!NILP (Vscroll_preserve_screen_position)) 5211 if (!NILP (Vscroll_preserve_screen_position))
5208 { 5212 {
5209 if (window_scroll_preserve_vpos <= 0 5213 if (window_scroll_preserve_vpos <= 0
5210 || (!EQ (current_kboard->Vlast_command, Qscroll_up) 5214 || NILP (Fmemq (current_kboard->Vlast_command,
5211 && !EQ (current_kboard->Vlast_command, Qscroll_down))) 5215 Vscroll_preserve_screen_position_commands)))
5212 { 5216 {
5213 struct position posit 5217 struct position posit
5214 = *compute_motion (startpos, 0, 0, 0, 5218 = *compute_motion (startpos, 0, 0, 0,
@@ -7265,9 +7269,19 @@ at the scroll margin or window boundary respectively.
7265A value of t means point keeps its screen position if the scroll 7269A value of t means point keeps its screen position if the scroll
7266command moved it vertically out of the window, e.g. when scrolling 7270command moved it vertically out of the window, e.g. when scrolling
7267by full screens. 7271by full screens.
7268Any other value means point always keeps its screen position. */); 7272Any other value means point always keeps its screen position.
7273Scroll commands are defined by the variable
7274`scroll-preserve-screen-position-commands'. */);
7269 Vscroll_preserve_screen_position = Qnil; 7275 Vscroll_preserve_screen_position = Qnil;
7270 7276
7277 DEFVAR_LISP ("scroll-preserve-screen-position-commands",
7278 &Vscroll_preserve_screen_position_commands,
7279 doc: /* A list of commands whose scrolling should keep screen position unchanged.
7280This list defines the names of scroll commands affected by the variable
7281`scroll-preserve-screen-position'. */);
7282 Vscroll_preserve_screen_position_commands =
7283 Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil));
7284
7271 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, 7285 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
7272 doc: /* Type of marker to use for `window-point'. */); 7286 doc: /* Type of marker to use for `window-point'. */);
7273 Vwindow_point_insertion_type = Qnil; 7287 Vwindow_point_insertion_type = Qnil;
@@ -7377,9 +7391,9 @@ keys_of_window ()
7377 initial_define_key (control_x_map, '<', "scroll-left"); 7391 initial_define_key (control_x_map, '<', "scroll-left");
7378 initial_define_key (control_x_map, '>', "scroll-right"); 7392 initial_define_key (control_x_map, '>', "scroll-right");
7379 7393
7380 initial_define_key (global_map, Ctl ('V'), "scroll-up"); 7394 initial_define_key (global_map, Ctl ('V'), "scroll-up-command");
7381 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); 7395 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
7382 initial_define_key (meta_map, 'v', "scroll-down"); 7396 initial_define_key (meta_map, 'v', "scroll-down-command");
7383} 7397}
7384 7398
7385/* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f 7399/* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f
diff --git a/src/xdisp.c b/src/xdisp.c
index 997c76934d4..902651dcc44 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6570,7 +6570,10 @@ next_element_from_stretch (it)
6570/* Scan forward from CHARPOS in the current buffer, until we find a 6570/* Scan forward from CHARPOS in the current buffer, until we find a
6571 stop position > current IT's position. Then handle the stop 6571 stop position > current IT's position. Then handle the stop
6572 position before that. This is called when we bump into a stop 6572 position before that. This is called when we bump into a stop
6573 position while reordering bidirectional text. */ 6573 position while reordering bidirectional text. CHARPOS should be
6574 the last previously processed stop_pos (or BEGV, if none were
6575 processed yet) whose position is less that IT's current
6576 position. */
6574 6577
6575static void 6578static void
6576handle_stop_backwards (it, charpos) 6579handle_stop_backwards (it, charpos)
@@ -12550,6 +12553,9 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12550 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; 12553 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta;
12551 EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; 12554 EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta;
12552 struct glyph *glyph_before = glyph - 1, *glyph_after = end; 12555 struct glyph *glyph_before = glyph - 1, *glyph_after = end;
12556 /* A glyph beyond the edge of TEXT_AREA which we should never
12557 touch. */
12558 struct glyph *glyphs_end = end;
12553 /* Non-zero means we've found a match for cursor position, but that 12559 /* Non-zero means we've found a match for cursor position, but that
12554 glyph has the avoid_cursor_p flag set. */ 12560 glyph has the avoid_cursor_p flag set. */
12555 int match_with_avoid_cursor = 0; 12561 int match_with_avoid_cursor = 0;
@@ -12591,7 +12597,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12591 12597
12592 /* If the glyph row is reversed, we need to process it from back 12598 /* If the glyph row is reversed, we need to process it from back
12593 to front, so swap the edge pointers. */ 12599 to front, so swap the edge pointers. */
12594 end = glyph - 1; 12600 glyphs_end = end = glyph - 1;
12595 glyph += row->used[TEXT_AREA] - 1; 12601 glyph += row->used[TEXT_AREA] - 1;
12596 /* Reverse the known positions in the row. */ 12602 /* Reverse the known positions in the row. */
12597 last_pos = pos_after = MATRIX_ROW_START_CHARPOS (row) + delta; 12603 last_pos = pos_after = MATRIX_ROW_START_CHARPOS (row) + delta;
@@ -12769,7 +12775,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12769 /* Step 2: If we didn't find an exact match for point, we need to 12775 /* Step 2: If we didn't find an exact match for point, we need to
12770 look for a proper place to put the cursor among glyphs between 12776 look for a proper place to put the cursor among glyphs between
12771 GLYPH_BEFORE and GLYPH_AFTER. */ 12777 GLYPH_BEFORE and GLYPH_AFTER. */
12772 if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) 12778 if (!((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
12779 && BUFFERP (glyph->object) && glyph->charpos == pt_old)
12773 && bpos_covered < pt_old) 12780 && bpos_covered < pt_old)
12774 { 12781 {
12775 if (row->ends_in_ellipsis_p && pos_after == last_pos) 12782 if (row->ends_in_ellipsis_p && pos_after == last_pos)
@@ -12935,9 +12942,15 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12935 struct glyph *g1 = 12942 struct glyph *g1 =
12936 MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; 12943 MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos;
12937 12944
12945 /* Don't consider glyphs that are outside TEXT_AREA. */
12946 if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end))
12947 return 0;
12938 /* Keep the candidate whose buffer position is the closest to 12948 /* Keep the candidate whose buffer position is the closest to
12939 point. */ 12949 point. */
12940 if (BUFFERP (g1->object) 12950 if (/* previous candidate is a glyph in TEXT_AREA of that row */
12951 w->cursor.hpos >= 0
12952 && w->cursor.hpos < MATRIX_ROW_USED(matrix, w->cursor.vpos)
12953 && BUFFERP (g1->object)
12941 && (g1->charpos == pt_old /* an exact match always wins */ 12954 && (g1->charpos == pt_old /* an exact match always wins */
12942 || (BUFFERP (glyph->object) 12955 || (BUFFERP (glyph->object)
12943 && eabs (g1->charpos - pt_old) 12956 && eabs (g1->charpos - pt_old)
@@ -14190,7 +14203,7 @@ redisplay_window (window, just_this_one_p)
14190 = try_window_reusing_current_matrix (w))) 14203 = try_window_reusing_current_matrix (w)))
14191 { 14204 {
14192 IF_DEBUG (debug_method_add (w, "1")); 14205 IF_DEBUG (debug_method_add (w, "1"));
14193 if (try_window (window, startp, 1) < 0) 14206 if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0)
14194 /* -1 means we need to scroll. 14207 /* -1 means we need to scroll.
14195 0 means we need new matrices, but fonts_changed_p 14208 0 means we need new matrices, but fonts_changed_p
14196 is set in that case, so we will detect it below. */ 14209 is set in that case, so we will detect it below. */
@@ -14541,13 +14554,15 @@ redisplay_window (window, just_this_one_p)
14541 Value is 1 if successful. It is zero if fonts were loaded during 14554 Value is 1 if successful. It is zero if fonts were loaded during
14542 redisplay which makes re-adjusting glyph matrices necessary, and -1 14555 redisplay which makes re-adjusting glyph matrices necessary, and -1
14543 if point would appear in the scroll margins. 14556 if point would appear in the scroll margins.
14544 (We check that only if CHECK_MARGINS is nonzero. */ 14557 (We check the former only if TRY_WINDOW_IGNORE_FONTS_CHANGE is
14558 unset in FLAGS, and the latter only if TRY_WINDOW_CHECK_MARGINS is
14559 set in FLAGS.) */
14545 14560
14546int 14561int
14547try_window (window, pos, check_margins) 14562try_window (window, pos, flags)
14548 Lisp_Object window; 14563 Lisp_Object window;
14549 struct text_pos pos; 14564 struct text_pos pos;
14550 int check_margins; 14565 int flags;
14551{ 14566{
14552 struct window *w = XWINDOW (window); 14567 struct window *w = XWINDOW (window);
14553 struct it it; 14568 struct it it;
@@ -14569,12 +14584,12 @@ try_window (window, pos, check_margins)
14569 { 14584 {
14570 if (display_line (&it)) 14585 if (display_line (&it))
14571 last_text_row = it.glyph_row - 1; 14586 last_text_row = it.glyph_row - 1;
14572 if (fonts_changed_p) 14587 if (fonts_changed_p && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE))
14573 return 0; 14588 return 0;
14574 } 14589 }
14575 14590
14576 /* Don't let the cursor end in the scroll margins. */ 14591 /* Don't let the cursor end in the scroll margins. */
14577 if (check_margins 14592 if ((flags & TRY_WINDOW_CHECK_MARGINS)
14578 && !MINI_WINDOW_P (w)) 14593 && !MINI_WINDOW_P (w))
14579 { 14594 {
14580 int this_scroll_margin; 14595 int this_scroll_margin;
diff --git a/src/xfns.c b/src/xfns.c
index ae5858ccfb5..d19914e8dec 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -110,11 +110,6 @@ extern void _XEditResCheckMessages ();
110 110
111extern LWLIB_ID widget_id_tick; 111extern LWLIB_ID widget_id_tick;
112 112
113#ifdef USE_LUCID
114/* This is part of a kludge--see lwlib/xlwmenu.c. */
115extern XFontStruct *xlwmenu_default_font;
116#endif
117
118extern void free_frame_menubar (); 113extern void free_frame_menubar ();
119extern double atof (); 114extern double atof ();
120 115
@@ -203,6 +198,10 @@ Lisp_Object Qfont_param;
203 198
204extern Lisp_Object Vwindow_system_version; 199extern Lisp_Object Vwindow_system_version;
205 200
201/* In editfns.c */
202
203extern Lisp_Object Vsystem_name;
204
206/* The below are defined in frame.c. */ 205/* The below are defined in frame.c. */
207 206
208#if GLYPH_DEBUG 207#if GLYPH_DEBUG
@@ -3145,6 +3144,37 @@ If FRAME is nil, use the selected frame. */)
3145 return Qnil; 3144 return Qnil;
3146} 3145}
3147 3146
3147static void
3148set_machine_and_pid_properties (struct frame *f)
3149{
3150 /* See the above comment "Note: Encoding strategy". */
3151 XTextProperty text;
3152 int bytes, stringp;
3153 int do_free_text_value = 0;
3154 long pid = (long) getpid ();
3155
3156 text.value = x_encode_text (Vsystem_name,
3157 Qcompound_text, 0, &bytes, &stringp,
3158 &do_free_text_value);
3159 text.encoding = (stringp ? XA_STRING
3160 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
3161 text.format = 8;
3162 text.nitems = bytes;
3163 XSetWMClientMachine (FRAME_X_DISPLAY (f),
3164 FRAME_OUTER_WINDOW (f),
3165 &text);
3166 if (do_free_text_value)
3167 xfree (text.value);
3168
3169 XChangeProperty (FRAME_X_DISPLAY (f),
3170 FRAME_OUTER_WINDOW (f),
3171 XInternAtom (FRAME_X_DISPLAY (f),
3172 "_NET_WM_PID",
3173 False),
3174 XA_CARDINAL, 32, PropModeReplace,
3175 (unsigned char *) &pid, 1);
3176}
3177
3148DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 3178DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
3149 1, 1, 0, 3179 1, 1, 0,
3150 doc: /* Make a new X window, which is called a "frame" in Emacs terms. 3180 doc: /* Make a new X window, which is called a "frame" in Emacs terms.
@@ -3344,17 +3374,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3344 error ("Invalid frame font"); 3374 error ("Invalid frame font");
3345 } 3375 }
3346 3376
3347#ifdef USE_LUCID
3348 /* Prevent lwlib/xlwmenu.c from crashing because of a bug
3349 whereby it fails to get any font. */
3350 BLOCK_INPUT;
3351 xlwmenu_default_font = XLoadQueryFont (FRAME_X_DISPLAY (f), "fixed");
3352 UNBLOCK_INPUT;
3353#endif
3354
3355 /* Frame contents get displaced if an embedded X window has a border. */ 3377 /* Frame contents get displaced if an embedded X window has a border. */
3356 if (! FRAME_X_EMBEDDED_P (f)) 3378 if (! FRAME_X_EMBEDDED_P (f))
3357 x_default_parameter (f, parms, Qborder_width, make_number (2), 3379 x_default_parameter (f, parms, Qborder_width, make_number (0),
3358 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 3380 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
3359 3381
3360 /* This defaults to 1 in order to match xterm. We recognize either 3382 /* This defaults to 1 in order to match xterm. We recognize either
@@ -3531,19 +3553,24 @@ This function is an internal primitive--use `make-frame' instead. */)
3531 ; 3553 ;
3532 } 3554 }
3533 3555
3556 BLOCK_INPUT;
3557
3558 /* Set machine name and pid for the purpose of window managers. */
3559 set_machine_and_pid_properties(f);
3560
3534 /* Set the WM leader property. GTK does this itself, so this is not 3561 /* Set the WM leader property. GTK does this itself, so this is not
3535 needed when using GTK. */ 3562 needed when using GTK. */
3536 if (dpyinfo->client_leader_window != 0) 3563 if (dpyinfo->client_leader_window != 0)
3537 { 3564 {
3538 BLOCK_INPUT;
3539 XChangeProperty (FRAME_X_DISPLAY (f), 3565 XChangeProperty (FRAME_X_DISPLAY (f),
3540 FRAME_OUTER_WINDOW (f), 3566 FRAME_OUTER_WINDOW (f),
3541 dpyinfo->Xatom_wm_client_leader, 3567 dpyinfo->Xatom_wm_client_leader,
3542 XA_WINDOW, 32, PropModeReplace, 3568 XA_WINDOW, 32, PropModeReplace,
3543 (unsigned char *) &dpyinfo->client_leader_window, 1); 3569 (unsigned char *) &dpyinfo->client_leader_window, 1);
3544 UNBLOCK_INPUT;
3545 } 3570 }
3546 3571
3572 UNBLOCK_INPUT;
3573
3547 /* Initialize `default-minibuffer-frame' in case this is the first 3574 /* Initialize `default-minibuffer-frame' in case this is the first
3548 frame on this terminal. */ 3575 frame on this terminal. */
3549 if (FRAME_HAS_MINIBUF_P (f) 3576 if (FRAME_HAS_MINIBUF_P (f)
@@ -4102,7 +4129,7 @@ select_visual (dpyinfo)
4102 vinfo_template.screen = XScreenNumberOfScreen (screen); 4129 vinfo_template.screen = XScreenNumberOfScreen (screen);
4103 vinfo = XGetVisualInfo (dpy, VisualIDMask | VisualScreenMask, 4130 vinfo = XGetVisualInfo (dpy, VisualIDMask | VisualScreenMask,
4104 &vinfo_template, &n_visuals); 4131 &vinfo_template, &n_visuals);
4105 if (n_visuals != 1) 4132 if (n_visuals <= 0)
4106 fatal ("Can't get proper X visual info"); 4133 fatal ("Can't get proper X visual info");
4107 4134
4108 dpyinfo->n_planes = vinfo->depth; 4135 dpyinfo->n_planes = vinfo->depth;
@@ -4820,7 +4847,7 @@ x_create_tip_frame (dpyinfo, parms, text)
4820 needed to determine window geometry. */ 4847 needed to determine window geometry. */
4821 x_default_font_parameter (f, parms); 4848 x_default_font_parameter (f, parms);
4822 4849
4823 x_default_parameter (f, parms, Qborder_width, make_number (2), 4850 x_default_parameter (f, parms, Qborder_width, make_number (0),
4824 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 4851 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
4825 4852
4826 /* This defaults to 2 in order to match xterm. We recognize either 4853 /* This defaults to 2 in order to match xterm. We recognize either
@@ -5201,7 +5228,7 @@ Text larger than the specified size is clipped. */)
5201 clear_glyph_matrix (w->desired_matrix); 5228 clear_glyph_matrix (w->desired_matrix);
5202 clear_glyph_matrix (w->current_matrix); 5229 clear_glyph_matrix (w->current_matrix);
5203 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5230 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
5204 try_window (FRAME_ROOT_WINDOW (f), pos, 0); 5231 try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
5205 5232
5206 /* Compute width and height of the tooltip. */ 5233 /* Compute width and height of the tooltip. */
5207 width = height = 0; 5234 width = height = 0;
@@ -5218,15 +5245,15 @@ Text larger than the specified size is clipped. */)
5218 /* Let the row go over the full width of the frame. */ 5245 /* Let the row go over the full width of the frame. */
5219 row->full_width_p = 1; 5246 row->full_width_p = 1;
5220 5247
5248 row_width = row->pixel_width;
5221 /* There's a glyph at the end of rows that is used to place 5249 /* There's a glyph at the end of rows that is used to place
5222 the cursor there. Don't include the width of this glyph. */ 5250 the cursor there. Don't include the width of this glyph. */
5223 if (row->used[TEXT_AREA]) 5251 if (row->used[TEXT_AREA])
5224 { 5252 {
5225 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; 5253 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
5226 row_width = row->pixel_width - last->pixel_width; 5254 if (INTEGERP (last->object))
5255 row_width -= last->pixel_width;
5227 } 5256 }
5228 else
5229 row_width = row->pixel_width;
5230 5257
5231 height += row->height; 5258 height += row->height;
5232 width = max (width, row_width); 5259 width = max (width, row_width);
diff --git a/src/xmenu.c b/src/xmenu.c
index 64e55b7413c..c8067a47deb 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -81,6 +81,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
81#include <X11/StringDefs.h> 81#include <X11/StringDefs.h>
82#include <X11/Shell.h> 82#include <X11/Shell.h>
83#ifdef USE_LUCID 83#ifdef USE_LUCID
84#include "xsettings.h"
85#include "../lwlib/xlwmenu.h"
84#ifdef HAVE_XAW3D 86#ifdef HAVE_XAW3D
85#include <X11/Xaw3d/Paned.h> 87#include <X11/Xaw3d/Paned.h>
86#else /* !HAVE_XAW3D */ 88#else /* !HAVE_XAW3D */
@@ -950,6 +952,49 @@ update_frame_menubar (f)
950 return 1; 952 return 1;
951} 953}
952 954
955#ifdef USE_LUCID
956static void
957apply_systemfont_to_dialog (w)
958 Widget w;
959{
960 const char *fn = xsettings_get_system_normal_font ();
961 if (fn)
962 {
963 XrmDatabase db = XtDatabase (XtDisplay (w));
964 if (db)
965 XrmPutStringResource (&db, "*dialog.faceName", fn);
966 }
967}
968
969static void
970apply_systemfont_to_menu (w)
971 Widget w;
972{
973 const char *fn = xsettings_get_system_normal_font ();
974 int defflt;
975
976 if (!fn) return;
977
978 if (XtIsShell (w)) /* popup menu */
979 {
980 Widget *childs = NULL;
981 int num = 0;
982
983 XtVaGetValues (w, XtNnumChildren, &num, NULL);
984 if (num != 1) return; /* Should only be one. */
985
986 childs[0] = 0;
987 XtVaGetValues (w, XtNchildren, &childs, NULL);
988 if (childs && *childs) w = *childs;
989 }
990
991 /* Only use system font if the default is used for the menu. */
992 XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
993 if (defflt)
994 XtVaSetValues (w, XtNfaceName, fn, NULL);
995}
996#endif
997
953/* Set the contents of the menubar widgets of frame F. 998/* Set the contents of the menubar widgets of frame F.
954 The argument FIRST_TIME is currently ignored; 999 The argument FIRST_TIME is currently ignored;
955 it is set the first time this is called, from initialize_frame_menubar. */ 1000 it is set the first time this is called, from initialize_frame_menubar. */
@@ -1262,6 +1307,7 @@ set_frame_menubar (f, first_time, deep_p)
1262 1307
1263 /* Make menu pop down on C-g. */ 1308 /* Make menu pop down on C-g. */
1264 XtOverrideTranslations (menubar_widget, override); 1309 XtOverrideTranslations (menubar_widget, override);
1310 apply_systemfont_to_menu (menubar_widget);
1265 } 1311 }
1266 1312
1267 { 1313 {
@@ -1608,6 +1654,8 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
1608 popup_deactivate_callback, 1654 popup_deactivate_callback,
1609 menu_highlight_callback); 1655 menu_highlight_callback);
1610 1656
1657 apply_systemfont_to_menu (menu);
1658
1611 dummy.type = ButtonPress; 1659 dummy.type = ButtonPress;
1612 dummy.serial = 0; 1660 dummy.serial = 0;
1613 dummy.send_event = 0; 1661 dummy.send_event = 0;
@@ -2012,11 +2060,13 @@ create_and_show_dialog (f, first_wv)
2012 abort(); 2060 abort();
2013 2061
2014 dialog_id = widget_id_tick++; 2062 dialog_id = widget_id_tick++;
2063#ifdef HAVE_XFT
2064 apply_systemfont_to_dialog (f->output_data.x->widget);
2065#endif
2015 lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, 2066 lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
2016 f->output_data.x->widget, 1, 0, 2067 f->output_data.x->widget, 1, 0,
2017 dialog_selection_callback, 0, 0); 2068 dialog_selection_callback, 0, 0);
2018 lw_modify_all_widgets (dialog_id, first_wv->contents, True); 2069 lw_modify_all_widgets (dialog_id, first_wv->contents, True);
2019
2020 /* Display the dialog box. */ 2070 /* Display the dialog box. */
2021 lw_pop_up_all_widgets (dialog_id); 2071 lw_pop_up_all_widgets (dialog_id);
2022 popup_activated_flag = 1; 2072 popup_activated_flag = 1;
diff --git a/src/xsettings.c b/src/xsettings.c
index 945007db2f0..1db7a24ebad 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39#endif 39#endif
40 40
41static char *current_mono_font; 41static char *current_mono_font;
42static char *current_font;
42static struct x_display_info *first_dpyinfo; 43static struct x_display_info *first_dpyinfo;
43static Lisp_Object Qfont_name, Qfont_render; 44static Lisp_Object Qfont_name, Qfont_render;
44static int use_system_font; 45static int use_system_font;
@@ -63,9 +64,12 @@ store_font_changed_event (arg, display_name)
63 kbd_buffer_store_event (&event); 64 kbd_buffer_store_event (&event);
64} 65}
65 66
67#define XSETTINGS_FONT_NAME "Gtk/FontName"
68
66#ifdef HAVE_GCONF 69#ifdef HAVE_GCONF
67 70
68#define SYSTEM_MONO_FONT "/desktop/gnome/interface/monospace_font_name" 71#define SYSTEM_MONO_FONT "/desktop/gnome/interface/monospace_font_name"
72#define SYSTEM_FONT "/desktop/gnome/interface/font_name"
69 73
70/* Callback called when something changed in GConf that we care about, 74/* Callback called when something changed in GConf that we care about,
71 that is SYSTEM_MONO_FONT. */ 75 that is SYSTEM_MONO_FONT. */
@@ -235,7 +239,7 @@ parse_xft_settings (prop, bytes, settings)
235 239
236 memset (settings, 0, sizeof (*settings)); 240 memset (settings, 0, sizeof (*settings));
237 241
238 while (bytes_parsed+4 < bytes && settings_seen < 6 242 while (bytes_parsed+4 < bytes && settings_seen < 7
239 && i < n_settings) 243 && i < n_settings)
240 { 244 {
241 int type = prop[bytes_parsed++]; 245 int type = prop[bytes_parsed++];
@@ -243,7 +247,7 @@ parse_xft_settings (prop, bytes, settings)
243 CARD32 vlen, ival = 0; 247 CARD32 vlen, ival = 0;
244 char name[128]; /* The names we are looking for are not this long. */ 248 char name[128]; /* The names we are looking for are not this long. */
245 char sval[128]; /* The values we are looking for are not this long. */ 249 char sval[128]; /* The values we are looking for are not this long. */
246 int is_xft; 250 int want_this;
247 int to_cpy; 251 int to_cpy;
248 252
249 sval[0] = '\0'; 253 sval[0] = '\0';
@@ -264,13 +268,14 @@ parse_xft_settings (prop, bytes, settings)
264 bytes_parsed += 4; /* Skip serial for this value */ 268 bytes_parsed += 4; /* Skip serial for this value */
265 if (bytes_parsed > bytes) return BadLength; 269 if (bytes_parsed > bytes) return BadLength;
266 270
267 is_xft = nlen > 6 && strncmp (name, "Xft/", 4) == 0; 271 want_this = (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
272 || (strcmp (XSETTINGS_FONT_NAME, name) == 0);
268 273
269 switch (type) 274 switch (type)
270 { 275 {
271 case 0: /* Integer */ 276 case 0: /* Integer */
272 if (bytes_parsed+4 > bytes) return BadLength; 277 if (bytes_parsed+4 > bytes) return BadLength;
273 if (is_xft) 278 if (want_this)
274 { 279 {
275 memcpy (&ival, prop+bytes_parsed, 4); 280 memcpy (&ival, prop+bytes_parsed, 4);
276 if (my_bo != that_bo) ival = SWAP32 (ival); 281 if (my_bo != that_bo) ival = SWAP32 (ival);
@@ -283,7 +288,7 @@ parse_xft_settings (prop, bytes, settings)
283 memcpy (&vlen, prop+bytes_parsed, 4); 288 memcpy (&vlen, prop+bytes_parsed, 4);
284 bytes_parsed += 4; 289 bytes_parsed += 4;
285 if (my_bo != that_bo) vlen = SWAP32 (vlen); 290 if (my_bo != that_bo) vlen = SWAP32 (vlen);
286 if (is_xft) 291 if (want_this)
287 { 292 {
288 to_cpy = vlen > 127 ? 127 : vlen; 293 to_cpy = vlen > 127 ? 127 : vlen;
289 memcpy (sval, prop+bytes_parsed, to_cpy); 294 memcpy (sval, prop+bytes_parsed, to_cpy);
@@ -303,7 +308,7 @@ parse_xft_settings (prop, bytes, settings)
303 return BadValue; 308 return BadValue;
304 } 309 }
305 310
306 if (is_xft) 311 if (want_this)
307 { 312 {
308 ++settings_seen; 313 ++settings_seen;
309 if (strcmp (name, "Xft/Antialias") == 0) 314 if (strcmp (name, "Xft/Antialias") == 0)
@@ -361,6 +366,11 @@ parse_xft_settings (prop, bytes, settings)
361 else 366 else
362 settings->seen &= ~SEEN_LCDFILTER; 367 settings->seen &= ~SEEN_LCDFILTER;
363 } 368 }
369 else if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
370 {
371 free (current_font);
372 current_font = xstrdup (sval);
373 }
364 } 374 }
365 } 375 }
366 376
@@ -571,6 +581,12 @@ init_gconf ()
571 current_mono_font = xstrdup (s); 581 current_mono_font = xstrdup (s);
572 g_free (s); 582 g_free (s);
573 } 583 }
584 s = gconf_client_get_string (gconf_client, SYSTEM_FONT, NULL);
585 if (s)
586 {
587 current_font = xstrdup (s);
588 g_free (s);
589 }
574 gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE); 590 gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE);
575 gconf_client_add_dir (gconf_client, 591 gconf_client_add_dir (gconf_client,
576 SYSTEM_MONO_FONT, 592 SYSTEM_MONO_FONT,
@@ -635,6 +651,23 @@ xsettings_get_system_font ()
635 return current_mono_font; 651 return current_mono_font;
636} 652}
637 653
654const char *
655xsettings_get_system_normal_font ()
656{
657 return current_font;
658}
659
660DEFUN ("font-get-system-normal-font", Ffont_get_system_normal_font,
661 Sfont_get_system_normal_font,
662 0, 0, 0,
663 doc: /* Get the system default font. */)
664 ()
665{
666 return current_font && use_system_font
667 ? make_string (current_font, strlen (current_font))
668 : Qnil;
669}
670
638DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font, 671DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
639 0, 0, 0, 672 0, 0, 0,
640 doc: /* Get the system default monospaced font. */) 673 doc: /* Get the system default monospaced font. */)
@@ -649,6 +682,7 @@ void
649syms_of_xsettings () 682syms_of_xsettings ()
650{ 683{
651 current_mono_font = NULL; 684 current_mono_font = NULL;
685 current_font = NULL;
652 first_dpyinfo = NULL; 686 first_dpyinfo = NULL;
653#ifdef HAVE_GCONF 687#ifdef HAVE_GCONF
654 gconf_client = NULL; 688 gconf_client = NULL;
@@ -659,6 +693,7 @@ syms_of_xsettings ()
659 Qfont_render = intern_c_string ("font-render"); 693 Qfont_render = intern_c_string ("font-render");
660 staticpro (&Qfont_render); 694 staticpro (&Qfont_render);
661 defsubr (&Sfont_get_system_font); 695 defsubr (&Sfont_get_system_font);
696 defsubr (&Sfont_get_system_normal_font);
662 697
663 DEFVAR_BOOL ("font-use-system-font", &use_system_font, 698 DEFVAR_BOOL ("font-use-system-font", &use_system_font,
664 doc: /* *Non-nil means to use the system defined font. */); 699 doc: /* *Non-nil means to use the system defined font. */);
diff --git a/src/xsettings.h b/src/xsettings.h
index 6c603e5bbd9..f6399ea1bcc 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -21,10 +21,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21#define XSETTINGS_H 21#define XSETTINGS_H
22 22
23EXFUN (Ffont_get_system_font, 0); 23EXFUN (Ffont_get_system_font, 0);
24EXFUN (Ffont_get_system_normal_font, 0);
25
24extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo)); 26extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo));
25extern void xft_settings_event P_ ((struct x_display_info *dpyinfo, 27extern void xft_settings_event P_ ((struct x_display_info *dpyinfo,
26 XEvent *)); 28 XEvent *));
27extern const char *xsettings_get_system_font P_ ((void)); 29extern const char *xsettings_get_system_font P_ ((void));
30extern const char *xsettings_get_system_normal_font P_ ((void));
28 31
29 32
30#endif /* XSETTINGS_H */ 33#endif /* XSETTINGS_H */
diff --git a/src/xterm.c b/src/xterm.c
index 90db15d9ed4..29ed5bb865c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8931,11 +8931,9 @@ x_set_window_size_1 (f, change_gravity, cols, rows)
8931 8931
8932 compute_fringe_widths (f, 0); 8932 compute_fringe_widths (f, 0);
8933 8933
8934 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols) 8934 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
8935 + 2*f->border_width;
8936 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) 8935 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows)
8937 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f) 8936 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
8938 + 2*f->border_width;
8939 8937
8940 if (change_gravity) f->win_gravity = NorthWestGravity; 8938 if (change_gravity) f->win_gravity = NorthWestGravity;
8941 x_wm_set_size_hint (f, (long) 0, 0); 8939 x_wm_set_size_hint (f, (long) 0, 0);