aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2010-05-19 10:10:29 +0900
committerKenichi Handa2010-05-19 10:10:29 +0900
commit134d1bcded02e066727ece838f14ffc767f76419 (patch)
tree2187c2ac9748400146394bdaefd59f314598685d /src
parent2833d9158d6315b59415173df5d47515faac5310 (diff)
parent1fc0ce04bc651fe8adbe822515e4ea7a4e904249 (diff)
downloademacs-134d1bcded02e066727ece838f14ffc767f76419.tar.gz
emacs-134d1bcded02e066727ece838f14ffc767f76419.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog134
-rw-r--r--src/Makefile.in168
-rw-r--r--src/bidi.c50
-rw-r--r--src/charset.c1
-rw-r--r--src/cmds.c16
-rw-r--r--src/composite.c10
-rw-r--r--src/config.in8
-rw-r--r--src/dispextern.h2
-rw-r--r--src/emacs.c75
-rw-r--r--src/eval.c32
-rw-r--r--src/lisp.h13
-rw-r--r--src/m/ia64.h5
-rw-r--r--src/m/template.h7
-rw-r--r--src/s/gnu-linux.h10
-rw-r--r--src/s/gnu.h10
-rw-r--r--src/s/template.h5
-rw-r--r--src/xdisp.c128
17 files changed, 462 insertions, 212 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5d47f437d4a..b0965f8e514 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,125 @@
12010-05-18 Juanma Barranquero <lekktu@gmail.com>
2
3 * charset.c (load_charset_map_from_file): Don't call close after fclose.
4
52010-05-18 Glenn Morris <rgm@gnu.org>
6
7 * s/gnu-linux.h: Combine two conditionals.
8
9 * Makefile.in (otherobj): Include $(VMLIMIT_OBJ) separately from
10 $(POST_ALLOC_OBJ).
11
12 * Makefile.in (RALLOC_OBJ): New, set by configure.
13 (rallocobj): Replace with the previous variable.
14 (otherobj): Use $RALLOC_OBJ.
15
16 * s/gnu.h (REL_ALLOC) [DOUG_LEA_MALLOC]:
17 * s/gnu-linux.h (REL_ALLOC) [DOUG_LEA_MALLOC]: Move undef to configure.
18
19 * Makefile.in (GMALLOC_OBJ, VMLIMIT_OBJ): New, set by configure.
20 (gmallocobj, vmlimitobj): Replace with previous two variables.
21 (otherobj): Use $GMALLOC_OBJ, $VMLIMIT_OBJ.
22
232010-05-17 Glenn Morris <rgm@gnu.org>
24
25 * Makefile.in (OLDXMENU_DEPS): New, set by configure.
26 (stamp-oldxmenu): Use $OLDXMENU_DEPS.
27
282010-05-16 Glenn Morris <rgm@gnu.org>
29
30 * Makefile.in (${ns_appbindir}Emacs, ns-app): Always define these rules.
31
32 * Makefile.in (clean): Get rid of HAVE_NS conditional.
33
34 * Makefile.in (ns_appdir, ns_appbindir): Now configure adds the
35 trailing "/".
36
37 * Makefile.in (TEMACS_LDFLAGS2): New, set by configure.
38 (temacs${EXEEXT}): Combine the NS_IMPL_GNUSTEP case with the default.
39
40 * Makefile.in (GNUSTEP_SYSTEM_LIBRARIES): Remove, unused.
41 (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New, set by configure.
42 (LD) [NS_IMPL_GNUSTEP]: Set to $(CC) -rdynamic.
43 (temacs${EXEEXT}): Remove $LOCALCPP, never defined or referenced.
44 Make most of the NS_IMPL_GNUSTEP case the same as the default case.
45
46 * Makefile.in (temacs${EXEEXT}) [!NS_IMPL_GNUSTEP]:
47 Remove ${STARTFLAGS}, nothing ever sets it.
48
492010-05-16 Dan Nicolaescu <dann@ics.uci.edu>
50
51 * m/ia64.h (UNEXEC): Remove, set in s/*.h.
52
532010-05-16 Glenn Morris <rgm@gnu.org>
54
55 * Makefile.in (LIBX_BASE): Always define.
56
57 * Makefile.in (LIBX_OTHER): Move out of cpp section.
58
59 * Makefile.in (LIBXT): Always define.
60
612010-05-15 Glenn Morris <rgm@gnu.org>
62
63 * Makefile.in (OLDXMENU, LIBXMENU, LIBX_OTHER): Always define.
64
65 * Makefile.in (FONT_DRIVERS): Remove, replace with $FONT_OBJ.
66 (obj, SOME_MACHINE_OBJECTS): Use $FONT_OBJ.
67
682010-05-15 Ken Raeburn <raeburn@raeburn.org>
69
70 * lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue. (Bug#5916)
71 (LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise.
72
73 * emacs.c (main): Initialize initial-environment and
74 process-environment before generating from env, not after.
75
76 Handle --version reasonably in CANNOT_DUMP configuration.
77 * emacs.c (emacs_version, emacs_copyright): New string variables.
78 (Vemacs_version, Vemacs_copyright): New Lisp_Object variables.
79 (syms_of_emacs): Defvar them, and initialize them from the C
80 string variables.
81 (main): If initialization hasn't been done, print initial version
82 info from the C strings, instead of starting an interactive session.
83
842010-05-15 Eli Zaretskii <eliz@gnu.org>
85
86 * bidi.c (bidi_paragraph_init): Don't leave alone garbage values
87 of bidi_it->paragraph_dir. Call bidi_initialize if needed.
88 (bidi_paragraph_init): Remove redundant assertion that we are at
89 the beginning of a line after call to bidi_find_paragraph_start.
90
91 * xdisp.c (Fcurrent_bidi_paragraph_direction): New function.
92 (syms_of_xdisp): Defsubr it.
93
94 * Makefile.in: Fix MSDOS-related comments.
95
962010-05-15 Glenn Morris <rgm@gnu.org>
97
98 * Makefile.in (OLDXMENU_TARGET): New, set by configure.
99 (really-lwlib, really-oldXMenu): Always define.
100 ($OLDXMENU): Depend on $OLDXMENU_TARGET.
101
102 * Makefile.in: Simplify cpp conditional.
103
104 * Makefile.in (${ns_appdir}): Simplify using umask.
105
106 * Makefile.in (${ns_appdir}): Remove references to CVS-related files.
107
1082010-05-14 Stefan Monnier <monnier@iro.umontreal.ca>
109
110 * eval.c (specbind): Remove left-over duplicate test.
111 Disallow let-binding frame-local vars. Add comment.
112
1132010-05-14 Eli Zaretskii <eliz@gnu.org>
114
115 Make the cache of bidi iterator states dynamically allocated.
116 * bidi.c (bidi_cache_shrink): New function.
117 (bidi_init_it): Call it.
118 (bidi_cache_iterator_state): Enlarge the cache if needed.
119
120 * bidi.c (bidi_move_to_visually_next): Rename from
121 bidi_get_next_char_visually. All callers changed.
122
12010-05-14 Kenichi Handa <handa@m17n.org> 1232010-05-14 Kenichi Handa <handa@m17n.org>
2 124
3 * dispextern.h (struct composition_it): New member reversed_p. 125 * dispextern.h (struct composition_it): New member reversed_p.
@@ -6,10 +128,10 @@
6 ENDPOS < CHARPOS. 128 ENDPOS < CHARPOS.
7 (composition_reseat_it): Handle the case that ENDPOS < CHARPOS. 129 (composition_reseat_it): Handle the case that ENDPOS < CHARPOS.
8 Set CMP_IT->reversed_p. 130 Set CMP_IT->reversed_p.
9 (composition_update_it): Pay attention ot CMP_IT->reversed_p. 131 (composition_update_it): Pay attention to CMP_IT->reversed_p.
10 132
11 * xdisp.c (set_iterator_to_next): Call 133 * xdisp.c (set_iterator_to_next):
12 composition_compute_stop_pos with negative ENDPOS if we are 134 Call composition_compute_stop_pos with negative ENDPOS if we are
13 scanning backward. Call composition_compute_stop_pos if scan 135 scanning backward. Call composition_compute_stop_pos if scan
14 direction is changed. 136 direction is changed.
15 (next_element_from_buffer): Call composition_compute_stop_pos with 137 (next_element_from_buffer): Call composition_compute_stop_pos with
@@ -19,8 +141,7 @@
19 141
202010-05-14 Kenichi Handa <handa@m17n.org> 1422010-05-14 Kenichi Handa <handa@m17n.org>
21 143
22 * font.c (font_range): Return the range for the font found at 144 * font.c (font_range): Return the range for the font found at first.
23 first.
24 145
252010-05-14 Glenn Morris <rgm@gnu.org> 1462010-05-14 Glenn Morris <rgm@gnu.org>
26 147
@@ -102,7 +223,6 @@
102 * xdisp.c (init_iterator): Don't turn on bidi reordering in 223 * xdisp.c (init_iterator): Don't turn on bidi reordering in
103 unibyte buffers. See 224 unibyte buffers. See
104 http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html. 225 http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html.
105>>>>>>> MERGE-SOURCE
106 226
1072010-05-10 Glenn Morris <rgm@gnu.org> 2272010-05-10 Glenn Morris <rgm@gnu.org>
108 228
@@ -11480,7 +11600,7 @@
11480 definitions from xmenu.c. Suggested by Adrian Robert. 11600 definitions from xmenu.c. Suggested by Adrian Robert.
11481 11601
11482 * xmenu.c: Remove platform-independent menu definitions. 11602 * xmenu.c: Remove platform-independent menu definitions.
11483 (menu_items menu_items_inuse, menu_items_allocated) 11603 (menu_items, menu_items_inuse, menu_items_allocated)
11484 (menu_items_used, menu_items_n_panes) 11604 (menu_items_used, menu_items_n_panes)
11485 (menu_items_submenu_depth): Move to keyboard.h. 11605 (menu_items_submenu_depth): Move to keyboard.h.
11486 (init_menu_items, finish_menu_items, unuse_menu_items) 11606 (init_menu_items, finish_menu_items, unuse_menu_items)
diff --git a/src/Makefile.in b/src/Makefile.in
index 8c723d1c886..676d2a0834e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -65,6 +65,7 @@ config_h = config.h $(M_FILE) $(S_FILE)
65 65
66bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT} 66bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT}
67 67
68## ns-app if HAVE_NS, else empty.
68OTHER_FILES = @OTHER_FILES@ 69OTHER_FILES = @OTHER_FILES@
69 70
70CRT_DIR=@CRT_DIR@ 71CRT_DIR=@CRT_DIR@
@@ -114,6 +115,9 @@ LD_SWITCH_SYSTEM_EXTRA=@LD_SWITCH_SYSTEM_EXTRA@
114## Flags to pass to ld only for temacs. 115## Flags to pass to ld only for temacs.
115TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS) 116TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS)
116 117
118## $LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason).
119TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
120
117## Some systems define this to request special libraries. 121## Some systems define this to request special libraries.
118LIBS_SYSTEM=@LIBS_SYSTEM@ 122LIBS_SYSTEM=@LIBS_SYSTEM@
119 123
@@ -167,11 +171,43 @@ LIBXTR6=@LIBXTR6@
167## Only used if HAVE_X_WINDOWS. 171## Only used if HAVE_X_WINDOWS.
168LIBXT_OTHER=@LIBXT_OTHER@ 172LIBXT_OTHER=@LIBXT_OTHER@
169 173
174## Only used if HAVE_X11 && !USE_GTK.
175## really-lwlib if USE_X_TOOLKIT, else really-oldxmenu.
176OLDXMENU_TARGET=@OLDXMENU_TARGET@
177
178## If !HAVE_X11 || USE_GTK, empty.
179## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a.
180## Else ${oldXMenudir}libXMenu11.a.
181OLDXMENU=@OLDXMENU@
182
183## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty.
184## We use stamp-xmenu with these two deps to both ensure that lwlib
185## gets remade based on its dependencies in its own makefile,
186## and remake temacs if lwlib gets changed by this.
187OLDXMENU_DEPS=@OLDXMENU_DEPS@
188
189## If !HAVE_X11 && HAVE_X_WINDOWS, -lXMenu (this case no longer possible).
190## Else if !HAVE_X11 || USE_GTK, empty.
191## Else $(OLDXMENU).
192LIBXMENU=@LIBXMENU@
193
170XMENU_OBJ=@XMENU_OBJ@ 194XMENU_OBJ=@XMENU_OBJ@
171XOBJ=@XOBJ@ 195XOBJ=@XOBJ@
172 196
173TOOLKIT_LIBW=@TOOLKIT_LIBW@ 197TOOLKIT_LIBW=@TOOLKIT_LIBW@
174 198
199## Only used if HAVE_X11, in LIBX_OTHER.
200LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER)
201
202## If HAVE_X11, $(LIBXT) $(LIBX_EXTRA), else empty.
203LIBX_OTHER=@LIBX_OTHER@
204
205## LIBXMENU is nil if !HAVE_X_WINDOWS.
206## LD_SWITCH_X_SITE should not be used if not using X, but nothing
207## sets it at present, and if something ever does, it should be
208## configure, which should set it to nil in non-X builds.
209LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE)
210
175LIBSOUND= @LIBSOUND@ 211LIBSOUND= @LIBSOUND@
176CFLAGS_SOUND= @CFLAGS_SOUND@ 212CFLAGS_SOUND= @CFLAGS_SOUND@
177 213
@@ -184,7 +220,7 @@ WIDGET_OBJ=@WIDGET_OBJ@
184## sheap.o if CYGWIN, otherwise empty. 220## sheap.o if CYGWIN, otherwise empty.
185CYGWIN_OBJ=@CYGWIN_OBJ@ 221CYGWIN_OBJ=@CYGWIN_OBJ@
186 222
187## dosfns.o msdos.o if MSDOS. 223## dosfns.o msdos.o w16select.o if MSDOS.
188MSDOS_OBJ = 224MSDOS_OBJ =
189## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. 225## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS.
190MSDOS_X_OBJ = 226MSDOS_X_OBJ =
@@ -194,16 +230,18 @@ MSDOS_SUPPORT_REAL = ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
194## $MSDOS_SUPPORT_REAL if MSDOS. 230## $MSDOS_SUPPORT_REAL if MSDOS.
195MSDOS_SUPPORT = 231MSDOS_SUPPORT =
196 232
197ns_appdir=@ns_appdir@/ 233ns_appdir=@ns_appdir@
198ns_appbindir=@ns_appbindir@/ 234ns_appbindir=@ns_appbindir@
199ns_appsrc=@ns_appsrc@ 235ns_appsrc=@ns_appsrc@
200NS_OBJ=@NS_OBJ@ 236NS_OBJ=@NS_OBJ@
201NS_SUPPORT=@NS_SUPPORT@ 237NS_SUPPORT=@NS_SUPPORT@
202## Next two only set if NS_IMPL_GNUSTEP. 238## Only set if NS_IMPL_GNUSTEP.
203GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ 239GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
204GNUSTEP_SYSTEM_LIBRARIES=@GNUSTEP_SYSTEM_LIBRARIES@
205 240
206## Only used if HAVE_X_WINDOWS. 241## Empty if !HAVE_X_WINDOWS
242## xfont.o ftfont.o xftfont.o ftxfont.o if HAVE_XFT
243## xfont.o ftfont.o ftxfont.o if HAVE_FREETYPE
244## else xfont.o
207FONT_OBJ=@FONT_OBJ@ 245FONT_OBJ=@FONT_OBJ@
208 246
209## Used if HAVE_MOUSE. 247## Used if HAVE_MOUSE.
@@ -257,6 +295,10 @@ DEPFLAGS = -MMD -MF deps/$*.d
257/* If NS_IMPL_GNUSTEP, some definitions and includes are expanded here. */ 295/* If NS_IMPL_GNUSTEP, some definitions and includes are expanded here. */
258@NS_IMPL_GNUSTEP_INC@ 296@NS_IMPL_GNUSTEP_INC@
259 297
298/* FIXME move to LD_SWITCH_SYSTEM_TEMACS?
299 This uses ${CONFIG_SYSTEM_LIBS}, presumably set by the above include. */
300NS_IMPL_GNUSTEP_TEMACS_LDFLAGS=@NS_IMPL_GNUSTEP_TEMACS_LDFLAGS@
301
260/* DO NOT use -R. There is a special hack described in lastfile.c 302/* DO NOT use -R. There is a special hack described in lastfile.c
261 which is used instead. Some initialized data areas are modified 303 which is used instead. Some initialized data areas are modified
262 at initial startup, then labeled as part of the text area when 304 at initial startup, then labeled as part of the text area when
@@ -286,15 +328,6 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
286#endif 328#endif
287 $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< 329 $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
288 330
289#ifdef HAVE_X_WINDOWS
290OLDXMENU=@OLDXMENU@
291LIBXMENU=@LIBXMENU@
292LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER)
293LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE)
294LIBX_OTHER=@LIBX_OTHER@
295FONT_DRIVERS=$(FONT_OBJ)
296#endif /* HAVE_X_WINDOWS */
297
298 331
299/* A macro which other sections of Makefile can redefine to munge the 332/* A macro which other sections of Makefile can redefine to munge the
300 flags before they are passed to LD. This is helpful if you have 333 flags before they are passed to LD. This is helpful if you have
@@ -336,6 +369,12 @@ LD=ld
336 369
337#endif /* not ORDINARY_LINK */ 370#endif /* not ORDINARY_LINK */
338 371
372
373#ifdef NS_IMPL_GNUSTEP
374LD=$(CC) -rdynamic
375#endif
376
377
339/* lastfile must follow all files whose initialized data areas should 378/* lastfile must follow all files whose initialized data areas should
340 be dumped as pure by dump-emacs. */ 379 be dumped as pure by dump-emacs. */
341obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ 380obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
@@ -351,7 +390,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
351 process.o callproc.o \ 390 process.o callproc.o \
352 region-cache.o sound.o atimer.o \ 391 region-cache.o sound.o atimer.o \
353 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ 392 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
354 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS) 393 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
355 394
356/* Object files used on some machine or other. 395/* Object files used on some machine or other.
357 These go in the DOC file on all machines in case they are needed. */ 396 These go in the DOC file on all machines in case they are needed. */
@@ -360,31 +399,25 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
360 fontset.o dbusbind.o \ 399 fontset.o dbusbind.o \
361 nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ 400 nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
362 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ 401 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
363 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS) 402 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_OBJ)
364
365gmallocobj =
366rallocobj =
367vmlimitobj =
368#ifndef SYSTEM_MALLOC
369#ifndef DOUG_LEA_MALLOC
370gmallocobj = gmalloc.o
371#endif
372 403
373#ifdef REL_ALLOC 404/* gmalloc.o if !SYSTEM_MALLOC && !DOUG_LEA_MALLOC, else empty. */
374rallocobj = ralloc.o 405GMALLOC_OBJ=@GMALLOC_OBJ@
375#endif 406
407/* vm-limit.o if !SYSTEM_MALLOC, else empty. */
408VMLIMIT_OBJ=@VMLIMIT_OBJ@
376 409
377vmlimitobj = vm-limit.o 410/* ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty. */
378#endif /* !SYSTEM_MALLOC */ 411RALLOC_OBJ=@RALLOC_OBJ@
379 412
380/* Empty on Cygwin, lastfile.o elsewhere. */ 413/* Empty on Cygwin, lastfile.o elsewhere. */
381PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@ 414PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
382/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere. */ 415/* lastfile.o on Cygwin, empty elsewhere. */
383POST_ALLOC_OBJ=@POST_ALLOC_OBJ@ 416POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
384 417
385/* List of object files that make-docfile should not be told about. */ 418/* List of object files that make-docfile should not be told about. */
386otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \ 419otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
387 $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS) 420 $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
388 421
389/* This is the platform-specific list of Lisp files loaded into the 422/* This is the platform-specific list of Lisp files loaded into the
390 dumped Emacs. It is arranged like this because it is easier to generate 423 dumped Emacs. It is arranged like this because it is easier to generate
@@ -611,6 +644,7 @@ LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
611 644
612all: emacs${EXEEXT} $(OTHER_FILES) 645all: emacs${EXEEXT} $(OTHER_FILES)
613 646
647/* Does anyone ever pay attention to the load-path-shadows output here? */
614emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} 648emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
615#ifdef CANNOT_DUMP 649#ifdef CANNOT_DUMP
616 rm -f emacs${EXEEXT} 650 rm -f emacs${EXEEXT}
@@ -648,55 +682,42 @@ ${libsrc}make-docfile${EXEEXT}:
648buildobj.h: Makefile 682buildobj.h: Makefile
649 echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h 683 echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
650 684
651/* FIXME LOCALCPP not defined or mentioned anywhere. */ 685temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
652temacs${EXEEXT}: $(LOCALCPP) $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} 686 $(LD) YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
653#ifdef NS_IMPL_GNUSTEP 687 ${NS_IMPL_GNUSTEP_TEMACS_LDFLAGS} ) \
654 $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \ 688 ${TEMACS_LDFLAGS2} \
655 -L$(GNUSTEP_SYSTEM_LIBRARIES) -lgnustep-gui -lgnustep-base \ 689 -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES}
656 -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread ) -o temacs \
657 ${obj} ${otherobj} ${LIBES}
658#else
659 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
660 -o temacs ${START_FILES} ${obj} ${otherobj} \
661 ${LIBES}
662#endif
663 690
664prefix-args${EXEEXT}: prefix-args.o $(config_h) 691prefix-args${EXEEXT}: prefix-args.o $(config_h)
665 $(CC) $(LDFLAGS) prefix-args.o -o prefix-args 692 $(CC) $(LDFLAGS) prefix-args.o -o prefix-args
666 693
667#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK)
668
669/* We use stamp-xmenu with these two deps to both ensure that lwlib
670 gets remade based on its dependencies in its own makefile,
671 and remake temacs if lwlib gets changed by this. */
672stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
673 touch stamp-oldxmenu
674/* Supply an ordering for parallel make. */
675../src/$(OLDXMENU): ${OLDXMENU}
676
677#ifdef USE_X_TOOLKIT
678$(OLDXMENU): really-lwlib
679 694
695/* Only (possibly) used if HAVE_X11 && !USE_GTK, but no harm in always
696 defining. */
680really-lwlib: 697really-lwlib:
681 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ 698 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \
682 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' 699 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
683 @true /* make -t should not create really-lwlib. */ 700 @true /* make -t should not create really-lwlib. */
684.PHONY: really-lwlib 701.PHONY: really-lwlib
685#else /* not USE_X_TOOLKIT */
686$(OLDXMENU): really-oldXMenu
687 702
688really-oldXMenu: 703really-oldXMenu:
689 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ 704 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \
690 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' 705 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
691 @true /* make -t should not create really-oldXMenu. */ 706 @true /* make -t should not create really-oldXMenu. */
692.PHONY: really-oldXMenu 707.PHONY: really-oldXMenu
693#endif /* not USE_X_TOOLKIT */
694#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */
695 708
696/* We don''t really need this, but satisfy the dependency. */ 709/* We don''t really need this when OLDXMENU_DEPS is empty, but as
697stamp-oldxmenu: 710 things stand we need something to satisfy the temacs dependency. */
711stamp-oldxmenu: ${OLDXMENU_DEPS}
698 touch stamp-oldxmenu 712 touch stamp-oldxmenu
699#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */ 713
714/* HAVE_X11 implies HAVE_X_WINDOWS and HAVE_MENUS. */
715#if defined (HAVE_X11) && ! defined (USE_GTK)
716/* Supply an ordering for parallel make. */
717../src/$(OLDXMENU): ${OLDXMENU}
718
719$(OLDXMENU): $(OLDXMENU_TARGET)
720#endif /* HAVE_X11 && !USE_GTK */
700 721
701../config.status:: epaths.in 722../config.status:: epaths.in
702 @echo "The file epaths.h needs to be set up from epaths.in." 723 @echo "The file epaths.h needs to be set up from epaths.in."
@@ -972,20 +993,16 @@ textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
972${ns_appdir}: ${ns_appsrc} 993${ns_appdir}: ${ns_appsrc}
973 rm -fr ${ns_appdir} 994 rm -fr ${ns_appdir}
974 mkdir -p ${ns_appdir} 995 mkdir -p ${ns_appdir}
975 ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; tar xf - ) 996 ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
976 ( cd ${ns_appdir} ; for subdir in `find . -type d ! -name CVS -print` ; do \ 997#endif /* HAVE_NS */
977 chmod a+rx $${subdir} ; \
978 rm -rf $${subdir}/CVS ; \
979 rm -f $${subdir}/.cvsignore ; done ; )
980 998
999/* These are only used if HAVE_NS, but no harm in always defining them. */
981${ns_appbindir}Emacs: emacs${EXEEXT} 1000${ns_appbindir}Emacs: emacs${EXEEXT}
982 mkdir -p ${ns_appbindir} 1001 mkdir -p ${ns_appbindir}
983 cp -f emacs${EXEEXT} ${ns_appbindir}Emacs 1002 cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
984 1003
985ns-app: ${ns_appdir} ${ns_appbindir}Emacs 1004ns-app: ${ns_appdir} ${ns_appbindir}Emacs
986 1005
987#endif /* HAVE_NS */
988
989mostlyclean: 1006mostlyclean:
990 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a 1007 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
991 rm -f ../etc/DOC 1008 rm -f ../etc/DOC
@@ -994,9 +1011,8 @@ mostlyclean:
994clean: mostlyclean 1011clean: mostlyclean
995 rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} 1012 rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
996 -rm -rf deps 1013 -rm -rf deps
997#ifdef HAVE_NS 1014 test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir}
998 rm -fr ${ns_appdir} 1015
999#endif
1000/* bootstrap-clean is used to clean up just before a bootstrap. 1016/* bootstrap-clean is used to clean up just before a bootstrap.
1001 It should remove all files generated during a compilation/bootstrap, 1017 It should remove all files generated during a compilation/bootstrap,
1002 but not things like config.status or TAGS. */ 1018 but not things like config.status or TAGS. */
@@ -1076,7 +1092,9 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
1076/* Since the .el.elc rule cannot specify an extra dependency, we do it here. */ 1092/* Since the .el.elc rule cannot specify an extra dependency, we do it here. */
1077${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS) 1093${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS)
1078 1094
1079${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) 1095/* VCSWITNESS points to the file that holds info about the current checkout.
1096 We use it as a heuristic to decide when to rebuild loaddefs.el. */
1097${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
1080 cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe} 1098 cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe}
1081 1099
1082/* Dump an Emacs executable named bootstrap-emacs containing the 1100/* Dump an Emacs executable named bootstrap-emacs containing the
diff --git a/src/bidi.c b/src/bidi.c
index d4c7d2451d7..dbc95608fea 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -26,13 +26,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26 designed to be called once for every character in the buffer or 26 designed to be called once for every character in the buffer or
27 string. 27 string.
28 28
29 The main entry point is bidi_get_next_char_visually. Each time it 29 The main entry point is bidi_move_to_visually_next. Each time it
30 is called, it finds the next character in the visual order, and 30 is called, it finds the next character in the visual order, and
31 returns its information in a special structure. The caller is then 31 returns its information in a special structure. The caller is then
32 expected to process this character for display or any other 32 expected to process this character for display or any other
33 purposes, and call bidi_get_next_char_visually for the next 33 purposes, and call bidi_move_to_visually_next for the next
34 character. See the comments in bidi_get_next_char_visually for 34 character. See the comments in bidi_move_to_visually_next for more
35 more details about its algorithm that finds the next visual-order 35 details about its algorithm that finds the next visual-order
36 character by resolving their levels on the fly. 36 character by resolving their levels on the fly.
37 37
38 The two other entry points are bidi_paragraph_init and 38 The two other entry points are bidi_paragraph_init and
@@ -540,9 +540,11 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
540 540
541/* Caching the bidi iterator states. */ 541/* Caching the bidi iterator states. */
542 542
543static struct bidi_it bidi_cache[1000]; /* FIXME: make this dynamically allocated! */ 543#define BIDI_CACHE_CHUNK 200
544static int bidi_cache_idx; 544static struct bidi_it *bidi_cache;
545static int bidi_cache_last_idx; 545static size_t bidi_cache_size = 0;
546static int bidi_cache_idx; /* next unused cache slot */
547static int bidi_cache_last_idx; /* slot of last cache hit */
546 548
547static INLINE void 549static INLINE void
548bidi_cache_reset (void) 550bidi_cache_reset (void)
@@ -552,6 +554,17 @@ bidi_cache_reset (void)
552} 554}
553 555
554static INLINE void 556static INLINE void
557bidi_cache_shrink (void)
558{
559 if (bidi_cache_size > BIDI_CACHE_CHUNK)
560 {
561 bidi_cache_size = BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
562 bidi_cache = (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
563 }
564 bidi_cache_reset ();
565}
566
567static INLINE void
555bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) 568bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it)
556{ 569{
557 int current_scan_dir = bidi_it->scan_dir; 570 int current_scan_dir = bidi_it->scan_dir;
@@ -672,9 +685,13 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
672 if (idx < 0) 685 if (idx < 0)
673 { 686 {
674 idx = bidi_cache_idx; 687 idx = bidi_cache_idx;
675 /* Don't overrun the cache limit. */ 688 /* Enlarge the cache as needed. */
676 if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1) 689 if (idx >= bidi_cache_size)
677 abort (); 690 {
691 bidi_cache_size += BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
692 bidi_cache =
693 (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
694 }
678 /* Character positions should correspond to cache positions 1:1. 695 /* Character positions should correspond to cache positions 1:1.
679 If we are outside the range of cached positions, the cache is 696 If we are outside the range of cached positions, the cache is
680 useless and must be reset. */ 697 useless and must be reset. */
@@ -873,6 +890,9 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
873 EMACS_INT pos; 890 EMACS_INT pos;
874 bidi_type_t type; 891 bidi_type_t type;
875 892
893 if (!bidi_initialized)
894 bidi_initialize ();
895
876 /* If we are inside a paragraph separator, we are just waiting 896 /* If we are inside a paragraph separator, we are just waiting
877 for the separator to be exhausted; use the previous paragraph 897 for the separator to be exhausted; use the previous paragraph
878 direction. But don't do that if we have been just reseated, 898 direction. But don't do that if we have been just reseated,
@@ -896,11 +916,6 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
896 middle of it. Find where this paragraph starts. */ 916 middle of it. Find where this paragraph starts. */
897 bytepos = bidi_find_paragraph_start (pos, bytepos); 917 bytepos = bidi_find_paragraph_start (pos, bytepos);
898 918
899 /* We should always be at the beginning of a new line at this
900 point. */
901 if (!(bytepos == BEGV_BYTE || FETCH_CHAR (bytepos - 1) == '\n'))
902 abort ();
903
904 bidi_it->separator_limit = -1; 919 bidi_it->separator_limit = -1;
905 bidi_it->new_paragraph = 0; 920 bidi_it->new_paragraph = 0;
906 ch = FETCH_CHAR (bytepos); 921 ch = FETCH_CHAR (bytepos);
@@ -940,7 +955,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
940 /* Contrary to UAX#9 clause P3, we only default the paragraph 955 /* Contrary to UAX#9 clause P3, we only default the paragraph
941 direction to L2R if we have no previous usable paragraph 956 direction to L2R if we have no previous usable paragraph
942 direction. */ 957 direction. */
943 if (bidi_it->paragraph_dir == NEUTRAL_DIR) 958 if (bidi_it->paragraph_dir != L2R && bidi_it->paragraph_dir != R2L)
944 bidi_it->paragraph_dir = L2R; /* P3 and ``higher protocols'' */ 959 bidi_it->paragraph_dir = L2R; /* P3 and ``higher protocols'' */
945 if (bidi_it->paragraph_dir == R2L) 960 if (bidi_it->paragraph_dir == R2L)
946 bidi_it->level_stack[0].level = 1; 961 bidi_it->level_stack[0].level = 1;
@@ -990,6 +1005,7 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
990 bidi_it->prev_for_neutral.type_after_w1 = 1005 bidi_it->prev_for_neutral.type_after_w1 =
991 bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; 1006 bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT;
992 bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */ 1007 bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */
1008 bidi_cache_shrink ();
993} 1009}
994 1010
995/* Push the current embedding level and override status; reset the 1011/* Push the current embedding level and override status; reset the
@@ -1876,7 +1892,7 @@ bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, int end_flag)
1876} 1892}
1877 1893
1878void 1894void
1879bidi_get_next_char_visually (struct bidi_it *bidi_it) 1895bidi_move_to_visually_next (struct bidi_it *bidi_it)
1880{ 1896{
1881 int old_level, new_level, next_level; 1897 int old_level, new_level, next_level;
1882 struct bidi_it sentinel; 1898 struct bidi_it sentinel;
diff --git a/src/charset.c b/src/charset.c
index 18c0bbb6310..f83fa994536 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -567,7 +567,6 @@ load_charset_map_from_file (charset, mapfile, control_flag)
567 n_entries++; 567 n_entries++;
568 } 568 }
569 fclose (fp); 569 fclose (fp);
570 close (fd);
571 570
572 load_charset_map (charset, head, n_entries, control_flag); 571 load_charset_map (charset, head, n_entries, control_flag);
573 SAFE_FREE (); 572 SAFE_FREE ();
diff --git a/src/cmds.c b/src/cmds.c
index 5d450fe9a13..b8a65324e9f 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -57,8 +57,12 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
57} 57}
58 58
59DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p", 59DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p",
60 doc: /* Move point right N characters (left if N is negative). 60 doc: /* Move point N characters forward (backward if N is negative).
61On reaching end of buffer, stop and signal error. */) 61On reaching end or beginning of buffer, stop and signal error.
62
63Depending on the bidirectional context, the movement may be to the
64right or to the left on the screen. This is in contrast with
65\\[right-arrow-command], which see. */)
62 (n) 66 (n)
63 Lisp_Object n; 67 Lisp_Object n;
64{ 68{
@@ -93,8 +97,12 @@ On reaching end of buffer, stop and signal error. */)
93} 97}
94 98
95DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p", 99DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p",
96 doc: /* Move point left N characters (right if N is negative). 100 doc: /* Move point N characters backward (forward if N is negative).
97On attempt to pass beginning or end of buffer, stop and signal error. */) 101On attempt to pass beginning or end of buffer, stop and signal error.
102
103Depending on the bidirectional context, the movement may be to the
104right or to the left on the screen. This is in contrast with
105\\[left-arrow-command], which see. */)
98 (n) 106 (n)
99 Lisp_Object n; 107 Lisp_Object n;
100{ 108{
diff --git a/src/composite.c b/src/composite.c
index cbfb4aa66d3..f392053bac9 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1150,13 +1150,13 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
1150 /* Search backward for a pattern that may be composed and the 1150 /* Search backward for a pattern that may be composed and the
1151 position of (possibly) the last character of the match is 1151 position of (possibly) the last character of the match is
1152 closest to (but not after) START. The reason for the last 1152 closest to (but not after) START. The reason for the last
1153 character is that set_iterator_to_next works in reverse order 1153 character is that set_iterator_to_next works in reverse order,
1154 and, thus we must stop at the last character for composition 1154 and thus we must stop at the last character for composition
1155 check. */ 1155 check. */
1156 unsigned char *p; 1156 unsigned char *p;
1157 int len; 1157 int len;
1158 /* limit byte position used in fast_looking_at. This is the 1158 /* Limit byte position used in fast_looking_at. This is the
1159 byte position of the next character of START. */ 1159 byte position of the character after START. */
1160 EMACS_INT limit; 1160 EMACS_INT limit;
1161 1161
1162 if (NILP (string)) 1162 if (NILP (string))
@@ -1191,7 +1191,7 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
1191 len = 1; 1191 len = 1;
1192 if (len > 0) 1192 if (len > 0)
1193 { 1193 {
1194 /* Make CPOS points the last character of match. 1194 /* Make CPOS point to the last character of match.
1195 Note that LEN is byte-length. */ 1195 Note that LEN is byte-length. */
1196 bpos += len; 1196 bpos += len;
1197 if (NILP (string)) 1197 if (NILP (string))
diff --git a/src/config.in b/src/config.in
index 35530943682..99a95d7f15d 100644
--- a/src/config.in
+++ b/src/config.in
@@ -1179,8 +1179,6 @@ typedef unsigned size_t;
1179 1179
1180#ifdef HAVE_X11R6 1180#ifdef HAVE_X11R6
1181#define HAVE_X_I18N 1181#define HAVE_X_I18N
1182#elif !defined X11R5_INHIBIT_I18N
1183#define HAVE_X_I18N
1184#endif 1182#endif
1185 1183
1186/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */ 1184/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */
@@ -1200,11 +1198,7 @@ typedef unsigned size_t;
1200 that the stack is continuous. */ 1198 that the stack is continuous. */
1201#ifdef __GNUC__ 1199#ifdef __GNUC__
1202# ifndef GC_SETJMP_WORKS 1200# ifndef GC_SETJMP_WORKS
1203 /* GC_SETJMP_WORKS is nearly always appropriate for GCC -- 1201 /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */
1204 see NON_SAVING_SETJMP in the target descriptions. */
1205 /* Exceptions (see NON_SAVING_SETJMP in target description) are
1206 SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
1207 Fixme: Deal with SVR3. */
1208# define GC_SETJMP_WORKS 1 1202# define GC_SETJMP_WORKS 1
1209# endif 1203# endif
1210# ifndef GC_LISP_OBJECT_ALIGNMENT 1204# ifndef GC_LISP_OBJECT_ALIGNMENT
diff --git a/src/dispextern.h b/src/dispextern.h
index 1b631493705..8e8da36daea 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2868,7 +2868,7 @@ extern EMACS_INT tool_bar_button_relief;
2868/* Defined in bidi.c */ 2868/* Defined in bidi.c */
2869 2869
2870extern void bidi_init_it P_ ((EMACS_INT, EMACS_INT, struct bidi_it *)); 2870extern void bidi_init_it P_ ((EMACS_INT, EMACS_INT, struct bidi_it *));
2871extern void bidi_get_next_char_visually P_ ((struct bidi_it *)); 2871extern void bidi_move_to_visually_next P_ ((struct bidi_it *));
2872extern void bidi_paragraph_init P_ ((bidi_dir_t, struct bidi_it *)); 2872extern void bidi_paragraph_init P_ ((bidi_dir_t, struct bidi_it *));
2873extern int bidi_mirror_char P_ ((int)); 2873extern int bidi_mirror_char P_ ((int));
2874 2874
diff --git a/src/emacs.c b/src/emacs.c
index 6b19b45d0b0..c0ef926da75 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -87,6 +87,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
87#endif 87#endif
88#endif 88#endif
89 89
90const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
91const char emacs_version[] = "24.0.50";
92
90extern void malloc_warning P_ ((char *)); 93extern void malloc_warning P_ ((char *));
91extern void set_time_zone_rule P_ ((char *)); 94extern void set_time_zone_rule P_ ((char *));
92#ifdef HAVE_INDEX 95#ifdef HAVE_INDEX
@@ -180,6 +183,10 @@ Lisp_Object Vprevious_system_messages_locale;
180Lisp_Object Vsystem_time_locale; 183Lisp_Object Vsystem_time_locale;
181Lisp_Object Vprevious_system_time_locale; 184Lisp_Object Vprevious_system_time_locale;
182 185
186/* Copyright and version info. The version number may be updated by
187 Lisp code. */
188Lisp_Object Vemacs_copyright, Vemacs_version;
189
183/* If non-zero, emacs should not attempt to use a window-specific code, 190/* If non-zero, emacs should not attempt to use a window-specific code,
184 but instead should use the virtual terminal under which it was started. */ 191 but instead should use the virtual terminal under which it was started. */
185int inhibit_window_system; 192int inhibit_window_system;
@@ -802,35 +809,43 @@ main (int argc, char **argv)
802 argc = 0; 809 argc = 0;
803 while (argv[argc]) argc++; 810 while (argv[argc]) argc++;
804 811
805 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) 812 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
806 /* We don't know the version number unless this is a dumped Emacs.
807 So ignore --version otherwise. */
808 && initialized)
809 { 813 {
810 Lisp_Object tem, tem2; 814 const char *version, *copyright;
811 tem = Fsymbol_value (intern_c_string ("emacs-version")); 815 if (initialized)
812 tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
813 if (!STRINGP (tem))
814 {
815 fprintf (stderr, "Invalid value of `emacs-version'\n");
816 exit (1);
817 }
818 if (!STRINGP (tem2))
819 { 816 {
820 fprintf (stderr, "Invalid value of `emacs-copyright'\n"); 817 Lisp_Object tem, tem2;
821 exit (1); 818 tem = Fsymbol_value (intern_c_string ("emacs-version"));
819 tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
820 if (!STRINGP (tem))
821 {
822 fprintf (stderr, "Invalid value of `emacs-version'\n");
823 exit (1);
824 }
825 if (!STRINGP (tem2))
826 {
827 fprintf (stderr, "Invalid value of `emacs-copyright'\n");
828 exit (1);
829 }
830 else
831 {
832 version = SDATA (tem);
833 copyright = SDATA (tem2);
834 }
822 } 835 }
823 else 836 else
824 { 837 {
825 printf ("GNU Emacs %s\n", SDATA (tem)); 838 version = emacs_version;
826 printf ("%s\n", SDATA(tem2)); 839 copyright = emacs_copyright;
827 printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
828 printf ("You may redistribute copies of Emacs\n");
829 printf ("under the terms of the GNU General Public License.\n");
830 printf ("For more information about these matters, ");
831 printf ("see the file named COPYING.\n");
832 exit (0);
833 } 840 }
841 printf ("GNU Emacs %s\n", version);
842 printf ("%s\n", copyright);
843 printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
844 printf ("You may redistribute copies of Emacs\n");
845 printf ("under the terms of the GNU General Public License.\n");
846 printf ("For more information about these matters, ");
847 printf ("see the file named COPYING.\n");
848 exit (0);
834 } 849 }
835 if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) 850 if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args))
836 if (chdir (ch_to_dir) == -1) 851 if (chdir (ch_to_dir) == -1)
@@ -1528,6 +1543,11 @@ main (int argc, char **argv)
1528 ns_init_paths (); 1543 ns_init_paths ();
1529#endif 1544#endif
1530 1545
1546 /* Initialize and GC-protect Vinitial_environment and
1547 Vprocess_environment before set_initial_environment fills them
1548 in. */
1549 if (!initialized)
1550 syms_of_callproc ();
1531 /* egetenv is a pretty low-level facility, which may get called in 1551 /* egetenv is a pretty low-level facility, which may get called in
1532 many circumstances; it seems flimsy to put off initializing it 1552 many circumstances; it seems flimsy to put off initializing it
1533 until calling init_callproc. */ 1553 until calling init_callproc. */
@@ -1577,7 +1597,6 @@ main (int argc, char **argv)
1577 syms_of_callint (); 1597 syms_of_callint ();
1578 syms_of_casefiddle (); 1598 syms_of_casefiddle ();
1579 syms_of_casetab (); 1599 syms_of_casetab ();
1580 syms_of_callproc ();
1581 syms_of_category (); 1600 syms_of_category ();
1582 syms_of_ccl (); 1601 syms_of_ccl ();
1583 syms_of_character (); 1602 syms_of_character ();
@@ -2577,6 +2596,14 @@ This is nil during initialization. */);
2577 doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */); 2596 doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */);
2578 inhibit_x_resources = 0; 2597 inhibit_x_resources = 0;
2579 2598
2599 DEFVAR_LISP ("emacs-copyright", &Vemacs_copyright,
2600 doc: /* Short copyright string for this version of Emacs. */);
2601 Vemacs_copyright = build_string (emacs_copyright);
2602
2603 DEFVAR_LISP ("emacs-version", &Vemacs_version,
2604 doc: /* Version numbers of this version of Emacs. */);
2605 Vemacs_version = build_string (emacs_version);
2606
2580 /* Make sure IS_DAEMON starts up as false. */ 2607 /* Make sure IS_DAEMON starts up as false. */
2581 daemon_pipe[1] = 0; 2608 daemon_pipe[1] = 0;
2582} 2609}
diff --git a/src/eval.c b/src/eval.c
index 2a0330acc38..199c4705736 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3308,6 +3308,21 @@ grow_specpdl ()
3308 specpdl_ptr = specpdl + count; 3308 specpdl_ptr = specpdl + count;
3309} 3309}
3310 3310
3311/* specpdl_ptr->symbol is a field which describes which variable is
3312 let-bound, so it can be properly undone when we unbind_to.
3313 It can have the following two shapes:
3314 - SYMBOL : if it's a plain symbol, it means that we have let-bound
3315 a symbol that is not buffer-local (at least at the time
3316 the let binding started). Note also that it should not be
3317 aliased (i.e. when let-binding V1 that's aliased to V2, we want
3318 to record V2 here).
3319 - (SYMBOL WHERE . BUFFER) : this means that it is a let-binding for
3320 variable SYMBOL which can be buffer-local. WHERE tells us
3321 which buffer is affected (or nil if the let-binding affects the
3322 global value of the variable) and BUFFER tells us which buffer was
3323 current (i.e. if WHERE is non-nil, then BUFFER==WHERE, otherwise
3324 BUFFER did not yet have a buffer-local value). */
3325
3311void 3326void
3312specbind (symbol, value) 3327specbind (symbol, value)
3313 Lisp_Object symbol, value; 3328 Lisp_Object symbol, value;
@@ -3339,7 +3354,10 @@ specbind (symbol, value)
3339 set_internal (symbol, value, Qnil, 1); 3354 set_internal (symbol, value, Qnil, 1);
3340 break; 3355 break;
3341 } 3356 }
3342 case SYMBOL_LOCALIZED: case SYMBOL_FORWARDED: 3357 case SYMBOL_LOCALIZED:
3358 if (SYMBOL_BLV (sym)->frame_local)
3359 error ("Frame-local vars cannot be let-bound");
3360 case SYMBOL_FORWARDED:
3343 { 3361 {
3344 Lisp_Object ovalue = find_symbol_value (symbol); 3362 Lisp_Object ovalue = find_symbol_value (symbol);
3345 specpdl_ptr->func = 0; 3363 specpdl_ptr->func = 0;
@@ -3376,6 +3394,7 @@ specbind (symbol, value)
3376 /* FIXME: The third value `current_buffer' is only used in 3394 /* FIXME: The third value `current_buffer' is only used in
3377 let_shadows_buffer_binding_p which is itself only used 3395 let_shadows_buffer_binding_p which is itself only used
3378 in set_internal for local_if_set. */ 3396 in set_internal for local_if_set. */
3397 eassert (NILP (where) || EQ (where, cur_buf));
3379 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf)); 3398 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf));
3380 3399
3381 /* If SYMBOL is a per-buffer variable which doesn't have a 3400 /* If SYMBOL is a per-buffer variable which doesn't have a
@@ -3460,13 +3479,10 @@ unbind_to (count, value)
3460 Fset_default (symbol, this_binding.old_value); 3479 Fset_default (symbol, this_binding.old_value);
3461 /* If `where' is non-nil, reset the value in the appropriate 3480 /* If `where' is non-nil, reset the value in the appropriate
3462 local binding, but only if that binding still exists. */ 3481 local binding, but only if that binding still exists. */
3463 else if (BUFFERP (where)) 3482 else if (BUFFERP (where)
3464 { 3483 ? !NILP (Flocal_variable_p (symbol, where))
3465 if (BUFFERP (where) 3484 : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
3466 ? !NILP (Flocal_variable_p (symbol, where)) 3485 set_internal (symbol, this_binding.old_value, where, 1);
3467 : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
3468 set_internal (symbol, this_binding.old_value, where, 1);
3469 }
3470 } 3486 }
3471 /* If variable has a trivial value (no forwarding), we can 3487 /* If variable has a trivial value (no forwarding), we can
3472 just set it. No need to check for constant symbols here, 3488 just set it. No need to check for constant symbols here,
diff --git a/src/lisp.h b/src/lisp.h
index 7d329cc754c..b4ff446b064 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -310,11 +310,10 @@ LISP_MAKE_RVALUE (Lisp_Object o)
310 return o; 310 return o;
311} 311}
312#else 312#else
313/* This isn't quite right - it keeps the argument as an lvalue. 313/* This is more portable to pre-C99 non-GCC compilers, but for
314 Making it const via casting would help avoid code actually 314 backwards compatibility GCC still accepts an old GNU extension
315 modifying the location in question, but the casting could cover 315 which caused this to only generate a warning. */
316 other type-related bugs. */ 316#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o))
317#define LISP_MAKE_RVALUE(o) (o)
318#endif 317#endif
319 318
320#else /* USE_LISP_UNION_TYPE */ 319#else /* USE_LISP_UNION_TYPE */
@@ -1461,9 +1460,9 @@ struct Lisp_Float
1461 }; 1460 };
1462 1461
1463#ifdef HIDE_LISP_IMPLEMENTATION 1462#ifdef HIDE_LISP_IMPLEMENTATION
1464#define XFLOAT_DATA(f) (XFLOAT (f)->u.data_ + 0) 1463#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data_ : XFLOAT (f)->u.data_)
1465#else 1464#else
1466#define XFLOAT_DATA(f) (XFLOAT (f)->u.data + 0) 1465#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data)
1467/* This should be used only in alloc.c, which always disables 1466/* This should be used only in alloc.c, which always disables
1468 HIDE_LISP_IMPLEMENTATION. */ 1467 HIDE_LISP_IMPLEMENTATION. */
1469#define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n)) 1468#define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n))
diff --git a/src/m/ia64.h b/src/m/ia64.h
index acf6c25844f..03ec37b4269 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -48,11 +48,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48/* Convert that into an integer that is 100 for a load average of 1.0 */ 48/* Convert that into an integer that is 100 for a load average of 1.0 */
49#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 49#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
50 50
51#ifdef __ELF__
52#undef UNEXEC
53#define UNEXEC unexelf.o
54#endif
55
56#ifndef NOT_C_CODE 51#ifndef NOT_C_CODE
57 52
58#ifdef REL_ALLOC 53#ifdef REL_ALLOC
diff --git a/src/m/template.h b/src/m/template.h
index 9b8d2d63055..2807cd913ec 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -69,11 +69,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
69 reasonable place to select for it is in the machine description file. */ 69 reasonable place to select for it is in the machine description file. */
70#define NO_SOCK_SIGIO 70#define NO_SOCK_SIGIO
71 71
72/* After adding support for a new system, modify the large case 72/* After adding support for a new machine, modify the large case
73 statement in the `configure' script to recognize reasonable 73 statement in configure.in to recognize reasonable
74 configuration names, and add a description of the system to 74 configuration names, and add a description of the system to
75 `etc/MACHINES'. 75 `etc/MACHINES'.
76 76
77 Check for any tests of $machine in configure.in, and add an entry
78 for the new machine if needed.
79
77 If you've just fixed a problem in an existing configuration file, 80 If you've just fixed a problem in an existing configuration file,
78 you should also check `etc/MACHINES' to make sure its descriptions 81 you should also check `etc/MACHINES' to make sure its descriptions
79 of known problems in that configuration should be updated. */ 82 of known problems in that configuration should be updated. */
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 3aa2dc16f42..674f00f1d09 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -97,7 +97,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
97/* This is used in list_system_processes. */ 97/* This is used in list_system_processes. */
98#define HAVE_PROCFS 1 98#define HAVE_PROCFS 1
99 99
100
101/* Define CLASH_DETECTION if you want lock files to be written 100/* Define CLASH_DETECTION if you want lock files to be written
102 so that Emacs can tell instantly when you try to modify 101 so that Emacs can tell instantly when you try to modify
103 a file that someone else has modified in his Emacs. */ 102 a file that someone else has modified in his Emacs. */
@@ -126,11 +125,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
126#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ 125#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
127 ((FILE)->_pptr - (FILE)->_pbase) 126 ((FILE)->_pptr - (FILE)->_pbase)
128#endif /* !_IO_STDIO_H && ! __UCLIBC__ */ 127#endif /* !_IO_STDIO_H && ! __UCLIBC__ */
129#endif /* emacs */
130 128
131#ifdef emacs
132#define INTERRUPT_INPUT 129#define INTERRUPT_INPUT
133#endif 130#endif /* emacs */
134 131
135#define SYSV_SYSTEM_DIR /* use dirent.h */ 132#define SYSV_SYSTEM_DIR /* use dirent.h */
136 133
@@ -147,11 +144,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
147 144
148#define NARROWPROTO 1 145#define NARROWPROTO 1
149 146
150/* Use mmap directly for allocating larger buffers. */
151#ifdef DOUG_LEA_MALLOC
152#undef REL_ALLOC
153#endif
154
155/* Tell that garbage collector that setjmp is known to save all 147/* Tell that garbage collector that setjmp is known to save all
156 registers relevant for conservative garbage collection in the jmp_buf. */ 148 registers relevant for conservative garbage collection in the jmp_buf. */
157/* Not all the architectures are tested, but there are Debian packages 149/* Not all the architectures are tested, but there are Debian packages
diff --git a/src/s/gnu.h b/src/s/gnu.h
index 9f6fe52a5de..cb4c4a9d807 100644
--- a/src/s/gnu.h
+++ b/src/s/gnu.h
@@ -1,6 +1,7 @@
1/* Definitions file for GNU Emacs running on the GNU Hurd. 1/* Definitions file for GNU Emacs running on the GNU Hurd.
2 Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -28,11 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 29
29#define SIGNALS_VIA_CHARACTERS 30#define SIGNALS_VIA_CHARACTERS
30 31
31/* Use mmap directly for allocating larger buffers. */
32#ifdef DOUG_LEA_MALLOC
33#undef REL_ALLOC
34#endif
35
36/* GNU needs its own crt0, and libc defines data_start. */ 32/* GNU needs its own crt0, and libc defines data_start. */
37#define ORDINARY_LINK 33#define ORDINARY_LINK
38#define DATA_START ({ extern int data_start; (char *) &data_start; }) 34#define DATA_START ({ extern int data_start; (char *) &data_start; })
diff --git a/src/s/template.h b/src/s/template.h
index 16df03092d2..f355d67b8c6 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -133,10 +133,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
133/* ============================================================ */ 133/* ============================================================ */
134 134
135/* After adding support for a new system, modify the large case 135/* After adding support for a new system, modify the large case
136 statement in the `configure' script to recognize reasonable 136 statement in configure.in to recognize reasonable
137 configuration names, and add a description of the system to 137 configuration names, and add a description of the system to
138 `etc/MACHINES'. 138 `etc/MACHINES'.
139 139
140 Check for any tests of $opsys in configure.in, and add an entry
141 for the new system if needed.
142
140 If you've just fixed a problem in an existing configuration file, 143 If you've just fixed a problem in an existing configuration file,
141 you should also check `etc/MACHINES' to make sure its descriptions 144 you should also check `etc/MACHINES' to make sure its descriptions
142 of known problems in that configuration should be updated. */ 145 of known problems in that configuration should be updated. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 16936b977fd..6b3097c9a1a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -184,7 +184,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
184 reordering engine which is called by set_iterator_to_next and 184 reordering engine which is called by set_iterator_to_next and
185 returns the next character to display in the visual order. See 185 returns the next character to display in the visual order. See
186 commentary on bidi.c for more details. As far as redisplay is 186 commentary on bidi.c for more details. As far as redisplay is
187 concerned, the effect of calling bidi_get_next_char_visually, the 187 concerned, the effect of calling bidi_move_to_visually_next, the
188 main interface of the reordering engine, is that the iterator gets 188 main interface of the reordering engine, is that the iterator gets
189 magically placed on the buffer or string position that is to be 189 magically placed on the buffer or string position that is to be
190 displayed next. In other words, a linear iteration through the 190 displayed next. In other words, a linear iteration through the
@@ -3918,7 +3918,7 @@ handle_invisible_prop (it)
3918 } 3918 }
3919 do 3919 do
3920 { 3920 {
3921 bidi_get_next_char_visually (&it->bidi_it); 3921 bidi_move_to_visually_next (&it->bidi_it);
3922 } 3922 }
3923 while (it->stop_charpos <= it->bidi_it.charpos 3923 while (it->stop_charpos <= it->bidi_it.charpos
3924 && it->bidi_it.charpos < newpos); 3924 && it->bidi_it.charpos < newpos);
@@ -5276,7 +5276,7 @@ iterate_out_of_display_property (it)
5276 while (it->bidi_it.charpos >= BEGV 5276 while (it->bidi_it.charpos >= BEGV
5277 && it->prev_stop <= it->bidi_it.charpos 5277 && it->prev_stop <= it->bidi_it.charpos
5278 && it->bidi_it.charpos < CHARPOS (it->position)) 5278 && it->bidi_it.charpos < CHARPOS (it->position))
5279 bidi_get_next_char_visually (&it->bidi_it); 5279 bidi_move_to_visually_next (&it->bidi_it);
5280 /* Record the stop_pos we just crossed, for when we cross it 5280 /* Record the stop_pos we just crossed, for when we cross it
5281 back, maybe. */ 5281 back, maybe. */
5282 if (it->bidi_it.charpos > CHARPOS (it->position)) 5282 if (it->bidi_it.charpos > CHARPOS (it->position))
@@ -6307,29 +6307,14 @@ set_iterator_to_next (it, reseat_p)
6307 else if (! it->cmp_it.reversed_p) 6307 else if (! it->cmp_it.reversed_p)
6308 { 6308 {
6309 /* Composition created while scanning forward. */ 6309 /* Composition created while scanning forward. */
6310 /* Update IT's char/byte positions to point the first 6310 /* Update IT's char/byte positions to point to the first
6311 character of the next grapheme cluster, or to the 6311 character of the next grapheme cluster, or to the
6312 character visually after the current composition. */ 6312 character visually after the current composition. */
6313#if 0
6314 /* Is it ok to do this directly? */
6315 IT_CHARPOS (*it) += it->cmp_it.nchars;
6316 IT_BYTEPOS (*it) += it->cmp_it.nbytes;
6317#else
6318 /* Or do we have to call bidi_get_next_char_visually
6319 repeatedly (perhaps not to confuse some internal
6320 state of bidi_it)? At least we must do this if we
6321 have consumed all grapheme clusters in the current
6322 composition because the next character will be in the
6323 different bidi level. */
6324 for (i = 0; i < it->cmp_it.nchars; i++) 6313 for (i = 0; i < it->cmp_it.nchars; i++)
6325 bidi_get_next_char_visually (&it->bidi_it); 6314 bidi_move_to_visually_next (&it->bidi_it);
6326 /* BTW, it seems that the name
6327 bidi_get_next_char_visually is confusing because
6328 it sounds like not advancing character position.
6329 How about bidi_set_iterator_to_next? */
6330 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 6315 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
6331 IT_CHARPOS (*it) = it->bidi_it.charpos; 6316 IT_CHARPOS (*it) = it->bidi_it.charpos;
6332#endif 6317
6333 if (it->cmp_it.to < it->cmp_it.nglyphs) 6318 if (it->cmp_it.to < it->cmp_it.nglyphs)
6334 { 6319 {
6335 /* Proceed to the next grapheme cluster. */ 6320 /* Proceed to the next grapheme cluster. */
@@ -6337,7 +6322,7 @@ set_iterator_to_next (it, reseat_p)
6337 } 6322 }
6338 else 6323 else
6339 { 6324 {
6340 /* No more grapheme cluster in this composition. 6325 /* No more grapheme clusters in this composition.
6341 Find the next stop position. */ 6326 Find the next stop position. */
6342 EMACS_INT stop = it->stop_charpos; 6327 EMACS_INT stop = it->stop_charpos;
6343 if (it->bidi_it.scan_dir < 0) 6328 if (it->bidi_it.scan_dir < 0)
@@ -6351,10 +6336,10 @@ set_iterator_to_next (it, reseat_p)
6351 else 6336 else
6352 { 6337 {
6353 /* Composition created while scanning backward. */ 6338 /* Composition created while scanning backward. */
6354 /* Update IT's char/byte positions to point the last 6339 /* Update IT's char/byte positions to point to the last
6355 character of the previous grapheme cluster, or the 6340 character of the previous grapheme cluster, or the
6356 character visually after the current composition. */ 6341 character visually after the current composition. */
6357 bidi_get_next_char_visually (&it->bidi_it); 6342 bidi_move_to_visually_next (&it->bidi_it);
6358 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 6343 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
6359 IT_CHARPOS (*it) = it->bidi_it.charpos; 6344 IT_CHARPOS (*it) = it->bidi_it.charpos;
6360 6345
@@ -6365,7 +6350,7 @@ set_iterator_to_next (it, reseat_p)
6365 } 6350 }
6366 else 6351 else
6367 { 6352 {
6368 /* No more grapheme cluster in this composition. 6353 /* No more grapheme clusters in this composition.
6369 Find the next stop position. */ 6354 Find the next stop position. */
6370 EMACS_INT stop = it->stop_charpos; 6355 EMACS_INT stop = it->stop_charpos;
6371 if (it->bidi_it.scan_dir < 0) 6356 if (it->bidi_it.scan_dir < 0)
@@ -6393,13 +6378,13 @@ set_iterator_to_next (it, reseat_p)
6393 direction (a.k.a. its base embedding level). */ 6378 direction (a.k.a. its base embedding level). */
6394 if (it->bidi_it.new_paragraph) 6379 if (it->bidi_it.new_paragraph)
6395 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6380 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6396 bidi_get_next_char_visually (&it->bidi_it); 6381 bidi_move_to_visually_next (&it->bidi_it);
6397 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 6382 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
6398 IT_CHARPOS (*it) = it->bidi_it.charpos; 6383 IT_CHARPOS (*it) = it->bidi_it.charpos;
6399 if (prev_scan_dir != it->bidi_it.scan_dir) 6384 if (prev_scan_dir != it->bidi_it.scan_dir)
6400 { 6385 {
6401 /* As scan direction was changed, we must re-compute 6386 /* As the scan direction was changed, we must
6402 the stop position for composition. */ 6387 re-compute the stop position for composition. */
6403 EMACS_INT stop = it->stop_charpos; 6388 EMACS_INT stop = it->stop_charpos;
6404 if (it->bidi_it.scan_dir < 0) 6389 if (it->bidi_it.scan_dir < 0)
6405 stop = -1; 6390 stop = -1;
@@ -6873,7 +6858,7 @@ next_element_from_buffer (it)
6873 /* If we are at the beginning of a line, we can produce the 6858 /* If we are at the beginning of a line, we can produce the
6874 next element right away. */ 6859 next element right away. */
6875 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6860 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6876 bidi_get_next_char_visually (&it->bidi_it); 6861 bidi_move_to_visually_next (&it->bidi_it);
6877 } 6862 }
6878 else 6863 else
6879 { 6864 {
@@ -6891,7 +6876,7 @@ next_element_from_buffer (it)
6891 { 6876 {
6892 /* Now return to buffer position where we were asked to 6877 /* Now return to buffer position where we were asked to
6893 get the next display element, and produce that. */ 6878 get the next display element, and produce that. */
6894 bidi_get_next_char_visually (&it->bidi_it); 6879 bidi_move_to_visually_next (&it->bidi_it);
6895 } 6880 }
6896 while (it->bidi_it.bytepos != orig_bytepos 6881 while (it->bidi_it.bytepos != orig_bytepos
6897 && it->bidi_it.bytepos < ZV_BYTE); 6882 && it->bidi_it.bytepos < ZV_BYTE);
@@ -7115,7 +7100,7 @@ next_element_from_composition (it)
7115 /* Resync the bidi iterator with IT's new position. 7100 /* Resync the bidi iterator with IT's new position.
7116 FIXME: this doesn't support bidirectional text. */ 7101 FIXME: this doesn't support bidirectional text. */
7117 while (it->bidi_it.charpos < IT_CHARPOS (*it)) 7102 while (it->bidi_it.charpos < IT_CHARPOS (*it))
7118 bidi_get_next_char_visually (&it->bidi_it); 7103 bidi_move_to_visually_next (&it->bidi_it);
7119 } 7104 }
7120 return 0; 7105 return 0;
7121 } 7106 }
@@ -7131,7 +7116,7 @@ next_element_from_composition (it)
7131 correct (struct glyph)->charpos. */ 7116 correct (struct glyph)->charpos. */
7132 int i; 7117 int i;
7133 for (i = 0; i < it->cmp_it.nchars - 1; i++) 7118 for (i = 0; i < it->cmp_it.nchars - 1; i++)
7134 bidi_get_next_char_visually (&it->bidi_it); 7119 bidi_move_to_visually_next (&it->bidi_it);
7135 IT_CHARPOS (*it) = it->bidi_it.charpos; 7120 IT_CHARPOS (*it) = it->bidi_it.charpos;
7136 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 7121 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
7137 it->position = it->current.pos; 7122 it->position = it->current.pos;
@@ -18256,6 +18241,84 @@ display_line (it)
18256 return row->displays_text_p; 18241 return row->displays_text_p;
18257} 18242}
18258 18243
18244DEFUN ("current-bidi-paragraph-direction", Fcurrent_bidi_paragraph_direction,
18245 Scurrent_bidi_paragraph_direction, 0, 1, 0,
18246 doc: /* Return paragraph direction at point in BUFFER.
18247Value is either `left-to-right' or `right-to-left'.
18248If BUFFER is omitted or nil, it defaults to the current buffer.
18249
18250Paragraph direction determines how the text in the paragraph is displayed.
18251In left-to-right paragraphs, text begins at the left margin of the window
18252and the reading direction is generally left to right. In right-to-left
18253paragraphs, text begins at the right margin and is read from right to left.
18254
18255See also `bidi-paragraph-direction'. */)
18256 (buffer)
18257 Lisp_Object buffer;
18258{
18259 struct buffer *buf;
18260 struct buffer *old;
18261
18262 if (NILP (buffer))
18263 buf = current_buffer;
18264 else
18265 {
18266 CHECK_BUFFER (buffer);
18267 buf = XBUFFER (buffer);
18268 old = current_buffer;
18269 }
18270
18271 if (NILP (buf->bidi_display_reordering))
18272 return Qleft_to_right;
18273 else if (!NILP (buf->bidi_paragraph_direction))
18274 return buf->bidi_paragraph_direction;
18275 else
18276 {
18277 /* Determine the direction from buffer text. We could try to
18278 use current_matrix if it is up to date, but this seems fast
18279 enough as it is. */
18280 struct bidi_it itb;
18281 EMACS_INT pos = BUF_PT (buf);
18282 EMACS_INT bytepos = BUF_PT_BYTE (buf);
18283
18284 if (buf != current_buffer)
18285 set_buffer_temp (buf);
18286 /* Find previous non-empty line. */
18287 if (pos >= ZV && pos > BEGV)
18288 {
18289 pos--;
18290 bytepos = CHAR_TO_BYTE (pos);
18291 }
18292 while (FETCH_BYTE (bytepos) == '\n')
18293 {
18294 if (bytepos <= BEGV_BYTE)
18295 break;
18296 bytepos--;
18297 pos--;
18298 }
18299 while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
18300 bytepos--;
18301 itb.charpos = pos;
18302 itb.bytepos = bytepos;
18303 itb.first_elt = 1;
18304
18305 bidi_paragraph_init (NEUTRAL_DIR, &itb);
18306 if (buf != current_buffer)
18307 set_buffer_temp (old);
18308 switch (itb.paragraph_dir)
18309 {
18310 case L2R:
18311 return Qleft_to_right;
18312 break;
18313 case R2L:
18314 return Qright_to_left;
18315 break;
18316 default:
18317 abort ();
18318 }
18319 }
18320}
18321
18259 18322
18260 18323
18261/*********************************************************************** 18324/***********************************************************************
@@ -25955,6 +26018,7 @@ syms_of_xdisp ()
25955#endif 26018#endif
25956 defsubr (&Sformat_mode_line); 26019 defsubr (&Sformat_mode_line);
25957 defsubr (&Sinvisible_p); 26020 defsubr (&Sinvisible_p);
26021 defsubr (&Scurrent_bidi_paragraph_direction);
25958 26022
25959 staticpro (&Qmenu_bar_update_hook); 26023 staticpro (&Qmenu_bar_update_hook);
25960 Qmenu_bar_update_hook = intern_c_string ("menu-bar-update-hook"); 26024 Qmenu_bar_update_hook = intern_c_string ("menu-bar-update-hook");