aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2012-06-13 18:00:21 +0200
committerJoakim Verona2012-06-13 18:00:21 +0200
commit13d6898b0656b38da837261ec20a055a1be4a7e5 (patch)
treeb3399abf9cbea221b083b5bd8368915169b02fb1 /src
parent5259b41aab32e82ff06d977877f2e456541b3c0b (diff)
parent8cca97031d60136b3bdebef0d978ee3fe40eddec (diff)
downloademacs-13d6898b0656b38da837261ec20a055a1be4a7e5.tar.gz
emacs-13d6898b0656b38da837261ec20a055a1be4a7e5.zip
upstream, doesn build yet
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit26
-rw-r--r--src/ChangeLog273
-rw-r--r--src/Makefile.in10
-rw-r--r--src/alloc.c499
-rw-r--r--src/buffer.c83
-rw-r--r--src/buffer.h1
-rw-r--r--src/callint.c13
-rw-r--r--src/data.c4
-rw-r--r--src/dbusbind.c47
-rw-r--r--src/dispextern.h24
-rw-r--r--src/doprnt.c22
-rw-r--r--src/emacs.c10
-rw-r--r--src/eval.c20
-rw-r--r--src/fileio.c4
-rw-r--r--src/frame.c8
-rw-r--r--src/fringe.c14
-rw-r--r--src/ftfont.c2
-rw-r--r--src/image.c215
-rw-r--r--src/keyboard.c36
-rw-r--r--src/lisp.h247
-rw-r--r--src/lread.c11
-rw-r--r--src/macros.c8
-rw-r--r--src/mem-limits.h2
-rw-r--r--src/minibuf.c2
-rw-r--r--src/regex.c41
-rw-r--r--src/s/aix4-2.h4
-rw-r--r--src/s/bsd-common.h6
-rw-r--r--src/s/cygwin.h4
-rw-r--r--src/s/darwin.h6
-rw-r--r--src/s/gnu-kfreebsd.h9
-rw-r--r--src/s/gnu-linux.h7
-rw-r--r--src/s/gnu.h5
-rw-r--r--src/s/hpux10-20.h10
-rw-r--r--src/s/hpux11.h9
-rw-r--r--src/s/irix6-5.h5
-rw-r--r--src/s/ms-w32.h4
-rw-r--r--src/s/msdos.h4
-rw-r--r--src/s/openbsd.h9
-rw-r--r--src/s/sol2-10.h10
-rw-r--r--src/s/template.h5
-rw-r--r--src/s/unixware.h2
-rw-r--r--src/s/usg5-4-common.h11
-rw-r--r--src/sysdep.c7
-rw-r--r--src/term.c41
-rw-r--r--src/termchar.h2
-rw-r--r--src/w32fns.c21
-rw-r--r--src/w32heap.c8
-rw-r--r--src/w32menu.c13
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c76
-rw-r--r--src/window.h57
-rw-r--r--src/xdisp.c163
-rw-r--r--src/xfaces.c41
-rw-r--r--src/xfns.c4
-rw-r--r--src/xfont.c2
55 files changed, 1307 insertions, 862 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 8f8508f291f..df3a9cd7124 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -49,17 +49,26 @@ handle SIGALRM ignore
49# Using a constant runs into GDB bugs sometimes. 49# Using a constant runs into GDB bugs sometimes.
50define xgetptr 50define xgetptr
51 set $bugfix = $arg0 51 set $bugfix = $arg0
52 set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : $bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits 52 if gdb_use_struct
53 set $bugfix = $bugfix.i
54 end
55 set $ptr = $bugfix & $valmask | gdb_data_seg_bits
53end 56end
54 57
55define xgetint 58define xgetint
56 set $bugfix = $arg0 59 set $bugfix = $arg0
57 set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix >> (gdb_gctypebits - 1) : $bugfix << gdb_gctypebits) >> gdb_gctypebits 60 if gdb_use_struct
61 set $bugfix = $bugfix.i
62 end
63 set $int = gdb_use_lsb ? $bugfix >> (gdb_gctypebits - 1) : $bugfix << gdb_gctypebits) >> gdb_gctypebits
58end 64end
59 65
60define xgettype 66define xgettype
61 set $bugfix = $arg0 67 set $bugfix = $arg0
62 set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits) 68 if gdb_use_struct
69 set $bugfix = $bugfix.i
70 end
71 set $type = (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
63end 72end
64 73
65# Set up something to print out s-expressions. 74# Set up something to print out s-expressions.
@@ -949,15 +958,8 @@ end
949 958
950define xpr 959define xpr
951 xtype 960 xtype
952 if gdb_use_union 961 if $type == Lisp_Int0 || $type == Lisp_Int1
953 if $type == Lisp_Int 962 xint
954 xint
955 end
956 end
957 if !gdb_use_union
958 if $type == Lisp_Int0 || $type == Lisp_Int1
959 xint
960 end
961 end 963 end
962 if $type == Lisp_Symbol 964 if $type == Lisp_Symbol
963 xsymbol 965 xsymbol
diff --git a/src/ChangeLog b/src/ChangeLog
index 6d71346dd78..19a9ace0728 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,276 @@
12012-06-13 Andreas Schwab <schwab@linux-m68k.org>
2
3 * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
4 instead of union.
5 (XLI, XIL): Define.
6 (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use
7 them.
8 * emacs.c (gdb_use_struct): Renamed from gdb_use_union.
9 * .gdbinit: Check gdb_use_struct instead of gdb_use_union.
10 * alloc.c (widen_to_Lisp_Object): Removed.
11 (mark_memory): Use XIL instead of widen_to_Lisp_Object.
12 * frame.c (delete_frame): Remove outdated comment.
13 * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
14 USE_LISP_UNION_TYPE.
15 (Fw32_unregister_hot_key): Likewise.
16 (Fw32_toggle_lock_key): Likewise.
17 * w32menu.c (add_menu_item): Likewise.
18 (w32_menu_display_help): Use XIL instead of checking
19 USE_LISP_UNION_TYPE.
20 * w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE.
21 (init_heap): Likewise.
22 * w32term.c (w32_read_socket): Update comment.
23
242012-06-13 Glenn Morris <rgm@gnu.org>
25
26 * s/usg5-4-common.h, src/s/unixware.h:
27 Remove define/undef of HAVE_SYSV_SIGPAUSE (not used since 2010-05-04).
28
29 * s/gnu.h (POSIX_SIGNALS): Remove (not used since 2010-05-04).
30
312012-06-13 Paul Eggert <eggert@cs.ucla.edu>
32
33 USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604)
34 * alloc.c (make_number) [!defined make_number]:
35 Remove, as lisp.h always defines this now.
36 (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now.
37 (roundup_size): Verify that it is a power of 2.
38 * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
39 * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO.
40 * lisp.h (USE_LSB_TAG): Allow the builder to compile with
41 -DUSE_LSB_TAG=0, to override the automatically-selected default.
42 USE_LSB_TAG now is always defined to be either 0 or 1.
43 All uses changed.
44 (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the
45 code works fine either way, and efficiency is not a concern here,
46 as the union type is for debugging, not for production.
47 (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]:
48 Use an inline function on all platforms when using the union type,
49 since this is simpler and 'static inline' can be used portably
50 within Emacs now.
51 (LISP_INITIALLY_ZERO): New macro.
52 (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove.
53 (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
54
552012-06-12 Glenn Morris <rgm@gnu.org>
56
57 * s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files.
58
59 * s/gnu-linux.h (HAVE_PROCFS): Move to configure.
60
61 * s/hpux10-20.h, s/openbsd.h, s/usg5-4-common.h:
62 Move BROKEN_SIGIO to configure.
63
64 * s/bsd-common.h, s/darwin.h, s/gnu-kfreebsd.h, s/hpux10-20.h:
65 Move NO_TERMIO to configure.
66
672012-06-12 Chong Yidong <cyd@gnu.org>
68
69 * image.c (imagemagick_load_image): Use MagickFlattenImage if
70 MagickMergeImageLayers is undefined. Use pixel pusher loop if
71 MagickExportImagePixels is undefined.
72
732012-06-12 Paul Eggert <eggert@cs.ucla.edu>
74
75 * image.c (imagemagick_load_image): Remove unused label.
76
772012-06-11 Glenn Morris <rgm@gnu.org>
78
79 * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
80 * s/gnu-kfreebsd.h, s/gnu-linux.h, s/gnu.h, s/hpux10-20.h:
81 * s/irix6-5.h, s/ms-w32.h, s/msdos.h, s/template.h:
82 * s/usg5-4-common.h: Move SYSTEM_TYPE to configure.
83
842012-06-11 Stefan Monnier <monnier@iro.umontreal.ca>
85
86 * alloc.c (make_byte_code): New function.
87 (Fmake_byte_code): Use it. Don't purify here.
88 * lread.c (read1): Use it as well to avoid extra allocation.
89
902012-06-11 Chong Yidong <cyd@gnu.org>
91
92 * image.c (imagemagick_load_image): Implement transparency.
93
942012-06-10 Andreas Schwab <schwab@linux-m68k.org>
95
96 * regex.c (at_begline_loc_p): Also recognize `(?N:' and correctly
97 account for preceding backslashes. (Bug#11663)
98
992012-06-09 Chong Yidong <cyd@gnu.org>
100
101 * term.c: Support italics in capable terminals (Bug#9652).
102 (no_color_bit): Replace unused NC_BLINK with NC_ITALIC.
103 (turn_on_face): Output using TS_enter_italic_mode if available.
104 Don't handle unused blinking and alt-charset cases.
105 (turn_off_face): Handle italic case; discard unused tty_blinking_p
106 and tty_alt_charset_p cases.
107 (tty_capable_p, init_tty): Support italics.
108
109 * termchar.h (struct tty_display_info): Add field for italics.
110 Remove unused blink field.
111
112 * xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
113 Handle slant.
114
115 * dispextern.h: Replace unused TTY_CAP_BLINK with TTY_CAP_ITALIC.
116 (struct face): Remove unused fields tty_dim_p, tty_blinking_p, and
117 tty_alt_charset_p. Add tty_italic_p.
118
1192012-06-09 Michael Albinus <michael.albinus@gmx.de>
120
121 * dbusbind.c (XD_BASIC_DBUS_TYPE): Use dbus_type_is_valid and
122 dbus_type_is_basic if available.
123 (xd_extract_signed, xd_extract_unsigned): Rename from
124 extract_signed and extract_unsigned, respectively. Adapt callers.
125
1262012-06-09 Chong Yidong <cyd@gnu.org>
127
128 * xfaces.c (face_for_overlay_string): Handle face remapping (Bug#2066).
129
130 * fringe.c (Fset_fringe_bitmap_face): Handle the noninteractive
131 case (Bug#9752).
132
1332012-06-08 Paul Eggert <eggert@cs.ucla.edu>
134
135 * xdisp.c (vmessage): Treat frame message as multibyte.
136 Without this change, (let ((§ 1)) (make-variable-buffer-local '§))
137 would generate the diagnostic "Making \302\247 buffer-local while
138 let-bound!".
139
1402012-06-08 Eli Zaretskii <eliz@gnu.org>
141
142 * dispnew.c (showing_window_margins_p): Undo last change, which
143 was done due to an inadvertent commit.
144 (adjust_frame_glyphs_for_frame_redisplay): Do call
145 showing_window_margins_p.
146
1472012-06-08 Stefan Monnier <monnier@iro.umontreal.ca>
148
149 * eval.c (Fmake_var_non_special): New primitive.
150 (syms_of_eval): Defsubr it.
151 * lread.c (syms_of_lread): Mark `values' as lexically scoped.
152
1532012-06-08 Juanma Barranquero <lekktu@gmail.com>
154
155 * dispnew.c (showing_window_margins_p): Wrap in #if 0 to prevent unused
156 function warning (the only call is inside #if 0 since 2012-06-08T08:44:45Z!eliz@gnu.org).
157
1582012-06-08 Eli Zaretskii <eliz@gnu.org>
159
160 * alloc.c (allocate_vectorlike): Fix last change.
161
1622012-06-08 Dmitry Antipov <dmantipov@yandex.ru>
163
164 Block-based vector allocation of small vectors.
165 * lisp.h (struct vectorlike_header): New field `nbytes',
166 adjust comment accordingly.
167 * alloc.c (enum mem_type): New type `MEM_TYPE_VECTOR_BLOCK'
168 to denote vector blocks. Adjust users (live_vector_p,
169 mark_maybe_pointer, valid_lisp_object_p) accordingly.
170 (COMMON_MULTIPLE): Move outside #if USE_LSB_TAG.
171 (VECTOR_BLOCK_SIZE, vroundup, VECTOR_BLOCK_BYTES),
172 (VBLOCK_BYTES_MIN, VBLOCK_BYTES_MAX, VECTOR_MAX_FREE_LIST_INDEX),
173 (VECTOR_FREE_LIST_FLAG, ADVANCE, VINDEX, SETUP_ON_FREE_LIST),
174 (VECTOR_SIZE, VECTOR_IN_BLOCK): New macros.
175 (roundup_size): New constant.
176 (struct vector_block): New data type.
177 (vector_blocks, vector_free_lists, zero_vector): New variables.
178 (all_vectors): Rename to `large_vectors'.
179 (allocate_vector_from_block, init_vectors, allocate_vector_from_block)
180 (sweep_vectors): New functions.
181 (allocate_vectorlike): Return `zero_vector' as the only vector of
182 0 items. Allocate new vector from block if vector size is less than
183 or equal to VBLOCK_BYTES_MAX.
184 (Fgarbage_collect): Move all vector sweeping code to sweep_vectors.
185 (init_alloc_once): Add call to init_vectors.
186
1872012-06-08 Stefan Monnier <monnier@iro.umontreal.ca>
188
189 * eval.c (Fmacroexpand): Stop if the macro returns the same form.
190
1912012-06-07 Paul Eggert <eggert@cs.ucla.edu>
192
193 * doprnt.c (doprnt): Truncate multibyte char correctly.
194 Without this change, doprnt (buf, 2, "%s", FORMAT_END, AP)
195 would mishandle a string argument "Xc" if X was a multibyte
196 character of length 2: it would truncate after X's first byte
197 rather than including all of X.
198
1992012-06-06 Chong Yidong <cyd@gnu.org>
200
201 * buffer.c (word_wrap): Doc fix.
202
2032012-06-04 Paul Eggert <eggert@cs.ucla.edu>
204
205 * xdisp.c (note_mode_line_or_margin_highlight): Pacify gcc -Wall.
206
2072012-06-03 Glenn Morris <rgm@gnu.org>
208
209 * xdisp.c (tool-bar-style): Doc fix.
210
2112012-06-03 Ulrich Müller <ulm@gentoo.org>
212
213 * Makefile.in (PAXCTL): Define.
214 (temacs$(EXEEXT)): Disable memory randomization for the temacs
215 binary via PaX flags if the paxctl utility is available.
216 (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)):
217 Restore PaX flags to their default. (Bug#11398)
218
2192012-06-03 Chong Yidong <cyd@gnu.org>
220
221 * xdisp.c (decode_mode_spec_coding): Display a space for a unibyte
222 buffer (Bug#11226).
223
2242012-06-03 Chong Yidong <cyd@gnu.org>
225
226 * xdisp.c (calc_pixel_width_or_height): Use Fbuffer_local_value.
227 (note_mode_line_or_margin_highlight): If there is no help echo,
228 use mode-line-default-help-echo. Handle the case where the mouse
229 position is past the end of the mode line string.
230
231 * buffer.c (buffer_local_value_1): New function, split from
232 Fbuffer_local_value; can return Qunbound.
233 (Fbuffer_local_value): Use it.
234 (Vmode_line_format): Docstring tweaks.
235
2362012-06-02 Paul Eggert <eggert@cs.ucla.edu>
237
238 * sysdep.c (system_process_attributes): Improve comment.
239
2402012-06-02 Stefan Monnier <monnier@iro.umontreal.ca>
241
242 * keyboard.c: Export real-this-command to Elisp.
243 (syms_of_keyboard): Rename real_this_command to Vreal_this_command
244 and DEFVAR it. Update all users.
245
2462012-06-02 Paul Eggert <eggert@cs.ucla.edu>
247
248 * minibuf.c (Fassoc_string): Remove duplicate declaration.
249
250 * sysdep.c (system_process_attributes) [SOLARIS2 && HAVE_PROCFS]:
251 Convert pctcpu and pctmem to Lisp float properly.
252 Let the compiler fold better, as 100.0/0x8000 is exact.
253
2542012-06-02 Andreas Schwab <schwab@linux-m68k.org>
255
256 * alloc.c (CONS_BLOCK_SIZE): Account for padding at the end of
257 cons_block.
258
2592012-06-01 Paul Eggert <eggert@cs.ucla.edu>
260
261 * xfns.c (x_set_tool_bar_lines) [USE_GTK]: Adjust to bitfield change.
262
2632012-06-01 Dmitry Antipov <dmantipov@yandex.ru>
264
265 For a 'struct window', replace some Lisp_Object fields to
266 bitfields where appropriate, remove unused fields.
267 * window.h (struct window): Remove unused 'last_mark_x' and
268 'last_mark_y' fields. Rename 'mini_p' field to 'mini',
269 change it's type from Lisp_Object to bitfield.
270 Change type of 'force_start', 'optional_new_start',
271 'last_had_star', 'update_mode_line' and 'start_at_line_beg'
272 fields from Lisp_Object to bitfield. Adjust users accordingly.
273
12012-05-31 Paul Eggert <eggert@cs.ucla.edu> 2742012-05-31 Paul Eggert <eggert@cs.ucla.edu>
2 275
3 Pacify gcc -Wdouble-precision when using Xaw. 276 Pacify gcc -Wdouble-precision when using Xaw.
diff --git a/src/Makefile.in b/src/Makefile.in
index 1dd966ec0a7..b02d49ff5b0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -113,6 +113,12 @@ TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
113## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason). 113## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason).
114TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@ 114TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
115 115
116## If available, the full path to the paxctl program.
117## On grsecurity/PaX systems, unexec will fail due to a gap between
118## the bss section and the heap. This can be prevented by disabling
119## memory randomization in temacs with "paxctl -r". See bug#11398.
120PAXCTL = @PAXCTL@
121
116## Some systems define this to request special libraries. 122## Some systems define this to request special libraries.
117LIBS_SYSTEM=@LIBS_SYSTEM@ 123LIBS_SYSTEM=@LIBS_SYSTEM@
118 124
@@ -413,6 +419,7 @@ emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
413 -f list-load-path-shadows || true; \ 419 -f list-load-path-shadows || true; \
414 else \ 420 else \
415 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ 421 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
422 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
416 ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 423 ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
417 ./emacs -batch -f list-load-path-shadows || true; \ 424 ./emacs -batch -f list-load-path-shadows || true; \
418 fi 425 fi
@@ -460,6 +467,8 @@ $(lib)/libgnu.a: $(config_h)
460temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a 467temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
461 $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \ 468 $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \
462 -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES) 469 -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
470 test "$(CANNOT_DUMP)" = "yes" || \
471 test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
463 472
464## The following oldxmenu-related rules are only (possibly) used if 473## The following oldxmenu-related rules are only (possibly) used if
465## HAVE_X11 && !USE_GTK, but there is no harm in always defining them 474## HAVE_X11 && !USE_GTK, but there is no harm in always defining them
@@ -607,6 +616,7 @@ bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
607 ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 616 ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
608 else \ 617 else \
609 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ 618 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
619 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
610 mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 620 mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
611 fi 621 fi
612 @: Compile some files earlier to speed up further compilation. 622 @: Compile some files earlier to speed up further compilation.
diff --git a/src/alloc.c b/src/alloc.c
index cf7778c05f6..1478ce9ae4e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -304,7 +304,9 @@ enum mem_type
304 process, hash_table, frame, terminal, and window, but we never made 304 process, hash_table, frame, terminal, and window, but we never made
305 use of the distinction, so it only caused source-code complexity 305 use of the distinction, so it only caused source-code complexity
306 and runtime slowdown. Minor but pointless. */ 306 and runtime slowdown. Minor but pointless. */
307 MEM_TYPE_VECTORLIKE 307 MEM_TYPE_VECTORLIKE,
308 /* Special type to denote vector blocks. */
309 MEM_TYPE_VECTOR_BLOCK
308}; 310};
309 311
310static void *lisp_malloc (size_t, enum mem_type); 312static void *lisp_malloc (size_t, enum mem_type);
@@ -494,6 +496,11 @@ buffer_memory_full (ptrdiff_t nbytes)
494 xsignal (Qnil, Vmemory_signal_data); 496 xsignal (Qnil, Vmemory_signal_data);
495} 497}
496 498
499/* A common multiple of the positive integers A and B. Ideally this
500 would be the least common multiple, but there's no way to do that
501 as a constant expression in C, so do the best that we can easily do. */
502#define COMMON_MULTIPLE(a, b) \
503 ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
497 504
498#ifndef XMALLOC_OVERRUN_CHECK 505#ifndef XMALLOC_OVERRUN_CHECK
499#define XMALLOC_OVERRUN_CHECK_OVERHEAD 0 506#define XMALLOC_OVERRUN_CHECK_OVERHEAD 0
@@ -525,12 +532,8 @@ buffer_memory_full (ptrdiff_t nbytes)
525 char c; \ 532 char c; \
526 }, \ 533 }, \
527 c) 534 c)
528#ifdef USE_LSB_TAG 535
529/* A common multiple of the positive integers A and B. Ideally this 536#if USE_LSB_TAG
530 would be the least common multiple, but there's no way to do that
531 as a constant expression in C, so do the best that we can easily do. */
532# define COMMON_MULTIPLE(a, b) \
533 ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
534# define XMALLOC_HEADER_ALIGNMENT \ 537# define XMALLOC_HEADER_ALIGNMENT \
535 COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT) 538 COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT)
536#else 539#else
@@ -890,8 +893,8 @@ safe_alloca_unwind (Lisp_Object arg)
890 number of bytes to allocate, TYPE describes the intended use of the 893 number of bytes to allocate, TYPE describes the intended use of the
891 allocated memory block (for strings, for conses, ...). */ 894 allocated memory block (for strings, for conses, ...). */
892 895
893#ifndef USE_LSB_TAG 896#if ! USE_LSB_TAG
894static void *lisp_malloc_loser; 897void *lisp_malloc_loser EXTERNALLY_VISIBLE;
895#endif 898#endif
896 899
897static void * 900static void *
@@ -907,7 +910,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
907 910
908 val = (void *) malloc (nbytes); 911 val = (void *) malloc (nbytes);
909 912
910#ifndef USE_LSB_TAG 913#if ! USE_LSB_TAG
911 /* If the memory just allocated cannot be addressed thru a Lisp 914 /* If the memory just allocated cannot be addressed thru a Lisp
912 object's pointer, and it needs to be, 915 object's pointer, and it needs to be,
913 that's equivalent to running out of memory. */ 916 that's equivalent to running out of memory. */
@@ -1088,7 +1091,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1088 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 1091 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
1089#endif 1092#endif
1090 1093
1091#ifndef USE_LSB_TAG 1094#if ! USE_LSB_TAG
1092 /* If the memory just allocated cannot be addressed thru a Lisp 1095 /* If the memory just allocated cannot be addressed thru a Lisp
1093 object's pointer, and it needs to be, that's equivalent to 1096 object's pointer, and it needs to be, that's equivalent to
1094 running out of memory. */ 1097 running out of memory. */
@@ -1581,35 +1584,6 @@ mark_interval_tree (register INTERVAL tree)
1581 if (! NULL_INTERVAL_P (i)) \ 1584 if (! NULL_INTERVAL_P (i)) \
1582 (i) = balance_intervals (i); \ 1585 (i) = balance_intervals (i); \
1583 } while (0) 1586 } while (0)
1584
1585
1586/* Number support. If USE_LISP_UNION_TYPE is in effect, we
1587 can't create number objects in macros. */
1588#ifndef make_number
1589Lisp_Object
1590make_number (EMACS_INT n)
1591{
1592 Lisp_Object obj;
1593 obj.s.val = n;
1594 obj.s.type = Lisp_Int;
1595 return obj;
1596}
1597#endif
1598
1599/* Convert the pointer-sized word P to EMACS_INT while preserving its
1600 type and ptr fields. */
1601static Lisp_Object
1602widen_to_Lisp_Object (void *p)
1603{
1604 intptr_t i = (intptr_t) p;
1605#ifdef USE_LISP_UNION_TYPE
1606 Lisp_Object obj;
1607 obj.i = i;
1608 return obj;
1609#else
1610 return i;
1611#endif
1612}
1613 1587
1614/*********************************************************************** 1588/***********************************************************************
1615 String Allocation 1589 String Allocation
@@ -2701,8 +2675,10 @@ make_float (double float_value)
2701 GC are put on a free list to be reallocated before allocating 2675 GC are put on a free list to be reallocated before allocating
2702 any new cons cells from the latest cons_block. */ 2676 any new cons cells from the latest cons_block. */
2703 2677
2704#define CONS_BLOCK_SIZE \ 2678#define CONS_BLOCK_SIZE \
2705 (((BLOCK_BYTES - sizeof (struct cons_block *)) * CHAR_BIT) \ 2679 (((BLOCK_BYTES - sizeof (struct cons_block *) \
2680 /* The compiler might add padding at the end. */ \
2681 - (sizeof (struct Lisp_Cons) - sizeof (int))) * CHAR_BIT) \
2706 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1)) 2682 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
2707 2683
2708#define CONS_BLOCK(fptr) \ 2684#define CONS_BLOCK(fptr) \
@@ -2926,17 +2902,302 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
2926 Vector Allocation 2902 Vector Allocation
2927 ***********************************************************************/ 2903 ***********************************************************************/
2928 2904
2929/* Singly-linked list of all vectors. */ 2905/* This value is balanced well enough to avoid too much internal overhead
2906 for the most common cases; it's not required to be a power of two, but
2907 it's expected to be a mult-of-ROUNDUP_SIZE (see below). */
2930 2908
2931static struct Lisp_Vector *all_vectors; 2909#define VECTOR_BLOCK_SIZE 4096
2932 2910
2933/* Handy constants for vectorlike objects. */ 2911/* Handy constants for vectorlike objects. */
2934enum 2912enum
2935 { 2913 {
2936 header_size = offsetof (struct Lisp_Vector, contents), 2914 header_size = offsetof (struct Lisp_Vector, contents),
2937 word_size = sizeof (Lisp_Object) 2915 word_size = sizeof (Lisp_Object),
2916 roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object),
2917 USE_LSB_TAG ? 1 << GCTYPEBITS : 1)
2938 }; 2918 };
2939 2919
2920/* ROUNDUP_SIZE must be a power of 2. */
2921verify ((roundup_size & (roundup_size - 1)) == 0);
2922
2923/* Round up X to nearest mult-of-ROUNDUP_SIZE. */
2924
2925#define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1))
2926
2927/* Rounding helps to maintain alignment constraints if USE_LSB_TAG. */
2928
2929#define VECTOR_BLOCK_BYTES (VECTOR_BLOCK_SIZE - vroundup (sizeof (void *)))
2930
2931/* Size of the minimal vector allocated from block. */
2932
2933#define VBLOCK_BYTES_MIN vroundup (sizeof (struct Lisp_Vector))
2934
2935/* Size of the largest vector allocated from block. */
2936
2937#define VBLOCK_BYTES_MAX \
2938 vroundup ((VECTOR_BLOCK_BYTES / 2) - sizeof (Lisp_Object))
2939
2940/* We maintain one free list for each possible block-allocated
2941 vector size, and this is the number of free lists we have. */
2942
2943#define VECTOR_MAX_FREE_LIST_INDEX \
2944 ((VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) / roundup_size + 1)
2945
2946/* When the vector is on a free list, vectorlike_header.SIZE is set to
2947 this special value ORed with vector's memory footprint size. */
2948
2949#define VECTOR_FREE_LIST_FLAG (~(ARRAY_MARK_FLAG | PSEUDOVECTOR_FLAG \
2950 | (VECTOR_BLOCK_SIZE - 1)))
2951
2952/* Common shortcut to advance vector pointer over a block data. */
2953
2954#define ADVANCE(v, nbytes) ((struct Lisp_Vector *) ((char *) (v) + (nbytes)))
2955
2956/* Common shortcut to calculate NBYTES-vector index in VECTOR_FREE_LISTS. */
2957
2958#define VINDEX(nbytes) (((nbytes) - VBLOCK_BYTES_MIN) / roundup_size)
2959
2960/* Common shortcut to setup vector on a free list. */
2961
2962#define SETUP_ON_FREE_LIST(v, nbytes, index) \
2963 do { \
2964 (v)->header.size = VECTOR_FREE_LIST_FLAG | (nbytes); \
2965 eassert ((nbytes) % roundup_size == 0); \
2966 (index) = VINDEX (nbytes); \
2967 eassert ((index) < VECTOR_MAX_FREE_LIST_INDEX); \
2968 (v)->header.next.vector = vector_free_lists[index]; \
2969 vector_free_lists[index] = (v); \
2970 } while (0)
2971
2972struct vector_block
2973{
2974 char data[VECTOR_BLOCK_BYTES];
2975 struct vector_block *next;
2976};
2977
2978/* Chain of vector blocks. */
2979
2980static struct vector_block *vector_blocks;
2981
2982/* Vector free lists, where NTH item points to a chain of free
2983 vectors of the same NBYTES size, so NTH == VINDEX (NBYTES). */
2984
2985static struct Lisp_Vector *vector_free_lists[VECTOR_MAX_FREE_LIST_INDEX];
2986
2987/* Singly-linked list of large vectors. */
2988
2989static struct Lisp_Vector *large_vectors;
2990
2991/* The only vector with 0 slots, allocated from pure space. */
2992
2993static struct Lisp_Vector *zero_vector;
2994
2995/* Get a new vector block. */
2996
2997static struct vector_block *
2998allocate_vector_block (void)
2999{
3000 struct vector_block *block;
3001
3002#ifdef DOUG_LEA_MALLOC
3003 mallopt (M_MMAP_MAX, 0);
3004#endif
3005
3006 block = xmalloc (sizeof (struct vector_block));
3007
3008#ifdef DOUG_LEA_MALLOC
3009 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
3010#endif
3011
3012#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
3013 mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES,
3014 MEM_TYPE_VECTOR_BLOCK);
3015#endif
3016
3017 block->next = vector_blocks;
3018 vector_blocks = block;
3019 return block;
3020}
3021
3022/* Called once to initialize vector allocation. */
3023
3024static void
3025init_vectors (void)
3026{
3027 zero_vector = pure_alloc (header_size, Lisp_Vectorlike);
3028 zero_vector->header.size = 0;
3029}
3030
3031/* Allocate vector from a vector block. */
3032
3033static struct Lisp_Vector *
3034allocate_vector_from_block (size_t nbytes)
3035{
3036 struct Lisp_Vector *vector, *rest;
3037 struct vector_block *block;
3038 size_t index, restbytes;
3039
3040 eassert (VBLOCK_BYTES_MIN <= nbytes && nbytes <= VBLOCK_BYTES_MAX);
3041 eassert (nbytes % roundup_size == 0);
3042
3043 /* First, try to allocate from a free list
3044 containing vectors of the requested size. */
3045 index = VINDEX (nbytes);
3046 if (vector_free_lists[index])
3047 {
3048 vector = vector_free_lists[index];
3049 vector_free_lists[index] = vector->header.next.vector;
3050 vector->header.next.nbytes = nbytes;
3051 return vector;
3052 }
3053
3054 /* Next, check free lists containing larger vectors. Since
3055 we will split the result, we should have remaining space
3056 large enough to use for one-slot vector at least. */
3057 for (index = VINDEX (nbytes + VBLOCK_BYTES_MIN);
3058 index < VECTOR_MAX_FREE_LIST_INDEX; index++)
3059 if (vector_free_lists[index])
3060 {
3061 /* This vector is larger than requested. */
3062 vector = vector_free_lists[index];
3063 vector_free_lists[index] = vector->header.next.vector;
3064 vector->header.next.nbytes = nbytes;
3065
3066 /* Excess bytes are used for the smaller vector,
3067 which should be set on an appropriate free list. */
3068 restbytes = index * roundup_size + VBLOCK_BYTES_MIN - nbytes;
3069 eassert (restbytes % roundup_size == 0);
3070 rest = ADVANCE (vector, nbytes);
3071 SETUP_ON_FREE_LIST (rest, restbytes, index);
3072 return vector;
3073 }
3074
3075 /* Finally, need a new vector block. */
3076 block = allocate_vector_block ();
3077
3078 /* New vector will be at the beginning of this block. */
3079 vector = (struct Lisp_Vector *) block->data;
3080 vector->header.next.nbytes = nbytes;
3081
3082 /* If the rest of space from this block is large enough
3083 for one-slot vector at least, set up it on a free list. */
3084 restbytes = VECTOR_BLOCK_BYTES - nbytes;
3085 if (restbytes >= VBLOCK_BYTES_MIN)
3086 {
3087 eassert (restbytes % roundup_size == 0);
3088 rest = ADVANCE (vector, nbytes);
3089 SETUP_ON_FREE_LIST (rest, restbytes, index);
3090 }
3091 return vector;
3092 }
3093
3094/* Return how many Lisp_Objects can be stored in V. */
3095
3096#define VECTOR_SIZE(v) ((v)->header.size & PSEUDOVECTOR_FLAG ? \
3097 (PSEUDOVECTOR_SIZE_MASK & (v)->header.size) : \
3098 (v)->header.size)
3099
3100/* Nonzero if VECTOR pointer is valid pointer inside BLOCK. */
3101
3102#define VECTOR_IN_BLOCK(vector, block) \
3103 ((char *) (vector) <= (block)->data \
3104 + VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN)
3105
3106/* Reclaim space used by unmarked vectors. */
3107
3108static void
3109sweep_vectors (void)
3110{
3111 struct vector_block *block = vector_blocks, **bprev = &vector_blocks;
3112 struct Lisp_Vector *vector, *next, **vprev = &large_vectors;
3113
3114 total_vector_size = 0;
3115 memset (vector_free_lists, 0, sizeof (vector_free_lists));
3116
3117 /* Looking through vector blocks. */
3118
3119 for (block = vector_blocks; block; block = *bprev)
3120 {
3121 int free_this_block = 0;
3122
3123 for (vector = (struct Lisp_Vector *) block->data;
3124 VECTOR_IN_BLOCK (vector, block); vector = next)
3125 {
3126 if (VECTOR_MARKED_P (vector))
3127 {
3128 VECTOR_UNMARK (vector);
3129 total_vector_size += VECTOR_SIZE (vector);
3130 next = ADVANCE (vector, vector->header.next.nbytes);
3131 }
3132 else
3133 {
3134 ptrdiff_t nbytes;
3135
3136 if ((vector->header.size & VECTOR_FREE_LIST_FLAG)
3137 == VECTOR_FREE_LIST_FLAG)
3138 vector->header.next.nbytes =
3139 vector->header.size & (VECTOR_BLOCK_SIZE - 1);
3140
3141 next = ADVANCE (vector, vector->header.next.nbytes);
3142
3143 /* While NEXT is not marked, try to coalesce with VECTOR,
3144 thus making VECTOR of the largest possible size. */
3145
3146 while (VECTOR_IN_BLOCK (next, block))
3147 {
3148 if (VECTOR_MARKED_P (next))
3149 break;
3150 if ((next->header.size & VECTOR_FREE_LIST_FLAG)
3151 == VECTOR_FREE_LIST_FLAG)
3152 nbytes = next->header.size & (VECTOR_BLOCK_SIZE - 1);
3153 else
3154 nbytes = next->header.next.nbytes;
3155 vector->header.next.nbytes += nbytes;
3156 next = ADVANCE (next, nbytes);
3157 }
3158
3159 eassert (vector->header.next.nbytes % roundup_size == 0);
3160
3161 if (vector == (struct Lisp_Vector *) block->data
3162 && !VECTOR_IN_BLOCK (next, block))
3163 /* This block should be freed because all of it's
3164 space was coalesced into the only free vector. */
3165 free_this_block = 1;
3166 else
3167 SETUP_ON_FREE_LIST (vector, vector->header.next.nbytes, nbytes);
3168 }
3169 }
3170
3171 if (free_this_block)
3172 {
3173 *bprev = block->next;
3174#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
3175 mem_delete (mem_find (block->data));
3176#endif
3177 xfree (block);
3178 }
3179 else
3180 bprev = &block->next;
3181 }
3182
3183 /* Sweep large vectors. */
3184
3185 for (vector = large_vectors; vector; vector = *vprev)
3186 {
3187 if (VECTOR_MARKED_P (vector))
3188 {
3189 VECTOR_UNMARK (vector);
3190 total_vector_size += VECTOR_SIZE (vector);
3191 vprev = &vector->header.next.vector;
3192 }
3193 else
3194 {
3195 *vprev = vector->header.next.vector;
3196 lisp_free (vector);
3197 }
3198 }
3199}
3200
2940/* Value is a pointer to a newly allocated Lisp_Vector structure 3201/* Value is a pointer to a newly allocated Lisp_Vector structure
2941 with room for LEN Lisp_Objects. */ 3202 with room for LEN Lisp_Objects. */
2942 3203
@@ -2958,8 +3219,22 @@ allocate_vectorlike (ptrdiff_t len)
2958 /* This gets triggered by code which I haven't bothered to fix. --Stef */ 3219 /* This gets triggered by code which I haven't bothered to fix. --Stef */
2959 /* eassert (!handling_signal); */ 3220 /* eassert (!handling_signal); */
2960 3221
3222 if (len == 0)
3223 {
3224 MALLOC_UNBLOCK_INPUT;
3225 return zero_vector;
3226 }
3227
2961 nbytes = header_size + len * word_size; 3228 nbytes = header_size + len * word_size;
2962 p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); 3229
3230 if (nbytes <= VBLOCK_BYTES_MAX)
3231 p = allocate_vector_from_block (vroundup (nbytes));
3232 else
3233 {
3234 p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
3235 p->header.next.vector = large_vectors;
3236 large_vectors = p;
3237 }
2963 3238
2964#ifdef DOUG_LEA_MALLOC 3239#ifdef DOUG_LEA_MALLOC
2965 /* Back to a reasonable maximum of mmap'ed areas. */ 3240 /* Back to a reasonable maximum of mmap'ed areas. */
@@ -2969,9 +3244,6 @@ allocate_vectorlike (ptrdiff_t len)
2969 consing_since_gc += nbytes; 3244 consing_since_gc += nbytes;
2970 vector_cells_consed += len; 3245 vector_cells_consed += len;
2971 3246
2972 p->header.next.vector = all_vectors;
2973 all_vectors = p;
2974
2975 MALLOC_UNBLOCK_INPUT; 3247 MALLOC_UNBLOCK_INPUT;
2976 3248
2977 return p; 3249 return p;
@@ -3095,6 +3367,19 @@ usage: (vector &rest OBJECTS) */)
3095 return val; 3367 return val;
3096} 3368}
3097 3369
3370void
3371make_byte_code (struct Lisp_Vector *v)
3372{
3373 if (v->header.size > 1 && STRINGP (v->contents[1])
3374 && STRING_MULTIBYTE (v->contents[1]))
3375 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
3376 earlier because they produced a raw 8-bit string for byte-code
3377 and now such a byte-code string is loaded as multibyte while
3378 raw 8-bit characters converted to multibyte form. Thus, now we
3379 must convert them back to the original unibyte form. */
3380 v->contents[1] = Fstring_as_unibyte (v->contents[1]);
3381 XSETPVECTYPE (v, PVEC_COMPILED);
3382}
3098 3383
3099DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0, 3384DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
3100 doc: /* Create a byte-code object with specified arguments as elements. 3385 doc: /* Create a byte-code object with specified arguments as elements.
@@ -3118,28 +3403,21 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3118 ptrdiff_t i; 3403 ptrdiff_t i;
3119 register struct Lisp_Vector *p; 3404 register struct Lisp_Vector *p;
3120 3405
3121 XSETFASTINT (len, nargs); 3406 /* We used to purecopy everything here, if purify-flga was set. This worked
3122 if (!NILP (Vpurify_flag)) 3407 OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
3123 val = make_pure_vector (nargs); 3408 dangerous, since make-byte-code is used during execution to build
3124 else 3409 closures, so any closure built during the preload phase would end up
3125 val = Fmake_vector (len, Qnil); 3410 copied into pure space, including its free variables, which is sometimes
3411 just wasteful and other times plainly wrong (e.g. those free vars may want
3412 to be setcar'd). */
3126 3413
3127 if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) 3414 XSETFASTINT (len, nargs);
3128 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the 3415 val = Fmake_vector (len, Qnil);
3129 earlier because they produced a raw 8-bit string for byte-code
3130 and now such a byte-code string is loaded as multibyte while
3131 raw 8-bit characters converted to multibyte form. Thus, now we
3132 must convert them back to the original unibyte form. */
3133 args[1] = Fstring_as_unibyte (args[1]);
3134 3416
3135 p = XVECTOR (val); 3417 p = XVECTOR (val);
3136 for (i = 0; i < nargs; i++) 3418 for (i = 0; i < nargs; i++)
3137 { 3419 p->contents[i] = args[i];
3138 if (!NILP (Vpurify_flag)) 3420 make_byte_code (p);
3139 args[i] = Fpurecopy (args[i]);
3140 p->contents[i] = args[i];
3141 }
3142 XSETPVECTYPE (p, PVEC_COMPILED);
3143 XSETCOMPILED (val, p); 3421 XSETCOMPILED (val, p);
3144 return val; 3422 return val;
3145} 3423}
@@ -3156,7 +3434,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3156union aligned_Lisp_Symbol 3434union aligned_Lisp_Symbol
3157{ 3435{
3158 struct Lisp_Symbol s; 3436 struct Lisp_Symbol s;
3159#ifdef USE_LSB_TAG 3437#if USE_LSB_TAG
3160 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1) 3438 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1)
3161 & -(1 << GCTYPEBITS)]; 3439 & -(1 << GCTYPEBITS)];
3162#endif 3440#endif
@@ -3164,7 +3442,7 @@ union aligned_Lisp_Symbol
3164 3442
3165/* Each symbol_block is just under 1020 bytes long, since malloc 3443/* Each symbol_block is just under 1020 bytes long, since malloc
3166 really allocates in units of powers of two and uses 4 bytes for its 3444 really allocates in units of powers of two and uses 4 bytes for its
3167 own overhead. */ 3445 own overhead. */
3168 3446
3169#define SYMBOL_BLOCK_SIZE \ 3447#define SYMBOL_BLOCK_SIZE \
3170 ((1020 - sizeof (struct symbol_block *)) / sizeof (union aligned_Lisp_Symbol)) 3448 ((1020 - sizeof (struct symbol_block *)) / sizeof (union aligned_Lisp_Symbol))
@@ -3262,7 +3540,7 @@ Its value and function definition are void, and its property list is nil. */)
3262union aligned_Lisp_Misc 3540union aligned_Lisp_Misc
3263{ 3541{
3264 union Lisp_Misc m; 3542 union Lisp_Misc m;
3265#ifdef USE_LSB_TAG 3543#if USE_LSB_TAG
3266 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1) 3544 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1)
3267 & -(1 << GCTYPEBITS)]; 3545 & -(1 << GCTYPEBITS)];
3268#endif 3546#endif
@@ -4070,7 +4348,34 @@ live_misc_p (struct mem_node *m, void *p)
4070static inline int 4348static inline int
4071live_vector_p (struct mem_node *m, void *p) 4349live_vector_p (struct mem_node *m, void *p)
4072{ 4350{
4073 return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); 4351 if (m->type == MEM_TYPE_VECTOR_BLOCK)
4352 {
4353 /* This memory node corresponds to a vector block. */
4354 struct vector_block *block = (struct vector_block *) m->start;
4355 struct Lisp_Vector *vector = (struct Lisp_Vector *) block->data;
4356
4357 /* P is in the block's allocation range. Scan the block
4358 up to P and see whether P points to the start of some
4359 vector which is not on a free list. FIXME: check whether
4360 some allocation patterns (probably a lot of short vectors)
4361 may cause a substantial overhead of this loop. */
4362 while (VECTOR_IN_BLOCK (vector, block)
4363 && vector <= (struct Lisp_Vector *) p)
4364 {
4365 if ((vector->header.size & VECTOR_FREE_LIST_FLAG)
4366 == VECTOR_FREE_LIST_FLAG)
4367 vector = ADVANCE (vector, (vector->header.size
4368 & (VECTOR_BLOCK_SIZE - 1)));
4369 else if (vector == p)
4370 return 1;
4371 else
4372 vector = ADVANCE (vector, vector->header.next.nbytes);
4373 }
4374 }
4375 else if (m->type == MEM_TYPE_VECTORLIKE && p == m->start)
4376 /* This memory node corresponds to a large vector. */
4377 return 1;
4378 return 0;
4074} 4379}
4075 4380
4076 4381
@@ -4217,14 +4522,10 @@ mark_maybe_pointer (void *p)
4217{ 4522{
4218 struct mem_node *m; 4523 struct mem_node *m;
4219 4524
4220 /* Quickly rule out some values which can't point to Lisp data. */ 4525 /* Quickly rule out some values which can't point to Lisp data.
4221 if ((intptr_t) p % 4526 USE_LSB_TAG needs Lisp data to be aligned on multiples of 1 << GCTYPEBITS.
4222#ifdef USE_LSB_TAG 4527 Otherwise, assume that Lisp data is aligned on even addresses. */
4223 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */ 4528 if ((intptr_t) p % (USE_LSB_TAG ? 1 << GCTYPEBITS : 2))
4224#else
4225 2 /* We assume that Lisp data is aligned on even addresses. */
4226#endif
4227 )
4228 return; 4529 return;
4229 4530
4230 m = mem_find (p); 4531 m = mem_find (p);
@@ -4270,6 +4571,7 @@ mark_maybe_pointer (void *p)
4270 break; 4571 break;
4271 4572
4272 case MEM_TYPE_VECTORLIKE: 4573 case MEM_TYPE_VECTORLIKE:
4574 case MEM_TYPE_VECTOR_BLOCK:
4273 if (live_vector_p (m, p)) 4575 if (live_vector_p (m, p))
4274 { 4576 {
4275 Lisp_Object tem; 4577 Lisp_Object tem;
@@ -4299,8 +4601,8 @@ mark_maybe_pointer (void *p)
4299 wider than a pointer might allocate a Lisp_Object in non-adjacent halves. 4601 wider than a pointer might allocate a Lisp_Object in non-adjacent halves.
4300 If USE_LSB_TAG, the bottom half is not a valid pointer, but it should 4602 If USE_LSB_TAG, the bottom half is not a valid pointer, but it should
4301 suffice to widen it to to a Lisp_Object and check it that way. */ 4603 suffice to widen it to to a Lisp_Object and check it that way. */
4302#if defined USE_LSB_TAG || VAL_MAX < UINTPTR_MAX 4604#if USE_LSB_TAG || VAL_MAX < UINTPTR_MAX
4303# if !defined USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS 4605# if !USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS
4304 /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer 4606 /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer
4305 nor mark_maybe_object can follow the pointers. This should not occur on 4607 nor mark_maybe_object can follow the pointers. This should not occur on
4306 any practical porting target. */ 4608 any practical porting target. */
@@ -4361,7 +4663,7 @@ mark_memory (void *start, void *end)
4361 void *p = *(void **) ((char *) pp + i); 4663 void *p = *(void **) ((char *) pp + i);
4362 mark_maybe_pointer (p); 4664 mark_maybe_pointer (p);
4363 if (POINTERS_MIGHT_HIDE_IN_OBJECTS) 4665 if (POINTERS_MIGHT_HIDE_IN_OBJECTS)
4364 mark_maybe_object (widen_to_Lisp_Object (p)); 4666 mark_maybe_object (XIL ((intptr_t) p));
4365 } 4667 }
4366} 4668}
4367 4669
@@ -4703,6 +5005,7 @@ valid_lisp_object_p (Lisp_Object obj)
4703 return live_float_p (m, p); 5005 return live_float_p (m, p);
4704 5006
4705 case MEM_TYPE_VECTORLIKE: 5007 case MEM_TYPE_VECTORLIKE:
5008 case MEM_TYPE_VECTOR_BLOCK:
4706 return live_vector_p (m, p); 5009 return live_vector_p (m, p);
4707 5010
4708 default: 5011 default:
@@ -4728,7 +5031,7 @@ static void *
4728pure_alloc (size_t size, int type) 5031pure_alloc (size_t size, int type)
4729{ 5032{
4730 void *result; 5033 void *result;
4731#ifdef USE_LSB_TAG 5034#if USE_LSB_TAG
4732 size_t alignment = (1 << GCTYPEBITS); 5035 size_t alignment = (1 << GCTYPEBITS);
4733#else 5036#else
4734 size_t alignment = sizeof (EMACS_INT); 5037 size_t alignment = sizeof (EMACS_INT);
@@ -6239,33 +6542,7 @@ gc_sweep (void)
6239 } 6542 }
6240 } 6543 }
6241 6544
6242 /* Free all unmarked vectors */ 6545 sweep_vectors ();
6243 {
6244 register struct Lisp_Vector *vector = all_vectors, *prev = 0, *next;
6245 total_vector_size = 0;
6246
6247 while (vector)
6248 if (!VECTOR_MARKED_P (vector))
6249 {
6250 if (prev)
6251 prev->header.next = vector->header.next;
6252 else
6253 all_vectors = vector->header.next.vector;
6254 next = vector->header.next.vector;
6255 lisp_free (vector);
6256 vector = next;
6257
6258 }
6259 else
6260 {
6261 VECTOR_UNMARK (vector);
6262 if (vector->header.size & PSEUDOVECTOR_FLAG)
6263 total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
6264 else
6265 total_vector_size += vector->header.size;
6266 prev = vector, vector = vector->header.next.vector;
6267 }
6268 }
6269 6546
6270#ifdef GC_CHECK_STRING_BYTES 6547#ifdef GC_CHECK_STRING_BYTES
6271 if (!noninteractive) 6548 if (!noninteractive)
@@ -6402,7 +6679,6 @@ init_alloc_once (void)
6402 Vdead = make_pure_string ("DEAD", 4, 4, 0); 6679 Vdead = make_pure_string ("DEAD", 4, 4, 0);
6403#endif 6680#endif
6404 6681
6405 all_vectors = 0;
6406 ignore_warnings = 1; 6682 ignore_warnings = 1;
6407#ifdef DOUG_LEA_MALLOC 6683#ifdef DOUG_LEA_MALLOC
6408 mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */ 6684 mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */
@@ -6415,6 +6691,7 @@ init_alloc_once (void)
6415 init_marker (); 6691 init_marker ();
6416 init_float (); 6692 init_float ();
6417 init_intervals (); 6693 init_intervals ();
6694 init_vectors ();
6418 init_weak_hash_tables (); 6695 init_weak_hash_tables ();
6419 6696
6420#ifdef REL_ALLOC 6697#ifdef REL_ALLOC
diff --git a/src/buffer.c b/src/buffer.c
index 20260d5a5d8..504d477494b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -933,6 +933,21 @@ If VARIABLE does not have a buffer-local binding in BUFFER, the value
933is the default binding of the variable. */) 933is the default binding of the variable. */)
934 (register Lisp_Object variable, register Lisp_Object buffer) 934 (register Lisp_Object variable, register Lisp_Object buffer)
935{ 935{
936 register Lisp_Object result = buffer_local_value_1 (variable, buffer);
937
938 if (EQ (result, Qunbound))
939 xsignal1 (Qvoid_variable, variable);
940
941 return result;
942}
943
944
945/* Like Fbuffer_local_value, but return Qunbound if the variable is
946 locally unbound. */
947
948Lisp_Object
949buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
950{
936 register struct buffer *buf; 951 register struct buffer *buf;
937 register Lisp_Object result; 952 register Lisp_Object result;
938 struct Lisp_Symbol *sym; 953 struct Lisp_Symbol *sym;
@@ -985,10 +1000,7 @@ is the default binding of the variable. */)
985 default: abort (); 1000 default: abort ();
986 } 1001 }
987 1002
988 if (!EQ (result, Qunbound)) 1003 return result;
989 return result;
990
991 xsignal1 (Qvoid_variable, variable);
992} 1004}
993 1005
994/* Return an alist of the Lisp-level buffer-local bindings of 1006/* Return an alist of the Lisp-level buffer-local bindings of
@@ -5329,31 +5341,40 @@ the mode line appears at the bottom. */);
5329 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), 5341 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
5330 Qnil, 5342 Qnil,
5331 doc: /* Template for displaying mode line for current buffer. 5343 doc: /* Template for displaying mode line for current buffer.
5332Each buffer has its own value of this variable. 5344
5333Value may be nil, a string, a symbol or a list or cons cell. 5345The value may be nil, a string, a symbol or a list.
5346
5334A value of nil means don't display a mode line. 5347A value of nil means don't display a mode line.
5335For a symbol, its value is used (but it is ignored if t or nil). 5348
5336 A string appearing directly as the value of a symbol is processed verbatim 5349For any symbol other than t or nil, the symbol's value is processed as
5337 in that the %-constructs below are not recognized. 5350 a mode line construct. As a special exception, if that value is a
5338 Note that unless the symbol is marked as a `risky-local-variable', all 5351 string, the string is processed verbatim, without handling any
5339 properties in any strings, as well as all :eval and :propertize forms 5352 %-constructs (see below). Also, unless the symbol has a non-nil
5340 in the value of that symbol will be ignored. 5353 `risky-local-variable' property, all properties in any strings, as
5341For a list of the form `(:eval FORM)', FORM is evaluated and the result 5354 well as all :eval and :propertize forms in the value, are ignored.
5342 is used as a mode line element. Be careful--FORM should not load any files, 5355
5343 because that can cause an infinite recursion. 5356A list whose car is a string or list is processed by processing each
5344For a list of the form `(:propertize ELT PROPS...)', ELT is displayed 5357 of the list elements recursively, as separate mode line constructs,
5345 with the specified properties PROPS applied. 5358 and concatenating the results.
5346For a list whose car is a symbol, the symbol's value is taken, 5359
5347 and if that is non-nil, the cadr of the list is processed recursively. 5360A list of the form `(:eval FORM)' is processed by evaluating FORM and
5348 Otherwise, the caddr of the list (if there is one) is processed. 5361 using the result as a mode line construct. Be careful--FORM should
5349For a list whose car is a string or list, each element is processed 5362 not load any files, because that can cause an infinite recursion.
5350 recursively and the results are effectively concatenated. 5363
5351For a list whose car is an integer, the cdr of the list is processed 5364A list of the form `(:propertize ELT PROPS...)' is processed by
5352 and padded (if the number is positive) or truncated (if negative) 5365 processing ELT as the mode line construct, and adding the text
5353 to the width specified by that number. 5366 properties PROPS to the result.
5367
5368A list whose car is a symbol is processed by examining the symbol's
5369 value, and, if that value is non-nil, processing the cadr of the list
5370 recursively; and if that value is nil, processing the caddr of the
5371 list recursively.
5372
5373A list whose car is an integer is processed by processing the cadr of
5374 the list, and padding (if the number is positive) or truncating (if
5375 negative) to the width specified by that number.
5376
5354A string is printed verbatim in the mode line except for %-constructs: 5377A string is printed verbatim in the mode line except for %-constructs:
5355 (%-constructs are allowed when the string is the entire mode-line-format
5356 or when it is found in a cons-cell or a list)
5357 %b -- print buffer name. %f -- print visited file name. 5378 %b -- print buffer name. %f -- print visited file name.
5358 %F -- print frame name. 5379 %F -- print frame name.
5359 %* -- print %, * or hyphen. %+ -- print *, % or hyphen. 5380 %* -- print %, * or hyphen. %+ -- print *, % or hyphen.
@@ -5501,7 +5522,13 @@ This variable has no effect if long lines are truncated (see
5501`truncate-lines' and `truncate-partial-width-windows'). If you use 5522`truncate-lines' and `truncate-partial-width-windows'). If you use
5502word-wrapping, you might want to reduce the value of 5523word-wrapping, you might want to reduce the value of
5503`truncate-partial-width-windows', since wrapping can make text readable 5524`truncate-partial-width-windows', since wrapping can make text readable
5504in narrower windows. */); 5525in narrower windows.
5526
5527Instead of setting this variable directly, most users should use
5528Visual Line mode . Visual Line mode, when enabled, sets `word-wrap'
5529to t, and additionally redefines simple editing commands to act on
5530visual lines rather than logical lines. See the documentation of
5531`visual-line-mode'. */);
5505 5532
5506 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), 5533 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
5507 make_number (Lisp_String), 5534 make_number (Lisp_String),
diff --git a/src/buffer.h b/src/buffer.h
index 97d891f044b..3aa4b11c450 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -912,6 +912,7 @@ extern void validate_region (Lisp_Object *, Lisp_Object *);
912extern void set_buffer_internal (struct buffer *); 912extern void set_buffer_internal (struct buffer *);
913extern void set_buffer_internal_1 (struct buffer *); 913extern void set_buffer_internal_1 (struct buffer *);
914extern void set_buffer_temp (struct buffer *); 914extern void set_buffer_temp (struct buffer *);
915extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
915extern void record_buffer (Lisp_Object); 916extern void record_buffer (Lisp_Object);
916extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN; 917extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN;
917extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); 918extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
diff --git a/src/callint.c b/src/callint.c
index 506698a4e4e..bfa981ec65a 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -284,7 +284,7 @@ invoke it. If KEYS is omitted or nil, the return value of
284 284
285 save_this_command = Vthis_command; 285 save_this_command = Vthis_command;
286 save_this_original_command = Vthis_original_command; 286 save_this_original_command = Vthis_original_command;
287 save_real_this_command = real_this_command; 287 save_real_this_command = Vreal_this_command;
288 save_last_command = KVAR (current_kboard, Vlast_command); 288 save_last_command = KVAR (current_kboard, Vlast_command);
289 289
290 if (NILP (keys)) 290 if (NILP (keys))
@@ -295,7 +295,7 @@ invoke it. If KEYS is omitted or nil, the return value of
295 key_count = ASIZE (keys); 295 key_count = ASIZE (keys);
296 } 296 }
297 297
298 /* Save this now, since use of minibuffer will clobber it. */ 298 /* Save this now, since use of minibuffer will clobber it. */
299 prefix_arg = Vcurrent_prefix_arg; 299 prefix_arg = Vcurrent_prefix_arg;
300 300
301 if (SYMBOLP (function)) 301 if (SYMBOLP (function))
@@ -310,7 +310,8 @@ invoke it. If KEYS is omitted or nil, the return value of
310 The feature is not fully implemented. */ 310 The feature is not fully implemented. */
311 filter_specs = Qnil; 311 filter_specs = Qnil;
312 312
313 /* If k or K discard an up-event, save it here so it can be retrieved with U */ 313 /* If k or K discard an up-event, save it here so it can be retrieved with
314 U. */
314 up_event = Qnil; 315 up_event = Qnil;
315 316
316 /* Set SPECS to the interactive form, or barf if not interactive. */ 317 /* Set SPECS to the interactive form, or barf if not interactive. */
@@ -370,14 +371,14 @@ invoke it. If KEYS is omitted or nil, the return value of
370 371
371 Vthis_command = save_this_command; 372 Vthis_command = save_this_command;
372 Vthis_original_command = save_this_original_command; 373 Vthis_original_command = save_this_original_command;
373 real_this_command= save_real_this_command; 374 Vreal_this_command = save_real_this_command;
374 KVAR (current_kboard, Vlast_command) = save_last_command; 375 KVAR (current_kboard, Vlast_command) = save_last_command;
375 376
376 temporarily_switch_to_single_kboard (NULL); 377 temporarily_switch_to_single_kboard (NULL);
377 return unbind_to (speccount, apply1 (function, specs)); 378 return unbind_to (speccount, apply1 (function, specs));
378 } 379 }
379 380
380 /* Here if function specifies a string to control parsing the defaults */ 381 /* Here if function specifies a string to control parsing the defaults. */
381 382
382 /* Set next_event to point to the first event with parameters. */ 383 /* Set next_event to point to the first event with parameters. */
383 for (next_event = 0; next_event < key_count; next_event++) 384 for (next_event = 0; next_event < key_count; next_event++)
@@ -841,7 +842,7 @@ invoke it. If KEYS is omitted or nil, the return value of
841 842
842 Vthis_command = save_this_command; 843 Vthis_command = save_this_command;
843 Vthis_original_command = save_this_original_command; 844 Vthis_original_command = save_this_original_command;
844 real_this_command= save_real_this_command; 845 Vreal_this_command = save_real_this_command;
845 KVAR (current_kboard, Vlast_command) = save_last_command; 846 KVAR (current_kboard, Vlast_command) = save_last_command;
846 847
847 { 848 {
diff --git a/src/data.c b/src/data.c
index defcd06a2ed..4449977dbe0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1500,7 +1500,7 @@ The function `default-value' gets the default value and `set-default' sets it.
1500{ 1500{
1501 struct Lisp_Symbol *sym; 1501 struct Lisp_Symbol *sym;
1502 struct Lisp_Buffer_Local_Value *blv = NULL; 1502 struct Lisp_Buffer_Local_Value *blv = NULL;
1503 union Lisp_Val_Fwd valcontents IF_LINT (= {0}); 1503 union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
1504 int forwarded IF_LINT (= 0); 1504 int forwarded IF_LINT (= 0);
1505 1505
1506 CHECK_SYMBOL (variable); 1506 CHECK_SYMBOL (variable);
@@ -1577,7 +1577,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1577{ 1577{
1578 register Lisp_Object tem; 1578 register Lisp_Object tem;
1579 int forwarded IF_LINT (= 0); 1579 int forwarded IF_LINT (= 0);
1580 union Lisp_Val_Fwd valcontents IF_LINT (= {0}); 1580 union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
1581 struct Lisp_Symbol *sym; 1581 struct Lisp_Symbol *sym;
1582 struct Lisp_Buffer_Local_Value *blv = NULL; 1582 struct Lisp_Buffer_Local_Value *blv = NULL;
1583 1583
diff --git a/src/dbusbind.c b/src/dbusbind.c
index e506380e607..d80bb21cd59 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -147,6 +147,10 @@ static int xd_in_read_queued_messages = 0;
147#endif 147#endif
148 148
149/* Check whether TYPE is a basic DBusType. */ 149/* Check whether TYPE is a basic DBusType. */
150#ifdef HAVE_DBUS_TYPE_IS_VALID
151#define XD_BASIC_DBUS_TYPE(type) \
152 (dbus_type_is_valid (type) && dbus_type_is_basic (type))
153#else
150#ifdef DBUS_TYPE_UNIX_FD 154#ifdef DBUS_TYPE_UNIX_FD
151#define XD_BASIC_DBUS_TYPE(type) \ 155#define XD_BASIC_DBUS_TYPE(type) \
152 ((type == DBUS_TYPE_BYTE) \ 156 ((type == DBUS_TYPE_BYTE) \
@@ -177,6 +181,7 @@ static int xd_in_read_queued_messages = 0;
177 || (type == DBUS_TYPE_OBJECT_PATH) \ 181 || (type == DBUS_TYPE_OBJECT_PATH) \
178 || (type == DBUS_TYPE_SIGNATURE)) 182 || (type == DBUS_TYPE_SIGNATURE))
179#endif 183#endif
184#endif
180 185
181/* This was a macro. On Solaris 2.11 it was said to compile for 186/* This was a macro. On Solaris 2.11 it was said to compile for
182 hours, when optimization is enabled. So we have transferred it into 187 hours, when optimization is enabled. So we have transferred it into
@@ -524,7 +529,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
524 529
525/* Convert X to a signed integer with bounds LO and HI. */ 530/* Convert X to a signed integer with bounds LO and HI. */
526static intmax_t 531static intmax_t
527extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi) 532xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
528{ 533{
529 CHECK_NUMBER_OR_FLOAT (x); 534 CHECK_NUMBER_OR_FLOAT (x);
530 if (INTEGERP (x)) 535 if (INTEGERP (x))
@@ -552,7 +557,7 @@ extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
552 557
553/* Convert X to an unsigned integer with bounds 0 and HI. */ 558/* Convert X to an unsigned integer with bounds 0 and HI. */
554static uintmax_t 559static uintmax_t
555extract_unsigned (Lisp_Object x, uintmax_t hi) 560xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
556{ 561{
557 CHECK_NUMBER_OR_FLOAT (x); 562 CHECK_NUMBER_OR_FLOAT (x);
558 if (INTEGERP (x)) 563 if (INTEGERP (x))
@@ -611,9 +616,10 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
611 616
612 case DBUS_TYPE_INT16: 617 case DBUS_TYPE_INT16:
613 { 618 {
614 dbus_int16_t val = extract_signed (object, 619 dbus_int16_t val =
615 TYPE_MINIMUM (dbus_int16_t), 620 xd_extract_signed (object,
616 TYPE_MAXIMUM (dbus_int16_t)); 621 TYPE_MINIMUM (dbus_int16_t),
622 TYPE_MAXIMUM (dbus_int16_t));
617 int pval = val; 623 int pval = val;
618 XD_DEBUG_MESSAGE ("%c %d", dtype, pval); 624 XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
619 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 625 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -623,8 +629,9 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
623 629
624 case DBUS_TYPE_UINT16: 630 case DBUS_TYPE_UINT16:
625 { 631 {
626 dbus_uint16_t val = extract_unsigned (object, 632 dbus_uint16_t val =
627 TYPE_MAXIMUM (dbus_uint16_t)); 633 xd_extract_unsigned (object,
634 TYPE_MAXIMUM (dbus_uint16_t));
628 unsigned int pval = val; 635 unsigned int pval = val;
629 XD_DEBUG_MESSAGE ("%c %u", dtype, pval); 636 XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
630 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 637 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -634,9 +641,10 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
634 641
635 case DBUS_TYPE_INT32: 642 case DBUS_TYPE_INT32:
636 { 643 {
637 dbus_int32_t val = extract_signed (object, 644 dbus_int32_t val =
638 TYPE_MINIMUM (dbus_int32_t), 645 xd_extract_signed (object,
639 TYPE_MAXIMUM (dbus_int32_t)); 646 TYPE_MINIMUM (dbus_int32_t),
647 TYPE_MAXIMUM (dbus_int32_t));
640 int pval = val; 648 int pval = val;
641 XD_DEBUG_MESSAGE ("%c %d", dtype, pval); 649 XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
642 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 650 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -649,8 +657,9 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
649 case DBUS_TYPE_UNIX_FD: 657 case DBUS_TYPE_UNIX_FD:
650#endif 658#endif
651 { 659 {
652 dbus_uint32_t val = extract_unsigned (object, 660 dbus_uint32_t val =
653 TYPE_MAXIMUM (dbus_uint32_t)); 661 xd_extract_unsigned (object,
662 TYPE_MAXIMUM (dbus_uint32_t));
654 unsigned int pval = val; 663 unsigned int pval = val;
655 XD_DEBUG_MESSAGE ("%c %u", dtype, pval); 664 XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
656 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 665 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -660,9 +669,10 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
660 669
661 case DBUS_TYPE_INT64: 670 case DBUS_TYPE_INT64:
662 { 671 {
663 dbus_int64_t val = extract_signed (object, 672 dbus_int64_t val =
664 TYPE_MINIMUM (dbus_int64_t), 673 xd_extract_signed (object,
665 TYPE_MAXIMUM (dbus_int64_t)); 674 TYPE_MINIMUM (dbus_int64_t),
675 TYPE_MAXIMUM (dbus_int64_t));
666 printmax_t pval = val; 676 printmax_t pval = val;
667 XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); 677 XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
668 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 678 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -672,8 +682,9 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
672 682
673 case DBUS_TYPE_UINT64: 683 case DBUS_TYPE_UINT64:
674 { 684 {
675 dbus_uint64_t val = extract_unsigned (object, 685 dbus_uint64_t val =
676 TYPE_MAXIMUM (dbus_uint64_t)); 686 xd_extract_unsigned (object,
687 TYPE_MAXIMUM (dbus_uint64_t));
677 uprintmax_t pval = val; 688 uprintmax_t pval = val;
678 XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval); 689 XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
679 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 690 if (!dbus_message_iter_append_basic (iter, dtype, &val))
@@ -1271,7 +1282,7 @@ usage: (dbus-message-internal &rest REST) */)
1271 } 1282 }
1272 else /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR */ 1283 else /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR */
1273 { 1284 {
1274 serial = extract_unsigned (args[3], TYPE_MAXIMUM (dbus_uint32_t)); 1285 serial = xd_extract_unsigned (args[3], TYPE_MAXIMUM (dbus_uint32_t));
1275 count = 4; 1286 count = 4;
1276 } 1287 }
1277 1288
diff --git a/src/dispextern.h b/src/dispextern.h
index 3076a02b217..76e98437cf1 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1619,15 +1619,12 @@ struct face
1619 unsigned strike_through_color_defaulted_p : 1; 1619 unsigned strike_through_color_defaulted_p : 1;
1620 unsigned box_color_defaulted_p : 1; 1620 unsigned box_color_defaulted_p : 1;
1621 1621
1622 /* TTY appearances. Blinking is not yet implemented. Colors are 1622 /* TTY appearances. Colors are found in `lface' with empty color
1623 found in `lface' with empty color string meaning the default 1623 string meaning the default color of the TTY. */
1624 color of the TTY. */
1625 unsigned tty_bold_p : 1; 1624 unsigned tty_bold_p : 1;
1626 unsigned tty_dim_p : 1; 1625 unsigned tty_italic_p : 1;
1627 unsigned tty_underline_p : 1; 1626 unsigned tty_underline_p : 1;
1628 unsigned tty_alt_charset_p : 1;
1629 unsigned tty_reverse_p : 1; 1627 unsigned tty_reverse_p : 1;
1630 unsigned tty_blinking_p : 1;
1631 1628
1632 /* 1 means that colors of this face may not be freed because they 1629 /* 1 means that colors of this face may not be freed because they
1633 have been copied bitwise from a base face (see 1630 have been copied bitwise from a base face (see
@@ -2225,7 +2222,11 @@ struct it
2225 struct display_pos current; 2222 struct display_pos current;
2226 2223
2227 /* Total number of overlay strings to process. This can be > 2224 /* Total number of overlay strings to process. This can be >
2228 OVERLAY_STRING_CHUNK_SIZE. */ 2225 OVERLAY_STRING_CHUNK_SIZE. Value is dependable only when
2226 current.overlay_string_index >= 0. Use the latter to determine
2227 whether an overlay string is being iterated over, because
2228 n_overlay_strings can be positive even when we are not rendering
2229 an overlay string. */
2229 ptrdiff_t n_overlay_strings; 2230 ptrdiff_t n_overlay_strings;
2230 2231
2231 /* The charpos where n_overlay_strings was calculated. This should 2232 /* The charpos where n_overlay_strings was calculated. This should
@@ -2244,7 +2245,8 @@ struct it
2244 2245
2245 /* If non-nil, a Lisp string being processed. If 2246 /* If non-nil, a Lisp string being processed. If
2246 current.overlay_string_index >= 0, this is an overlay string from 2247 current.overlay_string_index >= 0, this is an overlay string from
2247 pos. */ 2248 pos. Use STRINGP (it.string) to test whether we are rendering a
2249 string or something else; do NOT use BUFFERP (it.object). */
2248 Lisp_Object string; 2250 Lisp_Object string;
2249 2251
2250 /* If non-nil, we are processing a string that came 2252 /* If non-nil, we are processing a string that came
@@ -2444,6 +2446,9 @@ struct it
2444 and continuation glyphs, or blanks that extend each line to the 2446 and continuation glyphs, or blanks that extend each line to the
2445 edge of the window on a TTY. 2447 edge of the window on a TTY.
2446 2448
2449 Do NOT use !BUFFERP (it.object) as a test whether we are
2450 iterating over a string; use STRINGP (it.string) instead.
2451
2447 Position is the current iterator position in object. */ 2452 Position is the current iterator position in object. */
2448 Lisp_Object object; 2453 Lisp_Object object;
2449 struct text_pos position; 2454 struct text_pos position;
@@ -3007,8 +3012,7 @@ enum tool_bar_item_image
3007#define TTY_CAP_UNDERLINE 0x02 3012#define TTY_CAP_UNDERLINE 0x02
3008#define TTY_CAP_BOLD 0x04 3013#define TTY_CAP_BOLD 0x04
3009#define TTY_CAP_DIM 0x08 3014#define TTY_CAP_DIM 0x08
3010#define TTY_CAP_BLINK 0x10 3015#define TTY_CAP_ITALIC 0x10
3011#define TTY_CAP_ALT_CHARSET 0x20
3012 3016
3013 3017
3014/*********************************************************************** 3018/***********************************************************************
diff --git a/src/doprnt.c b/src/doprnt.c
index df9ebc11f9c..b106ffb1938 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -392,15 +392,19 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
392 { 392 {
393 /* Truncate the string at character boundary. */ 393 /* Truncate the string at character boundary. */
394 tem = bufsize; 394 tem = bufsize;
395 while (!CHAR_HEAD_P (string[tem - 1])) tem--; 395 do
396 /* If the multibyte sequence of this character is 396 {
397 too long for the space we have left in the 397 tem--;
398 buffer, truncate before it. */ 398 if (CHAR_HEAD_P (string[tem]))
399 if (tem > 0 399 {
400 && BYTES_BY_CHAR_HEAD (string[tem - 1]) > bufsize) 400 if (BYTES_BY_CHAR_HEAD (string[tem]) <= bufsize - tem)
401 tem--; 401 tem = bufsize;
402 if (tem > 0) 402 break;
403 memcpy (bufptr, string, tem); 403 }
404 }
405 while (tem != 0);
406
407 memcpy (bufptr, string, tem);
404 bufptr[tem] = 0; 408 bufptr[tem] = 0;
405 /* Trigger exit from the loop, but make sure we 409 /* Trigger exit from the loop, but make sure we
406 return to the caller a value which will indicate 410 return to the caller a value which will indicate
diff --git a/src/emacs.c b/src/emacs.c
index 3477d92dc6f..0b679c7747a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -107,19 +107,19 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati
107 107
108/* Make these values available in GDB, which doesn't see macros. */ 108/* Make these values available in GDB, which doesn't see macros. */
109 109
110#ifdef USE_LSB_TAG 110#if USE_LSB_TAG
111int gdb_use_lsb EXTERNALLY_VISIBLE = 1; 111int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
112#else 112#else
113int gdb_use_lsb EXTERNALLY_VISIBLE = 0; 113int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
114#endif 114#endif
115#ifndef USE_LISP_UNION_TYPE 115#ifndef CHECK_LISP_OBJECT_TYPE
116int gdb_use_union EXTERNALLY_VISIBLE = 0; 116int gdb_use_struct EXTERNALLY_VISIBLE = 0;
117#else 117#else
118int gdb_use_union EXTERNALLY_VISIBLE = 1; 118int gdb_use_struct EXTERNALLY_VISIBLE = 1;
119#endif 119#endif
120int gdb_valbits EXTERNALLY_VISIBLE = VALBITS; 120int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
121int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; 121int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
122#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) 122#if defined DATA_SEG_BITS && !USE_LSB_TAG
123uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; 123uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
124#else 124#else
125uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; 125uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
diff --git a/src/eval.c b/src/eval.c
index 1da841a4073..5a9327a99d8 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -790,6 +790,17 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
790 return sym; 790 return sym;
791} 791}
792 792
793/* Make SYMBOL lexically scoped. */
794DEFUN ("internal-make-var-non-special", Fmake_var_non_special,
795 Smake_var_non_special, 1, 1, 0,
796 doc: /* Internal function. */)
797 (Lisp_Object symbol)
798{
799 CHECK_SYMBOL (symbol);
800 XSYMBOL (symbol)->declared_special = 0;
801 return Qnil;
802}
803
793 804
794DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 805DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
795 doc: /* Bind variables according to VARLIST then eval BODY. 806 doc: /* Bind variables according to VARLIST then eval BODY.
@@ -1020,7 +1031,13 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
1020 if (NILP (expander)) 1031 if (NILP (expander))
1021 break; 1032 break;
1022 } 1033 }
1023 form = apply1 (expander, XCDR (form)); 1034 {
1035 Lisp_Object newform = apply1 (expander, XCDR (form));
1036 if (EQ (form, newform))
1037 break;
1038 else
1039 form = newform;
1040 }
1024 } 1041 }
1025 return form; 1042 return form;
1026} 1043}
@@ -3576,6 +3593,7 @@ alist of active lexical bindings. */);
3576 defsubr (&Sdefvar); 3593 defsubr (&Sdefvar);
3577 defsubr (&Sdefvaralias); 3594 defsubr (&Sdefvaralias);
3578 defsubr (&Sdefconst); 3595 defsubr (&Sdefconst);
3596 defsubr (&Smake_var_non_special);
3579 defsubr (&Slet); 3597 defsubr (&Slet);
3580 defsubr (&SletX); 3598 defsubr (&SletX);
3581 defsubr (&Swhile); 3599 defsubr (&Swhile);
diff --git a/src/fileio.c b/src/fileio.c
index c6e2eea5089..496f9d7efa4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3735,7 +3735,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3735 /* If display currently starts at beginning of line, 3735 /* If display currently starts at beginning of line,
3736 keep it that way. */ 3736 keep it that way. */
3737 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) 3737 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer)
3738 XWINDOW (selected_window)->start_at_line_beg = Fbolp (); 3738 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
3739 3739
3740 replace_handled = 1; 3740 replace_handled = 1;
3741 } 3741 }
@@ -3892,7 +3892,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3892 /* If display currently starts at beginning of line, 3892 /* If display currently starts at beginning of line,
3893 keep it that way. */ 3893 keep it that way. */
3894 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) 3894 if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer)
3895 XWINDOW (selected_window)->start_at_line_beg = Fbolp (); 3895 XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
3896 3896
3897 /* Replace the chars that we need to replace, 3897 /* Replace the chars that we need to replace,
3898 and update INSERTED to equal the number of bytes 3898 and update INSERTED to equal the number of bytes
diff --git a/src/frame.c b/src/frame.c
index e962251f420..39d26ded5a6 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -331,7 +331,7 @@ make_frame (int mini_p)
331 mini_window = make_window (); 331 mini_window = make_window ();
332 XWINDOW (root_window)->next = mini_window; 332 XWINDOW (root_window)->next = mini_window;
333 XWINDOW (mini_window)->prev = root_window; 333 XWINDOW (mini_window)->prev = root_window;
334 XWINDOW (mini_window)->mini_p = Qt; 334 XWINDOW (mini_window)->mini = 1;
335 XWINDOW (mini_window)->frame = frame; 335 XWINDOW (mini_window)->frame = frame;
336 f->minibuffer_window = mini_window; 336 f->minibuffer_window = mini_window;
337 } 337 }
@@ -480,7 +480,7 @@ make_minibuffer_frame (void)
480 as nil. */ 480 as nil. */
481 481
482 mini_window = f->minibuffer_window = f->root_window; 482 mini_window = f->minibuffer_window = f->root_window;
483 XWINDOW (mini_window)->mini_p = Qt; 483 XWINDOW (mini_window)->mini = 1;
484 XWINDOW (mini_window)->next = Qnil; 484 XWINDOW (mini_window)->next = Qnil;
485 XWINDOW (mini_window)->prev = Qnil; 485 XWINDOW (mini_window)->prev = Qnil;
486 XWINDOW (mini_window)->frame = frame; 486 XWINDOW (mini_window)->frame = frame;
@@ -1152,10 +1152,6 @@ other_visible_frames (FRAME_PTR f)
1152 described for Fdelete_frame. */ 1152 described for Fdelete_frame. */
1153Lisp_Object 1153Lisp_Object
1154delete_frame (Lisp_Object frame, Lisp_Object force) 1154delete_frame (Lisp_Object frame, Lisp_Object force)
1155 /* If we use `register' here, gcc-4.0.2 on amd64 using
1156 -DUSE_LISP_UNION_TYPE complains further down that we're getting the
1157 address of `force'. Go figure. */
1158
1159{ 1155{
1160 struct frame *f; 1156 struct frame *f;
1161 struct frame *sf = SELECTED_FRAME (); 1157 struct frame *sf = SELECTED_FRAME ();
diff --git a/src/fringe.c b/src/fringe.c
index c591d391e9f..39f7e8dbb54 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1671,23 +1671,27 @@ If FACE is nil, reset face to default fringe face. */)
1671 (Lisp_Object bitmap, Lisp_Object face) 1671 (Lisp_Object bitmap, Lisp_Object face)
1672{ 1672{
1673 int n; 1673 int n;
1674 int face_id;
1675 1674
1676 CHECK_SYMBOL (bitmap); 1675 CHECK_SYMBOL (bitmap);
1677 n = lookup_fringe_bitmap (bitmap); 1676 n = lookup_fringe_bitmap (bitmap);
1678 if (!n) 1677 if (!n)
1679 error ("Undefined fringe bitmap"); 1678 error ("Undefined fringe bitmap");
1680 1679
1680 /* The purpose of the following code is to signal an error if FACE
1681 is not a face. This is for the caller's convenience only; the
1682 redisplay code should be able to fail gracefully. Skip the check
1683 if FRINGE_FACE_ID is unrealized (as in batch mode and during
1684 daemon startup). */
1681 if (!NILP (face)) 1685 if (!NILP (face))
1682 { 1686 {
1683 face_id = lookup_derived_face (SELECTED_FRAME (), face, 1687 struct frame *f = SELECTED_FRAME ();
1684 FRINGE_FACE_ID, 1); 1688
1685 if (face_id < 0) 1689 if (FACE_FROM_ID (f, FRINGE_FACE_ID)
1690 && lookup_derived_face (f, face, FRINGE_FACE_ID, 1) < 0)
1686 error ("No such face"); 1691 error ("No such face");
1687 } 1692 }
1688 1693
1689 fringe_faces[n] = face; 1694 fringe_faces[n] = face;
1690
1691 return Qnil; 1695 return Qnil;
1692} 1696}
1693 1697
diff --git a/src/ftfont.c b/src/ftfont.c
index 5545b4b4ae2..bfce7425af4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -525,7 +525,7 @@ static int ftfont_variation_glyphs (struct font *, int c,
525 525
526struct font_driver ftfont_driver = 526struct font_driver ftfont_driver =
527 { 527 {
528 0, /* Qfreetype */ 528 LISP_INITIALLY_ZERO, /* Qfreetype */
529 0, /* case insensitive */ 529 0, /* case insensitive */
530 ftfont_get_cache, 530 ftfont_get_cache,
531 ftfont_list, 531 ftfont_list,
diff --git a/src/image.c b/src/image.c
index b6cdb6c8290..bd3a0822fe9 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7599,19 +7599,14 @@ imagemagick_load_image (struct frame *f, struct image *img,
7599 unsigned char *contents, unsigned int size, 7599 unsigned char *contents, unsigned int size,
7600 char *filename) 7600 char *filename)
7601{ 7601{
7602 size_t width; 7602 size_t width, height;
7603 size_t height;
7604
7605 MagickBooleanType status; 7603 MagickBooleanType status;
7606
7607 XImagePtr ximg; 7604 XImagePtr ximg;
7608 int x; 7605 int x, y;
7609 int y; 7606 MagickWand *image_wand;
7610 7607 MagickWand *ping_wand;
7611 MagickWand *image_wand;
7612 MagickWand *ping_wand;
7613 PixelIterator *iterator; 7608 PixelIterator *iterator;
7614 PixelWand **pixels; 7609 PixelWand **pixels, *bg_wand = NULL;
7615 MagickPixelPacket pixel; 7610 MagickPixelPacket pixel;
7616 Lisp_Object image; 7611 Lisp_Object image;
7617 Lisp_Object value; 7612 Lisp_Object value;
@@ -7620,10 +7615,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
7620 int desired_width, desired_height; 7615 int desired_width, desired_height;
7621 double rotation; 7616 double rotation;
7622 int pixelwidth; 7617 int pixelwidth;
7623 ImageInfo *image_info;
7624 ExceptionInfo *exception;
7625 Image * im_image;
7626
7627 7618
7628 /* Handle image index for image types who can contain more than one image. 7619 /* Handle image index for image types who can contain more than one image.
7629 Interface :index is same as for GIF. First we "ping" the image to see how 7620 Interface :index is same as for GIF. First we "ping" the image to see how
@@ -7637,14 +7628,9 @@ imagemagick_load_image (struct frame *f, struct image *img,
7637 ping_wand = NewMagickWand (); 7628 ping_wand = NewMagickWand ();
7638 /* MagickSetResolution (ping_wand, 2, 2); (Bug#10112) */ 7629 /* MagickSetResolution (ping_wand, 2, 2); (Bug#10112) */
7639 7630
7640 if (filename != NULL) 7631 status = filename
7641 { 7632 ? MagickPingImage (ping_wand, filename)
7642 status = MagickPingImage (ping_wand, filename); 7633 : MagickPingImageBlob (ping_wand, contents, size);
7643 }
7644 else
7645 {
7646 status = MagickPingImageBlob (ping_wand, contents, size);
7647 }
7648 7634
7649 if (status == MagickFalse) 7635 if (status == MagickFalse)
7650 { 7636 {
@@ -7653,7 +7639,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7653 return 0; 7639 return 0;
7654 } 7640 }
7655 7641
7656 if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand))) 7642 if (ino < 0 || ino >= MagickGetNumberImages (ping_wand))
7657 { 7643 {
7658 image_error ("Invalid image number `%s' in image `%s'", 7644 image_error ("Invalid image number `%s' in image `%s'",
7659 image, img->spec); 7645 image, img->spec);
@@ -7670,39 +7656,46 @@ imagemagick_load_image (struct frame *f, struct image *img,
7670 DestroyMagickWand (ping_wand); 7656 DestroyMagickWand (ping_wand);
7671 7657
7672 /* Now we know how many images are inside the file. If it's not a 7658 /* Now we know how many images are inside the file. If it's not a
7673 bundle, the number is one. */ 7659 bundle, the number is one. Load the image data. */
7674 7660
7675 if (filename != NULL) 7661 image_wand = NewMagickWand ();
7676 {
7677 image_info = CloneImageInfo ((ImageInfo *) NULL);
7678 (void) strcpy (image_info->filename, filename);
7679 image_info->number_scenes = 1;
7680 image_info->scene = ino;
7681 exception = AcquireExceptionInfo ();
7682
7683 im_image = ReadImage (image_info, exception);
7684 DestroyExceptionInfo (exception);
7685 7662
7686 if (im_image == NULL) 7663 if ((filename
7687 goto imagemagick_no_wand; 7664 ? MagickReadImage (image_wand, filename)
7688 image_wand = NewMagickWandFromImage (im_image); 7665 : MagickReadImageBlob (image_wand, contents, size))
7689 DestroyImage (im_image); 7666 == MagickFalse)
7690 }
7691 else
7692 { 7667 {
7693 image_wand = NewMagickWand (); 7668 imagemagick_error (image_wand);
7694 if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse) 7669 goto imagemagick_error;
7695 {
7696 imagemagick_error (image_wand);
7697 goto imagemagick_error;
7698 }
7699 } 7670 }
7700 7671
7672 /* Retrieve the frame's background color, for use later. */
7673 {
7674 XColor bgcolor;
7675 Lisp_Object specified_bg;
7676
7677 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
7678 if (!STRINGP (specified_bg)
7679 || !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0))
7680 {
7681#ifndef HAVE_NS
7682 bgcolor.pixel = FRAME_BACKGROUND_PIXEL (f);
7683 x_query_color (f, &bgcolor);
7684#else
7685 ns_query_color (FRAME_BACKGROUND_COLOR (f), &bgcolor, 1);
7686#endif
7687 }
7688
7689 bg_wand = NewPixelWand ();
7690 PixelSetRed (bg_wand, (double) bgcolor.red / 65535);
7691 PixelSetGreen (bg_wand, (double) bgcolor.green / 65535);
7692 PixelSetBlue (bg_wand, (double) bgcolor.blue / 65535);
7693 }
7694
7701 /* If width and/or height is set in the display spec assume we want 7695 /* If width and/or height is set in the display spec assume we want
7702 to scale to those values. If either h or w is unspecified, the 7696 to scale to those values. If either h or w is unspecified, the
7703 unspecified should be calculated from the specified to preserve 7697 unspecified should be calculated from the specified to preserve
7704 aspect ratio. */ 7698 aspect ratio. */
7705
7706 value = image_spec_value (img->spec, QCwidth, NULL); 7699 value = image_spec_value (img->spec, QCwidth, NULL);
7707 desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); 7700 desired_width = (INTEGERP (value) ? XFASTINT (value) : -1);
7708 value = image_spec_value (img->spec, QCheight, NULL); 7701 value = image_spec_value (img->spec, QCheight, NULL);
@@ -7768,13 +7761,8 @@ imagemagick_load_image (struct frame *f, struct image *img,
7768 value = image_spec_value (img->spec, QCrotation, NULL); 7761 value = image_spec_value (img->spec, QCrotation, NULL);
7769 if (FLOATP (value)) 7762 if (FLOATP (value))
7770 { 7763 {
7771 PixelWand* background = NewPixelWand ();
7772 PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/
7773
7774 rotation = extract_float (value); 7764 rotation = extract_float (value);
7775 7765 status = MagickRotateImage (image_wand, bg_wand, rotation);
7776 status = MagickRotateImage (image_wand, background, rotation);
7777 DestroyPixelWand (background);
7778 if (status == MagickFalse) 7766 if (status == MagickFalse)
7779 { 7767 {
7780 image_error ("Imagemagick image rotate failed", Qnil, Qnil); 7768 image_error ("Imagemagick image rotate failed", Qnil, Qnil);
@@ -7788,6 +7776,22 @@ imagemagick_load_image (struct frame *f, struct image *img,
7788 height = MagickGetImageHeight (image_wand); 7776 height = MagickGetImageHeight (image_wand);
7789 width = MagickGetImageWidth (image_wand); 7777 width = MagickGetImageWidth (image_wand);
7790 7778
7779 /* Set the canvas background color to the frame or specified
7780 background, and flatten the image. Note: as of ImageMagick
7781 6.6.0, SVG image transparency is not handled properly
7782 (e.g. etc/images/splash.svg shows a white background always). */
7783 {
7784 MagickWand *new_wand;
7785 MagickSetImageBackgroundColor (image_wand, bg_wand);
7786#ifdef HAVE_MAGICKMERGEIMAGELAYERS
7787 new_wand = MagickMergeImageLayers (image_wand, MergeLayer);
7788#else
7789 new_wand = MagickFlattenImages (image_wand);
7790#endif
7791 DestroyMagickWand (image_wand);
7792 image_wand = new_wand;
7793 }
7794
7791 if (! (width <= INT_MAX && height <= INT_MAX 7795 if (! (width <= INT_MAX && height <= INT_MAX
7792 && check_image_size (f, width, height))) 7796 && check_image_size (f, width, height)))
7793 { 7797 {
@@ -7800,7 +7804,50 @@ imagemagick_load_image (struct frame *f, struct image *img,
7800 7804
7801 init_color_table (); 7805 init_color_table ();
7802 7806
7803 if (imagemagick_render_type == 0) 7807#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS
7808 if (imagemagick_render_type != 0)
7809 {
7810 /* Magicexportimage is normally faster than pixelpushing. This
7811 method is also well tested. Some aspects of this method are
7812 ad-hoc and needs to be more researched. */
7813 int imagedepth = 24; /*MagickGetImageDepth(image_wand);*/
7814 const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP"; /*"RGBP";*/
7815 /* Try to create a x pixmap to hold the imagemagick pixmap. */
7816 if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
7817 &ximg, &img->pixmap))
7818 {
7819#ifdef COLOR_TABLE_SUPPORT
7820 free_color_table ();
7821#endif
7822 image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
7823 goto imagemagick_error;
7824 }
7825
7826 /* Oddly, the below code doesn't seem to work:*/
7827 /* switch(ximg->bitmap_unit){ */
7828 /* case 8: */
7829 /* pixelwidth=CharPixel; */
7830 /* break; */
7831 /* case 16: */
7832 /* pixelwidth=ShortPixel; */
7833 /* break; */
7834 /* case 32: */
7835 /* pixelwidth=LongPixel; */
7836 /* break; */
7837 /* } */
7838 /*
7839 Here im just guessing the format of the bitmap.
7840 happens to work fine for:
7841 - bw djvu images
7842 on rgb display.
7843 seems about 3 times as fast as pixel pushing(not carefully measured)
7844 */
7845 pixelwidth = CharPixel; /*??? TODO figure out*/
7846 MagickExportImagePixels (image_wand, 0, 0, width, height,
7847 exportdepth, pixelwidth, ximg->data);
7848 }
7849 else
7850#endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */
7804 { 7851 {
7805 size_t image_height; 7852 size_t image_height;
7806 7853
@@ -7850,59 +7897,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
7850 } 7897 }
7851 DestroyPixelIterator (iterator); 7898 DestroyPixelIterator (iterator);
7852 } 7899 }
7853 else /* imagemagick_render_type != 0 */
7854 {
7855 /* Magicexportimage is normally faster than pixelpushing. This
7856 method is also well tested. Some aspects of this method are
7857 ad-hoc and needs to be more researched. */
7858 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
7859 const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
7860 /* Try to create a x pixmap to hold the imagemagick pixmap. */
7861 if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
7862 &ximg, &img->pixmap))
7863 {
7864#ifdef COLOR_TABLE_SUPPORT
7865 free_color_table ();
7866#endif
7867 image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
7868 goto imagemagick_error;
7869 }
7870
7871
7872 /* Oddly, the below code doesn't seem to work:*/
7873 /* switch(ximg->bitmap_unit){ */
7874 /* case 8: */
7875 /* pixelwidth=CharPixel; */
7876 /* break; */
7877 /* case 16: */
7878 /* pixelwidth=ShortPixel; */
7879 /* break; */
7880 /* case 32: */
7881 /* pixelwidth=LongPixel; */
7882 /* break; */
7883 /* } */
7884 /*
7885 Here im just guessing the format of the bitmap.
7886 happens to work fine for:
7887 - bw djvu images
7888 on rgb display.
7889 seems about 3 times as fast as pixel pushing(not carefully measured)
7890 */
7891 pixelwidth = CharPixel;/*??? TODO figure out*/
7892#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS
7893 MagickExportImagePixels (image_wand,
7894 0, 0,
7895 width, height,
7896 exportdepth,
7897 pixelwidth,
7898 /*&(img->pixmap));*/
7899 ximg->data);
7900#else
7901 image_error ("You don't have MagickExportImagePixels, upgrade ImageMagick!",
7902 Qnil, Qnil);
7903#endif
7904 }
7905
7906 7900
7907#ifdef COLOR_TABLE_SUPPORT 7901#ifdef COLOR_TABLE_SUPPORT
7908 /* Remember colors allocated for this image. */ 7902 /* Remember colors allocated for this image. */
@@ -7910,7 +7904,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
7910 free_color_table (); 7904 free_color_table ();
7911#endif /* COLOR_TABLE_SUPPORT */ 7905#endif /* COLOR_TABLE_SUPPORT */
7912 7906
7913
7914 img->width = width; 7907 img->width = width;
7915 img->height = height; 7908 img->height = height;
7916 7909
@@ -7919,9 +7912,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
7919 x_put_x_image (f, ximg, img->pixmap, width, height); 7912 x_put_x_image (f, ximg, img->pixmap, width, height);
7920 x_destroy_x_image (ximg); 7913 x_destroy_x_image (ximg);
7921 7914
7922
7923 /* Final cleanup. image_wand should be the only resource left. */ 7915 /* Final cleanup. image_wand should be the only resource left. */
7924 DestroyMagickWand (image_wand); 7916 DestroyMagickWand (image_wand);
7917 if (bg_wand) DestroyPixelWand (bg_wand);
7918
7925 /* `MagickWandTerminus' terminates the imagemagick environment. */ 7919 /* `MagickWandTerminus' terminates the imagemagick environment. */
7926 MagickWandTerminus (); 7920 MagickWandTerminus ();
7927 7921
@@ -7929,7 +7923,8 @@ imagemagick_load_image (struct frame *f, struct image *img,
7929 7923
7930 imagemagick_error: 7924 imagemagick_error:
7931 DestroyMagickWand (image_wand); 7925 DestroyMagickWand (image_wand);
7932 imagemagick_no_wand: 7926 if (bg_wand) DestroyPixelWand (bg_wand);
7927
7933 MagickWandTerminus (); 7928 MagickWandTerminus ();
7934 /* TODO more cleanup. */ 7929 /* TODO more cleanup. */
7935 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); 7930 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
diff --git a/src/keyboard.c b/src/keyboard.c
index 37ac8192558..ba473ac8a2b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -217,9 +217,6 @@ uintmax_t num_input_events;
217 217
218static EMACS_INT last_auto_save; 218static EMACS_INT last_auto_save;
219 219
220/* This is like Vthis_command, except that commands never set it. */
221Lisp_Object real_this_command;
222
223/* The value of point when the last command was started. */ 220/* The value of point when the last command was started. */
224static ptrdiff_t last_point_position; 221static ptrdiff_t last_point_position;
225 222
@@ -1379,9 +1376,9 @@ command_loop_1 (void)
1379 1376
1380 /* Do this after running Vpost_command_hook, for consistency. */ 1377 /* Do this after running Vpost_command_hook, for consistency. */
1381 KVAR (current_kboard, Vlast_command) = Vthis_command; 1378 KVAR (current_kboard, Vlast_command) = Vthis_command;
1382 KVAR (current_kboard, Vreal_last_command) = real_this_command; 1379 KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
1383 if (!CONSP (last_command_event)) 1380 if (!CONSP (last_command_event))
1384 KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; 1381 KVAR (current_kboard, Vlast_repeatable_command) = Vreal_this_command;
1385 1382
1386 while (1) 1383 while (1)
1387 { 1384 {
@@ -1448,7 +1445,7 @@ command_loop_1 (void)
1448 before_command_echo_length = echo_length (); 1445 before_command_echo_length = echo_length ();
1449 1446
1450 Vthis_command = Qnil; 1447 Vthis_command = Qnil;
1451 real_this_command = Qnil; 1448 Vreal_this_command = Qnil;
1452 Vthis_original_command = Qnil; 1449 Vthis_original_command = Qnil;
1453 Vthis_command_keys_shift_translated = Qnil; 1450 Vthis_command_keys_shift_translated = Qnil;
1454 1451
@@ -1487,10 +1484,10 @@ command_loop_1 (void)
1487 from that position. But also throw away beg_unchanged and 1484 from that position. But also throw away beg_unchanged and
1488 end_unchanged information in that case, so that redisplay will 1485 end_unchanged information in that case, so that redisplay will
1489 update the whole window properly. */ 1486 update the whole window properly. */
1490 if (!NILP (XWINDOW (selected_window)->force_start)) 1487 if (XWINDOW (selected_window)->force_start)
1491 { 1488 {
1492 struct buffer *b; 1489 struct buffer *b;
1493 XWINDOW (selected_window)->force_start = Qnil; 1490 XWINDOW (selected_window)->force_start = 0;
1494 b = XBUFFER (XWINDOW (selected_window)->buffer); 1491 b = XBUFFER (XWINDOW (selected_window)->buffer);
1495 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; 1492 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
1496 } 1493 }
@@ -1532,7 +1529,7 @@ command_loop_1 (void)
1532 /* Execute the command. */ 1529 /* Execute the command. */
1533 1530
1534 Vthis_command = cmd; 1531 Vthis_command = cmd;
1535 real_this_command = cmd; 1532 Vreal_this_command = cmd;
1536 safe_run_hooks (Qpre_command_hook); 1533 safe_run_hooks (Qpre_command_hook);
1537 1534
1538 already_adjusted = 0; 1535 already_adjusted = 0;
@@ -1616,12 +1613,14 @@ command_loop_1 (void)
1616 If the command didn't actually create a prefix arg, 1613 If the command didn't actually create a prefix arg,
1617 but is merely a frame event that is transparent to prefix args, 1614 but is merely a frame event that is transparent to prefix args,
1618 then the above doesn't apply. */ 1615 then the above doesn't apply. */
1619 if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event)) 1616 if (NILP (KVAR (current_kboard, Vprefix_arg))
1617 || CONSP (last_command_event))
1620 { 1618 {
1621 KVAR (current_kboard, Vlast_command) = Vthis_command; 1619 KVAR (current_kboard, Vlast_command) = Vthis_command;
1622 KVAR (current_kboard, Vreal_last_command) = real_this_command; 1620 KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
1623 if (!CONSP (last_command_event)) 1621 if (!CONSP (last_command_event))
1624 KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; 1622 KVAR (current_kboard, Vlast_repeatable_command)
1623 = Vreal_this_command;
1625 cancel_echoing (); 1624 cancel_echoing ();
1626 this_command_key_count = 0; 1625 this_command_key_count = 0;
1627 this_command_key_count_reset = 0; 1626 this_command_key_count_reset = 0;
@@ -11488,9 +11487,6 @@ syms_of_keyboard (void)
11488 staticpro (&tool_bar_items_vector); 11487 staticpro (&tool_bar_items_vector);
11489 tool_bar_items_vector = Qnil; 11488 tool_bar_items_vector = Qnil;
11490 11489
11491 staticpro (&real_this_command);
11492 real_this_command = Qnil;
11493
11494 DEFSYM (Qtimer_event_handler, "timer-event-handler"); 11490 DEFSYM (Qtimer_event_handler, "timer-event-handler");
11495 DEFSYM (Qdisabled_command_function, "disabled-command-function"); 11491 DEFSYM (Qdisabled_command_function, "disabled-command-function");
11496 DEFSYM (Qself_insert_command, "self-insert-command"); 11492 DEFSYM (Qself_insert_command, "self-insert-command");
@@ -11748,12 +11744,14 @@ was a kill command.
11748See Info node `(elisp)Multiple Terminals'. */); 11744See Info node `(elisp)Multiple Terminals'. */);
11749 11745
11750 DEFVAR_KBOARD ("real-last-command", Vreal_last_command, 11746 DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
11751 doc: /* Same as `last-command', but never altered by Lisp code. */); 11747 doc: /* Same as `last-command', but never altered by Lisp code.
11748Taken from the previous value of `real-this-command'. */);
11752 11749
11753 DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command, 11750 DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command,
11754 doc: /* Last command that may be repeated. 11751 doc: /* Last command that may be repeated.
11755The last command executed that was not bound to an input event. 11752The last command executed that was not bound to an input event.
11756This is the command `repeat' will try to repeat. */); 11753This is the command `repeat' will try to repeat.
11754Taken from a previous value of `real-this-command'. */);
11757 11755
11758 DEFVAR_LISP ("this-command", Vthis_command, 11756 DEFVAR_LISP ("this-command", Vthis_command,
11759 doc: /* The command now being executed. 11757 doc: /* The command now being executed.
@@ -11761,6 +11759,10 @@ The command can set this variable; whatever is put here
11761will be in `last-command' during the following command. */); 11759will be in `last-command' during the following command. */);
11762 Vthis_command = Qnil; 11760 Vthis_command = Qnil;
11763 11761
11762 DEFVAR_LISP ("real-this-command", Vreal_this_command,
11763 doc: /* This is like `this-command', except that commands should never modify it. */);
11764 Vreal_this_command = Qnil;
11765
11764 DEFVAR_LISP ("this-command-keys-shift-translated", 11766 DEFVAR_LISP ("this-command-keys-shift-translated",
11765 Vthis_command_keys_shift_translated, 11767 Vthis_command_keys_shift_translated,
11766 doc: /* Non-nil if the key sequence activating this command was shift-translated. 11768 doc: /* Non-nil if the key sequence activating this command was shift-translated.
diff --git a/src/lisp.h b/src/lisp.h
index 5e64392ec78..c655413544c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -149,22 +149,18 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
149#endif 149#endif
150#endif /* ENABLE_CHECKING */ 150#endif /* ENABLE_CHECKING */
151 151
152/* Use the configure flag --enable-use-lisp-union-type to make 152/* Use the configure flag --enable-check-lisp-object-type to make
153 Lisp_Object use a union type instead of the default int. The flag 153 Lisp_Object use a struct type instead of the default int. The flag
154 causes USE_LISP_UNION_TYPE to be defined. */ 154 causes CHECK_LISP_OBJECT_TYPE to be defined. */
155 155
156/***** Select the tagging scheme. *****/ 156/***** Select the tagging scheme. *****/
157/* There are basically two options that control the tagging scheme: 157/* The following option controls the tagging scheme:
158 - USE_LISP_UNION_TYPE says that Lisp_Object should be a union instead
159 of an integer.
160 - USE_LSB_TAG means that we can assume the least 3 bits of pointers are 158 - USE_LSB_TAG means that we can assume the least 3 bits of pointers are
161 always 0, and we can thus use them to hold tag bits, without 159 always 0, and we can thus use them to hold tag bits, without
162 restricting our addressing space. 160 restricting our addressing space.
163 161
164 If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus 162 If ! USE_LSB_TAG, then use the top 3 bits for tagging, thus
165 restricting our possible address range. Currently USE_LSB_TAG is not 163 restricting our possible address range.
166 allowed together with a union. This is not due to any fundamental
167 technical (or political ;-) problem: nobody wrote the code to do it yet.
168 164
169 USE_LSB_TAG not only requires the least 3 bits of pointers returned by 165 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
170 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment 166 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
@@ -201,25 +197,31 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
201# endif 197# endif
202#endif 198#endif
203 199
204/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ 200/* Unless otherwise specified, use USE_LSB_TAG on systems where: */
205#if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ 201#ifndef USE_LSB_TAG
206 || defined DARWIN_OS || defined __sun) 202/* 1. We know malloc returns a multiple of 8. */
207/* We also need to be able to specify mult-of-8 alignment on static vars. */ 203# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
208# if defined DECL_ALIGN 204 || defined DARWIN_OS || defined __sun)
209/* On hosts where pointers-as-ints do not exceed VAL_MAX, 205/* 2. We can specify multiple-of-8 alignment on static variables. */
210 USE_LSB_TAG is: 206# ifdef DECL_ALIGN
207/* 3. Pointers-as-ints exceed VAL_MAX.
208 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
211 a. unnecessary, because the top bits of an EMACS_INT are unused, and 209 a. unnecessary, because the top bits of an EMACS_INT are unused, and
212 b. slower, because it typically requires extra masking. 210 b. slower, because it typically requires extra masking.
213 So, define USE_LSB_TAG only on hosts where it might be useful. */ 211 So, default USE_LSB_TAG to 1 only on hosts where it might be useful. */
214# if VAL_MAX < UINTPTR_MAX 212# if VAL_MAX < UINTPTR_MAX
215# define USE_LSB_TAG 213# define USE_LSB_TAG 1
214# endif
216# endif 215# endif
217# endif 216# endif
218#endif 217#endif
218#ifndef USE_LSB_TAG
219# define USE_LSB_TAG 0
220#endif
219 221
220/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ 222/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */
221#ifndef DECL_ALIGN 223#ifndef DECL_ALIGN
222# ifdef USE_LSB_TAG 224# if USE_LSB_TAG
223# error "USE_LSB_TAG used without defining DECL_ALIGN" 225# error "USE_LSB_TAG used without defining DECL_ALIGN"
224# endif 226# endif
225# define DECL_ALIGN(type, var) type var 227# define DECL_ALIGN(type, var) type var
@@ -233,11 +235,6 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
233 e.g -2^28..2^28-1 to -2^29..2^29-1. */ 235 e.g -2^28..2^28-1 to -2^29..2^29-1. */
234#define USE_2_TAGS_FOR_INTS 236#define USE_2_TAGS_FOR_INTS
235 237
236/* Making it work for the union case is too much trouble. */
237#ifdef USE_LISP_UNION_TYPE
238# undef USE_2_TAGS_FOR_INTS
239#endif
240
241/* This is the set of Lisp data types. */ 238/* This is the set of Lisp data types. */
242 239
243#if !defined USE_2_TAGS_FOR_INTS 240#if !defined USE_2_TAGS_FOR_INTS
@@ -248,7 +245,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
248#else 245#else
249# define LISP_INT_TAG Lisp_Int0 246# define LISP_INT_TAG Lisp_Int0
250# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 247# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
251# ifdef USE_LSB_TAG 248# if USE_LSB_TAG
252# define LISP_INT1_TAG 4 249# define LISP_INT1_TAG 4
253# define LISP_STRING_TAG 1 250# define LISP_STRING_TAG 1
254# define LISP_INT_TAG_P(x) (((x) & 3) == 0) 251# define LISP_INT_TAG_P(x) (((x) & 3) == 0)
@@ -331,80 +328,36 @@ enum Lisp_Fwd_Type
331 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ 328 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
332 }; 329 };
333 330
334#ifdef USE_LISP_UNION_TYPE 331#ifdef CHECK_LISP_OBJECT_TYPE
335
336#ifndef WORDS_BIGENDIAN
337 332
338/* Definition of Lisp_Object for little-endian machines. */ 333typedef struct { EMACS_INT i; } Lisp_Object;
339 334
340typedef 335#define XLI(o) (o).i
341union Lisp_Object 336static inline Lisp_Object
342 { 337XIL (EMACS_INT i)
343 /* Used for comparing two Lisp_Objects; 338{
344 also, positive integers can be accessed fast this way. */ 339 Lisp_Object o = { i };
345 EMACS_INT i; 340 return o;
346 341}
347 struct
348 {
349 /* Use explicit signed, the signedness of a bit-field of type
350 int is implementation defined. */
351 signed EMACS_INT val : VALBITS;
352 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
353 } s;
354 struct
355 {
356 EMACS_UINT val : VALBITS;
357 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
358 } u;
359 }
360Lisp_Object;
361
362#else /* If WORDS_BIGENDIAN */
363
364typedef
365union Lisp_Object
366 {
367 /* Used for comparing two Lisp_Objects;
368 also, positive integers can be accessed fast this way. */
369 EMACS_INT i;
370
371 struct
372 {
373 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
374 /* Use explicit signed, the signedness of a bit-field of type
375 int is implementation defined. */
376 signed EMACS_INT val : VALBITS;
377 } s;
378 struct
379 {
380 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
381 EMACS_UINT val : VALBITS;
382 } u;
383 }
384Lisp_Object;
385
386#endif /* WORDS_BIGENDIAN */
387 342
388#ifdef __GNUC__
389static inline Lisp_Object 343static inline Lisp_Object
390LISP_MAKE_RVALUE (Lisp_Object o) 344LISP_MAKE_RVALUE (Lisp_Object o)
391{ 345{
392 return o; 346 return o;
393} 347}
394#else
395/* This is more portable to pre-C99 non-GCC compilers, but for
396 backwards compatibility GCC still accepts an old GNU extension
397 which caused this to only generate a warning. */
398#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o))
399#endif
400 348
401#else /* USE_LISP_UNION_TYPE */ 349#define LISP_INITIALLY_ZERO {0}
402 350
403/* If union type is not wanted, define Lisp_Object as just a number. */ 351#else /* CHECK_LISP_OBJECT_TYPE */
352
353/* If a struct type is not wanted, define Lisp_Object as just a number. */
404 354
405typedef EMACS_INT Lisp_Object; 355typedef EMACS_INT Lisp_Object;
356#define XLI(o) (o)
357#define XIL(i) (i)
406#define LISP_MAKE_RVALUE(o) (0+(o)) 358#define LISP_MAKE_RVALUE(o) (0+(o))
407#endif /* USE_LISP_UNION_TYPE */ 359#define LISP_INITIALLY_ZERO 0
360#endif /* CHECK_LISP_OBJECT_TYPE */
408 361
409/* In the size word of a vector, this bit means the vector has been marked. */ 362/* In the size word of a vector, this bit means the vector has been marked. */
410 363
@@ -466,30 +419,28 @@ enum pvec_type
466 For example, if tem is a Lisp_Object whose type is Lisp_Cons, 419 For example, if tem is a Lisp_Object whose type is Lisp_Cons,
467 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */ 420 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
468 421
469#ifndef USE_LISP_UNION_TYPE
470
471/* Return a perfect hash of the Lisp_Object representation. */ 422/* Return a perfect hash of the Lisp_Object representation. */
472#define XHASH(a) (a) 423#define XHASH(a) XLI(a)
473 424
474#ifdef USE_LSB_TAG 425#if USE_LSB_TAG
475 426
476#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1) 427#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
477#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK)) 428#define XTYPE(a) ((enum Lisp_Type) (XLI(a) & TYPEMASK))
478#ifdef USE_2_TAGS_FOR_INTS 429#ifdef USE_2_TAGS_FOR_INTS
479# define XINT(a) (((EMACS_INT) (a)) >> (GCTYPEBITS - 1)) 430# define XINT(a) (((EMACS_INT) XLI(a)) >> (GCTYPEBITS - 1))
480# define XUINT(a) (((EMACS_UINT) (a)) >> (GCTYPEBITS - 1)) 431# define XUINT(a) (((EMACS_UINT) XLI(a)) >> (GCTYPEBITS - 1))
481# define make_number(N) (((EMACS_INT) (N)) << (GCTYPEBITS - 1)) 432# define make_number(N) XIL(((EMACS_INT) (N)) << (GCTYPEBITS - 1))
482#else 433#else
483# define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS) 434# define XINT(a) (((EMACS_INT) XLI(a)) >> GCTYPEBITS)
484# define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS) 435# define XUINT(a) (((EMACS_UINT) XLI(a)) >> GCTYPEBITS)
485# define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS) 436# define make_number(N) XIL(((EMACS_INT) (N)) << GCTYPEBITS)
486#endif 437#endif
487#define XSET(var, type, ptr) \ 438#define XSET(var, type, ptr) \
488 (eassert (XTYPE ((intptr_t) (ptr)) == 0), /* Check alignment. */ \ 439 (eassert (XTYPE (XIL((intptr_t) (ptr))) == 0), /* Check alignment. */ \
489 (var) = (type) | (intptr_t) (ptr)) 440 (var) = XIL((type) | (intptr_t) (ptr)))
490 441
491#define XPNTR(a) ((intptr_t) ((a) & ~TYPEMASK)) 442#define XPNTR(a) ((intptr_t) (XLI(a) & ~TYPEMASK))
492#define XUNTAG(a, type) ((intptr_t) ((a) - (type))) 443#define XUNTAG(a, type) ((intptr_t) (XLI(a) - (type)))
493 444
494#else /* not USE_LSB_TAG */ 445#else /* not USE_LSB_TAG */
495 446
@@ -499,95 +450,42 @@ enum pvec_type
499 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work 450 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
500 on all machines, but would penalize machines which don't need it) 451 on all machines, but would penalize machines which don't need it)
501 */ 452 */
502#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS)) 453#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) XLI(a)) >> VALBITS))
503 454
504/* For integers known to be positive, XFASTINT provides fast retrieval 455/* For integers known to be positive, XFASTINT provides fast retrieval
505 and XSETFASTINT provides fast storage. This takes advantage of the 456 and XSETFASTINT provides fast storage. This takes advantage of the
506 fact that Lisp_Int is 0. */ 457 fact that Lisp_Int is 0. */
507#define XFASTINT(a) ((a) + 0) 458#define XFASTINT(a) (XLI(a) + 0)
508#define XSETFASTINT(a, b) ((a) = (b)) 459#define XSETFASTINT(a, b) ((a) = XIL(b))
509 460
510/* Extract the value of a Lisp_Object as a (un)signed integer. */ 461/* Extract the value of a Lisp_Object as a (un)signed integer. */
511 462
512#ifdef USE_2_TAGS_FOR_INTS 463#ifdef USE_2_TAGS_FOR_INTS
513# define XINT(a) ((((EMACS_INT) (a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 1)) 464# define XINT(a) ((((EMACS_INT) XLI(a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 1))
514# define XUINT(a) ((EMACS_UINT) ((a) & (1 + (VALMASK << 1)))) 465# define XUINT(a) ((EMACS_UINT) (XLI(a) & (1 + (VALMASK << 1))))
515# define make_number(N) ((((EMACS_INT) (N)) & (1 + (VALMASK << 1)))) 466# define make_number(N) XIL((((EMACS_INT) (N)) & (1 + (VALMASK << 1))))
516#else 467#else
517# define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS)) \ 468# define XINT(a) ((((EMACS_INT) XLI(a)) << (BITS_PER_EMACS_INT - VALBITS)) \
518 >> (BITS_PER_EMACS_INT - VALBITS)) 469 >> (BITS_PER_EMACS_INT - VALBITS))
519# define XUINT(a) ((EMACS_UINT) ((a) & VALMASK)) 470# define XUINT(a) ((EMACS_UINT) (XLI(a) & VALMASK))
520# define make_number(N) \ 471# define make_number(N) \
521 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) 472 XIL((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
522#endif 473#endif
523 474
524#define XSET(var, type, ptr) \ 475#define XSET(var, type, ptr) \
525 ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ 476 ((var) = XIL((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
526 + ((intptr_t) (ptr) & VALMASK))) 477 + ((intptr_t) (ptr) & VALMASK)))
527 478
528#ifdef DATA_SEG_BITS 479#ifdef DATA_SEG_BITS
529/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers 480/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
530 which were stored in a Lisp_Object */ 481 which were stored in a Lisp_Object */
531#define XPNTR(a) ((uintptr_t) (((a) & VALMASK)) | DATA_SEG_BITS)) 482#define XPNTR(a) ((uintptr_t) ((XLI(a) & VALMASK)) | DATA_SEG_BITS))
532#else 483#else
533#define XPNTR(a) ((uintptr_t) ((a) & VALMASK)) 484#define XPNTR(a) ((uintptr_t) (XLI(a) & VALMASK))
534#endif 485#endif
535 486
536#endif /* not USE_LSB_TAG */ 487#endif /* not USE_LSB_TAG */
537 488
538#else /* USE_LISP_UNION_TYPE */
539
540#ifdef USE_2_TAGS_FOR_INTS
541# error "USE_2_TAGS_FOR_INTS is not supported with USE_LISP_UNION_TYPE"
542#endif
543
544#define XHASH(a) ((a).i)
545#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
546#define XINT(a) ((EMACS_INT) (a).s.val)
547#define XUINT(a) ((EMACS_UINT) (a).u.val)
548
549#ifdef USE_LSB_TAG
550
551# define XSET(var, vartype, ptr) \
552 (eassert ((((uintptr_t) (ptr)) & ((1 << GCTYPEBITS) - 1)) == 0), \
553 (var).u.val = ((uintptr_t) (ptr)) >> GCTYPEBITS, \
554 (var).u.type = ((char) (vartype)))
555
556/* Some versions of gcc seem to consider the bitfield width when issuing
557 the "cast to pointer from integer of different size" warning, so the
558 cast is here to widen the value back to its natural size. */
559# define XPNTR(v) ((intptr_t) (v).s.val << GCTYPEBITS)
560
561#else /* !USE_LSB_TAG */
562
563/* For integers known to be positive, XFASTINT provides fast retrieval
564 and XSETFASTINT provides fast storage. This takes advantage of the
565 fact that Lisp_Int is 0. */
566# define XFASTINT(a) ((a).i + 0)
567# define XSETFASTINT(a, b) ((a).i = (b))
568
569# define XSET(var, vartype, ptr) \
570 (((var).s.val = ((intptr_t) (ptr))), ((var).s.type = ((char) (vartype))))
571
572#ifdef DATA_SEG_BITS
573/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
574 which were stored in a Lisp_Object */
575#define XPNTR(a) ((intptr_t) (XUINT (a) | DATA_SEG_BITS))
576#else
577#define XPNTR(a) ((intptr_t) XUINT (a))
578#endif
579
580#endif /* !USE_LSB_TAG */
581
582#if __GNUC__ >= 2 && defined (__OPTIMIZE__)
583#define make_number(N) \
584 (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
585#else
586extern Lisp_Object make_number (EMACS_INT);
587#endif
588
589#endif /* USE_LISP_UNION_TYPE */
590
591/* For integers known to be positive, XFASTINT sometimes provides 489/* For integers known to be positive, XFASTINT sometimes provides
592 faster retrieval and XSETFASTINT provides faster storage. 490 faster retrieval and XSETFASTINT provides faster storage.
593 If not, fallback on the non-accelerated path. */ 491 If not, fallback on the non-accelerated path. */
@@ -920,11 +818,15 @@ struct vectorlike_header
920 { 818 {
921 ptrdiff_t size; 819 ptrdiff_t size;
922 820
923 /* Pointer to the next vector-like object. It is generally a buffer or a 821 /* When the vector is allocated from a vector block, NBYTES is used
822 if the vector is not on a free list, and VECTOR is used otherwise.
823 For large vector-like objects, BUFFER or VECTOR is used as a pointer
824 to the next vector-like object. It is generally a buffer or a
924 Lisp_Vector alias, so for convenience it is a union instead of a 825 Lisp_Vector alias, so for convenience it is a union instead of a
925 pointer: this way, one can write P->next.vector instead of ((struct 826 pointer: this way, one can write P->next.vector instead of ((struct
926 Lisp_Vector *) P->next). */ 827 Lisp_Vector *) P->next). */
927 union { 828 union {
829 ptrdiff_t nbytes;
928 struct buffer *buffer; 830 struct buffer *buffer;
929 struct Lisp_Vector *vector; 831 struct Lisp_Vector *vector;
930 } next; 832 } next;
@@ -2880,6 +2782,7 @@ extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int);
2880extern Lisp_Object make_pure_c_string (const char *data); 2782extern Lisp_Object make_pure_c_string (const char *data);
2881extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); 2783extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
2882EXFUN (Fgarbage_collect, 0); 2784EXFUN (Fgarbage_collect, 0);
2785extern void make_byte_code (struct Lisp_Vector *);
2883EXFUN (Fmake_byte_code, MANY); 2786EXFUN (Fmake_byte_code, MANY);
2884EXFUN (Fmake_bool_vector, 2); 2787EXFUN (Fmake_bool_vector, 2);
2885extern Lisp_Object Qchar_table_extra_slots; 2788extern Lisp_Object Qchar_table_extra_slots;
diff --git a/src/lread.c b/src/lread.c
index 38b00a66962..8a9088b8ed2 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2551,8 +2551,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2551 build them using function calls. */ 2551 build them using function calls. */
2552 Lisp_Object tmp; 2552 Lisp_Object tmp;
2553 tmp = read_vector (readcharfun, 1); 2553 tmp = read_vector (readcharfun, 1);
2554 return Fmake_byte_code (ASIZE (tmp), 2554 make_byte_code (XVECTOR (tmp));
2555 XVECTOR (tmp)->contents); 2555 return tmp;
2556 } 2556 }
2557 if (c == '(') 2557 if (c == '(')
2558 { 2558 {
@@ -4375,7 +4375,8 @@ to find all the symbols in an obarray, use `mapatoms'. */);
4375 4375
4376 DEFVAR_LISP ("values", Vvalues, 4376 DEFVAR_LISP ("values", Vvalues,
4377 doc: /* List of values of all expressions which were read, evaluated and printed. 4377 doc: /* List of values of all expressions which were read, evaluated and printed.
4378Order is reverse chronological. */); 4378 Order is reverse chronological. */);
4379 XSYMBOL (intern ("values"))->declared_special = 0;
4379 4380
4380 DEFVAR_LISP ("standard-input", Vstandard_input, 4381 DEFVAR_LISP ("standard-input", Vstandard_input,
4381 doc: /* Stream for read to get input from. 4382 doc: /* Stream for read to get input from.
@@ -4393,7 +4394,7 @@ defined, although they may be in the future.
4393 4394
4394The positions are relative to the last call to `read' or 4395The positions are relative to the last call to `read' or
4395`read-from-string'. It is probably a bad idea to set this variable at 4396`read-from-string'. It is probably a bad idea to set this variable at
4396the toplevel; bind it instead. */); 4397the toplevel; bind it instead. */);
4397 Vread_with_symbol_positions = Qnil; 4398 Vread_with_symbol_positions = Qnil;
4398 4399
4399 DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list, 4400 DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list,
@@ -4408,7 +4409,7 @@ symbol from the position where `read' or `read-from-string' started.
4408 4409
4409Note that a symbol will appear multiple times in this list, if it was 4410Note that a symbol will appear multiple times in this list, if it was
4410read multiple times. The list is in the same order as the symbols 4411read multiple times. The list is in the same order as the symbols
4411were read in. */); 4412were read in. */);
4412 Vread_symbol_positions_list = Qnil; 4413 Vread_symbol_positions_list = Qnil;
4413 4414
4414 DEFVAR_LISP ("read-circle", Vread_circle, 4415 DEFVAR_LISP ("read-circle", Vread_circle,
diff --git a/src/macros.c b/src/macros.c
index 3f4f8624479..0db7e63d622 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -259,7 +259,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
259 from before this macro started. */ 259 from before this macro started. */
260 Vthis_command = KVAR (current_kboard, Vlast_command); 260 Vthis_command = KVAR (current_kboard, Vlast_command);
261 /* C-x z after the macro should repeat the macro. */ 261 /* C-x z after the macro should repeat the macro. */
262 real_this_command = KVAR (current_kboard, Vlast_kbd_macro); 262 Vreal_this_command = KVAR (current_kboard, Vlast_kbd_macro);
263 263
264 if (! NILP (KVAR (current_kboard, defining_kbd_macro))) 264 if (! NILP (KVAR (current_kboard, defining_kbd_macro)))
265 error ("Can't execute anonymous macro while defining one"); 265 error ("Can't execute anonymous macro while defining one");
@@ -286,7 +286,7 @@ pop_kbd_macro (Lisp_Object info)
286 Vexecuting_kbd_macro = XCAR (info); 286 Vexecuting_kbd_macro = XCAR (info);
287 tem = XCDR (info); 287 tem = XCDR (info);
288 executing_kbd_macro_index = XINT (XCAR (tem)); 288 executing_kbd_macro_index = XINT (XCAR (tem));
289 real_this_command = XCDR (tem); 289 Vreal_this_command = XCDR (tem);
290 Frun_hooks (1, &Qkbd_macro_termination_hook); 290 Frun_hooks (1, &Qkbd_macro_termination_hook);
291 return Qnil; 291 return Qnil;
292} 292}
@@ -321,7 +321,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
321 321
322 tem = Fcons (Vexecuting_kbd_macro, 322 tem = Fcons (Vexecuting_kbd_macro,
323 Fcons (make_number (executing_kbd_macro_index), 323 Fcons (make_number (executing_kbd_macro_index),
324 real_this_command)); 324 Vreal_this_command));
325 record_unwind_protect (pop_kbd_macro, tem); 325 record_unwind_protect (pop_kbd_macro, tem);
326 326
327 GCPRO2 (final, loopfunc); 327 GCPRO2 (final, loopfunc);
@@ -352,7 +352,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
352 352
353 executing_kbd_macro = Qnil; 353 executing_kbd_macro = Qnil;
354 354
355 real_this_command = Vexecuting_kbd_macro; 355 Vreal_this_command = Vexecuting_kbd_macro;
356 356
357 UNGCPRO; 357 UNGCPRO;
358 return unbind_to (pdlcount, Qnil); 358 return unbind_to (pdlcount, Qnil);
diff --git a/src/mem-limits.h b/src/mem-limits.h
index 1fd53b472f3..01b0e6ebb2b 100644
--- a/src/mem-limits.h
+++ b/src/mem-limits.h
@@ -34,7 +34,7 @@ extern int etext;
34#endif 34#endif
35 35
36extern char *start_of_data (void); 36extern char *start_of_data (void);
37#if defined USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX 37#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
38#define EXCEEDS_LISP_PTR(ptr) 0 38#define EXCEEDS_LISP_PTR(ptr) 0
39#elif defined DATA_SEG_BITS 39#elif defined DATA_SEG_BITS
40#define EXCEEDS_LISP_PTR(ptr) \ 40#define EXCEEDS_LISP_PTR(ptr) \
diff --git a/src/minibuf.c b/src/minibuf.c
index e9bc36303f9..d921e80be48 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1726,8 +1726,6 @@ See also `completing-read-function'. */)
1726 return Ffuncall (9, args); 1726 return Ffuncall (9, args);
1727} 1727}
1728 1728
1729Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold);
1730
1731/* Test whether TXT is an exact completion. */ 1729/* Test whether TXT is an exact completion. */
1732DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0, 1730DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0,
1733 doc: /* Return non-nil if STRING is a valid completion. 1731 doc: /* Return non-nil if STRING is a valid completion.
diff --git a/src/regex.c b/src/regex.c
index f9a12a3c2dc..0dd3a187898 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -3824,18 +3824,37 @@ static boolean
3824at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) 3824at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax)
3825{ 3825{
3826 re_char *prev = p - 2; 3826 re_char *prev = p - 2;
3827 boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; 3827 boolean odd_backslashes;
3828 3828
3829 return 3829 /* After a subexpression? */
3830 /* After a subexpression? */ 3830 if (*prev == '(')
3831 (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) 3831 odd_backslashes = (syntax & RE_NO_BK_PARENS) == 0;
3832 /* After an alternative? */ 3832
3833 || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)) 3833 /* After an alternative? */
3834 /* After a shy subexpression? */ 3834 else if (*prev == '|')
3835 || ((syntax & RE_SHY_GROUPS) && prev - 2 >= pattern 3835 odd_backslashes = (syntax & RE_NO_BK_VBAR) == 0;
3836 && prev[-1] == '?' && prev[-2] == '(' 3836
3837 && (syntax & RE_NO_BK_PARENS 3837 /* After a shy subexpression? */
3838 || (prev - 3 >= pattern && prev[-3] == '\\'))); 3838 else if (*prev == ':' && (syntax & RE_SHY_GROUPS))
3839 {
3840 /* Skip over optional regnum. */
3841 while (prev - 1 >= pattern && prev[-1] >= '0' && prev[-1] <= '9')
3842 --prev;
3843
3844 if (!(prev - 2 >= pattern
3845 && prev[-1] == '?' && prev[-2] == '('))
3846 return false;
3847 prev -= 2;
3848 odd_backslashes = (syntax & RE_NO_BK_PARENS) == 0;
3849 }
3850 else
3851 return false;
3852
3853 /* Count the number of preceding backslashes. */
3854 p = prev;
3855 while (prev - 1 >= pattern && prev[-1] == '\\')
3856 --prev;
3857 return (p - prev) & odd_backslashes;
3839} 3858}
3840 3859
3841 3860
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index cacfdc7ed63..51ac9748f27 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -26,10 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#define _AIX 26#define _AIX
27#endif 27#endif
28 28
29/* SYSTEM_TYPE should indicate the kind of system you are using.
30 It sets the Lisp variable system-type. */
31#define SYSTEM_TYPE "aix"
32
33/* In AIX, you allocate a pty by opening /dev/ptc to get the master side. 29/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
34 To get the name of the slave side, you just ttyname() the master side. */ 30 To get the name of the slave side, you just ttyname() the master side. */
35#define PTY_ITERATION int c; for (c = 0; !c ; c++) 31#define PTY_ITERATION int c; for (c = 0; !c ; c++)
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index c2dbdb9a109..ce67dd7b9af 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -37,8 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#define TABDLY OXTABS 37#define TABDLY OXTABS
38#define TAB3 OXTABS 38#define TAB3 OXTABS
39 39
40#define NO_TERMIO
41
42/* If the system's imake configuration file defines `NeedWidePrototypes' 40/* If the system's imake configuration file defines `NeedWidePrototypes'
43 as `NO', we must define NARROWPROTO manually. Such a define is 41 as `NO', we must define NARROWPROTO manually. Such a define is
44 generated in the Makefile generated by `xmkmf'. If we don't 42 generated in the Makefile generated by `xmkmf'. If we don't
@@ -46,10 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46 for X functions taking float or double parameters. */ 44 for X functions taking float or double parameters. */
47#define NARROWPROTO 1 45#define NARROWPROTO 1
48 46
49/* SYSTEM_TYPE should indicate the kind of system you are using.
50 It sets the Lisp variable system-type. */
51#define SYSTEM_TYPE "berkeley-unix"
52
53/* Do not use interrupt_input = 1 by default, because in 4.3 47/* Do not use interrupt_input = 1 by default, because in 4.3
54 we can make noninterrupt input work properly. */ 48 we can make noninterrupt input work properly. */
55#undef INTERRUPT_INPUT 49#undef INTERRUPT_INPUT
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index 9310890351e..9b437341324 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -17,10 +17,6 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* SYSTEM_TYPE should indicate the kind of system you are using.
21 It sets the Lisp variable system-type. */
22#define SYSTEM_TYPE "cygwin"
23
24/* Emacs can read input using SIGIO and buffering characters itself, 20/* Emacs can read input using SIGIO and buffering characters itself,
25 or using CBREAK mode and making C-g cause SIGINT. 21 or using CBREAK mode and making C-g cause SIGINT.
26 The choice is controlled by the variable interrupt_input. 22 The choice is controlled by the variable interrupt_input.
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 7c8e26f46cc..ce86bc5f578 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -31,10 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#define DARWIN_OS 31#define DARWIN_OS
32 32
33 33
34/* SYSTEM_TYPE should indicate the kind of system you are using.
35 It sets the Lisp variable system-type. */
36#define SYSTEM_TYPE "darwin"
37
38/* Emacs can read input using SIGIO and buffering characters itself, 34/* Emacs can read input using SIGIO and buffering characters itself,
39 or using CBREAK mode and making C-g cause SIGINT. 35 or using CBREAK mode and making C-g cause SIGINT.
40 The choice is controlled by the variable interrupt_input. 36 The choice is controlled by the variable interrupt_input.
@@ -62,8 +58,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
62 if system supports pty's. 'a' means it is /dev/ptya0 */ 58 if system supports pty's. 'a' means it is /dev/ptya0 */
63#define FIRST_PTY_LETTER 'p' 59#define FIRST_PTY_LETTER 'p'
64 60
65#define NO_TERMIO
66
67/* Define HAVE_PTYS if the system supports pty devices. 61/* Define HAVE_PTYS if the system supports pty devices.
68 Note: PTYs are broken on darwin <6. Use at your own risk. */ 62 Note: PTYs are broken on darwin <6. Use at your own risk. */
69#define HAVE_PTYS 63#define HAVE_PTYS
diff --git a/src/s/gnu-kfreebsd.h b/src/s/gnu-kfreebsd.h
deleted file mode 100644
index a85571915df..00000000000
--- a/src/s/gnu-kfreebsd.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#include "gnu-linux.h"
2
3/* SYSTEM_TYPE should indicate the kind of system you are using.
4 It sets the Lisp variable system-type. */
5#undef SYSTEM_TYPE
6#define SYSTEM_TYPE "gnu/kfreebsd" /* All the best software is free */
7
8#define NO_TERMIO /* use only <termios.h> */
9
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 409d0205520..e3d43249d81 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -25,10 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25#define USG 25#define USG
26#define GNU_LINUX 26#define GNU_LINUX
27 27
28/* SYSTEM_TYPE should indicate the kind of system you are using.
29 It sets the Lisp variable system-type. */
30#define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
31
32#ifdef emacs 28#ifdef emacs
33#ifdef HAVE_LINUX_VERSION_H 29#ifdef HAVE_LINUX_VERSION_H
34#include <linux/version.h> 30#include <linux/version.h>
@@ -85,9 +81,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
85 81
86#define HAVE_SOCKETS 82#define HAVE_SOCKETS
87 83
88/* This is used in list_system_processes. */
89#define HAVE_PROCFS 1
90
91/* Define CLASH_DETECTION if you want lock files to be written 84/* Define CLASH_DETECTION if you want lock files to be written
92 so that Emacs can tell instantly when you try to modify 85 so that Emacs can tell instantly when you try to modify
93 a file that someone else has modified in his Emacs. */ 86 a file that someone else has modified in his Emacs. */
diff --git a/src/s/gnu.h b/src/s/gnu.h
index cd72164a520..c2bcf7fd9ab 100644
--- a/src/s/gnu.h
+++ b/src/s/gnu.h
@@ -21,9 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21/* Get most of the stuff from bsd-common */ 21/* Get most of the stuff from bsd-common */
22#include "bsd-common.h" 22#include "bsd-common.h"
23 23
24#undef SYSTEM_TYPE
25#define SYSTEM_TYPE "gnu"
26
27#define SIGNALS_VIA_CHARACTERS 24#define SIGNALS_VIA_CHARACTERS
28 25
29/* libc defines data_start. */ 26/* libc defines data_start. */
@@ -41,5 +38,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base) 38 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
42#endif /* !_IO_STDIO_H */ 39#endif /* !_IO_STDIO_H */
43#endif /* emacs */ 40#endif /* emacs */
44
45#define POSIX_SIGNALS 1
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index f1ae50c533a..683837891f4 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -26,16 +26,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#define USG5 26#define USG5
27#define HPUX 27#define HPUX
28 28
29/* SYSTEM_TYPE should indicate the kind of system you are using.
30 It sets the Lisp variable system-type. */
31#define SYSTEM_TYPE "hpux"
32
33/* Letter to use in finding device name of first pty, 29/* Letter to use in finding device name of first pty,
34 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ 30 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */
35#define FIRST_PTY_LETTER 'p' 31#define FIRST_PTY_LETTER 'p'
36 32
37#define NO_TERMIO
38
39/* Define HAVE_PTYS if the system supports pty devices. */ 33/* Define HAVE_PTYS if the system supports pty devices. */
40#define HAVE_PTYS 34#define HAVE_PTYS
41 35
@@ -49,10 +43,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49 43
50/* Special hacks needed to make Emacs run on this system. */ 44/* Special hacks needed to make Emacs run on this system. */
51 45
52/* In hpux, the symbol SIGIO is defined, but the feature
53 doesn't work in the way Emacs needs it to. */
54#define BROKEN_SIGIO
55
56/* Some additional system facilities exist. */ 46/* Some additional system facilities exist. */
57#define HAVE_PERROR /* Delete this line for version 6. */ 47#define HAVE_PERROR /* Delete this line for version 6. */
58 48
diff --git a/src/s/hpux11.h b/src/s/hpux11.h
deleted file mode 100644
index 40bcc987973..00000000000
--- a/src/s/hpux11.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#include "hpux10-20.h"
2
3/* SA_RESTART resets the timeout of `select', so don't use it. */
4#define BROKEN_SA_RESTART
5
6/* It does work on HPUX to open the pty's tty in the parent (Emacs),
7 then close and reopen it in the child. */
8#define USG_SUBTTY_WORKS
9
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index e5479c3b8d3..7e5a5505ee2 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -26,11 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26 26
27#define SETPGRP_RELEASES_CTTY 27#define SETPGRP_RELEASES_CTTY
28 28
29#ifdef SYSTEM_TYPE
30#undef SYSTEM_TYPE
31#endif
32#define SYSTEM_TYPE "irix"
33
34#ifdef SETUP_SLAVE_PTY 29#ifdef SETUP_SLAVE_PTY
35#undef SETUP_SLAVE_PTY 30#undef SETUP_SLAVE_PTY
36#endif 31#endif
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index f88128b27aa..5bf71d5f321 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -36,10 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36 convention must be whatever standard the libraries expect. */ 36 convention must be whatever standard the libraries expect. */
37#define _CALLBACK_ __cdecl 37#define _CALLBACK_ __cdecl
38 38
39/* SYSTEM_TYPE should indicate the kind of system you are using.
40 It sets the Lisp variable system-type. */
41#define SYSTEM_TYPE "windows-nt"
42
43#define NO_MATHERR 1 39#define NO_MATHERR 1
44 40
45/* Letter to use in finding device name of first pty, 41/* Letter to use in finding device name of first pty,
diff --git a/src/s/msdos.h b/src/s/msdos.h
index add2902d5f3..fc1a8c7506a 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -33,10 +33,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
33#define DOS_NT /* MSDOS or WINDOWSNT */ 33#define DOS_NT /* MSDOS or WINDOWSNT */
34#undef BSD_SYSTEM 34#undef BSD_SYSTEM
35 35
36/* SYSTEM_TYPE should indicate the kind of system you are using.
37 It sets the Lisp variable system-type. */
38#define SYSTEM_TYPE "ms-dos"
39
40/* subprocesses should be defined if you want to have code for 36/* subprocesses should be defined if you want to have code for
41 asynchronous subprocesses (as used in M-x compile and M-x shell). 37 asynchronous subprocesses (as used in M-x compile and M-x shell).
42 This is the only system that needs this. */ 38 This is the only system that needs this. */
diff --git a/src/s/openbsd.h b/src/s/openbsd.h
deleted file mode 100644
index 0a8bab2290f..00000000000
--- a/src/s/openbsd.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/* System file for openbsd. */
2
3/* Nearly the same as NetBSD. Note there are differences in configure. */
4#include "netbsd.h"
5
6/* The symbol SIGIO is defined, but the feature doesn't work in the
7 way Emacs needs it to. See
8 <http://article.gmane.org/gmane.os.openbsd.ports/46831>. */
9#define BROKEN_SIGIO
diff --git a/src/s/sol2-10.h b/src/s/sol2-10.h
deleted file mode 100644
index b20476e7fba..00000000000
--- a/src/s/sol2-10.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/* Handle Solaris 2.10. */
2
3#include "sol2-6.h"
4
5/* This is used in list_system_processes. */
6#define HAVE_PROCFS 1
7
8/* This is needed for the system_process_attributes implementation. */
9#define _STRUCTURED_PROC 1
10
diff --git a/src/s/template.h b/src/s/template.h
index 527694bd4bb..d8f811dc8aa 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -30,11 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30/* #define BSD4_3 */ 30/* #define BSD4_3 */
31/* #define BSD_SYSTEM */ 31/* #define BSD_SYSTEM */
32 32
33/* SYSTEM_TYPE should indicate the kind of system you are using.
34 It sets the Lisp variable system-type. */
35
36#define SYSTEM_TYPE "berkeley-unix"
37
38/* Emacs can read input using SIGIO and buffering characters itself, 33/* Emacs can read input using SIGIO and buffering characters itself,
39 or using CBREAK mode and making C-g cause SIGINT. 34 or using CBREAK mode and making C-g cause SIGINT.
40 The choice is controlled by the variable interrupt_input. 35 The choice is controlled by the variable interrupt_input.
diff --git a/src/s/unixware.h b/src/s/unixware.h
index 63c36ee40c2..18d24b28507 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -23,8 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23/* #define HAVE_GETWD (appears to be buggy on SVR4.2) */ 23/* #define HAVE_GETWD (appears to be buggy on SVR4.2) */
24#undef HAVE_GETWD 24#undef HAVE_GETWD
25 25
26#undef HAVE_SYSV_SIGPAUSE
27
28/* This is the same definition as in usg5-4-common.h, but with sigblock/sigunblock 26/* This is the same definition as in usg5-4-common.h, but with sigblock/sigunblock
29 rather than sighold/sigrelse, which appear to be BSD4.1 specific. 27 rather than sighold/sigrelse, which appear to be BSD4.1 specific.
30 It may also be appropriate for SVR4.x 28 It may also be appropriate for SVR4.x
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index fabdd66f3bb..1502228c0d8 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -26,21 +26,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#define USG5 26#define USG5
27#define USG5_4 27#define USG5_4
28 28
29/* SYSTEM_TYPE should indicate the kind of system you are using.
30 It sets the Lisp variable system-type. */
31#define SYSTEM_TYPE "usg-unix-v"
32
33/* setjmp and longjmp can safely replace _setjmp and _longjmp, 29/* setjmp and longjmp can safely replace _setjmp and _longjmp,
34 but they will run slower. */ 30 but they will run slower. */
35#define _setjmp setjmp 31#define _setjmp setjmp
36#define _longjmp longjmp 32#define _longjmp longjmp
37 33
38/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */
39#define HAVE_SYSV_SIGPAUSE
40
41/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars. 34/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars.
42 But get <termio.h> first to make sure ttold.h doesn't interfere. 35 But get <termio.h> first to make sure ttold.h doesn't interfere. */
43 And don't try to use SIGIO yet. */
44#include <sys/wait.h> 36#include <sys/wait.h>
45 37
46#ifdef emacs 38#ifdef emacs
@@ -51,7 +43,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#include <sys/stream.h> 43#include <sys/stream.h>
52#include <sys/stropts.h> 44#include <sys/stropts.h>
53#include <sys/termios.h> 45#include <sys/termios.h>
54#define BROKEN_SIGIO
55#endif 46#endif
56 47
57/* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments; 48/* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
diff --git a/src/sysdep.c b/src/sysdep.c
index a82f802a785..3356582de0c 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3106,9 +3106,10 @@ system_process_attributes (Lisp_Object pid)
3106 attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)), attrs); 3106 attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)), attrs);
3107 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)), attrs); 3107 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)), attrs);
3108 3108
3109 /* pr_pctcpu and pr_pctmem are encoded as a fixed point 16 bit number in [0 ... 1]. */ 3109 /* pr_pctcpu and pr_pctmem are unsigned integers in the
3110 attrs = Fcons (Fcons (Qpcpu, (pinfo.pr_pctcpu * 100.0) / (double)0x8000), attrs); 3110 range 0 .. 2**15, representing 0.0 .. 1.0. */
3111 attrs = Fcons (Fcons (Qpmem, (pinfo.pr_pctmem * 100.0) / (double)0x8000), attrs); 3111 attrs = Fcons (Fcons (Qpcpu, make_float (100.0 / 0x8000 * pinfo.pr_pctcpu)), attrs);
3112 attrs = Fcons (Fcons (Qpmem, make_float (100.0 / 0x8000 * pinfo.pr_pctmem)), attrs);
3112 3113
3113 decoded_cmd 3114 decoded_cmd
3114 = code_convert_string_norecord (make_unibyte_string (pinfo.pr_fname, 3115 = code_convert_string_norecord (make_unibyte_string (pinfo.pr_fname,
diff --git a/src/term.c b/src/term.c
index 3d7a677374c..8ce2efc0929 100644
--- a/src/term.c
+++ b/src/term.c
@@ -122,12 +122,11 @@ enum no_color_bit
122 NC_STANDOUT = 1 << 0, 122 NC_STANDOUT = 1 << 0,
123 NC_UNDERLINE = 1 << 1, 123 NC_UNDERLINE = 1 << 1,
124 NC_REVERSE = 1 << 2, 124 NC_REVERSE = 1 << 2,
125 NC_BLINK = 1 << 3, 125 NC_ITALIC = 1 << 3,
126 NC_DIM = 1 << 4, 126 NC_DIM = 1 << 4,
127 NC_BOLD = 1 << 5, 127 NC_BOLD = 1 << 5,
128 NC_INVIS = 1 << 6, 128 NC_INVIS = 1 << 6,
129 NC_PROTECT = 1 << 7, 129 NC_PROTECT = 1 << 7
130 NC_ALT_CHARSET = 1 << 8
131}; 130};
132 131
133/* internal state */ 132/* internal state */
@@ -2022,17 +2021,16 @@ turn_on_face (struct frame *f, int face_id)
2022 if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) 2021 if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
2023 OUTPUT1_IF (tty, tty->TS_enter_bold_mode); 2022 OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
2024 2023
2025 if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM)) 2024 if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC))
2026 OUTPUT1_IF (tty, tty->TS_enter_dim_mode); 2025 {
2027 2026 if (tty->TS_enter_italic_mode)
2028 /* Alternate charset and blinking not yet used. */ 2027 OUTPUT1 (tty, tty->TS_enter_italic_mode);
2029 if (face->tty_alt_charset_p 2028 else
2030 && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET)) 2029 /* Italics mode is unavailable on many terminals. In that
2031 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode); 2030 case, map slant to dimmed text; we want italic text to
2032 2031 appear different and dimming is not otherwise used. */
2033 if (face->tty_blinking_p 2032 OUTPUT1 (tty, tty->TS_enter_dim_mode);
2034 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK)) 2033 }
2035 OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
2036 2034
2037 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE)) 2035 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
2038 OUTPUT1_IF (tty, tty->TS_enter_underline_mode); 2036 OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
@@ -2077,27 +2075,19 @@ turn_off_face (struct frame *f, int face_id)
2077 half-bright, reverse-video, standout, underline. It may or 2075 half-bright, reverse-video, standout, underline. It may or
2078 may not turn off alt-char-mode. */ 2076 may not turn off alt-char-mode. */
2079 if (face->tty_bold_p 2077 if (face->tty_bold_p
2080 || face->tty_dim_p 2078 || face->tty_italic_p
2081 || face->tty_reverse_p 2079 || face->tty_reverse_p
2082 || face->tty_alt_charset_p
2083 || face->tty_blinking_p
2084 || face->tty_underline_p) 2080 || face->tty_underline_p)
2085 { 2081 {
2086 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); 2082 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
2087 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0) 2083 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
2088 tty->standout_mode = 0; 2084 tty->standout_mode = 0;
2089 } 2085 }
2090
2091 if (face->tty_alt_charset_p)
2092 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
2093 } 2086 }
2094 else 2087 else
2095 { 2088 {
2096 /* If we don't have "me" we can only have those appearances 2089 /* If we don't have "me" we can only have those appearances
2097 that have exit sequences defined. */ 2090 that have exit sequences defined. */
2098 if (face->tty_alt_charset_p)
2099 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
2100
2101 if (face->tty_underline_p) 2091 if (face->tty_underline_p)
2102 OUTPUT_IF (tty, tty->TS_exit_underline_mode); 2092 OUTPUT_IF (tty, tty->TS_exit_underline_mode);
2103 } 2093 }
@@ -2128,8 +2118,7 @@ tty_capable_p (struct tty_display_info *tty, unsigned int caps,
2128 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE); 2118 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
2129 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); 2119 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
2130 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM); 2120 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
2131 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK); 2121 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, tty->TS_enter_italic_mode, NC_ITALIC);
2132 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
2133 2122
2134 /* We can do it! */ 2123 /* We can do it! */
2135 return 1; 2124 return 1;
@@ -3222,8 +3211,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3222 tty->TS_enter_underline_mode = tgetstr ("us", address); 3211 tty->TS_enter_underline_mode = tgetstr ("us", address);
3223 tty->TS_exit_underline_mode = tgetstr ("ue", address); 3212 tty->TS_exit_underline_mode = tgetstr ("ue", address);
3224 tty->TS_enter_bold_mode = tgetstr ("md", address); 3213 tty->TS_enter_bold_mode = tgetstr ("md", address);
3214 tty->TS_enter_italic_mode = tgetstr ("ZH", address);
3225 tty->TS_enter_dim_mode = tgetstr ("mh", address); 3215 tty->TS_enter_dim_mode = tgetstr ("mh", address);
3226 tty->TS_enter_blink_mode = tgetstr ("mb", address);
3227 tty->TS_enter_reverse_mode = tgetstr ("mr", address); 3216 tty->TS_enter_reverse_mode = tgetstr ("mr", address);
3228 tty->TS_enter_alt_charset_mode = tgetstr ("as", address); 3217 tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
3229 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); 3218 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
diff --git a/src/termchar.h b/src/termchar.h
index d50ee805e03..102fe45350e 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -124,8 +124,8 @@ struct tty_display_info
124 each as vpos and hpos) */ 124 each as vpos and hpos) */
125 125
126 const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ 126 const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
127 const char *TS_enter_italic_mode; /* "ZH" -- turn on italics mode. */
127 const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ 128 const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
128 const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
129 const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ 129 const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
130 const char *TS_exit_underline_mode; /* "us" -- start underlining. */ 130 const char *TS_exit_underline_mode; /* "us" -- start underlining. */
131 const char *TS_enter_underline_mode; /* "ue" -- end underlining. */ 131 const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
diff --git a/src/w32fns.c b/src/w32fns.c
index b8dc62f5250..a8becea1b74 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -6326,13 +6326,8 @@ The return value is the hotkey-id if registered, otherwise nil. */)
6326 6326
6327 /* Notify input thread about new hot-key definition, so that it 6327 /* Notify input thread about new hot-key definition, so that it
6328 takes effect without needing to switch focus. */ 6328 takes effect without needing to switch focus. */
6329#ifdef USE_LISP_UNION_TYPE
6330 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, 6329 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
6331 (WPARAM) key.i, 0); 6330 (WPARAM) XLI (key), 0);
6332#else
6333 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
6334 (WPARAM) key, 0);
6335#endif
6336 } 6331 }
6337 6332
6338 return key; 6333 return key;
@@ -6354,13 +6349,8 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
6354 { 6349 {
6355 /* Notify input thread about hot-key definition being removed, so 6350 /* Notify input thread about hot-key definition being removed, so
6356 that it takes effect without needing focus switch. */ 6351 that it takes effect without needing focus switch. */
6357#ifdef USE_LISP_UNION_TYPE
6358 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
6359 (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
6360#else
6361 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, 6352 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
6362 (WPARAM) XINT (XCAR (item)), (LPARAM) item)) 6353 (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item)))
6363#endif
6364 { 6354 {
6365 MSG msg; 6355 MSG msg;
6366 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 6356 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -6432,13 +6422,8 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
6432 if (!dwWindowsThreadId) 6422 if (!dwWindowsThreadId)
6433 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); 6423 return make_number (w32_console_toggle_lock_key (vk_code, new_state));
6434 6424
6435#ifdef USE_LISP_UNION_TYPE
6436 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
6437 (WPARAM) vk_code, (LPARAM) new_state.i))
6438#else
6439 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, 6425 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
6440 (WPARAM) vk_code, (LPARAM) new_state)) 6426 (WPARAM) vk_code, (LPARAM) XLI (new_state)))
6441#endif
6442 { 6427 {
6443 MSG msg; 6428 MSG msg;
6444 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 6429 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
diff --git a/src/w32heap.c b/src/w32heap.c
index da8579896f2..cc5e5cd2bf5 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -114,7 +114,7 @@ get_data_end (void)
114 return data_region_end; 114 return data_region_end;
115} 115}
116 116
117#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) 117#if !USE_LSB_TAG
118static char * 118static char *
119allocate_heap (void) 119allocate_heap (void)
120{ 120{
@@ -141,7 +141,7 @@ allocate_heap (void)
141 141
142 return ptr; 142 return ptr;
143} 143}
144#else /* USE_LISP_UNION_TYPE || USE_LSB_TAG */ 144#else /* USE_LSB_TAG */
145static char * 145static char *
146allocate_heap (void) 146allocate_heap (void)
147{ 147{
@@ -160,7 +160,7 @@ allocate_heap (void)
160 160
161 return ptr; 161 return ptr;
162} 162}
163#endif /* USE_LISP_UNION_TYPE || USE_LSB_TAG */ 163#endif /* USE_LSB_TAG */
164 164
165 165
166/* Emulate Unix sbrk. Note that ralloc.c expects the return value to 166/* Emulate Unix sbrk. Note that ralloc.c expects the return value to
@@ -259,7 +259,7 @@ init_heap (void)
259 exit (1); 259 exit (1);
260 } 260 }
261 261
262#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) 262#if !USE_LSB_TAG
263 /* Ensure that the addresses don't use the upper tag bits since 263 /* Ensure that the addresses don't use the upper tag bits since
264 the Lisp type goes there. */ 264 the Lisp type goes there. */
265 if (((unsigned long) data_region_base & ~VALMASK) != 0) 265 if (((unsigned long) data_region_base & ~VALMASK) != 0)
diff --git a/src/w32menu.c b/src/w32menu.c
index 2bc4c208956..f5f5c6656c4 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1533,11 +1533,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1533 until it is ready to be displayed, since GC can happen while 1533 until it is ready to be displayed, since GC can happen while
1534 menus are active. */ 1534 menus are active. */
1535 if (!NILP (wv->help)) 1535 if (!NILP (wv->help))
1536#ifdef USE_LISP_UNION_TYPE 1536 info.dwItemData = (DWORD) XLI (wv->help);
1537 info.dwItemData = (DWORD) (wv->help).i;
1538#else
1539 info.dwItemData = (DWORD) (wv->help);
1540#endif
1541 if (wv->button_type == BUTTON_TYPE_RADIO) 1537 if (wv->button_type == BUTTON_TYPE_RADIO)
1542 { 1538 {
1543 /* CheckMenuRadioItem allows us to differentiate TOGGLE and 1539 /* CheckMenuRadioItem allows us to differentiate TOGGLE and
@@ -1612,12 +1608,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1612 info.fMask = MIIM_DATA; 1608 info.fMask = MIIM_DATA;
1613 get_menu_item_info (menu, item, FALSE, &info); 1609 get_menu_item_info (menu, item, FALSE, &info);
1614 1610
1615#ifdef USE_LISP_UNION_TYPE 1611 help = info.dwItemData ? XIL (info.dwItemData) : Qnil;
1616 help = info.dwItemData ? (Lisp_Object) ((EMACS_INT) info.dwItemData)
1617 : Qnil;
1618#else
1619 help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
1620#endif
1621 } 1612 }
1622 1613
1623 /* Store the help echo in the keyboard buffer as the X toolkit 1614 /* Store the help echo in the keyboard buffer as the X toolkit
diff --git a/src/w32term.c b/src/w32term.c
index a90e067a3fd..38120b77ac9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4342,7 +4342,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4342 4342
4343 /* If the contents of the global variable help_echo_string 4343 /* If the contents of the global variable help_echo_string
4344 has changed, generate a HELP_EVENT. */ 4344 has changed, generate a HELP_EVENT. */
4345#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE. 4345#if 0 /* The below is an invalid comparison when CHECK_LISP_OBJECT_TYPE.
4346 But it was originally changed to this to fix a bug, so I have 4346 But it was originally changed to this to fix a bug, so I have
4347 not removed it completely in case the bug is still there. */ 4347 not removed it completely in case the bug is still there. */
4348 if (help_echo_string != previous_help_echo_string || 4348 if (help_echo_string != previous_help_echo_string ||
diff --git a/src/window.c b/src/window.c
index a10222b1aff..2a498c43d80 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1395,10 +1395,10 @@ overriding motion of point in order to display at this exact start. */)
1395 CHECK_NUMBER_COERCE_MARKER (pos); 1395 CHECK_NUMBER_COERCE_MARKER (pos);
1396 set_marker_restricted (w->start, pos, w->buffer); 1396 set_marker_restricted (w->start, pos, w->buffer);
1397 /* this is not right, but much easier than doing what is right. */ 1397 /* this is not right, but much easier than doing what is right. */
1398 w->start_at_line_beg = Qnil; 1398 w->start_at_line_beg = 0;
1399 if (NILP (noforce)) 1399 if (NILP (noforce))
1400 w->force_start = Qt; 1400 w->force_start = 1;
1401 w->update_mode_line = Qt; 1401 w->update_mode_line = 1;
1402 XSETFASTINT (w->last_modified, 0); 1402 XSETFASTINT (w->last_modified, 0);
1403 XSETFASTINT (w->last_overlay_modified, 0); 1403 XSETFASTINT (w->last_overlay_modified, 0);
1404 if (!EQ (window, selected_window)) 1404 if (!EQ (window, selected_window))
@@ -2474,7 +2474,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2474 if (EQ (w->buffer, obj)) 2474 if (EQ (w->buffer, obj))
2475 { 2475 {
2476 mark_window_display_accurate (window, 0); 2476 mark_window_display_accurate (window, 0);
2477 w->update_mode_line = Qt; 2477 w->update_mode_line = 1;
2478 XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; 2478 XBUFFER (obj)->prevent_redisplay_optimizations_p = 1;
2479 ++update_mode_lines; 2479 ++update_mode_lines;
2480 best_window = window; 2480 best_window = window;
@@ -2773,12 +2773,11 @@ window-start value is reasonable when this function is called. */)
2773 2773
2774 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); 2774 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
2775 w->window_end_valid = Qnil; 2775 w->window_end_valid = Qnil;
2776 w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE 2776 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
2777 || FETCH_BYTE (pos.bytepos - 1) == '\n') ? Qt 2777 || FETCH_BYTE (pos.bytepos - 1) == '\n');
2778 : Qnil);
2779 /* We need to do this, so that the window-scroll-functions 2778 /* We need to do this, so that the window-scroll-functions
2780 get called. */ 2779 get called. */
2781 w->optional_new_start = Qt; 2780 w->optional_new_start = 1;
2782 2781
2783 set_buffer_internal (obuf); 2782 set_buffer_internal (obuf);
2784 } 2783 }
@@ -3008,8 +3007,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3008 set_marker_restricted (w->start, 3007 set_marker_restricted (w->start,
3009 make_number (b->last_window_start), 3008 make_number (b->last_window_start),
3010 buffer); 3009 buffer);
3011 w->start_at_line_beg = Qnil; 3010 w->start_at_line_beg = 0;
3012 w->force_start = Qnil; 3011 w->force_start = 0;
3013 XSETFASTINT (w->last_modified, 0); 3012 XSETFASTINT (w->last_modified, 0);
3014 XSETFASTINT (w->last_overlay_modified, 0); 3013 XSETFASTINT (w->last_overlay_modified, 0);
3015 } 3014 }
@@ -3145,7 +3144,7 @@ displaying that buffer. */)
3145 { 3144 {
3146 struct window *w = XWINDOW (object); 3145 struct window *w = XWINDOW (object);
3147 mark_window_display_accurate (object, 0); 3146 mark_window_display_accurate (object, 0);
3148 w->update_mode_line = Qt; 3147 w->update_mode_line = 1;
3149 if (BUFFERP (w->buffer)) 3148 if (BUFFERP (w->buffer))
3150 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 3149 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
3151 ++update_mode_lines; 3150 ++update_mode_lines;
@@ -3277,7 +3276,8 @@ make_window (void)
3277 3276
3278 w = allocate_window (); 3277 w = allocate_window ();
3279 /* Initialize all Lisp data. */ 3278 /* Initialize all Lisp data. */
3280 w->frame = w->mini_p = Qnil; 3279 w->frame = Qnil;
3280 w->mini = 0;
3281 w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil; 3281 w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil;
3282 XSETFASTINT (w->left_col, 0); 3282 XSETFASTINT (w->left_col, 0);
3283 XSETFASTINT (w->top_line, 0); 3283 XSETFASTINT (w->top_line, 0);
@@ -3290,7 +3290,7 @@ make_window (void)
3290 w->buffer = Qnil; 3290 w->buffer = Qnil;
3291 w->start = Fmake_marker (); 3291 w->start = Fmake_marker ();
3292 w->pointm = Fmake_marker (); 3292 w->pointm = Fmake_marker ();
3293 w->force_start = w->optional_new_start = Qnil; 3293 w->force_start = w->optional_new_start = 0;
3294 XSETFASTINT (w->hscroll, 0); 3294 XSETFASTINT (w->hscroll, 0);
3295 XSETFASTINT (w->min_hscroll, 0); 3295 XSETFASTINT (w->min_hscroll, 0);
3296 XSETFASTINT (w->use_time, 0); 3296 XSETFASTINT (w->use_time, 0);
@@ -3298,17 +3298,18 @@ make_window (void)
3298 XSETFASTINT (w->sequence_number, sequence_number); 3298 XSETFASTINT (w->sequence_number, sequence_number);
3299 w->temslot = w->last_modified = w->last_overlay_modified = Qnil; 3299 w->temslot = w->last_modified = w->last_overlay_modified = Qnil;
3300 XSETFASTINT (w->last_point, 0); 3300 XSETFASTINT (w->last_point, 0);
3301 w->last_had_star = w->vertical_scroll_bar = Qnil; 3301 w->last_had_star = 0;
3302 w->vertical_scroll_bar = Qnil;
3302 w->left_margin_cols = w->right_margin_cols = Qnil; 3303 w->left_margin_cols = w->right_margin_cols = Qnil;
3303 w->left_fringe_width = w->right_fringe_width = Qnil; 3304 w->left_fringe_width = w->right_fringe_width = Qnil;
3304 w->fringes_outside_margins = Qnil; 3305 w->fringes_outside_margins = Qnil;
3305 w->scroll_bar_width = Qnil; 3306 w->scroll_bar_width = Qnil;
3306 w->vertical_scroll_bar_type = Qt; 3307 w->vertical_scroll_bar_type = Qt;
3307 w->last_mark_x = w->last_mark_y = Qnil;
3308 XSETFASTINT (w->window_end_pos, 0); 3308 XSETFASTINT (w->window_end_pos, 0);
3309 XSETFASTINT (w->window_end_vpos, 0); 3309 XSETFASTINT (w->window_end_vpos, 0);
3310 w->window_end_valid = w->update_mode_line = Qnil; 3310 w->window_end_valid = w->display_table = Qnil;
3311 w->start_at_line_beg = w->display_table = w->dedicated = Qnil; 3311 w->update_mode_line = w->start_at_line_beg = 0;
3312 w->dedicated = Qnil;
3312 w->base_line_number = w->base_line_pos = w->region_showing = Qnil; 3313 w->base_line_number = w->base_line_pos = w->region_showing = Qnil;
3313 w->column_number_displayed = w->redisplay_end_trigger = Qnil; 3314 w->column_number_displayed = w->redisplay_end_trigger = Qnil;
3314 w->combination_limit = w->window_parameters = Qnil; 3315 w->combination_limit = w->window_parameters = Qnil;
@@ -4310,13 +4311,13 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4310 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); 4311 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
4311 set_marker_restricted (w->start, make_number (spos), 4312 set_marker_restricted (w->start, make_number (spos),
4312 w->buffer); 4313 w->buffer);
4313 w->start_at_line_beg = Qt; 4314 w->start_at_line_beg = 1;
4314 w->update_mode_line = Qt; 4315 w->update_mode_line = 1;
4315 XSETFASTINT (w->last_modified, 0); 4316 XSETFASTINT (w->last_modified, 0);
4316 XSETFASTINT (w->last_overlay_modified, 0); 4317 XSETFASTINT (w->last_overlay_modified, 0);
4317 /* Set force_start so that redisplay_window will run the 4318 /* Set force_start so that redisplay_window will run the
4318 window-scroll-functions. */ 4319 window-scroll-functions. */
4319 w->force_start = Qt; 4320 w->force_start = 1;
4320 return; 4321 return;
4321 } 4322 }
4322 } 4323 }
@@ -4456,14 +4457,13 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4456 set_marker_restricted (w->start, make_number (pos), 4457 set_marker_restricted (w->start, make_number (pos),
4457 w->buffer); 4458 w->buffer);
4458 bytepos = XMARKER (w->start)->bytepos; 4459 bytepos = XMARKER (w->start)->bytepos;
4459 w->start_at_line_beg = ((pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n') 4460 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
4460 ? Qt : Qnil); 4461 w->update_mode_line = 1;
4461 w->update_mode_line = Qt;
4462 XSETFASTINT (w->last_modified, 0); 4462 XSETFASTINT (w->last_modified, 0);
4463 XSETFASTINT (w->last_overlay_modified, 0); 4463 XSETFASTINT (w->last_overlay_modified, 0);
4464 /* Set force_start so that redisplay_window will run the 4464 /* Set force_start so that redisplay_window will run the
4465 window-scroll-functions. */ 4465 window-scroll-functions. */
4466 w->force_start = Qt; 4466 w->force_start = 1;
4467 } 4467 }
4468 4468
4469 /* The rest of this function uses current_y in a nonstandard way, 4469 /* The rest of this function uses current_y in a nonstandard way,
@@ -4656,13 +4656,13 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4656 max (0, min (scroll_margin, XINT (w->total_lines) / 4)); 4656 max (0, min (scroll_margin, XINT (w->total_lines) / 4));
4657 4657
4658 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4658 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
4659 w->start_at_line_beg = bolp; 4659 w->start_at_line_beg = !NILP (bolp);
4660 w->update_mode_line = Qt; 4660 w->update_mode_line = 1;
4661 XSETFASTINT (w->last_modified, 0); 4661 XSETFASTINT (w->last_modified, 0);
4662 XSETFASTINT (w->last_overlay_modified, 0); 4662 XSETFASTINT (w->last_overlay_modified, 0);
4663 /* Set force_start so that redisplay_window will run 4663 /* Set force_start so that redisplay_window will run
4664 the window-scroll-functions. */ 4664 the window-scroll-functions. */
4665 w->force_start = Qt; 4665 w->force_start = 1;
4666 4666
4667 if (!NILP (Vscroll_preserve_screen_position) 4667 if (!NILP (Vscroll_preserve_screen_position)
4668 && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) 4668 && (whole || !EQ (Vscroll_preserve_screen_position, Qt)))
@@ -5206,12 +5206,10 @@ and redisplay normally--don't erase and redraw the frame. */)
5206 set_marker_both (w->start, w->buffer, charpos, bytepos); 5206 set_marker_both (w->start, w->buffer, charpos, bytepos);
5207 w->window_end_valid = Qnil; 5207 w->window_end_valid = Qnil;
5208 5208
5209 w->optional_new_start = Qt; 5209 w->optional_new_start = 1;
5210 5210
5211 if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n') 5211 w->start_at_line_beg = (bytepos == BEGV_BYTE ||
5212 w->start_at_line_beg = Qt; 5212 FETCH_BYTE (bytepos - 1) == '\n');
5213 else
5214 w->start_at_line_beg = Qnil;
5215 5213
5216 set_buffer_internal (obuf); 5214 set_buffer_internal (obuf);
5217 return Qnil; 5215 return Qnil;
@@ -5262,8 +5260,8 @@ zero means top of window, negative means relative to bottom of window. */)
5262 int height = window_internal_height (w); 5260 int height = window_internal_height (w);
5263 Fvertical_motion (make_number (- (height / 2)), window); 5261 Fvertical_motion (make_number (- (height / 2)), window);
5264 set_marker_both (w->start, w->buffer, PT, PT_BYTE); 5262 set_marker_both (w->start, w->buffer, PT, PT_BYTE);
5265 w->start_at_line_beg = Fbolp (); 5263 w->start_at_line_beg = !NILP (Fbolp ());
5266 w->force_start = Qt; 5264 w->force_start = 1;
5267 } 5265 }
5268 else 5266 else
5269 Fgoto_char (w->start); 5267 Fgoto_char (w->start);
@@ -5612,7 +5610,7 @@ the return value is nil. Otherwise the value is t. */)
5612 /* If saved buffer is alive, install it. */ 5610 /* If saved buffer is alive, install it. */
5613 { 5611 {
5614 w->buffer = p->buffer; 5612 w->buffer = p->buffer;
5615 w->start_at_line_beg = p->start_at_line_beg; 5613 w->start_at_line_beg = !NILP (p->start_at_line_beg);
5616 set_marker_restricted (w->start, p->start, w->buffer); 5614 set_marker_restricted (w->start, p->start, w->buffer);
5617 set_marker_restricted (w->pointm, p->pointm, w->buffer); 5615 set_marker_restricted (w->pointm, p->pointm, w->buffer);
5618 Fset_marker (BVAR (XBUFFER (w->buffer), mark), 5616 Fset_marker (BVAR (XBUFFER (w->buffer), mark),
@@ -5637,7 +5635,7 @@ the return value is nil. Otherwise the value is t. */)
5637 set_marker_restricted_both (w->pointm, w->buffer, 5635 set_marker_restricted_both (w->pointm, w->buffer,
5638 BUF_PT (XBUFFER (w->buffer)), 5636 BUF_PT (XBUFFER (w->buffer)),
5639 BUF_PT_BYTE (XBUFFER (w->buffer))); 5637 BUF_PT_BYTE (XBUFFER (w->buffer)));
5640 w->start_at_line_beg = Qt; 5638 w->start_at_line_beg = 1;
5641 } 5639 }
5642 else if (STRINGP (auto_buffer_name = 5640 else if (STRINGP (auto_buffer_name =
5643 Fwindow_parameter (window, Qauto_buffer_name)) 5641 Fwindow_parameter (window, Qauto_buffer_name))
@@ -5646,7 +5644,7 @@ the return value is nil. Otherwise the value is t. */)
5646 { 5644 {
5647 set_marker_restricted (w->start, make_number (0), w->buffer); 5645 set_marker_restricted (w->start, make_number (0), w->buffer);
5648 set_marker_restricted (w->pointm, make_number (0), w->buffer); 5646 set_marker_restricted (w->pointm, make_number (0), w->buffer);
5649 w->start_at_line_beg = Qt; 5647 w->start_at_line_beg = 1;
5650 } 5648 }
5651 else 5649 else
5652 /* Window has no live buffer, get one. */ 5650 /* Window has no live buffer, get one. */
@@ -5660,7 +5658,7 @@ the return value is nil. Otherwise the value is t. */)
5660 range. */ 5658 range. */
5661 set_marker_restricted (w->start, make_number (0), w->buffer); 5659 set_marker_restricted (w->start, make_number (0), w->buffer);
5662 set_marker_restricted (w->pointm, make_number (0), w->buffer); 5660 set_marker_restricted (w->pointm, make_number (0), w->buffer);
5663 w->start_at_line_beg = Qt; 5661 w->start_at_line_beg = 1;
5664 if (!NILP (w->dedicated)) 5662 if (!NILP (w->dedicated))
5665 /* Record this window as dead. */ 5663 /* Record this window as dead. */
5666 dead_windows = Fcons (window, dead_windows); 5664 dead_windows = Fcons (window, dead_windows);
@@ -5961,7 +5959,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5961 = !NILP (Vwindow_point_insertion_type); 5959 = !NILP (Vwindow_point_insertion_type);
5962 5960
5963 p->start = Fcopy_marker (w->start, Qnil); 5961 p->start = Fcopy_marker (w->start, Qnil);
5964 p->start_at_line_beg = w->start_at_line_beg; 5962 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
5965 5963
5966 tem = BVAR (XBUFFER (w->buffer), mark); 5964 tem = BVAR (XBUFFER (w->buffer), mark);
5967 p->mark = Fcopy_marker (tem, Qnil); 5965 p->mark = Fcopy_marker (tem, Qnil);
diff --git a/src/window.h b/src/window.h
index 1524805579f..0d3910c8cb0 100644
--- a/src/window.h
+++ b/src/window.h
@@ -94,9 +94,6 @@ struct window
94 /* The frame this window is on. */ 94 /* The frame this window is on. */
95 Lisp_Object frame; 95 Lisp_Object frame;
96 96
97 /* t if this window is a minibuffer window. */
98 Lisp_Object mini_p;
99
100 /* Following (to right or down) and preceding (to left or up) child 97 /* Following (to right or down) and preceding (to left or up) child
101 at same level of tree. */ 98 at same level of tree. */
102 Lisp_Object next, prev; 99 Lisp_Object next, prev;
@@ -144,15 +141,6 @@ struct window
144 each one can have its own value of point. */ 141 each one can have its own value of point. */
145 Lisp_Object pointm; 142 Lisp_Object pointm;
146 143
147 /* Non-nil means next redisplay must use the value of start
148 set up for it in advance. Set by scrolling commands. */
149 Lisp_Object force_start;
150 /* Non-nil means we have explicitly changed the value of start,
151 but that the next redisplay is not obliged to use the new value.
152 This is used in Fdelete_other_windows to force a call to
153 Vwindow_scroll_functions; also by Frecenter with argument. */
154 Lisp_Object optional_new_start;
155
156 /* Number of columns display within the window is scrolled to the left. */ 144 /* Number of columns display within the window is scrolled to the left. */
157 Lisp_Object hscroll; 145 Lisp_Object hscroll;
158 /* Minimum hscroll for automatic hscrolling. This is the value 146 /* Minimum hscroll for automatic hscrolling. This is the value
@@ -176,9 +164,6 @@ struct window
176 Lisp_Object last_overlay_modified; 164 Lisp_Object last_overlay_modified;
177 /* Value of point at that time. */ 165 /* Value of point at that time. */
178 Lisp_Object last_point; 166 Lisp_Object last_point;
179 /* Non-nil if the buffer was "modified" when the window
180 was last updated. */
181 Lisp_Object last_had_star;
182 167
183 /* This window's vertical scroll bar. This field is only for use 168 /* This window's vertical scroll bar. This field is only for use
184 by the window-system-dependent code which implements the 169 by the window-system-dependent code which implements the
@@ -206,11 +191,6 @@ struct window
206 no scroll bar. A value of t means use frame value. */ 191 no scroll bar. A value of t means use frame value. */
207 Lisp_Object vertical_scroll_bar_type; 192 Lisp_Object vertical_scroll_bar_type;
208 193
209 /* Frame coords of mark as of last time display completed */
210 /* May be nil if mark does not exist or was not on frame */
211 Lisp_Object last_mark_x;
212 Lisp_Object last_mark_y;
213
214 /* Z - the buffer position of the last glyph in the current matrix 194 /* Z - the buffer position of the last glyph in the current matrix
215 of W. Only valid if WINDOW_END_VALID is not nil. */ 195 of W. Only valid if WINDOW_END_VALID is not nil. */
216 Lisp_Object window_end_pos; 196 Lisp_Object window_end_pos;
@@ -223,18 +203,13 @@ struct window
223 did not get onto the frame. */ 203 did not get onto the frame. */
224 Lisp_Object window_end_valid; 204 Lisp_Object window_end_valid;
225 205
226 /* Non-nil means must regenerate mode line of this window */
227 Lisp_Object update_mode_line;
228
229 /* Non-nil means current value of `start'
230 was the beginning of a line when it was chosen. */
231 Lisp_Object start_at_line_beg;
232
233 /* Display-table to use for displaying chars in this window. 206 /* Display-table to use for displaying chars in this window.
234 Nil means use the buffer's own display-table. */ 207 Nil means use the buffer's own display-table. */
235 Lisp_Object display_table; 208 Lisp_Object display_table;
236 209
237 /* Non-nil means window is marked as dedicated. */ 210 /* Non-nil usually means window is marked as dedicated.
211 Note Lisp code may set this to something beyond Qnil
212 and Qt, so bitfield can't be used here. */
238 Lisp_Object dedicated; 213 Lisp_Object dedicated;
239 214
240 /* Line number and position of a line somewhere above the top of the 215 /* Line number and position of a line somewhere above the top of the
@@ -302,6 +277,30 @@ struct window
302 /* This is handy for undrawing the cursor. */ 277 /* This is handy for undrawing the cursor. */
303 int phys_cursor_ascent, phys_cursor_height; 278 int phys_cursor_ascent, phys_cursor_height;
304 279
280 /* Non-zero if this window is a minibuffer window. */
281 unsigned mini : 1;
282
283 /* Non-zero means must regenerate mode line of this window */
284 unsigned update_mode_line : 1;
285
286 /* Non-nil if the buffer was "modified" when the window
287 was last updated. */
288 unsigned last_had_star : 1;
289
290 /* Non-zero means current value of `start'
291 was the beginning of a line when it was chosen. */
292 unsigned start_at_line_beg : 1;
293
294 /* Non-zero means next redisplay must use the value of start
295 set up for it in advance. Set by scrolling commands. */
296 unsigned force_start : 1;
297
298 /* Non-zero means we have explicitly changed the value of start,
299 but that the next redisplay is not obliged to use the new value.
300 This is used in Fdelete_other_windows to force a call to
301 Vwindow_scroll_functions; also by Frecenter with argument. */
302 unsigned optional_new_start : 1;
303
305 /* Non-zero means the cursor is currently displayed. This can be 304 /* Non-zero means the cursor is currently displayed. This can be
306 set to zero by functions overpainting the cursor image. */ 305 set to zero by functions overpainting the cursor image. */
307 unsigned phys_cursor_on_p : 1; 306 unsigned phys_cursor_on_p : 1;
@@ -337,7 +336,7 @@ struct window
337 336
338/* 1 if W is a minibuffer window. */ 337/* 1 if W is a minibuffer window. */
339 338
340#define MINI_WINDOW_P(W) (!NILP ((W)->mini_p)) 339#define MINI_WINDOW_P(W) ((W)->mini)
341 340
342/* General window layout: 341/* General window layout:
343 342
diff --git a/src/xdisp.c b/src/xdisp.c
index c8d2de7c9de..39059acdb85 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,6 +1,6 @@
1/* Display generation from window structure and buffer text. 1/* Display generation from window structure and buffer text.
2 2
3Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc. 3Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -753,6 +753,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
753int redisplaying_p; 753int redisplaying_p;
754 754
755static Lisp_Object Qinhibit_free_realized_faces; 755static Lisp_Object Qinhibit_free_realized_faces;
756static Lisp_Object Qmode_line_default_help_echo;
756 757
757/* If a string, XTread_socket generates an event to display that string. 758/* If a string, XTread_socket generates an event to display that string.
758 (The display is done in read_char.) */ 759 (The display is done in read_char.) */
@@ -9818,7 +9819,7 @@ vmessage (const char *m, va_list ap)
9818 len = doprnt (FRAME_MESSAGE_BUF (f), 9819 len = doprnt (FRAME_MESSAGE_BUF (f),
9819 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); 9820 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
9820 9821
9821 message2 (FRAME_MESSAGE_BUF (f), len, 0); 9822 message2 (FRAME_MESSAGE_BUF (f), len, 1);
9822 } 9823 }
9823 else 9824 else
9824 message1 (0); 9825 message1 (0);
@@ -11223,7 +11224,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11223 || update_mode_lines 11224 || update_mode_lines
11224 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11225 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer))
11225 < BUF_MODIFF (XBUFFER (w->buffer))) 11226 < BUF_MODIFF (XBUFFER (w->buffer)))
11226 != !NILP (w->last_had_star)) 11227 != w->last_had_star)
11227 || ((!NILP (Vtransient_mark_mode) 11228 || ((!NILP (Vtransient_mark_mode)
11228 && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) 11229 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11229 != !NILP (w->region_showing))) 11230 != !NILP (w->region_showing)))
@@ -11275,11 +11276,11 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11275 else 11276 else
11276 /* On a terminal screen, the menu bar is an ordinary screen 11277 /* On a terminal screen, the menu bar is an ordinary screen
11277 line, and this makes it get updated. */ 11278 line, and this makes it get updated. */
11278 w->update_mode_line = Qt; 11279 w->update_mode_line = 1;
11279#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */ 11280#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
11280 /* In the non-toolkit version, the menu bar is an ordinary screen 11281 /* In the non-toolkit version, the menu bar is an ordinary screen
11281 line, and this makes it get updated. */ 11282 line, and this makes it get updated. */
11282 w->update_mode_line = Qt; 11283 w->update_mode_line = 1;
11283#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */ 11284#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
11284 11285
11285 unbind_to (count, Qnil); 11286 unbind_to (count, Qnil);
@@ -11417,11 +11418,11 @@ update_tool_bar (struct frame *f, int save_match_data)
11417 the rest of the redisplay algorithm is about the same as 11418 the rest of the redisplay algorithm is about the same as
11418 windows_or_buffers_changed anyway. */ 11419 windows_or_buffers_changed anyway. */
11419 if (windows_or_buffers_changed 11420 if (windows_or_buffers_changed
11420 || !NILP (w->update_mode_line) 11421 || w->update_mode_line
11421 || update_mode_lines 11422 || update_mode_lines
11422 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11423 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer))
11423 < BUF_MODIFF (XBUFFER (w->buffer))) 11424 < BUF_MODIFF (XBUFFER (w->buffer)))
11424 != !NILP (w->last_had_star)) 11425 != w->last_had_star)
11425 || ((!NILP (Vtransient_mark_mode) 11426 || ((!NILP (Vtransient_mark_mode)
11426 && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) 11427 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11427 != !NILP (w->region_showing))) 11428 != !NILP (w->region_showing)))
@@ -11472,7 +11473,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11472 BLOCK_INPUT; 11473 BLOCK_INPUT;
11473 f->tool_bar_items = new_tool_bar; 11474 f->tool_bar_items = new_tool_bar;
11474 f->n_tool_bar_items = new_n_tool_bar; 11475 f->n_tool_bar_items = new_n_tool_bar;
11475 w->update_mode_line = Qt; 11476 w->update_mode_line = 1;
11476 UNBLOCK_INPUT; 11477 UNBLOCK_INPUT;
11477 } 11478 }
11478 11479
@@ -13021,9 +13022,9 @@ redisplay_internal (void)
13021 update_mode_lines++; 13022 update_mode_lines++;
13022 13023
13023 /* Detect case that we need to write or remove a star in the mode line. */ 13024 /* Detect case that we need to write or remove a star in the mode line. */
13024 if ((SAVE_MODIFF < MODIFF) != !NILP (w->last_had_star)) 13025 if ((SAVE_MODIFF < MODIFF) != w->last_had_star)
13025 { 13026 {
13026 w->update_mode_line = Qt; 13027 w->update_mode_line = 1;
13027 if (buffer_shared > 1) 13028 if (buffer_shared > 1)
13028 update_mode_lines++; 13029 update_mode_lines++;
13029 } 13030 }
@@ -13040,7 +13041,7 @@ redisplay_internal (void)
13040 && XFASTINT (w->last_modified) >= MODIFF 13041 && XFASTINT (w->last_modified) >= MODIFF
13041 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) 13042 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
13042 && (XFASTINT (w->column_number_displayed) != current_column ())) 13043 && (XFASTINT (w->column_number_displayed) != current_column ()))
13043 w->update_mode_line = Qt; 13044 w->update_mode_line = 1;
13044 13045
13045 unbind_to (count1, Qnil); 13046 unbind_to (count1, Qnil);
13046 13047
@@ -13143,7 +13144,7 @@ redisplay_internal (void)
13143 tlendpos = this_line_end_pos; 13144 tlendpos = this_line_end_pos;
13144 if (!consider_all_windows_p 13145 if (!consider_all_windows_p
13145 && CHARPOS (tlbufpos) > 0 13146 && CHARPOS (tlbufpos) > 0
13146 && NILP (w->update_mode_line) 13147 && !w->update_mode_line
13147 && !current_buffer->clip_changed 13148 && !current_buffer->clip_changed
13148 && !current_buffer->prevent_redisplay_optimizations_p 13149 && !current_buffer->prevent_redisplay_optimizations_p
13149 && FRAME_VISIBLE_P (XFRAME (w->frame)) 13150 && FRAME_VISIBLE_P (XFRAME (w->frame))
@@ -13151,8 +13152,8 @@ redisplay_internal (void)
13151 /* Make sure recorded data applies to current buffer, etc. */ 13152 /* Make sure recorded data applies to current buffer, etc. */
13152 && this_line_buffer == current_buffer 13153 && this_line_buffer == current_buffer
13153 && current_buffer == XBUFFER (w->buffer) 13154 && current_buffer == XBUFFER (w->buffer)
13154 && NILP (w->force_start) 13155 && !w->force_start
13155 && NILP (w->optional_new_start) 13156 && !w->optional_new_start
13156 /* Point must be on the line that we have info recorded about. */ 13157 /* Point must be on the line that we have info recorded about. */
13157 && PT >= CHARPOS (tlbufpos) 13158 && PT >= CHARPOS (tlbufpos)
13158 && PT <= Z - CHARPOS (tlendpos) 13159 && PT <= Z - CHARPOS (tlendpos)
@@ -13694,7 +13695,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13694 w->last_overlay_modified 13695 w->last_overlay_modified
13695 = make_number (accurate_p ? BUF_OVERLAY_MODIFF (b) : 0); 13696 = make_number (accurate_p ? BUF_OVERLAY_MODIFF (b) : 0);
13696 w->last_had_star 13697 w->last_had_star
13697 = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b) ? Qt : Qnil; 13698 = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
13698 13699
13699 if (accurate_p) 13700 if (accurate_p)
13700 { 13701 {
@@ -13723,7 +13724,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13723 if (accurate_p) 13724 if (accurate_p)
13724 { 13725 {
13725 w->window_end_valid = w->buffer; 13726 w->window_end_valid = w->buffer;
13726 w->update_mode_line = Qnil; 13727 w->update_mode_line = 0;
13727 } 13728 }
13728} 13729}
13729 13730
@@ -15352,7 +15353,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15352 reconsider_clip_changes (w, buffer); 15353 reconsider_clip_changes (w, buffer);
15353 15354
15354 /* Has the mode line to be updated? */ 15355 /* Has the mode line to be updated? */
15355 update_mode_line = (!NILP (w->update_mode_line) 15356 update_mode_line = (w->update_mode_line
15356 || update_mode_lines 15357 || update_mode_lines
15357 || buffer->clip_changed 15358 || buffer->clip_changed
15358 || buffer->prevent_redisplay_optimizations_p); 15359 || buffer->prevent_redisplay_optimizations_p);
@@ -15524,32 +15525,31 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15524 15525
15525 /* If someone specified a new starting point but did not insist, 15526 /* If someone specified a new starting point but did not insist,
15526 check whether it can be used. */ 15527 check whether it can be used. */
15527 if (!NILP (w->optional_new_start) 15528 if (w->optional_new_start
15528 && CHARPOS (startp) >= BEGV 15529 && CHARPOS (startp) >= BEGV
15529 && CHARPOS (startp) <= ZV) 15530 && CHARPOS (startp) <= ZV)
15530 { 15531 {
15531 w->optional_new_start = Qnil; 15532 w->optional_new_start = 0;
15532 start_display (&it, w, startp); 15533 start_display (&it, w, startp);
15533 move_it_to (&it, PT, 0, it.last_visible_y, -1, 15534 move_it_to (&it, PT, 0, it.last_visible_y, -1,
15534 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); 15535 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
15535 if (IT_CHARPOS (it) == PT) 15536 if (IT_CHARPOS (it) == PT)
15536 w->force_start = Qt; 15537 w->force_start = 1;
15537 /* IT may overshoot PT if text at PT is invisible. */ 15538 /* IT may overshoot PT if text at PT is invisible. */
15538 else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT) 15539 else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT)
15539 w->force_start = Qt; 15540 w->force_start = 1;
15540 } 15541 }
15541 15542
15542 force_start: 15543 force_start:
15543 15544
15544 /* Handle case where place to start displaying has been specified, 15545 /* Handle case where place to start displaying has been specified,
15545 unless the specified location is outside the accessible range. */ 15546 unless the specified location is outside the accessible range. */
15546 if (!NILP (w->force_start) 15547 if (w->force_start || w->frozen_window_start_p)
15547 || w->frozen_window_start_p)
15548 { 15548 {
15549 /* We set this later on if we have to adjust point. */ 15549 /* We set this later on if we have to adjust point. */
15550 int new_vpos = -1; 15550 int new_vpos = -1;
15551 15551
15552 w->force_start = Qnil; 15552 w->force_start = 0;
15553 w->vscroll = 0; 15553 w->vscroll = 0;
15554 w->window_end_valid = Qnil; 15554 w->window_end_valid = Qnil;
15555 15555
@@ -15568,7 +15568,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15568 || ! NILP (Vwindow_scroll_functions)) 15568 || ! NILP (Vwindow_scroll_functions))
15569 { 15569 {
15570 update_mode_line = 1; 15570 update_mode_line = 1;
15571 w->update_mode_line = Qt; 15571 w->update_mode_line = 1;
15572 startp = run_window_scroll_functions (window, startp); 15572 startp = run_window_scroll_functions (window, startp);
15573 } 15573 }
15574 15574
@@ -15586,7 +15586,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15586 the scroll margin (bug#148) -- cyd */ 15586 the scroll margin (bug#148) -- cyd */
15587 if (!try_window (window, startp, 0)) 15587 if (!try_window (window, startp, 0))
15588 { 15588 {
15589 w->force_start = Qt; 15589 w->force_start = 1;
15590 clear_glyph_matrix (w->desired_matrix); 15590 clear_glyph_matrix (w->desired_matrix);
15591 goto need_larger_matrices; 15591 goto need_larger_matrices;
15592 } 15592 }
@@ -15665,7 +15665,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15665 } 15665 }
15666 /* If current starting point was originally the beginning of a line 15666 /* If current starting point was originally the beginning of a line
15667 but no longer is, find a new starting point. */ 15667 but no longer is, find a new starting point. */
15668 else if (!NILP (w->start_at_line_beg) 15668 else if (w->start_at_line_beg
15669 && !(CHARPOS (startp) <= BEGV 15669 && !(CHARPOS (startp) <= BEGV
15670 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n')) 15670 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'))
15671 { 15671 {
@@ -15712,7 +15712,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15712 new window start, since that would change the position under 15712 new window start, since that would change the position under
15713 the mouse, resulting in an unwanted mouse-movement rather 15713 the mouse, resulting in an unwanted mouse-movement rather
15714 than a simple mouse-click. */ 15714 than a simple mouse-click. */
15715 if (NILP (w->start_at_line_beg) 15715 if (!w->start_at_line_beg
15716 && NILP (do_mouse_tracking) 15716 && NILP (do_mouse_tracking)
15717 && CHARPOS (startp) > BEGV 15717 && CHARPOS (startp) > BEGV
15718 && CHARPOS (startp) > BEG + beg_unchanged 15718 && CHARPOS (startp) > BEG + beg_unchanged
@@ -15732,7 +15732,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15732 See bug#9324. */ 15732 See bug#9324. */
15733 && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6)) 15733 && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6))
15734 { 15734 {
15735 w->force_start = Qt; 15735 w->force_start = 1;
15736 SET_TEXT_POS_FROM_MARKER (startp, w->start); 15736 SET_TEXT_POS_FROM_MARKER (startp, w->start);
15737 goto force_start; 15737 goto force_start;
15738 } 15738 }
@@ -15793,7 +15793,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15793 if (!update_mode_line) 15793 if (!update_mode_line)
15794 { 15794 {
15795 update_mode_line = 1; 15795 update_mode_line = 1;
15796 w->update_mode_line = Qt; 15796 w->update_mode_line = 1;
15797 } 15797 }
15798 15798
15799 /* Try to scroll by specified few lines. */ 15799 /* Try to scroll by specified few lines. */
@@ -16048,9 +16048,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16048 done: 16048 done:
16049 16049
16050 SET_TEXT_POS_FROM_MARKER (startp, w->start); 16050 SET_TEXT_POS_FROM_MARKER (startp, w->start);
16051 w->start_at_line_beg = ((CHARPOS (startp) == BEGV 16051 w->start_at_line_beg = (CHARPOS (startp) == BEGV
16052 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n') 16052 || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
16053 ? Qt : Qnil);
16054 16053
16055 /* Display the mode line, if we must. */ 16054 /* Display the mode line, if we must. */
16056 if ((update_mode_line 16055 if ((update_mode_line
@@ -16274,7 +16273,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16274 /* If bottom moved off end of frame, change mode line percentage. */ 16273 /* If bottom moved off end of frame, change mode line percentage. */
16275 if (XFASTINT (w->window_end_pos) <= 0 16274 if (XFASTINT (w->window_end_pos) <= 0
16276 && Z != IT_CHARPOS (it)) 16275 && Z != IT_CHARPOS (it))
16277 w->update_mode_line = Qt; 16276 w->update_mode_line = 1;
16278 16277
16279 /* Set window_end_pos to the offset of the last character displayed 16278 /* Set window_end_pos to the offset of the last character displayed
16280 on the window from the end of current_buffer. Set 16279 on the window from the end of current_buffer. Set
@@ -21118,8 +21117,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
21118 21117
21119 if (!VECTORP (val)) /* Not yet decided. */ 21118 if (!VECTORP (val)) /* Not yet decided. */
21120 { 21119 {
21121 if (multibyte) 21120 *buf++ = multibyte ? '-' : ' ';
21122 *buf++ = '-';
21123 if (eol_flag) 21121 if (eol_flag)
21124 eoltype = eol_mnemonic_undecided; 21122 eoltype = eol_mnemonic_undecided;
21125 /* Don't mention EOL conversion if it isn't decided. */ 21123 /* Don't mention EOL conversion if it isn't decided. */
@@ -21132,8 +21130,9 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
21132 attrs = AREF (val, 0); 21130 attrs = AREF (val, 0);
21133 eolvalue = AREF (val, 2); 21131 eolvalue = AREF (val, 2);
21134 21132
21135 if (multibyte) 21133 *buf++ = multibyte
21136 *buf++ = XFASTINT (CODING_ATTR_MNEMONIC (attrs)); 21134 ? XFASTINT (CODING_ATTR_MNEMONIC (attrs))
21135 : ' ';
21137 21136
21138 if (eol_flag) 21137 if (eol_flag)
21139 { 21138 {
@@ -22198,7 +22197,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22198 return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); 22197 return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
22199 } 22198 }
22200 22199
22201 prop = Fbuffer_local_value (prop, it->w->buffer); 22200 prop = buffer_local_value_1 (prop, it->w->buffer);
22201 if (EQ (prop, Qunbound))
22202 prop = Qnil;
22202 } 22203 }
22203 22204
22204 if (INTEGERP (prop) || FLOATP (prop)) 22205 if (INTEGERP (prop) || FLOATP (prop))
@@ -22255,7 +22256,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
22255 return OK_PIXELS (pixels); 22256 return OK_PIXELS (pixels);
22256 } 22257 }
22257 22258
22258 car = Fbuffer_local_value (car, it->w->buffer); 22259 car = buffer_local_value_1 (car, it->w->buffer);
22260 if (EQ (car, Qunbound))
22261 car = Qnil;
22259 } 22262 }
22260 22263
22261 if (INTEGERP (car) || FLOATP (car)) 22264 if (INTEGERP (car) || FLOATP (car))
@@ -27202,12 +27205,12 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27202 int dx, dy, width, height; 27205 int dx, dy, width, height;
27203 ptrdiff_t charpos; 27206 ptrdiff_t charpos;
27204 Lisp_Object string, object = Qnil; 27207 Lisp_Object string, object = Qnil;
27205 Lisp_Object pos, help; 27208 Lisp_Object pos IF_LINT (= Qnil), help;
27206 27209
27207 Lisp_Object mouse_face; 27210 Lisp_Object mouse_face;
27208 int original_x_pixel = x; 27211 int original_x_pixel = x;
27209 struct glyph * glyph = NULL, * row_start_glyph = NULL; 27212 struct glyph * glyph = NULL, * row_start_glyph = NULL;
27210 struct glyph_row *row; 27213 struct glyph_row *row IF_LINT (= 0);
27211 27214
27212 if (area == ON_MODE_LINE || area == ON_HEADER_LINE) 27215 if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
27213 { 27216 {
@@ -27275,7 +27278,6 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27275 if (!NILP (help)) 27278 if (!NILP (help))
27276 { 27279 {
27277 help_echo_string = help; 27280 help_echo_string = help;
27278 /* Is this correct? ++kfs */
27279 XSETWINDOW (help_echo_window, w); 27281 XSETWINDOW (help_echo_window, w);
27280 help_echo_object = w->buffer; 27282 help_echo_object = w->buffer;
27281 help_echo_pos = charpos; 27283 help_echo_pos = charpos;
@@ -27288,14 +27290,20 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27288#endif /* HAVE_WINDOW_SYSTEM */ 27290#endif /* HAVE_WINDOW_SYSTEM */
27289 27291
27290 if (STRINGP (string)) 27292 if (STRINGP (string))
27293 pos = make_number (charpos);
27294
27295 /* Set the help text and mouse pointer. If the mouse is on a part
27296 of the mode line without any text (e.g. past the right edge of
27297 the mode line text), use the default help text and pointer. */
27298 if (STRINGP (string) || area == ON_MODE_LINE)
27291 { 27299 {
27292 pos = make_number (charpos); 27300 /* Arrange to display the help by setting the global variables
27293 /* If we're on a string with `help-echo' text property, arrange 27301 help_echo_string, help_echo_object, and help_echo_pos. */
27294 for the help to be displayed. This is done by setting the
27295 global variable help_echo_string to the help string. */
27296 if (NILP (help)) 27302 if (NILP (help))
27297 { 27303 {
27298 help = Fget_text_property (pos, Qhelp_echo, string); 27304 if (STRINGP (string))
27305 help = Fget_text_property (pos, Qhelp_echo, string);
27306
27299 if (!NILP (help)) 27307 if (!NILP (help))
27300 { 27308 {
27301 help_echo_string = help; 27309 help_echo_string = help;
@@ -27303,31 +27311,56 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
27303 help_echo_object = string; 27311 help_echo_object = string;
27304 help_echo_pos = charpos; 27312 help_echo_pos = charpos;
27305 } 27313 }
27314 else if (area == ON_MODE_LINE)
27315 {
27316 Lisp_Object default_help
27317 = buffer_local_value_1 (Qmode_line_default_help_echo,
27318 w->buffer);
27319
27320 if (STRINGP (default_help))
27321 {
27322 help_echo_string = default_help;
27323 XSETWINDOW (help_echo_window, w);
27324 help_echo_object = Qnil;
27325 help_echo_pos = -1;
27326 }
27327 }
27306 } 27328 }
27307 27329
27308#ifdef HAVE_WINDOW_SYSTEM 27330#ifdef HAVE_WINDOW_SYSTEM
27331 /* Change the mouse pointer according to what is under it. */
27309 if (FRAME_WINDOW_P (f)) 27332 if (FRAME_WINDOW_P (f))
27310 { 27333 {
27311 dpyinfo = FRAME_X_DISPLAY_INFO (f); 27334 dpyinfo = FRAME_X_DISPLAY_INFO (f);
27312 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 27335 if (STRINGP (string))
27313 if (NILP (pointer))
27314 pointer = Fget_text_property (pos, Qpointer, string);
27315
27316 /* Change the mouse pointer according to what is under X/Y. */
27317 if (NILP (pointer)
27318 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
27319 { 27336 {
27320 Lisp_Object map; 27337 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
27321 map = Fget_text_property (pos, Qlocal_map, string); 27338
27322 if (!KEYMAPP (map)) 27339 if (NILP (pointer))
27323 map = Fget_text_property (pos, Qkeymap, string); 27340 pointer = Fget_text_property (pos, Qpointer, string);
27324 if (!KEYMAPP (map)) 27341
27325 cursor = dpyinfo->vertical_scroll_bar_cursor; 27342 /* Change the mouse pointer according to what is under X/Y. */
27343 if (NILP (pointer)
27344 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
27345 {
27346 Lisp_Object map;
27347 map = Fget_text_property (pos, Qlocal_map, string);
27348 if (!KEYMAPP (map))
27349 map = Fget_text_property (pos, Qkeymap, string);
27350 if (!KEYMAPP (map))
27351 cursor = dpyinfo->vertical_scroll_bar_cursor;
27352 }
27326 } 27353 }
27354 else
27355 /* Default mode-line pointer. */
27356 cursor = FRAME_X_DISPLAY_INFO (f)->vertical_scroll_bar_cursor;
27327 } 27357 }
27328#endif 27358#endif
27359 }
27329 27360
27330 /* Change the mouse face according to what is under X/Y. */ 27361 /* Change the mouse face according to what is under X/Y. */
27362 if (STRINGP (string))
27363 {
27331 mouse_face = Fget_text_property (pos, Qmouse_face, string); 27364 mouse_face = Fget_text_property (pos, Qmouse_face, string);
27332 if (!NILP (mouse_face) 27365 if (!NILP (mouse_face)
27333 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) 27366 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
@@ -28668,6 +28701,8 @@ syms_of_xdisp (void)
28668 Vmode_line_unwind_vector = Qnil; 28701 Vmode_line_unwind_vector = Qnil;
28669 staticpro (&Vmode_line_unwind_vector); 28702 staticpro (&Vmode_line_unwind_vector);
28670 28703
28704 DEFSYM (Qmode_line_default_help_echo, "mode-line-default-help-echo");
28705
28671 help_echo_string = Qnil; 28706 help_echo_string = Qnil;
28672 staticpro (&help_echo_string); 28707 staticpro (&help_echo_string);
28673 help_echo_object = Qnil; 28708 help_echo_object = Qnil;
@@ -28948,7 +28983,9 @@ It can be one of
28948 both - show both, text below image 28983 both - show both, text below image
28949 both-horiz - show text to the right of the image 28984 both-horiz - show text to the right of the image
28950 text-image-horiz - show text to the left of the image 28985 text-image-horiz - show text to the left of the image
28951 any other - use system default or image if no system default. */); 28986 any other - use system default or image if no system default.
28987
28988This variable only affects the GTK+ toolkit version of Emacs. */);
28952 Vtool_bar_style = Qnil; 28989 Vtool_bar_style = Qnil;
28953 28990
28954 DEFVAR_INT ("tool-bar-max-label-size", tool_bar_max_label_size, 28991 DEFVAR_INT ("tool-bar-max-label-size", tool_bar_max_label_size,
diff --git a/src/xfaces.c b/src/xfaces.c
index 84a47cf6ccf..772d2646291 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4579,7 +4579,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
4579} 4579}
4580 4580
4581 4581
4582/* Return the display face-id of the basic face who's canonical face-id 4582/* Return the display face-id of the basic face whose canonical face-id
4583 is FACE_ID. The return value will usually simply be FACE_ID, unless that 4583 is FACE_ID. The return value will usually simply be FACE_ID, unless that
4584 basic face has bee remapped via Vface_remapping_alist. This function is 4584 basic face has bee remapped via Vface_remapping_alist. This function is
4585 conservative: if something goes wrong, it will simply return FACE_ID 4585 conservative: if something goes wrong, it will simply return FACE_ID
@@ -4884,14 +4884,13 @@ static int
4884tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, 4884tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4885 struct face *def_face) 4885 struct face *def_face)
4886{ 4886{
4887 int weight; 4887 int weight, slant;
4888 Lisp_Object val, fg, bg; 4888 Lisp_Object val, fg, bg;
4889 XColor fg_tty_color, fg_std_color; 4889 XColor fg_tty_color, fg_std_color;
4890 XColor bg_tty_color, bg_std_color; 4890 XColor bg_tty_color, bg_std_color;
4891 unsigned test_caps = 0; 4891 unsigned test_caps = 0;
4892 Lisp_Object *def_attrs = def_face->lface; 4892 Lisp_Object *def_attrs = def_face->lface;
4893 4893
4894
4895 /* First check some easy-to-check stuff; ttys support none of the 4894 /* First check some easy-to-check stuff; ttys support none of the
4896 following attributes, so we can just return false if any are requested 4895 following attributes, so we can just return false if any are requested
4897 (even if `nominal' values are specified, we should still return false, 4896 (even if `nominal' values are specified, we should still return false,
@@ -4907,11 +4906,9 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4907 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) 4906 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
4908 || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) 4907 || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
4909 || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) 4908 || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
4910 || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) 4909 || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
4911 || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]))
4912 return 0; 4910 return 0;
4913 4911
4914
4915 /* Test for terminal `capabilities' (non-color character attributes). */ 4912 /* Test for terminal `capabilities' (non-color character attributes). */
4916 4913
4917 /* font weight (bold/dim) */ 4914 /* font weight (bold/dim) */
@@ -4937,6 +4934,18 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
4937 return 0; /* same as default */ 4934 return 0; /* same as default */
4938 } 4935 }
4939 4936
4937 /* font slant */
4938 val = attrs[LFACE_SLANT_INDEX];
4939 if (!UNSPECIFIEDP (val)
4940 && (slant = FONT_SLANT_NAME_NUMERIC (val), slant >= 0))
4941 {
4942 int def_slant = FONT_SLANT_NAME_NUMERIC (def_attrs[LFACE_SLANT_INDEX]);
4943 if (slant == 100 || slant == def_slant)
4944 return 0; /* same as default */
4945 else
4946 test_caps |= TTY_CAP_ITALIC;
4947 }
4948
4940 /* underlining */ 4949 /* underlining */
4941 val = attrs[LFACE_UNDERLINE_INDEX]; 4950 val = attrs[LFACE_UNDERLINE_INDEX];
4942 if (!UNSPECIFIEDP (val)) 4951 if (!UNSPECIFIEDP (val))
@@ -5336,11 +5345,11 @@ realize_default_face (struct frame *f)
5336 /* If the `default' face is not yet known, create it. */ 5345 /* If the `default' face is not yet known, create it. */
5337 lface = lface_from_face_name (f, Qdefault, 0); 5346 lface = lface_from_face_name (f, Qdefault, 0);
5338 if (NILP (lface)) 5347 if (NILP (lface))
5339 { 5348 {
5340 Lisp_Object frame; 5349 Lisp_Object frame;
5341 XSETFRAME (frame, f); 5350 XSETFRAME (frame, f);
5342 lface = Finternal_make_lisp_face (Qdefault, frame); 5351 lface = Finternal_make_lisp_face (Qdefault, frame);
5343 } 5352 }
5344 5353
5345#ifdef HAVE_WINDOW_SYSTEM 5354#ifdef HAVE_WINDOW_SYSTEM
5346 if (FRAME_WINDOW_P (f)) 5355 if (FRAME_WINDOW_P (f))
@@ -5857,15 +5866,13 @@ realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
5857 face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty"; 5866 face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty";
5858#endif 5867#endif
5859 5868
5860 /* Map face attributes to TTY appearances. We map slant to 5869 /* Map face attributes to TTY appearances. */
5861 dimmed text because we want italic text to appear differently
5862 and because dimmed text is probably used infrequently. */
5863 weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]); 5870 weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]);
5864 slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]); 5871 slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]);
5865 if (weight > 100) 5872 if (weight > 100)
5866 face->tty_bold_p = 1; 5873 face->tty_bold_p = 1;
5867 if (weight < 100 || slant != 100) 5874 if (slant != 100)
5868 face->tty_dim_p = 1; 5875 face->tty_italic_p = 1;
5869 if (!NILP (attrs[LFACE_UNDERLINE_INDEX])) 5876 if (!NILP (attrs[LFACE_UNDERLINE_INDEX]))
5870 face->tty_underline_p = 1; 5877 face->tty_underline_p = 1;
5871 if (!NILP (attrs[LFACE_INVERSE_INDEX])) 5878 if (!NILP (attrs[LFACE_INVERSE_INDEX]))
@@ -6111,14 +6118,14 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
6111 6118
6112 *endptr = endpos; 6119 *endptr = endpos;
6113 6120
6114 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 6121 /* Optimize common case where we can use the default face. */
6115
6116 /* Optimize common cases where we can use the default face. */
6117 if (NILP (prop) 6122 if (NILP (prop)
6118 && !(pos >= region_beg && pos < region_end)) 6123 && !(pos >= region_beg && pos < region_end)
6124 && NILP (Vface_remapping_alist))
6119 return DEFAULT_FACE_ID; 6125 return DEFAULT_FACE_ID;
6120 6126
6121 /* Begin with attributes from the default face. */ 6127 /* Begin with attributes from the default face. */
6128 default_face = FACE_FROM_ID (f, lookup_basic_face (f, DEFAULT_FACE_ID));
6122 memcpy (attrs, default_face->lface, sizeof attrs); 6129 memcpy (attrs, default_face->lface, sizeof attrs);
6123 6130
6124 /* Merge in attributes specified via text properties. */ 6131 /* Merge in attributes specified via text properties. */
diff --git a/src/xfns.c b/src/xfns.c
index 1f1d3d3ef0c..43ccdfaef1a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1207,7 +1207,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1207 FRAME_EXTERNAL_MENU_BAR (f) = 1; 1207 FRAME_EXTERNAL_MENU_BAR (f) = 1;
1208 if (FRAME_X_P (f) && f->output_data.x->menubar_widget == 0) 1208 if (FRAME_X_P (f) && f->output_data.x->menubar_widget == 0)
1209 /* Make sure next redisplay shows the menu bar. */ 1209 /* Make sure next redisplay shows the menu bar. */
1210 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt; 1210 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = 1;
1211 } 1211 }
1212 else 1212 else
1213 { 1213 {
@@ -1291,7 +1291,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1291 FRAME_EXTERNAL_TOOL_BAR (f) = 1; 1291 FRAME_EXTERNAL_TOOL_BAR (f) = 1;
1292 if (FRAME_X_P (f) && f->output_data.x->toolbar_widget == 0) 1292 if (FRAME_X_P (f) && f->output_data.x->toolbar_widget == 0)
1293 /* Make sure next redisplay shows the tool bar. */ 1293 /* Make sure next redisplay shows the tool bar. */
1294 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt; 1294 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = 1;
1295 update_frame_tool_bar (f); 1295 update_frame_tool_bar (f);
1296 } 1296 }
1297 else 1297 else
diff --git a/src/xfont.c b/src/xfont.c
index bde76c0ba3c..cc06e27fe02 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -132,7 +132,7 @@ static int xfont_check (FRAME_PTR, struct font *);
132 132
133struct font_driver xfont_driver = 133struct font_driver xfont_driver =
134 { 134 {
135 0, /* Qx */ 135 LISP_INITIALLY_ZERO, /* Qx */
136 0, /* case insensitive */ 136 0, /* case insensitive */
137 xfont_get_cache, 137 xfont_get_cache,
138 xfont_list, 138 xfont_list,