diff --git a/ChangeLog b/ChangeLog index ab69ce7b457..eb3ed433d0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,71 @@ +2010-05-18 Glenn Morris + + * configure.in (POST_ALLOC_OBJ) [cygwin]: Omit vm-limit.o. + (POST_ALLOC_OBJ) [!cygwin]: Set to empty. + + * config.bat (RALLOC_OBJ): Edit to empty if sys_malloc. + * configure.in (REL_ALLOC): Unset on gnu, gnu-linux if DOUG_LEA_MALLOC. + (RALLOC_OBJ): New output variable. + + * config.bat (GMALLOC_OBJ, VMLIMIT_OBJ): Edit to empty if sys_malloc. + * configure.in (GMALLOC_OBJ, VMLIMIT_OBJ): New output variables. + +2010-05-17 Stefan Monnier + + * Makefile.in (src): Provide the name of the VCS file that witnesses + a pull. + ($(srcdir)/src/config.in): Handle accidental removal of src/config.in. + +2010-05-17 Glenn Morris + + * configure.in (OLDXMENU_DEPS): New output variable. + +2010-05-16 Glenn Morris + + * configure.in (ns_appbindir, ns_appresdir): Set using $ns_appdir. + + * configure.in (ns_appdir, ns_appbindir): Add trailing "/" to value. + * Makefile.in (install-arch-dep): Update for above change. + + * Makefile.in (ns_appdir): Remove. + (install-arch-dep): Test $ns_appresdir instead of $ns_appdir. + + * configure.in (TEMACS_LDFLAGS2): New output variable. + + * configure.in (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New output variable. + (START_FILES): Set to empty if NS_IMPL_GNUSTEP. + (GNUSTEP_SYSTEM_HEADERS, GNUSTEP_SYSTEM_LIBRARIES): Do not output, + nothing uses. + +2010-05-16 Dan Nicolaescu + + * configure.in: Remove references to usg5-4 and bsd-common, $opsys + does not use them. + (X11R5_INHIBIT_I18N): Remove, unused. + +2010-05-15 Glenn Morris + + * configure.in (LIBXMENU): Set to empty if !HAVE_X_WINDOWS. + + * configure.in (FONT_OBJ): Set to empty if !HAVE_X_WINDOWS. + +2010-05-15 Ken Raeburn + + * configure.in: Look for version string in its new location. + +2010-05-15 Eli Zaretskii + + * config.bat: Remove support for DJGPP v1.x. + +2010-05-15 Glenn Morris + + * configure.in (OLDXMENU_TARGET): New output variable. + + * Makefile.in (install-arch-dep): Update odd NS rule for Emacs version. + + * Makefile.in (install-arch-indep): Remove references to RCS, CVS, + and other files that no longer exist. + 2010-05-14 Glenn Morris * configure.in (cpp_undefs): Add mktime, register, X11. diff --git a/Makefile.in b/Makefile.in index 71d00243fed..cd677d3295d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -164,7 +164,6 @@ VPATH=@srcdir@ x_default_search_path=@x_default_search_path@ # Location to install Emacs.app under NeXT/Open/GNUstep / Cocoa -ns_appdir=@ns_appdir@ ns_appbindir=@ns_appbindir@ ns_appresdir=@ns_appresdir@ @@ -336,9 +335,13 @@ src: Makefile FRC CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="$$boot"; \ fi; + if [ -r .bzr/checkout/dirstate ]; then \ + vcswitness="$$(pwd)/.bzr/checkout/dirstate"; \ + fi; \ cd $@; $(MAKE) all $(MFLAGS) \ CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ - LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="" + LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="" \ + VCSWITNESS="$$vcswitness" blessmail: Makefile src FRC cd lib-src; $(MAKE) maybe-blessmail $(MFLAGS) \ @@ -370,7 +373,11 @@ $(srcdir)/configure: $(AUTOCONF_INPUTS) cd ${srcdir} && autoconf $(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in - @true + @ # Usually, there's no need to rebuild src/config.in just + @ # because stamp-h.in has changed (since building stamp-h.in + @ # refreshes config.in as well), but if config.in is missing + @ # then we really need to do something more. + [ -r "$@" ] || ( cd ${srcdir} && autoheader ) $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS) cd ${srcdir} && autoheader rm -f $(srcdir)/src/stamp-h.in @@ -418,17 +425,22 @@ install-arch-dep: mkdir ${INSTALL_DATA} lib-src/$$f $(DESTDIR)${archlibdir}/$$f; \ else true; fi ; \ done - if test "${ns_appdir}" != ""; then \ + if test "${ns_appresdir}" != ""; then \ ( cd ${ns_appresdir} ; \ if test -d share/emacs ; then dir=share/emacs/*/*; $(MV_DIRS); fi;\ if test -d share/info ; then dir=share/info; $(MV_DIRS) ; fi ; \ rm -fr share ) ; \ - ( cd ${ns_appbindir}/libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \ + ( cd ${ns_appbindir}libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \ rm -fr emacs ) ; \ - ( cd ${ns_appbindir}/bin ; rm -f emacs emacs-23* ; \ + ( cd ${ns_appbindir}bin ; rm -f emacs emacs-24* ; \ ln -sf ../libexec/* .) ; \ else true ; fi +## FIXME is the emacs-24* bit above really necessary and correct? +## What if I have 24.1 and 24.2 installed at the same time? +## In any case, it should use something like echo $version | sed 's/\..*//' +## instead of hard-coding a version. + ## http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01672.html ## Needs to be the user running install, so configure can't set it. set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ @@ -476,11 +488,8 @@ install-arch-indep: mkdir info install-etc | (cd $${dest}; umask 022; \ tar -xvf - && cat > /dev/null) || exit 1; \ find $${dest} -exec chown $${installuser} {} ';' ;\ - for subdir in `find $${dest} -type d ! -name RCS ! -name CVS -print` ; do \ + for subdir in `find $${dest} -type d -print` ; do \ chmod a+rx $${subdir} ; \ - rm -rf $${subdir}/RCS ; \ - rm -rf $${subdir}/CVS ; \ - rm -f $${subdir}/.cvsignore ; \ rm -f $${subdir}/.gitignore ; \ rm -f $${subdir}/.arch-inventory ; \ rm -f $${subdir}/.DS_Store ; \ @@ -492,7 +501,6 @@ install-arch-indep: mkdir info install-etc rm -f $${subdir}/[mM]akefile*.c $${subdir}/[mM]akefile*[.-]in \ $${subdir}/[mM]akefile ; \ rm -f $${subdir}/ChangeLog* ; \ - rm -f $${subdir}/dired.todo ; \ done) ; \ done -rm -f $(DESTDIR)${lispdir}/subdirs.el diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 1f42eeb9528..cffbcf95e80 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -22,6 +22,9 @@ NS_IMPL_GNUSTEP Compile support for GNUstep implementation of NS GUI API. NS_IMPL_COCOA Compile support for Cocoa (Apple) implementation of NS GUI API. HAVE_X11 Compile support for the X11 GUI. HAVE_X_WINDOWS Compile support for X Window system + (It looks like, nowadays, if HAVE_X11 is set, HAVE_X_WINDOWS must + be, and vice versa. At least, this is true for configure, and + msdos; not sure about nt.) USE_LUCID Use the Lucid toolkit for menus&scrollbars. Requires HAVE_X11. USE_MOTIF Use the Motif toolkit for menus&scrollbars. Requires HAVE_X11. USE_GTK Use the Gtk toolkit for menus&scrollbars. Requires HAVE_X11. diff --git a/admin/ChangeLog b/admin/ChangeLog index 9ffdcd47d40..54be4a7fec3 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,13 @@ +2010-05-15 Ken Raeburn + + * admin.el (set-version, set-copyright): Update emacs.c instead of + version.el. + + * make-tarball.txt: Update filename list in step 6. + + * quick-install-emacs: Scan emacs.c instead of version.el for + version string. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/admin/admin.el b/admin/admin.el index 984f3649b2c..f2cf008f475 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -60,8 +60,8 @@ Root must be the root of an Emacs source tree." (interactive "DEmacs root directory: \nsVersion number: ") (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (error "%s doesn't seem to be the root of an Emacs source tree" root)) - (set-version-in-file root "lisp/version.el" version - (rx (and "emacs-version" (0+ space) + (set-version-in-file root "src/emacs.c" version + (rx (and "emacs_version" (0+ (not (in ?\"))) ?\" (submatch (1+ (not (in ?\")))) ?\"))) (set-version-in-file root "README" version (rx (and "version" (1+ space) @@ -184,8 +184,8 @@ Root must be the root of an Emacs source tree." (format-time-string "%Y"))))) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (error "%s doesn't seem to be the root of an Emacs source tree" root)) - (set-version-in-file root "lisp/version.el" copyright - (rx (and "emacs-copyright" (0+ space) + (set-version-in-file root "src/emacs.c" copyright + (rx (and "emacs_copyright" (0+ (not (in ?\"))) ?\" (submatch (1+ (not (in ?\")))) ?\"))) (set-version-in-file root "lib-src/ebrowse.c" copyright (rx (and "emacs_copyright" (0+ (not (in ?\"))) diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index 9979aa03ca6..f685dd5e50f 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -31,7 +31,7 @@ For each step, check for possible errors. make bootstrap 6. Commit configure, README, doc/emacs/emacs.texi, - doc/lispref/elisp.texi, etc/AUTHORS, lisp/version.el, nt/emacs.rc, + doc/lispref/elisp.texi, etc/AUTHORS, src/emacs.c, nt/emacs.rc, and lisp/cus-edit.el (if modified). Copy lisp/loaddefs.el to lisp/ldefs-boot.el and commit lisp/ldefs-boot.el. For a release, also commit the ChangeLog files in all directories. diff --git a/admin/notes/bzr b/admin/notes/bzr new file mode 100644 index 00000000000..c66cdd98a3c --- /dev/null +++ b/admin/notes/bzr @@ -0,0 +1,40 @@ +NOTES ON COMMITTING TO EMACS'S BAZAAR REPO -*- outline -*- + +* Install changes only on one branch, let them get merged elsewhere if needed. +In particular, install bug-fixes only on the release branch (if there +is one) and let them get synced to the trunk; do not install them by +hand on the trunk as well. E.g. if there is an active "emacs-23" branch +and you have a bug-fix appropriate for the next Emacs-23.x release, +install it only on the emacs-23 branch, not on the trunk as well. + +Installing things manually into more than one branch makes merges more +difficult. + +http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01124.html + +* Backporting a bug-fix from the trunk to a branch (e.g. "emacs-23"). +Label the commit as a backport, e.g. by starting the commit message with +"Backport:". This is helpful for the person merging the release branch +to the trunk. + +http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00262.html + +* Installing changes from your personal branches. +If your branch has only a single commit, or many different real +commits, it is fine to do a merge. If your branch has only a very +small number of "real" commits, but several "merge from trunks", it is +preferred that you take your branch's diff, apply it to the trunk, and +commit directly, not merge. This keeps the history cleaner. + +In general, when working on some feature in a separate branch, it is +preferable not to merge from trunk until you are done with the +feature. Unless you really need some change that was done on the +trunk while you were developing on the branch, you don't really need +those merges; just merge once, when you are done with the feature, and +Bazaar will take care of the rest. Bazaar is much better in this than +CVS, so interim merges are unnecessary. + +Or use shelves; or rebase; or do something else. See the thread for +yet another fun excursion into the exciting world of version control. + +http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00086.html diff --git a/admin/quick-install-emacs b/admin/quick-install-emacs index b912ed4e3ff..d603d8fd0d6 100755 --- a/admin/quick-install-emacs +++ b/admin/quick-install-emacs @@ -171,7 +171,7 @@ test x"$SRC" = x && { SRC="`get_config_var srcdir`" || exit 4 ; } test x"$prefix" = x && { prefix="`get_config_var prefix`" || exit 4 ; } test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; } -VERSION=`grep 'defconst[ ]*emacs-version' $SRC/lisp/version.el \ +VERSION=`grep 'char emacs_version' $SRC/src/emacs.c \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` DST_SHARE="$prefix/share/emacs/$VERSION" diff --git a/config.bat b/config.bat index 0482d4f15f0..20b8b285e59 100644 --- a/config.bat +++ b/config.bat @@ -23,7 +23,7 @@ rem ---------------------------------------------------------------------- rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS: rem rem + msdos version 3 or better. -rem + DJGPP version 1.12maint1 or later (version 2.03 or later recommended). +rem + DJGPP version 2.0 or later (version 2.03 or later recommended). rem + make utility that allows breaking of the 128 chars limit on rem command lines. ndmake (as of version 4.5) won't work due to a rem line length limit. The make that comes with DJGPP does work (and is @@ -125,11 +125,10 @@ rm -f junk.c junk junk.exe Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed! Goto End :go32Ok -set djgpp_ver=1 -If ErrorLevel 20 set djgpp_ver=2 +set djgpp_ver=2 +If Not ErrorLevel 20 Echo To build 'Emacs' you need DJGPP v2.0 or later! +If Not ErrorLevel 20 Goto End rm -f junk.c junk junk.exe -rem The v1.x build does not need djecho -if "%DJGPP_VER%" == "1" Goto djechoOk rem DJECHO is used by the top-level Makefile in the v2.x build Echo Checking whether 'djecho' is available... redir -o Nul -eo djecho -o junk.$$$ foo @@ -159,12 +158,7 @@ sed -e '' config.in > config.tmp if "%X11%" == "" goto src4 sed -f ../msdos/sed2x.inp config.tmp :src4 -if "%DJGPP_VER%" == "2" Goto src41 -sed -f ../msdos/sed2.inp config.h2 -goto src42 -:src41 sed -f ../msdos/sed2v2.inp config.h2 -:src42 Rem See if DECL_ALIGN can be supported with this GCC rm -f junk.c junk.o junk junk.exe echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo; >junk.c @@ -198,12 +192,7 @@ if exist dir.h ren dir.h vmsdir.h rem Create "makefile" from "makefile.in". rm -f Makefile junk.c sed -e "1,/== start of cpp stuff ==/s@^##*[ ].*$@@" junk.c -If "%DJGPP_VER%" == "1" Goto mfV1 gcc -E -traditional junk.c | sed -f ../msdos/sed1v2.inp >Makefile -goto mfDone -:mfV1 -gcc -E -traditional junk.c | sed -f ../msdos/sed1.inp >Makefile -:mfDone rm -f junk.c if "%X11%" == "" goto src5 @@ -212,6 +201,13 @@ sed -f ../msdos/sed1x.inp Makefile rm -f makefile.tmp :src5 +if "%sys_malloc%" == "" goto src5a +sed -e "/^GMALLOC_OBJ *=/s/gmalloc.o//" makefile.tmp +sed -e "/^VMLIMIT_OBJ *=/s/vm-limit.o//" makefile.tmp2 +sed -e "/^RALLOC_OBJ *=/s/ralloc.o//" Makefile +rm -f makefile.tmp makefile.tmp2 +:src5a + if "%nodebug%" == "" goto src6 sed -e "/^CFLAGS *=/s/ *-gcoff//" makefile.tmp sed -e "/^LDFLAGS *=/s/=/=-s/" Makefile @@ -221,12 +217,7 @@ cd .. rem ---------------------------------------------------------------------- Echo Configuring the library source directory... cd lib-src -If "%DJGPP_VER%" == "2" goto libsrc-v2 -sed -f ../msdos/sed3.inp Makefile -Goto libsrc2 -:libsrc-v2 sed -f ../msdos/sed3v2.inp Makefile -:libsrc2 if "%X11%" == "" goto libsrc2a mv Makefile makefile.tmp sed -f ../msdos/sed3x.inp Makefile @@ -272,7 +263,6 @@ rem ---------------------------------------------------------------------- Echo Configuring the main directory... If Exist .dir-locals.el update .dir-locals.el _dir-locals.el If Exist src\.dbxinit update src/.dbxinit src/_dbxinit -If "%DJGPP_VER%" == "1" goto mainv1 Echo Looking for the GDB init file... If Exist src\.gdbinit update src/.gdbinit src/_gdbinit If Exist src\_gdbinit goto gdbinitOk @@ -287,8 +277,6 @@ goto End :gdbinitOk Echo Looking for the GDB init file...found copy msdos\mainmake.v2 Makefile >nul -:mainv1 -If "%DJGPP_VER%" == "1" copy msdos\mainmake Makefile >nul rem ---------------------------------------------------------------------- goto End :SmallEnv diff --git a/configure b/configure index 0a1c2ee3d3b..5cc425413cd 100755 --- a/configure +++ b/configure @@ -718,10 +718,14 @@ XMKMF LD_SWITCH_X_SITE_AUX LD_SWITCH_X_SITE_AUX_RPATH NS_IMPL_GNUSTEP_INC +NS_IMPL_GNUSTEP_TEMACS_LDFLAGS +TEMACS_LDFLAGS2 NS_OBJ NS_SUPPORT LIB_STANDARD HAVE_XSERVER +GMALLOC_OBJ +VMLIMIT_OBJ RSVG_CFLAGS RSVG_LIBS GTK_CFLAGS @@ -743,7 +747,6 @@ LIBOTF_CFLAGS LIBOTF_LIBS M17N_FLT_CFLAGS M17N_FLT_LIBS -FONT_OBJ FREETYPE_CFLAGS FREETYPE_LIBS LIBXPM @@ -796,18 +799,20 @@ ns_appdir ns_appbindir ns_appresdir ns_appsrc -GNUSTEP_SYSTEM_HEADERS -GNUSTEP_SYSTEM_LIBRARIES GNU_OBJC_CFLAGS OTHER_FILES +FONT_OBJ XMENU_OBJ XOBJ WIDGET_OBJ TOOLKIT_LIBW LIBXT_OTHER +OLDXMENU_TARGET OLDXMENU LIBXMENU LIBX_OTHER +OLDXMENU_DEPS +RALLOC_OBJ CYGWIN_OBJ PRE_ALLOC_OBJ POST_ALLOC_OBJ @@ -9932,22 +9937,24 @@ HAVE_NS=no NS_IMPL_COCOA=no NS_IMPL_GNUSTEP=no NS_IMPL_GNUSTEP_INC= +NS_IMPL_GNUSTEP_TEMACS_LDFLAGS= tmp_CPPFLAGS="$CPPFLAGS" tmp_CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c" +TEMACS_LDFLAGS2="\${LDFLAGS}" if test "${with_ns}" != no; then if test "${opsys}" = darwin; then NS_IMPL_COCOA=yes - ns_appdir=`pwd`/nextstep/Emacs.app - ns_appbindir=`pwd`/nextstep/Emacs.app/Contents/MacOS - ns_appresdir=`pwd`/nextstep/Emacs.app/Contents/Resources + ns_appdir=`pwd`/nextstep/Emacs.app/ + ns_appbindir=${ns_appdir}Contents/MacOS/ + ns_appresdir=${ns_appdir}Contents/Resources ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base elif test -f $GNUSTEP_CONFIG_FILE; then NS_IMPL_GNUSTEP=yes - ns_appdir=`pwd`/nextstep/Emacs.app - ns_appbindir=`pwd`/nextstep/Emacs.app - ns_appresdir=`pwd`/nextstep/Emacs.app/Resources + ns_appdir=`pwd`/nextstep/Emacs.app/ + ns_appbindir=${ns_appdir} + ns_appresdir=${ns_appdir}Resources ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)" GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)" @@ -9959,11 +9966,14 @@ include $GNUSTEP_MAKEFILES/Additional/base.make include $GNUSTEP_MAKEFILES/Additional/gui.make shared=no " + NS_IMPL_GNUSTEP_TEMACS_LDFLAGS="-L${GNUSTEP_SYSTEM_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc \${CONFIG_SYSTEM_LIBS} -lpthread" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}" LIB_STANDARD= + START_FILES= + TEMACS_LDFLAGS2= fi if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for AppKit/AppKit.h" >&5 @@ -10152,6 +10162,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + + NS_OBJ= NS_SUPPORT= if test "${HAVE_NS}" = yes; then @@ -10504,11 +10516,20 @@ $as_echo "$emacs_cv_var___after_morecore_hook" >&6; } if test $emacs_cv_var___after_morecore_hook = no; then doug_lea_malloc=no fi + if test "${system_malloc}" = "yes"; then GNU_MALLOC=no GNU_MALLOC_reason=" (The GNU allocators don't work with this system configuration.)" + GMALLOC_OBJ= + VMLIMIT_OBJ= +else + test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o + VMLIMIT_OBJ=vm-limit.o fi + + + if test "$doug_lea_malloc" = "yes" ; then if test "$GNU_MALLOC" = yes ; then GNU_MALLOC_reason=" @@ -10519,6 +10540,14 @@ cat >>confdefs.h <<\_ACEOF #define DOUG_LEA_MALLOC 1 _ACEOF + + ## Use mmap directly for allocating larger buffers. + ## FIXME this comes from src/s/{gnu,gnu-linux}.h: + ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif + ## Does the AC_FUNC_MMAP test below make this check unecessary? + case "$opsys" in + gnu*) REL_ALLOC=no ;; + esac fi if test x"${REL_ALLOC}" = x; then @@ -14701,14 +14730,6 @@ else HAVE_M17N_FLT=no fi -FONT_OBJ=xfont.o -if test "$HAVE_XFT" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" -elif test "$HAVE_FREETYPE" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o" -fi - - ### End of font-backend (under X11) section. @@ -21601,7 +21622,7 @@ HAVE_LIBNCURSES=yes ## Use terminfo instead of termcap? ## Note only system files NOT using terminfo are: -## bsd-common, freebsd < 40000, ms-w32, msdos, netbsd, and +## freebsd < 40000, ms-w32, msdos, netbsd, and ## darwin|gnu without ncurses. TERMINFO=no LIBS_TERMCAP= @@ -21610,7 +21631,7 @@ case "$opsys" in ## hpux10-20: Use the system provided termcap(3) library. ## openbsd: David Mazieres says this ## is necessary. Otherwise Emacs dumps core when run -nw. - aix4-2|cygwin|hpux*|irix6-5|openbsd|usg5-4|sol2*|unixware) TERMINFO=yes ;; + aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;; ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2. ## The ncurses library has been moved out of the System framework in @@ -26308,16 +26329,16 @@ $as_echo "$as_me: error: GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEM fi #### Find out which version of Emacs this is. -version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \ +version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` if test x"${version}" = x; then - { { $as_echo "$as_me:$LINENO: error: can't find current emacs version in \`${srcdir}/lisp/version.el'." >&5 -$as_echo "$as_me: error: can't find current emacs version in \`${srcdir}/lisp/version.el'." >&2;} + { { $as_echo "$as_me:$LINENO: error: can't find current emacs version in \`${srcdir}/src/emacs.c'." >&5 +$as_echo "$as_me: error: can't find current emacs version in \`${srcdir}/src/emacs.c'." >&2;} { (exit 1); exit 1; }; } fi if test x"${version}" != x"$PACKAGE_VERSION"; then - { $as_echo "$as_me:$LINENO: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/lisp/version.el'." >&5 -$as_echo "$as_me: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/lisp/version.el'." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/src/emacs.c'." >&5 +$as_echo "$as_me: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/src/emacs.c'." >&2;} fi ### Specify what sort of things we'll be editing into Makefile and config.h. @@ -26366,8 +26387,6 @@ fi - - cat >>confdefs.h <<_ACEOF #define EMACS_CONFIGURATION "${canonical}" _ACEOF @@ -26390,6 +26409,7 @@ _ACEOF XMENU_OBJ= XOBJ= +FONT_OBJ= if test "${HAVE_X_WINDOWS}" = "yes" ; then cat >>confdefs.h <<\_ACEOF @@ -26398,10 +26418,18 @@ _ACEOF XMENU_OBJ=xmenu.o XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + FONT_OBJ=xfont.o + if test "$HAVE_XFT" = "yes"; then + FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" + elif test "$HAVE_FREETYPE" = "yes"; then + FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o" + fi + fi + WIDGET_OBJ= MOTIF_LIBW= if test "${USE_X_TOOLKIT}" != "none" ; then @@ -26456,11 +26484,14 @@ esac if test "$USE_X_TOOLKIT" = "none"; then LIBXT_OTHER="\$(LIBXSM)" + OLDXMENU_TARGET="really-oldXMenu" else LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext" + OLDXMENU_TARGET="really-lwlib" fi + ## The X Menu stuff is present in the X10 distribution, but missing ## from X11. If we have X10, just use the installed library; ## otherwise, use our own copy. @@ -26478,21 +26509,30 @@ _ACEOF fi LIBXMENU="\$(OLDXMENU)" LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)" + OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}" else OLDXMENU= - LIBXMENU="-lXMenu" + ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?). + if test "${HAVE_X_WINDOWS}" = "yes"; then + LIBXMENU="-lXMenu" + else + LIBXMENU= + fi LIBX_OTHER= + OLDXMENU_DEPS= fi if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then OLDXMENU= LIBXMENU= + OLDXMENU_DEPS= fi + if test "${HAVE_MENUS}" = "yes" ; then cat >>confdefs.h <<\_ACEOF @@ -26500,6 +26540,7 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi + if test "${GNU_MALLOC}" = "yes" ; then cat >>confdefs.h <<\_ACEOF @@ -26507,12 +26548,16 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi + +RALLOC_OBJ= if test "${REL_ALLOC}" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define REL_ALLOC 1 _ACEOF + + test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o fi @@ -26520,11 +26565,11 @@ if test "$opsys" = "cygwin"; then CYGWIN_OBJ="sheap.o" ## Cygwin differs because of its unexec(). PRE_ALLOC_OBJ= - POST_ALLOC_OBJ="lastfile.o vm-limit.o" + POST_ALLOC_OBJ=lastfile.o else CYGWIN_OBJ= PRE_ALLOC_OBJ=lastfile.o - POST_ALLOC_OBJ="\$(vmlimitobj)" + POST_ALLOC_OBJ= fi @@ -26722,6 +26767,9 @@ test "${exec_prefix}" != NONE && # the C preprocessor to some helpful value like 1, or maybe the empty # string. Needless to say consequent macro substitutions are less # than conducive to the makefile finding the correct directory. +# src/Makefile.in used to treat X11 as equivalent to HAVE_X11. +# But nothing in Emacs defines X11, and everywhere else uses HAVE_X11, +# so that cannot have been doing anything. cpp_undefs="`echo $srcdir $configuration $canonical unix mktime register X11 | sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \ -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g'`" diff --git a/configure.in b/configure.in index 2475caae053..57fb0548f53 100644 --- a/configure.in +++ b/configure.in @@ -1453,22 +1453,27 @@ HAVE_NS=no NS_IMPL_COCOA=no NS_IMPL_GNUSTEP=no NS_IMPL_GNUSTEP_INC= +NS_IMPL_GNUSTEP_TEMACS_LDFLAGS= tmp_CPPFLAGS="$CPPFLAGS" tmp_CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c" +TEMACS_LDFLAGS2="\${LDFLAGS}" +dnl I don't think it's especially important, but src/Makefile.in +dnl (now the only user of ns_appdir) used to go to the trouble of adding a +dnl trailing "/" to it, so now we do it here. if test "${with_ns}" != no; then if test "${opsys}" = darwin; then NS_IMPL_COCOA=yes - ns_appdir=`pwd`/nextstep/Emacs.app - ns_appbindir=`pwd`/nextstep/Emacs.app/Contents/MacOS - ns_appresdir=`pwd`/nextstep/Emacs.app/Contents/Resources + ns_appdir=`pwd`/nextstep/Emacs.app/ + ns_appbindir=${ns_appdir}Contents/MacOS/ + ns_appresdir=${ns_appdir}Contents/Resources ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base elif test -f $GNUSTEP_CONFIG_FILE; then NS_IMPL_GNUSTEP=yes - ns_appdir=`pwd`/nextstep/Emacs.app - ns_appbindir=`pwd`/nextstep/Emacs.app - ns_appresdir=`pwd`/nextstep/Emacs.app/Resources + ns_appdir=`pwd`/nextstep/Emacs.app/ + ns_appbindir=${ns_appdir} + ns_appresdir=${ns_appdir}Resources ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base dnl FIXME sourcing this 3 times in subshells seems inefficient. GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)" @@ -1481,11 +1486,15 @@ include $GNUSTEP_MAKEFILES/Additional/base.make include $GNUSTEP_MAKEFILES/Additional/gui.make shared=no " + dnl Presumably ${CONFIG_SYSTEM_LIBS} is defined by above includes. + NS_IMPL_GNUSTEP_TEMACS_LDFLAGS="-L${GNUSTEP_SYSTEM_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc \${CONFIG_SYSTEM_LIBS} -lpthread" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}" LIB_STANDARD= + START_FILES= + TEMACS_LDFLAGS2= fi AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes], [AC_MSG_ERROR([`--with-ns' was specified, but the include @@ -1500,6 +1509,8 @@ shared=no fi fi AC_SUBST(NS_IMPL_GNUSTEP_INC) +AC_SUBST(NS_IMPL_GNUSTEP_TEMACS_LDFLAGS) +AC_SUBST(TEMACS_LDFLAGS2) NS_OBJ= NS_SUPPORT= @@ -1581,11 +1592,20 @@ AC_CACHE_CHECK(whether __after_morecore_hook exists, if test $emacs_cv_var___after_morecore_hook = no; then doug_lea_malloc=no fi + if test "${system_malloc}" = "yes"; then GNU_MALLOC=no GNU_MALLOC_reason=" (The GNU allocators don't work with this system configuration.)" + GMALLOC_OBJ= + VMLIMIT_OBJ= +else + test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o + VMLIMIT_OBJ=vm-limit.o fi +AC_SUBST(GMALLOC_OBJ) +AC_SUBST(VMLIMIT_OBJ) + if test "$doug_lea_malloc" = "yes" ; then if test "$GNU_MALLOC" = yes ; then GNU_MALLOC_reason=" @@ -1593,6 +1613,14 @@ if test "$doug_lea_malloc" = "yes" ; then fi AC_DEFINE(DOUG_LEA_MALLOC, 1, [Define to 1 if you are using the GNU C Library.]) + + ## Use mmap directly for allocating larger buffers. + ## FIXME this comes from src/s/{gnu,gnu-linux}.h: + ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif + ## Does the AC_FUNC_MMAP test below make this check unecessary? + case "$opsys" in + gnu*) REL_ALLOC=no ;; + esac fi if test x"${REL_ALLOC}" = x; then @@ -2231,14 +2259,6 @@ else HAVE_M17N_FLT=no fi -FONT_OBJ=xfont.o -if test "$HAVE_XFT" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" -elif test "$HAVE_FREETYPE" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o" -fi -AC_SUBST(FONT_OBJ) - ### End of font-backend (under X11) section. AC_SUBST(FREETYPE_CFLAGS) @@ -2620,7 +2640,7 @@ HAVE_LIBNCURSES=yes ## Use terminfo instead of termcap? ## Note only system files NOT using terminfo are: -## bsd-common, freebsd < 40000, ms-w32, msdos, netbsd, and +## freebsd < 40000, ms-w32, msdos, netbsd, and ## darwin|gnu without ncurses. TERMINFO=no LIBS_TERMCAP= @@ -2629,7 +2649,7 @@ case "$opsys" in ## hpux10-20: Use the system provided termcap(3) library. ## openbsd: David Mazieres says this ## is necessary. Otherwise Emacs dumps core when run -nw. - aix4-2|cygwin|hpux*|irix6-5|openbsd|usg5-4|sol2*|unixware) TERMINFO=yes ;; + aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;; ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2. ## The ncurses library has been moved out of the System framework in @@ -3008,13 +3028,13 @@ if test "x$GCC" = xyes \ fi #### Find out which version of Emacs this is. -[version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \ +[version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`] if test x"${version}" = x; then - AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.]) + AC_MSG_ERROR([can't find current emacs version in `${srcdir}/src/emacs.c'.]) fi if test x"${version}" != x"$PACKAGE_VERSION"; then - AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/lisp/version.el'.]) + AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/src/emacs.c'.]) fi ### Specify what sort of things we'll be editing into Makefile and config.h. @@ -3059,8 +3079,6 @@ AC_SUBST(ns_appdir) AC_SUBST(ns_appbindir) AC_SUBST(ns_appresdir) AC_SUBST(ns_appsrc) -AC_SUBST(GNUSTEP_SYSTEM_HEADERS) -AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES) AC_SUBST(GNU_OBJC_CFLAGS) AC_SUBST(OTHER_FILES) @@ -3075,14 +3093,23 @@ AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}", XMENU_OBJ= XOBJ= +FONT_OBJ= if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) XMENU_OBJ=xmenu.o XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + FONT_OBJ=xfont.o + if test "$HAVE_XFT" = "yes"; then + FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" + elif test "$HAVE_FREETYPE" = "yes"; then + FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o" + fi + AC_SUBST(FONT_OBJ) fi AC_SUBST(XMENU_OBJ) AC_SUBST(XOBJ) +AC_SUBST(FONT_OBJ) WIDGET_OBJ= MOTIF_LIBW= @@ -3126,10 +3153,13 @@ AC_SUBST(TOOLKIT_LIBW) if test "$USE_X_TOOLKIT" = "none"; then LIBXT_OTHER="\$(LIBXSM)" + OLDXMENU_TARGET="really-oldXMenu" else LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext" + OLDXMENU_TARGET="really-lwlib" fi AC_SUBST(LIBXT_OTHER) +AC_SUBST(OLDXMENU_TARGET) ## The X Menu stuff is present in the X10 distribution, but missing ## from X11. If we have X10, just use the installed library; @@ -3146,20 +3176,29 @@ if test "${HAVE_X11}" = "yes" ; then fi LIBXMENU="\$(OLDXMENU)" LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)" + OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}" else OLDXMENU= - LIBXMENU="-lXMenu" + ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?). + if test "${HAVE_X_WINDOWS}" = "yes"; then + LIBXMENU="-lXMenu" + else + LIBXMENU= + fi LIBX_OTHER= + OLDXMENU_DEPS= fi if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then OLDXMENU= LIBXMENU= + OLDXMENU_DEPS= fi AC_SUBST(OLDXMENU) AC_SUBST(LIBXMENU) AC_SUBST(LIBX_OTHER) +AC_SUBST(OLDXMENU_DEPS) if test "${HAVE_MENUS}" = "yes" ; then AC_DEFINE(HAVE_MENUS, 1, @@ -3167,26 +3206,31 @@ if test "${HAVE_MENUS}" = "yes" ; then (This is automatic if you use X, but the option to specify it remains.) It is also defined with other window systems that support xmenu.c.]) fi + if test "${GNU_MALLOC}" = "yes" ; then AC_DEFINE(GNU_MALLOC, 1, [Define to 1 if you want to use the GNU memory allocator.]) fi + +RALLOC_OBJ= if test "${REL_ALLOC}" = "yes" ; then AC_DEFINE(REL_ALLOC, 1, [Define REL_ALLOC if you want to use the relocating allocator for buffer space.]) -fi + test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o +fi +AC_SUBST(RALLOC_OBJ) if test "$opsys" = "cygwin"; then CYGWIN_OBJ="sheap.o" ## Cygwin differs because of its unexec(). PRE_ALLOC_OBJ= - POST_ALLOC_OBJ="lastfile.o vm-limit.o" + POST_ALLOC_OBJ=lastfile.o else CYGWIN_OBJ= PRE_ALLOC_OBJ=lastfile.o - POST_ALLOC_OBJ="\$(vmlimitobj)" + POST_ALLOC_OBJ= fi AC_SUBST(CYGWIN_OBJ) AC_SUBST(PRE_ALLOC_OBJ) @@ -3478,8 +3522,6 @@ typedef unsigned size_t; #ifdef HAVE_X11R6 #define HAVE_X_I18N -#elif !defined X11R5_INHIBIT_I18N -#define HAVE_X_I18N #endif /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */ @@ -3499,11 +3541,7 @@ typedef unsigned size_t; that the stack is continuous. */ #ifdef __GNUC__ # ifndef GC_SETJMP_WORKS - /* GC_SETJMP_WORKS is nearly always appropriate for GCC -- - see NON_SAVING_SETJMP in the target descriptions. */ - /* Exceptions (see NON_SAVING_SETJMP in target description) are - SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86. - Fixme: Deal with SVR3. */ + /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ # define GC_SETJMP_WORKS 1 # endif # ifndef GC_LISP_OBJECT_ALIGNMENT diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index a8a43f56d9d..82d4d028040 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,12 @@ +2010-05-18 Eli Zaretskii + + * display.texi (Fringes): Document reversal of fringe arrows for R2L + paragraphs. + (Line Truncation): Fix wording for bidi display. + + * basic.texi (Moving Point): Document bidi-aware behavior of the arrow + keys. + 2010-05-08 Chong Yidong * building.texi (GDB Graphical Interface): Remove misleading comparison @@ -127,7 +136,7 @@ * custom.texi (Init Examples): Add xref to Mail Header. - * emacs.texi (Top): Fix xrefs. + * emacs.texi (Top): Fix xrefs. 2010-03-30 Chong Yidong @@ -1695,7 +1704,7 @@ (Fortran Columns): Mention font-locking. (Fortran Abbrev): Word syntax not relevant with new-style abbrev. -2008-08-23 Johan Bockgard +2008-08-23 Johan BockgÃ¥rd * basic.texi (Moving Point): Fix / confusion. diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index ae04ebf9c41..654c017c59e 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -146,6 +146,8 @@ keyboard commands that move point in more sophisticated ways. @findex move-end-of-line @findex forward-char @findex backward-char +@findex right-arrow-command +@findex left-arrow-command @findex next-line @findex previous-line @findex beginning-of-buffer @@ -161,11 +163,19 @@ Move to the beginning of the line (@code{move-beginning-of-line}). @itemx @key{End} Move to the end of the line (@code{move-end-of-line}). @item C-f -@itemx @key{right} Move forward one character (@code{forward-char}). +@item @key{right} +Move one character to the right (@code{right-arrow-command}). This +moves one character forward in text that is read in the usual +left-to-right direction, but one character @emph{backward} if the text +is read right-to-left, as needed for right-to-left scripts such as +Arabic. @xref{Bidirectional Editing}. @item C-b -@itemx @key{left} Move backward one character (@code{backward-char}). +@item @key{left} +Move one character to the left (@code{left-arrow-command}). This +moves one character backward in left-to-right text and one character +forward in right-to-left text. @item M-f @itemx M-@key{right} @itemx C-@key{right} diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index dcf424f0f47..3d3a1e03e46 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -804,7 +804,10 @@ line, when one line of text is split into multiple lines on the screen. The left fringe shows a curving arrow for each screen line except the first, indicating that ``this is not the real beginning.'' The right fringe shows a curving arrow for each screen line except the -last, indicating that ``this is not the real end.'' +last, indicating that ``this is not the real end.'' If the line's +direction is right-to-left (@pxref{Bidirectional Editing}), the +meaning of the curving arrows in the left and right fringes are +swapped. The fringes indicate line truncation with short horizontal arrows meaning ``there's more text on this line which is scrolled @@ -1191,8 +1194,8 @@ can display long lines by @dfn{truncation}. This means that all the characters that do not fit in the width of the screen or window do not appear at all. On graphical displays, a small straight arrow in the fringe indicates truncation at either end of the line. On text-only -terminals, @samp{$} appears in the first column when there is text -truncated to the left, and in the last column when there is text +terminals, @samp{$} appears in the leftmost column when there is text +truncated to the left, and in the rightmost column when there is text truncated to the right. @vindex truncate-lines diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index c6d3c1be498..4c857c45a32 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,6 +1,11 @@ +2010-05-16 Jay Belanger + + * calc.texi (Manipulating Vectors): Mention that vectors can + be used to determine bins for `calc-histogram'. + 2010-05-13 Jay Belanger - * calc.texi: Remove "\turnoffactive" commands througout. + * calc.texi: Remove "\turnoffactive" commands throughout. 2010-05-08 Å tÄ›pán NÄ›mec (tiny change) diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index c578e919612..12b8d8e162d 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -20030,6 +20030,20 @@ range are ignored. (You can tell if elements have been ignored by noting that the counts in the result vector don't add up to the length of the input vector.) +If no prefix is given, then you will be prompted for a vector which +will be used to determine the bins. (If a positive integer is given at +this prompt, it will be still treated as if it were given as a +prefix.) Each bin will consist of the interval of numbers closest to +the corresponding number of this new vector; if the vector +@expr{[a, b, c, ...]} is entered at the prompt, the bins will be +@expr{(-inf, (a+b)/2]}, @expr{((a+b)/2, (b+c)/2]}, etc. The result of +this command will be a vector counting how many elements of the +original vector are in each bin. + +The result will then be a vector with the same length as this new vector; +each element of the new vector will be replaced by the number of +elements of the original vector which are closest to it. + @kindex H v H @kindex H V H With the Hyperbolic flag, @kbd{H V H} pulls two vectors from the stack. diff --git a/etc/DEBUG b/etc/DEBUG index 334daa36eac..b4272929bae 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -627,8 +627,7 @@ CPU-specific headers in the subdirectories of `src'): - In src/s/SYSTEM-NAME.h add "#define SYSTEM_MALLOC". - - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP" and - "#define CANNOT_UNEXEC". + - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP" - Configure with a different --prefix= option. If you use GCC, version 2.7.2 is preferred, as some malloc debugging packages diff --git a/etc/NEWS b/etc/NEWS index c4393a53efe..df68e42cd66 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -63,6 +63,9 @@ according to the value of this variable. Possible values are default), Emacs determines the base direction of each paragraph from its text, as specified by the Unicode Bidirectional Algorithm. +The function `current-bidi-paragraph-direction' returns the actual +value of paragraph base direction at point. + Reordering of bidirectional text for display in Emacs is a "Full bidirectionality" class implementation of the Unicode Bidirectional Algorithm. @@ -207,6 +210,8 @@ threads simultaneously. * New Modes and Packages in Emacs 24.1 +** smie.el is a package providing a simple generic indentation engine. + ** secrets.el is an implementation of the Secret Service API, an interface to password managers like GNOME Keyring or KDE Wallet. The Secret Service API requires D-Bus for communication. @@ -221,6 +226,8 @@ Secret Service API requires D-Bus for communication. * Lisp changes in Emacs 24.1 +** frame-local variables cannot be let-bound any more. +** prog-mode is a new major-mode meant to be the parent of programming mode. ** define-minor-mode accepts a new keyword :variable. ** delete-file now accepts an optional second arg, FORCE, which says diff --git a/leim/ChangeLog b/leim/ChangeLog index 4b9d6adbf39..972a3279a29 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,7 @@ +2010-05-15 Glenn Morris + + * Makefile.in (install): Remove references to CVS-related files. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/leim/Makefile.in b/leim/Makefile.in index f0fba8d2462..6eb18bc76d9 100644 --- a/leim/Makefile.in +++ b/leim/Makefile.in @@ -237,8 +237,6 @@ install: all tar -chf - quail/* ja-dic \ | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\ fi; \ - rm -rf ${INSTALLDIR}/CVS ${INSTALLDIR}/*/CVS; \ - rm -f ${INSTALLDIR}/.cvsignore ${INSTALLDIR}/*/.cvsignore; \ rm -f ${INSTALLDIR}/.gitignore ${INSTALLDIR}/*/.gitignore; \ rm -f ${INSTALLDIR}/.arch-inventory ${INSTALLDIR}/*/.arch-inventory; \ rm -f ${INSTALLDIR}/\#* ${INSTALLDIR}/*/\#* ; \ diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 4799a9fefc4..6202feb890c 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -106,14 +106,15 @@ INSTALL_STRIP = # ========================== Lists of Files =========================== -# Things that a user might actually run, -# which should be installed in bindir. -INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} +# Things that a user might actually run, which should be installed in bindir. +INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ + b2m${EXEEXT} ebrowse${EXEEXT} + INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog # Things that Emacs runs internally, or during the build process, # which should not be installed in bindir. -UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \ +UTILITIES = profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \ movemail${EXEEXT} fakemail${EXEEXT} \ hexl${EXEEXT} update-game-score${EXEEXT} @@ -153,7 +154,8 @@ LIBRESOLV=@LIBRESOLV@ LIBS_MAIL=@LIBS_MAIL@ ## Extra libraries to use when linking movemail. -LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) +LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ + $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) ## Some systems define this to request special libraries. LIBS_SYSTEM = @LIBS_SYSTEM@ @@ -161,7 +163,8 @@ LIBS_SYSTEM = @LIBS_SYSTEM@ # Those files shared with other GNU utilities need HAVE_CONFIG_H # defined before they know they can take advantage of the information # in ../src/config.h. -BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src +BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \ + -I. -I../src -I${srcdir} -I${srcdir}/../src ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} @@ -316,24 +319,31 @@ REGEXPOBJ = regex.o REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h - ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c + ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ + ${srcdir}/../src/regex.c etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h - $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags + $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ + -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \ + $(REGEXPOBJ) $(LOADLIBES) -o etags ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h - $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse + $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ + ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse ## We depend on etags to assure that parallel makes do not write two ## etags.o files on top of each other. ctags${EXEEXT}: etags${EXEEXT} - $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags + $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ + -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \ + $(REGEXPOBJ) $(LOADLIBES) -o ctags profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h - $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile + $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ + -o make-docfile digest-doc${EXEEXT}: ${srcdir}/digest-doc.c $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc @@ -346,9 +356,9 @@ b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS) $(GETOPTOBJS) $(LOADLIBES) -o b2m movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS) - $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail + $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \ + $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail -## We need to define emacs to get the right version of something (what?). movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H) $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c @@ -367,7 +377,8 @@ hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS) - $(CC) ${LINK_CFLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score + $(CC) ${LINK_CFLAGS} update-game-score.o $(GETOPTOBJS) \ + $(LOADLIBES) -o update-game-score update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H) $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 21d0e827f67..d0fc357c4ea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,10 +4,127 @@ composition-function-table only for combining characters (Mn, Mc, Me). +2010-05-18 Juanma Barranquero + + * progmodes/prolog.el (smie-indent-basic): Declare for byte-compiler. + + * emacs-lisp/smie.el (smie-precs-precedence-table, smie-backward-sexp) + (smie-forward-sexp, smie-indent-calculate): Fix typos in docstrings. + +2010-05-17 Stefan Monnier + + Provide a simple generic indentation engine and use it for Prolog. + * emacs-lisp/smie.el: New file. + * progmodes/prolog.el (prolog-smie-op-levels) + (prolog-smie-indent-rules): New var. + (prolog-mode-variables): Use them to configure SMIE. + (prolog-indent-line, prolog-indent-level): Remove. + +2010-05-17 Jay Belanger + + * calc/calc-vec.el (math-vector-avg): Put the vector elements in + order before computing the averages. + +2010-05-16 Jay Belanger + + * calc/calc-vec.el (calc-histogram): + (calcFunc-histogram): Allow vectors as inputs. + (math-vector-avg): New function. + + * calc/calc-ext.el (math-group-float): Have the number of digits + being grouped depend on the radix (Bug#6189). + +2010-05-15 Ken Raeburn + + * version.el (emacs-copyright, emacs-version): Don't define here, + now that emacs.c defines it. + +2010-05-15 Eli Zaretskii + + * international/mule-cmds.el (mule-menu-keymap): Fix definition of + "Describe Language Environment" menu item. + + * language/hebrew.el ("Hebrew", "Windows-1255"): Doc fix. + + Bidi-sensitive movement with arrow keys. + * subr.el (right-arrow-command, left-arrow-command): New functions. + + * bindings.el (global-map): Bind them to right and left arrow keys. + + Don't override standard definition of convert-standard-filename. + * files.el (convert-standard-filename): Call + w32-convert-standard-filename and dos-convert-standard-filename on + the corresponding systems. + + * w32-fns.el (w32-convert-standard-filename): Rename from + convert-standard-filename. Doc fix. + + * dos-fns.el (dos-convert-standard-filename): Doc fix. + (convert-standard-filename): Don't defalias. + (register-name-alist, make-register, register-value) + (set-register-value, intdos): Obsolete aliases for the + corresponding dos-* functions and variables. + (dos-intdos): Add a doc string. + +2010-05-15 Jay Belanger + + * calc/calc-aent.el (math-read-token, math-find-user-tokens): + * calc/calc-lang.el (math-read-big-rec, math-lang-read-symbol): + (math-compose-tex-func): + * calc/calccomp.el (math-compose-expr): + * calc/calc-ext.el (math-format-flat-expr-fancy): + * calc/calc-store.el (calc-read-var-name): + * calc/calc-units.el (calc-explain-units-rec): Allow Greek letters. + + * calc/calc.el (var-Ï€, var-φ, var-γ): New variables. + * calc/calc-aent.el (math-read-replacement-list): Add "micro" symbol. + * calc/calc-units.el (math-unit-prefixes): Add mu for micro. + (math-standard-units): Add units. + +2010-05-15 Stefan Monnier + + * progmodes/asm-mode.el (asm-mode): + * progmodes/prolog.el (prolog-mode): Use define-derived-mode. + + * pcomplete.el (pcomplete-completions-at-point): New function, + extracted from pcomplete-std-complete. + (pcomplete-std-complete): Use it. + +2010-05-15 Glenn Morris + + * Makefile.in (setwins, setwins_almost, setwins_for_subdirs): + Remove references to CVS, RCS and Old directories. + +2010-05-14 Jay Belanger + + * calc/calc-bin.el (math-format-twos-complement): Group digits when + appropriate. + +2010-05-14 Stefan Monnier + + * progmodes/sh-script.el (sh-mode-default-syntax-table): Remove. + (sh-mode-syntax-table): Give it a default value instead. + (sh-header-marker): Make buffer-local. + (sh-mode): Move make-local-variable to the corresponding setq. + (sh-add-completer): Avoid gratuitously let-binding a buffer-local var. + Use complete-with-action. + + * simple.el (prog-mode): New (abstract) major mode. + * emacs-lisp/lisp-mode.el (emacs-lisp-mode, lisp-mode): Use it. + * progmodes/sh-script.el (sh-mode): Remove redundant var assignment. + +2010-05-14 Juanma Barranquero + + * progmodes/sql.el (sql-oracle-program): Reflow docstring. + (sql-oracle-scan-on, sql-sybase-program, sql-product-font-lock) + (sql-add-product-keywords, sql-highlight-product, sql-set-product) + (sql-make-alternate-buffer-name, sql-placeholders-filter) + (sql-escape-newlines-filter, sql-input-sender) + (sql-send-magic-terminator, sql-sybase): Fix typos in docstrings. + 2010-05-13 Chong Yidong - Add TeX open-block and close-block keybindings to SGML, and vice - versa. + Add TeX open-block and close-block keybindings to SGML, and vice versa. * textmodes/tex-mode.el (tex-mode-map): Bind C-c C-t to latex-open-block and C-c / to latex-close-block. @@ -21,8 +138,8 @@ only when the message would be displayed. Handled nested calls. (tramp-handle-load, tramp-handle-file-local-copy) (tramp-handle-insert-file-contents, tramp-handle-write-region) - (tramp-maybe-send-script, tramp-find-shell): Use - `with-progress-reporter'. + (tramp-maybe-send-script, tramp-find-shell): + Use `with-progress-reporter'. (tramp-handle-dired-compress-file, tramp-maybe-open-connection): Fix message text. @@ -313,7 +430,7 @@ * Version 23.2 released. -2010-05-07 Deniz Dogan (tiny change) +2010-05-07 Deniz Dogan (tiny change) Stefan Monnier Highlight vendor specific properties. @@ -334,7 +451,7 @@ * simple.el (auto-save-mode): Move from files.el. * minibuffer.el (completion--common-suffix): Fix copy&paste error. -2010-05-07 Christian von Roques (tiny change) +2010-05-07 Christian von Roques (tiny change) * lisp/epg.el (epg-key-capablity-alist): Add "D" flag (Bug#5592). diff --git a/lisp/Makefile.in b/lisp/Makefile.in index fe7dcfa4e99..4effdddff6a 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -84,28 +84,25 @@ COMPILE_FIRST = \ emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT) # Common command to find subdirectories - setwins=subdirs=`(find . -type d -print)`; \ for file in $$subdirs; do \ - case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \ + case $$file in */.* | */.*/* | */=* ) ;; \ *) wins="$$wins $$file" ;; \ esac; \ done # Find all subdirectories except `obsolete' and `term'. - setwins_almost=subdirs=`(find . -type d -print)`; \ for file in $$subdirs; do \ - case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \ + case $$file in */.* | */.*/* | */=* | */obsolete | */term ) ;; \ *) wins="$$wins $$file" ;; \ esac; \ done # Find all subdirectories in which we might want to create subdirs.el - setwins_for_subdirs=subdirs=`(find . -type d -print)`; \ for file in $$subdirs; do \ - case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */cedet* ) ;; \ + case $$file in */.* | */.*/* | */=* | */cedet* ) ;; \ *) wins="$$wins $$file" ;; \ esac; \ done diff --git a/lisp/bindings.el b/lisp/bindings.el index 05a0ac8bc11..14cebfeda8f 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -828,9 +828,9 @@ is okay. See `mode-line-format'.") (define-key global-map [C-home] 'beginning-of-buffer) (define-key global-map [M-home] 'beginning-of-buffer-other-window) (define-key esc-map [home] 'beginning-of-buffer-other-window) -(define-key global-map [left] 'backward-char) +(define-key global-map [left] 'left-arrow-command) (define-key global-map [up] 'previous-line) -(define-key global-map [right] 'forward-char) +(define-key global-map [right] 'right-arrow-command) (define-key global-map [down] 'next-line) (define-key global-map [prior] 'scroll-down-command) (define-key global-map [next] 'scroll-up-command) diff --git a/lisp/calc/README b/lisp/calc/README index 3e3acaebb27..4b32ada63ad 100644 --- a/lisp/calc/README +++ b/lisp/calc/README @@ -74,6 +74,8 @@ Summary of changes to "Calc" Emacs 24.1 +* Gave `calc-histogram' the option of using a vector to determine the bins. + * Added "O" option prefix. * Used "O" prefix to "d r" (`calc-radix') to turn on twos-complement mode. diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 58e30a237f9..77a02b58c73 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -510,6 +510,7 @@ The value t means abort and give an error message.") ("≥" ">=") ("≦" "<=") ("≧" ">=") + ("µ" "μ") ;; fractions ("¼" "(1:4)") ; 1/4 ("½" "(1:2)") ; 1/2 @@ -675,11 +676,11 @@ in Calc algebraic input.") (cond ((and (stringp (car p)) (or (> (length (car p)) 1) (equal (car p) "$") (equal (car p) "\"")) - (string-match "[^a-zA-Z0-9]" (car p))) + (string-match "[^a-zA-Zα-ωΑ-Ω0-9]" (car p))) (let ((s (regexp-quote (car p)))) - (if (string-match "\\`[a-zA-Z0-9]" s) + (if (string-match "\\`[a-zA-Zα-ωΑ-Ω0-9]" s) (setq s (concat "\\<" s))) - (if (string-match "[a-zA-Z0-9]\\'" s) + (if (string-match "[a-zA-Zα-ωΑ-Ω0-9]\\'" s) (setq s (concat s "\\>"))) (or (assoc s math-toks) (progn @@ -718,15 +719,17 @@ in Calc algebraic input.") math-expr-data (math-match-substring math-exp-str 0) math-exp-pos (match-end 0))) ((or (and (>= ch ?a) (<= ch ?z)) - (and (>= ch ?A) (<= ch ?Z))) + (and (>= ch ?A) (<= ch ?Z)) + (and (>= ch ?α) (<= ch ?ω)) + (and (>= ch ?Α) (<= ch ?Ω))) (string-match (cond ((and (memq calc-language calc-lang-allow-underscores) (memq calc-language calc-lang-allow-percentsigns)) - "[a-zA-Z0-9_'#]*") + "[a-zA-Zα-ωΑ-Ω0-9_'#]*") ((memq calc-language calc-lang-allow-underscores) - "[a-zA-Z0-9_#]*") - (t "[a-zA-Z0-9'#]*")) + "[a-zA-Zα-ωΑ-Ω0-9_#]*") + (t "[a-zA-Zα-ωΑ-Ω0-9'#]*")) math-exp-str math-exp-pos) (setq math-exp-token 'symbol math-exp-pos (match-end 0) @@ -744,12 +747,12 @@ in Calc algebraic input.") (or (eq math-exp-pos 0) (and (not (memq calc-language calc-lang-allow-underscores)) - (eq (string-match "[^])}\"a-zA-Z0-9'$]_" + (eq (string-match "[^])}\"a-zA-Zα-ωΑ-Ω0-9'$]_" math-exp-str (1- math-exp-pos)) (1- math-exp-pos)))))) (or (and (memq calc-language calc-lang-c-type-hex) (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos)) - (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" + (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Zα-ωΑ-Ω:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" math-exp-str math-exp-pos)) (setq math-exp-token 'number math-expr-data (math-match-substring math-exp-str 0) diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el index 0e31fbe681c..4ab698ea640 100644 --- a/lisp/calc/calc-bin.el +++ b/lisp/calc/calc-bin.el @@ -845,6 +845,8 @@ the size of a Calc bignum digit.") (len (length num))) (if (< len digs) (setq num (concat (make-string (- digs len) ?0) num)))) + (when calc-group-digits + (setq num (math-group-float num))) (concat (number-to-string calc-number-radix) "##" diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index f6f8e3d03d9..17dc9293237 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -3283,7 +3283,7 @@ If X is not an error form, return 1." (concat "-" (math-format-flat-expr (nth 1 a) 1000))) (t (concat (math-remove-dashes - (if (string-match "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'" + (if (string-match "\\`calcFunc-\\([a-zA-Zα-ωΑ-Ω0-9']+\\)\\'" (symbol-name (car a))) (math-match-substring (symbol-name (car a)) 1) (symbol-name (car a)))) @@ -3469,7 +3469,8 @@ If X is not an error form, return 1." (defun math-group-float (str) ; [X X] (let* ((pt (or (string-match "[^0-9a-zA-Z]" str) (length str))) - (g (if (integerp calc-group-digits) (math-abs calc-group-digits) 3)) + (g (if (integerp calc-group-digits) (math-abs calc-group-digits) + (if (memq calc-number-radix '(2 16)) 4 3))) (i pt)) (if (and (integerp calc-group-digits) (< calc-group-digits 0)) (while (< (setq i (+ (1+ i) g)) (length str)) diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index cd30232feee..0ebf1a18fef 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -214,7 +214,7 @@ (put 'pascal 'math-lang-read-symbol '((?\$ (eq (string-match - "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)" + "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)" math-exp-str math-exp-pos) math-exp-pos) (setq math-exp-token 'number @@ -312,7 +312,7 @@ (put 'fortran 'math-lang-read-symbol '((?\. - (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\." + (eq (string-match "\\.[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω]?\\." math-exp-str math-exp-pos) math-exp-pos) (setq math-exp-token 'punc math-expr-data (upcase (math-match-substring math-exp-str 0)) @@ -603,9 +603,9 @@ '((?\\ (< math-exp-pos (1- (length math-exp-str))) (progn - (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" + (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}" math-exp-str math-exp-pos) - (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" + (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)" math-exp-str math-exp-pos)) (setq math-exp-token 'symbol math-exp-pos (match-end 0) @@ -691,7 +691,7 @@ (defun math-compose-tex-var (a prec) (if (and calc-language-option (not (= calc-language-option 0)) - (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" + (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'" (symbol-name (nth 1 a)))) (if (eq calc-language 'latex) (format "\\text{%s}" (symbol-name (nth 1 a))) @@ -702,7 +702,7 @@ (let (left right) (if (and calc-language-option (not (= calc-language-option 0)) - (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func)) + (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'" func)) (if (< (prefix-numeric-value calc-language-option) 0) (setq func (format "\\%s" func)) (setq func (if (eq calc-language 'latex) @@ -824,11 +824,11 @@ '((?\\ (< math-exp-pos (1- (length math-exp-str))) (progn - (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" + (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}" math-exp-str math-exp-pos) - (string-match "\\\\text *{\\([a-zA-Z0-9]+\\)}" + (string-match "\\\\text *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}" math-exp-str math-exp-pos) - (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" + (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)" math-exp-str math-exp-pos)) (setq math-exp-token 'symbol math-exp-pos (match-end 0) @@ -2301,9 +2301,11 @@ order to Calc's." ;; Variable name or function call. ((or (and (>= other-char ?a) (<= other-char ?z)) - (and (>= other-char ?A) (<= other-char ?Z))) + (and (>= other-char ?A) (<= other-char ?Z)) + (and (>= other-char ?α) (<= other-char ?ω)) + (and (>= other-char ?Α) (<= other-char ?Ω))) (setq line (nth v math-read-big-lines)) - (string-match "\\([a-zA-Z'_]+\\) *" line math-rb-h1) + (string-match "\\([a-zA-Zα-ωΑ-Ω'_]+\\) *" line math-rb-h1) (setq h (match-end 1) widest (match-end 0) p (math-match-substring line 1)) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 5ec21eee887..8f73e71b0f9 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -202,7 +202,7 @@ 'calc-read-var-name-history))))) (setq calc-aborted-prefix "") (and (not (equal var "var-")) - (if (string-match "\\`\\([-a-zA-Z0-9]+\\) *:?=" var) + (if (string-match "\\`\\([-a-zA-Zα-ωΑ-Ω0-9]+\\) *:?=" var) (if (null calc-given-value-flag) (error "Assignment is not allowed in this command") (let ((svar (intern (substring var 0 (match-end 1))))) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 6dd3e4911b7..6881db3fb12 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -36,13 +36,13 @@ ;;; Units table last updated 9-Jan-91 by Ulrich Mueller (ulm@vsnhd1.cern.ch) ;;; with some additions by Przemek Klosowski (przemek@rrdstrad.nist.gov) -;;; Updated April 2002 by Jochen Küpper +;;; Updated April 2002 by Jochen Küpper ;;; Updated August 2007, using ;;; CODATA (http://physics.nist.gov/cuu/Constants/index.html) ;;; NIST (http://physics.nist.gov/Pubs/SP811/appenB9.html) ;;; ESUWM (Encyclopaedia of Scientific Units, Weights and -;;; Measures, by François Cardarelli) +;;; Measures, by François Cardarelli) ;;; All conversions are exact unless otherwise noted. (defvar math-standard-units @@ -210,6 +210,7 @@ "1.602176487 10^-19 C (*)") ;;(approx) CODATA ( V "W/A" "Volt" ) ( ohm "V/A" "Ohm" ) + ( Ω "ohm" "Ohm" ) ( mho "A/V" "Mho" ) ( S "A/V" "Siemens" ) ( F "C/V" "Farad" ) @@ -259,7 +260,9 @@ "6.62606896 10^-34 J s (*)") ( hbar "h / (2 pi)" "Planck's constant" ) ;; Exact ( mu0 "4 pi 10^(-7) H/m" "Permeability of vacuum") ;; Exact + ( μ0 "mu0" "Permeability of vacuum") ;; Exact ( eps0 "1 / (mu0 c^2)" "Permittivity of vacuum" ) + ( ε0 "eps0" "Permittivity of vacuum" ) ( G "6.67428*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil "6.67428 10^-11 m^3/(kg s^2) (*)") ( Nav "6.02214179*10^(23) / mol" "Avogadro's constant" nil @@ -272,12 +275,16 @@ "1.674927211 10^-27 kg (*)") ( mmu "1.88353130*10^(-28) kg" "Muon rest mass" nil "1.88353130 10^-28 kg (*)") + ( mμ "mmu" "Muon rest mass" nil + "1.88353130 10^-28 kg (*)") ( Ryd "10973731.568527 /m" "Rydberg's constant" nil "10973731.568527 /m (*)") ( k "1.3806504*10^(-23) J/K" "Boltzmann's constant" nil "1.3806504 10^-23 J/K (*)") ( alpha "7.2973525376*10^(-3)" "Fine structure constant" nil "7.2973525376 10^-3 (*)") + ( α "alpha" "Fine structure constant" nil + "7.2973525376 10^-3 (*)") ( muB "927.400915*10^(-26) J/T" "Bohr magneton" nil "927.400915 10^-26 J/T (*)") ( muN "5.05078324*10^(-27) J/T" "Nuclear magneton" nil @@ -316,6 +323,7 @@ that the combined units table will be rebuilt.") ( ?c (^ 10 -2) "Centi" ) ( ?m (^ 10 -3) "Milli" ) ( ?u (^ 10 -6) "Micro" ) + ( ?μ (^ 10 -6) "Micro" ) ( ?n (^ 10 -9) "Nano" ) ( ?p (^ 10 -12) "Pico" ) ( ?f (^ 10 -15) "Femto" ) @@ -581,8 +589,8 @@ If EXPR is nil, return nil." (let ((name (or (nth 2 u) (symbol-name (car u))))) (if (eq (aref name 0) ?\*) (setq name (substring name 1))) - (if (string-match "[^a-zA-Z0-9']" name) - (if (string-match "^[a-zA-Z0-9' ()]*$" name) + (if (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name) + (if (string-match "^[a-zA-Zα-ωΑ-Ω0-9' ()]*$" name) (while (setq pos (string-match "[ ()]" name)) (setq name (concat (substring name 0 pos) (if (eq (aref name pos) 32) "-" "") @@ -592,7 +600,7 @@ If EXPR is nil, return nil." (setq name (concat (nth 2 (assq (aref (symbol-name (nth 1 expr)) 0) math-unit-prefixes)) - (if (and (string-match "[^a-zA-Z0-9']" name) + (if (and (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" name) (not (memq (car u) '(mHg gf)))) (concat "-" name) (downcase name))))) @@ -1540,9 +1548,5 @@ If EXPR is nil, return nil." (provide 'calc-units) -;; Local Variables: -;; coding: iso-latin-1 -;; End: - ;; arch-tag: e993314f-3adc-4191-be61-4ef8874881c4 ;;; calc-units.el ends here diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el index c4de362ab36..5b807a55491 100644 --- a/lisp/calc/calc-vec.el +++ b/lisp/calc/calc-vec.el @@ -451,16 +451,18 @@ (calc-enter-result 1 "grad" (list 'calcFunc-grade (calc-top-n 1)))))) (defun calc-histogram (n) - (interactive "NNumber of bins: ") + (interactive "P") + (unless (natnump n) + (setq n (math-read-expr (read-string "Centers of bins: ")))) (calc-slow-wrapper (if calc-hyperbolic-flag (calc-enter-result 2 "hist" (list 'calcFunc-histogram (calc-top-n 2) (calc-top-n 1) - (prefix-numeric-value n))) + n)) (calc-enter-result 1 "hist" (list 'calcFunc-histogram (calc-top-n 1) - (prefix-numeric-value n)))))) + n))))) (defun calc-transpose (arg) (interactive "P") @@ -1135,22 +1137,53 @@ (if (Math-vectorp wts) (or (= (length vec) (length wts)) (math-dimension-error))) - (or (natnump n) - (math-reject-arg n 'fixnatnump)) - (let ((res (make-vector n 0)) - (vp vec) - (wvec (Math-vectorp wts)) - (wp wts) - bin) - (while (setq vp (cdr vp)) - (setq bin (car vp)) - (or (natnump bin) - (setq bin (math-floor bin))) - (and (natnump bin) - (< bin n) - (aset res bin (math-add (aref res bin) - (if wvec (car (setq wp (cdr wp))) wts))))) - (cons 'vec (append res nil)))) + (cond ((natnump n) + (let ((res (make-vector n 0)) + (vp vec) + (wvec (Math-vectorp wts)) + (wp wts) + bin) + (while (setq vp (cdr vp)) + (setq bin (car vp)) + (or (natnump bin) + (setq bin (math-floor bin))) + (and (natnump bin) + (< bin n) + (aset res bin + (math-add (aref res bin) + (if wvec (car (setq wp (cdr wp))) wts))))) + (cons 'vec (append res nil)))) + ((Math-vectorp n) ;; n is a vector of midpoints + (let* ((bds (math-vector-avg n)) + (res (make-vector (1- (length n)) 0)) + (vp (cdr vec)) + (wvec (Math-vectorp wts)) + (wp wts) + num) + (while vp + (setq num (car vp)) + (let ((tbds (cdr bds)) + (i 0)) + (while (and tbds (Math-lessp (car tbds) num)) + (setq i (1+ i)) + (setq tbds (cdr tbds))) + (aset res i + (math-add (aref res i) + (if wvec (car (setq wp (cdr wp))) wts)))) + (setq vp (cdr vp))) + (cons 'vec (append res nil)))) + (t + (math-reject-arg n "*Expecting an integer or vector")))) + +;;; Replace a vector [a b c ...] with a vector of averages +;;; [(a+b)/2 (b+c)/2 ...] +(defun math-vector-avg (vec) + (let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep)) + (res nil)) + (while (and vp (cdr vp)) + (setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res) + vp (cdr vp))) + (cons 'vec (reverse res)))) ;;; Set operations. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 07fa4414dda..73a865cab1a 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -999,9 +999,12 @@ Used by `calc-user-invocation'.") (defvar math-working-step-2 nil) (defvar var-i '(special-const (math-imaginary 1))) (defvar var-pi '(special-const (math-pi))) +(defvar var-Ï€ '(special-const (math-pi))) (defvar var-e '(special-const (math-e))) (defvar var-phi '(special-const (math-phi))) +(defvar var-φ '(special-const (math-phi))) (defvar var-gamma '(special-const (math-gamma-const))) +(defvar var-γ '(special-const (math-gamma-const))) (defvar var-Modes '(special-const (math-get-modes-vec))) (mapc (lambda (v) (or (boundp v) (set v nil))) diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index c7d3469abe0..c8efded9270 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -663,6 +663,8 @@ (and prevc nextc (or (and (>= nextc ?a) (<= nextc ?z)) (and (>= nextc ?A) (<= nextc ?Z)) + (and (>= nextc ?α) (<= nextc ?ω)) + (and (>= nextc ?Α) (<= nextc ?Ω)) (and (>= nextc ?0) (<= nextc ?9)) (memq nextc '(?. ?_ ?# ?\( ?\[ ?\{)) @@ -732,7 +734,7 @@ (not (math-tex-expr-is-flat (nth 1 a)))))) (list 'horiz (if lr "\\left" "") - (if (string-match "\\`u\\([^a-zA-Z]\\)\\'" (car op)) + (if (string-match "\\`u\\([^a-zA-Zα-ωΑ-Ω]\\)\\'" (car op)) (substring (car op) 1) (car op)) (if (or lr (> (length (car op)) 2)) " " "") @@ -758,7 +760,7 @@ (t (let ((rhs (math-compose-expr (nth 1 a) (nth 3 op)))) (list 'horiz - (let ((ops (if (string-match "\\`u\\([^a-zA-Z]\\)\\'" + (let ((ops (if (string-match "\\`u\\([^a-zA-Zα-ωΑ-Ω]\\)\\'" (car op)) (substring (car op) 1) (car op)))) @@ -806,7 +808,7 @@ (setq func (car func2))) (setq func (math-remove-dashes (if (string-match - "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'" + "\\`calcFunc-\\([a-zA-Zα-ωΑ-Ω0-9']+\\)\\'" (symbol-name func)) (math-match-substring (symbol-name func) 1) (symbol-name func)))) diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el index 5834afae8bc..e343446a366 100644 --- a/lisp/dos-fns.el +++ b/lisp/dos-fns.el @@ -30,16 +30,16 @@ (declare-function int86 "dosfns.c") (declare-function msdos-long-file-names "msdos.c") -;; This overrides a trivial definition in files.el. +;; See convert-standard-filename in files.el. (defun dos-convert-standard-filename (filename) - "Convert a standard file's name to something suitable for the current OS. + "Convert a standard file's name to something suitable for MS-DOS. This means to guarantee valid names and perhaps to canonicalize certain patterns. +This function is called by `convert-standard-filename'. + On Windows and DOS, replace invalid characters. On DOS, make -sure to obey the 8.3 limitations. On Windows, turn Cygwin names -into native names, and also turn slashes into backslashes if the -shell requires it (see `w32-shell-dos-semantics')." +sure to obey the 8.3 limitations." (if (or (not (stringp filename)) ;; This catches the case where FILENAME is "x:" or "x:/" or ;; "/", thus preventing infinite recursion. @@ -128,11 +128,6 @@ shell requires it (see `w32-shell-dos-semantics')." (dos-convert-standard-filename dir)) string)))))) -;; Only redirect convert-standard-filename if it has a chance of working, -;; otherwise loading dos-fns.el might make your non-DOS Emacs misbehave. -(when (fboundp 'msdos-long-file-names) - (defalias 'convert-standard-filename 'dos-convert-standard-filename)) - (defun dos-8+3-filename (filename) "Truncate FILENAME to DOS 8+3 limits." (if (or (not (stringp filename)) @@ -243,9 +238,14 @@ returned unaltered." (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0)) (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1)))) +(define-obsolete-variable-alias + 'register-name-alist 'dos-register-name-alist "24.1") + (defun dos-make-register () (make-vector 8 0)) +(define-obsolete-function-alias 'make-register 'dos-make-register "24.1") + (defun dos-register-value (regs name) (let ((where (cdr (assoc name dos-register-name-alist)))) (cond ((consp where) @@ -257,6 +257,8 @@ returned unaltered." (aref regs where)) (t nil)))) +(define-obsolete-function-alias 'register-value 'dos-register-value "24.1") + (defun dos-set-register-value (regs name value) (and (numberp value) (>= value 0) @@ -273,9 +275,18 @@ returned unaltered." (aset regs where (logand value 65535)))))) regs) +(define-obsolete-function-alias + 'set-register-value 'dos-set-register-value "24.1") + (defsubst dos-intdos (regs) + "Issue the DOS Int 21h with registers REGS. + +REGS should be a vector produced by `dos-make-register' +and `dos-set-register-value', which see." (int86 33 regs)) +(define-obsolete-function-alias 'intdos 'dos-intdos "24.1") + ;; Backward compatibility for obsolescent functions which ;; set screen size. @@ -284,6 +295,8 @@ returned unaltered." (interactive) (set-frame-size (selected-frame) 80 25)) +(define-obsolete-function-alias 'mode25 'dos-mode25 "24.1") + (defun dos-mode4350 () "Changes the number of rows to 43 or 50. Emacs always tries to set the screen height to 50 rows first. @@ -295,6 +308,8 @@ that your video hardware might not support 50-line mode." nil ; the original built-in function returned nil (set-frame-size (selected-frame) 80 43))) +(define-obsolete-function-alias 'mode4350 'dos-mode4350 "24.1") + (provide 'dos-fns) ;; arch-tag: 00b03579-8ebb-4a02-8762-5c5a929774ad diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 4a7f59e26fb..02477baf74f 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -221,8 +221,6 @@ font-lock keywords will not be case sensitive." ;;(set (make-local-variable 'adaptive-fill-mode) nil) (make-local-variable 'indent-line-function) (setq indent-line-function 'lisp-indent-line) - (make-local-variable 'parse-sexp-ignore-comments) - (setq parse-sexp-ignore-comments t) (make-local-variable 'outline-regexp) (setq outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(") (make-local-variable 'outline-level) @@ -431,7 +429,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") :type 'hook :group 'lisp) -(define-derived-mode emacs-lisp-mode nil "Emacs-Lisp" +(define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" "Major mode for editing Lisp code to run in Emacs. Commands: Delete converts tabs to spaces as it moves back. @@ -466,7 +464,7 @@ if that value is non-nil." "Keymap for ordinary Lisp mode. All commands in `lisp-mode-shared-map' are inherited by this map.") -(define-derived-mode lisp-mode nil "Lisp" +(define-derived-mode lisp-mode prog-mode "Lisp" "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. Commands: Delete converts tabs to spaces as it moves back. diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el new file mode 100644 index 00000000000..27ddeb762af --- /dev/null +++ b/lisp/emacs-lisp/smie.el @@ -0,0 +1,688 @@ +;;; smie.el --- Simple Minded Indentation Engine + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Stefan Monnier +;; Keywords: languages, lisp, internal, parsing, indentation + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; While working on the SML indentation code, the idea grew that maybe +;; I could write something generic to do the same thing, and at the +;; end of working on the SML code, I had a pretty good idea of what it +;; could look like. That idea grew stronger after working on +;; LaTeX indentation. +;; +;; So at some point I decided to try it out, by writing a new +;; indentation code for Coq while trying to keep most of the code +;; "table driven", where only the tables are Coq-specific. The result +;; (which was used for Beluga-mode as well) turned out to be based on +;; something pretty close to an operator precedence parser. + +;; So here is another rewrite, this time following the actual principles of +;; operator precedence grammars. Why OPG? Even though they're among the +;; weakest kinds of parsers, these parsers have some very desirable properties +;; for Emacs: +;; - most importantly for indentation, they work equally well in either +;; direction, so you can use them to parse backward from the indentation +;; point to learn the syntactic context; +;; - they work locally, so there's no need to keep a cache of +;; the parser's state; +;; - because of that locality, indentation also works just fine when earlier +;; parts of the buffer are syntactically incorrect since the indentation +;; looks at "as little as possible" of the buffer make an indentation +;; decision. +;; - they typically have no error handling and can't even detect a parsing +;; error, so we don't have to worry about what to do in case of a syntax +;; error because the parser just automatically does something. Better yet, +;; we can afford to use a sloppy grammar. + +;; The development (especially the parts building the 2D precedence +;; tables and then computing the precedence levels from it) is largely +;; inspired from page 187-194 of "Parsing techniques" by Dick Grune +;; and Ceriel Jacobs (BookBody.pdf available at +;; http://www.cs.vu.nl/~dick/PTAPG.html). +;; +;; OTOH we had to kill many chickens, read many coffee grounds, and practiced +;; untold numbers of black magic spells. + +;;; Code: + +(eval-when-compile (require 'cl)) + +;;; Building precedence level tables from BNF specs. + +(defun smie-set-prec2tab (table x y val &optional override) + (assert (and x y)) + (let* ((key (cons x y)) + (old (gethash key table))) + (if (and old (not (eq old val))) + (if (gethash key override) + ;; FIXME: The override is meant to resolve ambiguities, + ;; but it also hides real conflicts. It would be great to + ;; be able to distinguish the two cases so that overrides + ;; don't hide real conflicts. + (puthash key (gethash key override) table) + (display-warning 'smie (format "Conflict: %s %s/%s %s" x old val y))) + (puthash key val table)))) + +(defun smie-precs-precedence-table (precs) + "Compute a 2D precedence table from a list of precedences. +PRECS should be a list, sorted by precedence (e.g. \"+\" will +come before \"*\"), of elements of the form \(left OP ...) +or (right OP ...) or (nonassoc OP ...) or (assoc OP ...). All operators in +one of those elements share the same precedence level and associativity." + (let ((prec2-table (make-hash-table :test 'equal))) + (dolist (prec precs) + (dolist (op (cdr prec)) + (let ((selfrule (cdr (assq (car prec) + '((left . >) (right . <) (assoc . =)))))) + (when selfrule + (dolist (other-op (cdr prec)) + (smie-set-prec2tab prec2-table op other-op selfrule)))) + (let ((op1 '<) (op2 '>)) + (dolist (other-prec precs) + (if (eq prec other-prec) + (setq op1 '> op2 '<) + (dolist (other-op (cdr other-prec)) + (smie-set-prec2tab prec2-table op other-op op2) + (smie-set-prec2tab prec2-table other-op op op1))))))) + prec2-table)) + +(defun smie-merge-prec2s (tables) + (if (null (cdr tables)) + (car tables) + (let ((prec2 (make-hash-table :test 'equal))) + (dolist (table tables) + (maphash (lambda (k v) + (smie-set-prec2tab prec2 (car k) (cdr k) v)) + table)) + prec2))) + +(defun smie-bnf-precedence-table (bnf &rest precs) + (let ((nts (mapcar 'car bnf)) ;Non-terminals + (first-ops-table ()) + (last-ops-table ()) + (first-nts-table ()) + (last-nts-table ()) + (prec2 (make-hash-table :test 'equal)) + (override (smie-merge-prec2s + (mapcar 'smie-precs-precedence-table precs))) + again) + (dolist (rules bnf) + (let ((nt (car rules)) + (last-ops ()) + (first-ops ()) + (last-nts ()) + (first-nts ())) + (dolist (rhs (cdr rules)) + (assert (consp rhs)) + (if (not (member (car rhs) nts)) + (pushnew (car rhs) first-ops) + (pushnew (car rhs) first-nts) + (when (consp (cdr rhs)) + ;; If the first is not an OP we add the second (which + ;; should be an OP if BNF is an "operator grammar"). + ;; Strictly speaking, this should only be done if the + ;; first is a non-terminal which can expand to a phrase + ;; without any OP in it, but checking doesn't seem worth + ;; the trouble, and it lets the writer of the BNF + ;; be a bit more sloppy by skipping uninteresting base + ;; cases which are terminals but not OPs. + (assert (not (member (cadr rhs) nts))) + (pushnew (cadr rhs) first-ops))) + (let ((shr (reverse rhs))) + (if (not (member (car shr) nts)) + (pushnew (car shr) last-ops) + (pushnew (car shr) last-nts) + (when (consp (cdr shr)) + (assert (not (member (cadr shr) nts))) + (pushnew (cadr shr) last-ops))))) + (push (cons nt first-ops) first-ops-table) + (push (cons nt last-ops) last-ops-table) + (push (cons nt first-nts) first-nts-table) + (push (cons nt last-nts) last-nts-table))) + ;; Compute all first-ops by propagating the initial ones we have + ;; now, according to first-nts. + (setq again t) + (while (prog1 again (setq again nil)) + (dolist (first-nts first-nts-table) + (let* ((nt (pop first-nts)) + (first-ops (assoc nt first-ops-table))) + (dolist (first-nt first-nts) + (dolist (op (cdr (assoc first-nt first-ops-table))) + (unless (member op first-ops) + (setq again t) + (push op (cdr first-ops)))))))) + ;; Same thing for last-ops. + (setq again t) + (while (prog1 again (setq again nil)) + (dolist (last-nts last-nts-table) + (let* ((nt (pop last-nts)) + (last-ops (assoc nt last-ops-table))) + (dolist (last-nt last-nts) + (dolist (op (cdr (assoc last-nt last-ops-table))) + (unless (member op last-ops) + (setq again t) + (push op (cdr last-ops)))))))) + ;; Now generate the 2D precedence table. + (dolist (rules bnf) + (dolist (rhs (cdr rules)) + (while (cdr rhs) + (cond + ((member (car rhs) nts) + (dolist (last (cdr (assoc (car rhs) last-ops-table))) + (smie-set-prec2tab prec2 last (cadr rhs) '> override))) + ((member (cadr rhs) nts) + (dolist (first (cdr (assoc (cadr rhs) first-ops-table))) + (smie-set-prec2tab prec2 (car rhs) first '< override)) + (if (and (cddr rhs) (not (member (car (cddr rhs)) nts))) + (smie-set-prec2tab prec2 (car rhs) (car (cddr rhs)) + '= override))) + (t (smie-set-prec2tab prec2 (car rhs) (cadr rhs) '= override))) + (setq rhs (cdr rhs))))) + prec2)) + +(defun smie-prec2-levels (prec2) + "Take a 2D precedence table and turn it into an alist of precedence levels. +PREC2 is a table as returned by `smie-precs-precedence-table' or +`smie-bnf-precedence-table'." + ;; For each operator, we create two "variables" (corresponding to + ;; the left and right precedence level), which are represented by + ;; cons cells. Those are the vary cons cells that appear in the + ;; final `table'. The value of each "variable" is kept in the `car'. + (let ((table ()) + (csts ()) + (eqs ()) + tmp x y) + ;; From `prec2' we construct a list of constraints between + ;; variables (aka "precedence levels"). These can be either + ;; equality constraints (in `eqs') or `<' constraints (in `csts'). + (maphash (lambda (k v) + (if (setq tmp (assoc (car k) table)) + (setq x (cddr tmp)) + (setq x (cons nil nil)) + (push (cons (car k) (cons nil x)) table)) + (if (setq tmp (assoc (cdr k) table)) + (setq y (cdr tmp)) + (setq y (cons nil (cons nil nil))) + (push (cons (cdr k) y) table)) + (ecase v + (= (push (cons x y) eqs)) + (< (push (cons x y) csts)) + (> (push (cons y x) csts)))) + prec2) + ;; First process the equality constraints. + (let ((eqs eqs)) + (while eqs + (let ((from (caar eqs)) + (to (cdar eqs))) + (setq eqs (cdr eqs)) + (if (eq to from) + (debug) ;Can it happen? + (dolist (other-eq eqs) + (if (eq from (cdr other-eq)) (setcdr other-eq to)) + (when (eq from (car other-eq)) + ;; This can happen because of `assoc' settings in precs + ;; or because of a rhs like ("op" foo "op"). + (setcar other-eq to))) + (dolist (cst csts) + (if (eq from (cdr cst)) (setcdr cst to)) + (if (eq from (car cst)) (setcar cst to))))))) + ;; Then eliminate trivial constraints iteratively. + (let ((i 0)) + (while csts + (let ((rhvs (mapcar 'cdr csts)) + (progress nil)) + (dolist (cst csts) + (unless (memq (car cst) rhvs) + (setq progress t) + (setcar (car cst) i) + (setq csts (delq cst csts)))) + (unless progress + (error "Can't resolve the precedence table to precedence levels"))) + (incf i)) + ;; Propagate equalities back to their source. + (dolist (eq (nreverse eqs)) + (assert (null (caar eq))) + (setcar (car eq) (cadr eq))) + ;; Finally, fill in the remaining vars (which only appeared on the + ;; right side of the < constraints). + ;; Tho leaving them at nil is not a bad choice, since it makes + ;; it clear that these don't bind at all. + ;; (dolist (x table) + ;; (unless (nth 1 x) (setf (nth 1 x) i)) + ;; (unless (nth 2 x) (setf (nth 2 x) i))) + ) + table)) + +;;; Parsing using a precedence level table. + +(defvar smie-op-levels 'unset + "List of token parsing info. +Each element is of the form (TOKEN LEFT-LEVEL RIGHT-LEVEL). +Parsing is done using an operator precedence parser.") + +(defun smie-backward-token () + ;; FIXME: This may be an OK default but probably needs a hook. + (buffer-substring (point) + (progn (if (zerop (skip-syntax-backward ".")) + (skip-syntax-backward "w_'")) + (point)))) + +(defun smie-forward-token () + ;; FIXME: This may be an OK default but probably needs a hook. + (buffer-substring (point) + (progn (if (zerop (skip-syntax-forward ".")) + (skip-syntax-forward "w_'")) + (point)))) + +(defun smie-backward-sexp (&optional halfsexp) + "Skip over one sexp. +HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the +first token we see is an operator, skip over its left-hand-side argument. +Possible return values: + (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level + is too high. LEFT-LEVEL is the left-level of TOKEN, + POS is its start position in the buffer. + (t POS TOKEN): same thing but for an open-paren or the beginning of buffer. + (nil POS TOKEN): we skipped over a paren-like pair. + nil: we skipped over an identifier, matched parentheses, ..." + (if (bobp) (list t (point)) + (catch 'return + (let ((levels ())) + (while + (let* ((pos (point)) + (token (progn (forward-comment (- (point-max))) + (smie-backward-token))) + (toklevels (cdr (assoc token smie-op-levels)))) + + (cond + ((null toklevels) + (if (equal token "") + (condition-case err + (progn (goto-char pos) (backward-sexp 1) nil) + (scan-error (throw 'return (list t (caddr err))))))) + ((null (nth 1 toklevels)) + ;; A token like a paren-close. + (assert (nth 0 toklevels)) ;Otherwise, why mention it? + (push (nth 0 toklevels) levels)) + (t + (while (and levels (< (nth 1 toklevels) (car levels))) + (setq levels (cdr levels))) + (cond + ((null levels) + (if (and halfsexp (nth 0 toklevels)) + (push (nth 0 toklevels) levels) + (throw 'return + (prog1 (list (or (car toklevels) t) (point) token) + (goto-char pos))))) + (t + (while (and levels (= (nth 1 toklevels) (car levels))) + (setq levels (cdr levels))) + (cond + ((null levels) + (cond + ((null (nth 0 toklevels)) + (throw 'return (list nil (point) token))) + ((eq (nth 0 toklevels) (nth 1 toklevels)) + (throw 'return + (prog1 (list (or (car toklevels) t) (point) token) + (goto-char pos)))) + (t (debug)))) ;Not sure yet what to do here. + (t + (if (nth 0 toklevels) + (push (nth 0 toklevels) levels)))))))) + levels) + (setq halfsexp nil)))))) + +;; Mirror image, not used for indentation. +(defun smie-forward-sexp (&optional halfsexp) + "Skip over one sexp. +HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the +first token we see is an operator, skip over its left-hand-side argument. +Possible return values: + (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level + is too high. RIGHT-LEVEL is the right-level of TOKEN, + POS is its end position in the buffer. + (t POS TOKEN): same thing but for an open-paren or the beginning of buffer. + (nil POS TOKEN): we skipped over a paren-like pair. + nil: we skipped over an identifier, matched parentheses, ..." + (if (eobp) (list t (point)) + (catch 'return + (let ((levels ())) + (while + (let* ((pos (point)) + (token (progn (forward-comment (point-max)) + (smie-forward-token))) + (toklevels (cdr (assoc token smie-op-levels)))) + + (cond + ((null toklevels) + (if (equal token "") + (condition-case err + (progn (goto-char pos) (forward-sexp 1) nil) + (scan-error (throw 'return (list t (caddr err))))))) + ((null (nth 0 toklevels)) + ;; A token like a paren-close. + (assert (nth 1 toklevels)) ;Otherwise, why mention it? + (push (nth 1 toklevels) levels)) + (t + (while (and levels (< (nth 0 toklevels) (car levels))) + (setq levels (cdr levels))) + (cond + ((null levels) + (if (and halfsexp (nth 1 toklevels)) + (push (nth 1 toklevels) levels) + (throw 'return + (prog1 (list (or (nth 1 toklevels) t) (point) token) + (goto-char pos))))) + (t + (while (and levels (= (nth 0 toklevels) (car levels))) + (setq levels (cdr levels))) + (cond + ((null levels) + (cond + ((null (nth 1 toklevels)) + (throw 'return (list nil (point) token))) + ((eq (nth 1 toklevels) (nth 0 toklevels)) + (throw 'return + (prog1 (list (or (nth 1 toklevels) t) (point) token) + (goto-char pos)))) + (t (debug)))) ;Not sure yet what to do here. + (t + (if (nth 1 toklevels) + (push (nth 1 toklevels) levels)))))))) + levels) + (setq halfsexp nil)))))) + +(defun smie-backward-sexp-command (&optional n) + "Move backward through N logical elements." + (interactive "p") + (if (< n 0) + (smie-forward-sexp-command (- n)) + (let ((forward-sexp-function nil)) + (while (> n 0) + (decf n) + (let ((pos (point)) + (res (smie-backward-sexp 'halfsexp))) + (if (and (car res) (= pos (point)) (not (bolp))) + (signal 'scan-error + (list "Containing expression ends prematurely" + (cadr res) (cadr res))) + nil)))))) + +(defun smie-forward-sexp-command (&optional n) + "Move forward through N logical elements." + (interactive "p") + (if (< n 0) + (smie-backward-sexp-command (- n)) + (let ((forward-sexp-function nil)) + (while (> n 0) + (decf n) + (let ((pos (point)) + (res (smie-forward-sexp 'halfsexp))) + (if (and (car res) (= pos (point)) (not (bolp))) + (signal 'scan-error + (list "Containing expression ends prematurely" + (cadr res) (cadr res))) + nil)))))) + +;;; The indentation engine. + +(defcustom smie-indent-basic 4 + "Basic amount of indentation." + :type 'integer) + +(defvar smie-indent-rules 'unset + "Rules of the following form. +\(TOK OFFSET) how to indent right after TOK. +\(TOK O1 O2) how to indent right after TOK: + O1 is the default; + O2 is used if TOK is \"hanging\". +\((T1 . T2) . OFFSET) how to indent token T2 w.r.t T1. +\((t . TOK) . OFFSET) how to indent TOK with respect to its parent. +\(list-intro . TOKENS) declare TOKENS as being followed by what may look like + a funcall but is just a sequence of expressions. +\(t . OFFSET) basic indentation step. +\(args . OFFSET) indentation of arguments. +A nil offset defaults to `smie-indent-basic'.") + +(defun smie-indent-hanging-p () + ;; A Hanging keyword is one that's at the end of a line except it's not at + ;; the beginning of a line. + (and (save-excursion (smie-forward-token) + (skip-chars-forward " \t") (eolp)) + (save-excursion (skip-chars-backward " \t") (not (bolp))))) + +(defun smie-bolp () + (save-excursion (skip-chars-backward " \t") (bolp))) + +(defun smie-indent-offset (elem) + (or (cdr (assq elem smie-indent-rules)) + (cdr (assq t smie-indent-rules)) + smie-indent-basic)) + +(defun smie-indent-calculate (&optional virtual) + "Compute the indentation to use for point. +If VIRTUAL is non-nil, it means we're not trying to indent point but just +need to compute the column at which point should be indented +in order to figure out the indentation of some other (further down) point. +VIRTUAL can take two different non-nil values: +- :bolp: means that the current indentation of point can be trusted + to be good only if it follows a line break. +- :hanging: means that the current indentation of point can be + trusted to be good except if the following token is hanging." + ;; FIXME: This has accumulated a lot of rules, some of which aren't + ;; clearly orthogonal any more, so we should probably try and + ;; restructure it somewhat. + (or + ;; Trust pre-existing indentation on other lines. + (and virtual + (if (eq virtual :hanging) (not (smie-indent-hanging-p)) (smie-bolp)) + (current-column)) + ;; Align close paren with opening paren. + (save-excursion + ;; (forward-comment (point-max)) + (when (looking-at "\\s)") + (while (not (zerop (skip-syntax-forward ")"))) + (skip-chars-forward " \t")) + (condition-case nil + (progn + (backward-sexp 1) + (smie-indent-calculate :hanging)) + (scan-error nil)))) + ;; Align closing token with the corresponding opening one. + ;; (e.g. "of" with "case", or "in" with "let"). + (save-excursion + (let* ((pos (point)) + (token (smie-forward-token)) + (toklevels (cdr (assoc token smie-op-levels)))) + (when (car toklevels) + (let ((res (smie-backward-sexp 'halfsexp)) tmp) + ;; If we didn't move at all, that means we didn't really skip + ;; what we wanted. + (when (< (point) pos) + (cond + ((eq (car res) (car toklevels)) + ;; We bumped into a same-level operator. align with it. + (goto-char (cadr res)) + ;; Don't use (smie-indent-calculate :hanging) here, because we + ;; want to jump back over a sequence of same-level ops such as + ;; a -> b -> c + ;; -> d + ;; So as to align with the earliest appropriate place. + (smie-indent-calculate :bolp)) + ((equal token (save-excursion + (forward-comment (- (point-max))) + (smie-backward-token))) + ;; in cases such as "fn x => fn y => fn z =>", + ;; jump back to the very first fn. + ;; FIXME: should we only do that for special tokens like "=>"? + (smie-indent-calculate :bolp)) + ((setq tmp (assoc (cons (caddr res) token) + smie-indent-rules)) + (goto-char (cadr res)) + (+ (cdr tmp) (smie-indent-calculate :hanging))) + (t + (+ (or (cdr (assoc (cons t token) smie-indent-rules)) 0) + (current-column))))))))) + ;; Indentation of a comment. + (and (looking-at comment-start-skip) + (save-excursion + (forward-comment (point-max)) + (skip-chars-forward " \t\r\n") + (smie-indent-calculate nil))) + ;; Indentation inside a comment. + (and (looking-at "\\*") (nth 4 (syntax-ppss)) + (let ((ppss (syntax-ppss))) + (save-excursion + (forward-line -1) + (if (<= (point) (nth 8 ppss)) + (progn (goto-char (1+ (nth 8 ppss))) (current-column)) + (skip-chars-forward " \t") + (if (looking-at "\\*") + (current-column)))))) + ;; Indentation right after a special keyword. + (save-excursion + (let* ((tok (progn (forward-comment (- (point-max))) + (smie-backward-token))) + (tokinfo (assoc tok smie-indent-rules)) + (toklevel (assoc tok smie-op-levels))) + (when (or tokinfo (and toklevel (null (cadr toklevel)))) + (if (or (smie-indent-hanging-p) + ;; If calculating the virtual indentation point, prefer + ;; looking up the virtual indentation of the alignment + ;; point as well. This is used for indentation after + ;; "fn x => fn y =>". + virtual) + (+ (smie-indent-calculate :bolp) + (or (caddr tokinfo) (cadr tokinfo) (smie-indent-offset t))) + (+ (current-column) + (or (cadr tokinfo) (smie-indent-offset t))))))) + ;; Main loop (FIXME: whatever that means!?). + (save-excursion + (let ((positions nil) + (begline nil) + arg) + (while (and (null (car (smie-backward-sexp))) + (push (point) positions) + (not (setq begline (smie-bolp))))) + (save-excursion + ;; Figure out if the atom we just skipped is an argument rather + ;; than a function. + (setq arg (or (null (car (smie-backward-sexp))) + (member (progn (forward-comment (- (point-max))) + (smie-backward-token)) + (cdr (assoc 'list-intro smie-indent-rules)))))) + (cond + ((and arg positions) + (goto-char (car positions)) + (current-column)) + ((and (null begline) (cdr positions)) + ;; We skipped some args plus the function and bumped into something. + ;; Align with the first arg. + (goto-char (cadr positions)) + (current-column)) + ((and (null begline) positions) + ;; We're the first arg. + ;; FIXME: it might not be a funcall, in which case we might be the + ;; second element. + (goto-char (car positions)) + (+ (smie-indent-offset 'args) + ;; We used to use (smie-indent-calculate :bolp), but that + ;; doesn't seem right since it might then indent args less than + ;; the function itself. + (current-column))) + ((and (null arg) (null positions)) + ;; We're the function itself. Not sure what to do here yet. + (if virtual (current-column) + (save-excursion + (let* ((pos (point)) + (tok (progn (forward-comment (- (point-max))) + (smie-backward-token))) + (toklevels (cdr (assoc tok smie-op-levels)))) + (cond + ((numberp (car toklevels)) + ;; We're right after an infix token. Let's skip over the + ;; lefthand side. + (goto-char pos) + (let (res) + (while (progn (setq res (smie-backward-sexp 'halfsexp)) + (and (not (smie-bolp)) + (equal (car res) (car toklevels))))) + ;; We should be right after a token of equal or + ;; higher precedence. + (cond + ((and (consp res) (memq (car res) '(t nil))) + ;; The token of higher-precedence is like an open-paren. + ;; Sample case for t: foo { bar, \n[TAB] baz }. + ;; Sample case for nil: match ... with \n[TAB] | toto ... + ;; (goto-char (cadr res)) + (smie-indent-calculate :hanging)) + ((and (consp res) (<= (car res) (car toklevels))) + ;; We stopped at a token of equal or higher precedence + ;; because we found a place with which to align. + (current-column)) + ))) + ;; For other cases.... hmm... we'll see when we get there. + ))))) + ((null positions) + (smie-backward-token) + (+ (smie-indent-offset 'args) (smie-indent-calculate :bolp))) + ((car (smie-backward-sexp)) + ;; No arg stands on its own line, but the function does: + (if (cdr positions) + (progn + (goto-char (cadr positions)) + (current-column)) + (goto-char (car positions)) + (+ (current-column) (smie-indent-offset 'args)))) + (t + ;; We've skipped to a previous arg on its own line: align. + (goto-char (car positions)) + (current-column))))))) + +(defun smie-indent-line () + "Indent current line using the SMIE indentation engine." + (interactive) + (let* ((savep (point)) + (indent (condition-case nil + (save-excursion + (forward-line 0) + (skip-chars-forward " \t") + (if (>= (point) savep) (setq savep nil)) + (or (smie-indent-calculate) 0)) + (error 0)))) + (if (not (numberp indent)) + ;; If something funny is used (e.g. `noindent'), return it. + indent + (if (< indent 0) (setq indent 0)) ;Just in case. + (if savep + (save-excursion (indent-line-to indent)) + (indent-line-to indent))))) + +;;;###autoload +(defun smie-setup (op-levels indent-rules) + (set (make-local-variable 'smie-indent-rules) indent-rules) + (set (make-local-variable 'smie-op-levels) op-levels) + (set (make-local-variable 'indent-line-function) 'smie-indent-line)) + + +(provide 'smie) +;;; smie.el ends here diff --git a/lisp/files.el b/lisp/files.el index 83ae91dd63a..d4c05bdc5d6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -574,6 +574,9 @@ Runs the usual ange-ftp hook, but only for completion operations." (inhibit-file-name-operation op)) (apply op args)))) +(declare-function dos-convert-standard-filename "dos-fns.el" (filename)) +(declare-function w32-convert-standard-filename "w32-fns.el" (filename)) + (defun convert-standard-filename (filename) "Convert a standard file's name to something suitable for the OS. This means to guarantee valid names and perhaps to canonicalize @@ -591,15 +594,20 @@ and also turn slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics'). See Info node `(elisp)Standard File Names' for more details." - (if (eq system-type 'cygwin) - (let ((name (copy-sequence filename)) - (start 0)) - ;; Replace invalid filename characters with ! - (while (string-match "[?*:<>|\"\000-\037]" name start) - (aset name (match-beginning 0) ?!) - (setq start (match-end 0))) - name) - filename)) + (cond + ((eq system-type 'cygwin) + (let ((name (copy-sequence filename)) + (start 0)) + ;; Replace invalid filename characters with ! + (while (string-match "[?*:<>|\"\000-\037]" name start) + (aset name (match-beginning 0) ?!) + (setq start (match-end 0))) + name)) + ((eq system-type 'windows-nt) + (w32-convert-standard-filename filename)) + ((eq system-type 'ms-dos) + (dos-convert-standard-filename filename)) + (t filename))) (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) "Read directory name, prompting with PROMPT and completing in directory DIR. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 0b7eaf7ed72..395cca72a93 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-05-14 Katsumi Yamaoka + + * gnus-sum.el (gnus-summary-save-article): Don't bother to re-fetch + article unless decoding article to be saved. + 2010-05-13 Katsumi Yamaoka * mml1991.el (mml1991-mailcrypt-encrypt, mml1991-gpg-encrypt) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 3a2c944ed2f..3626d0bd904 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -11664,12 +11664,8 @@ will not be marked as saved." (gnus-message 1 "Article %d is unsaveable" article)) ;; This is a real article. (save-window-excursion - (let ((gnus-display-mime-function (when decode - gnus-display-mime-function)) - (gnus-article-prepare-hook (when decode - gnus-article-prepare-hook))) - (gnus-summary-select-article t t nil article) - (gnus-summary-goto-subject article))) + (gnus-summary-select-article decode decode nil article) + (gnus-summary-goto-subject article)) (with-current-buffer save-buffer (erase-buffer) (insert-buffer-substring (if decode diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index fb13df54045..d97320da861 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -140,7 +140,7 @@ (define-key-after map [describe-language-environment] `(menu-item ,(purecopy "Describe Language Environment") - describe-language-environment-map + ,describe-language-environment-map :help ,(purecopy "Show multilingual settings for a specific language"))) (define-key-after map [describe-input-method] `(menu-item ,(purecopy "Describe Input Method...") describe-input-method diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index 993df98b3a6..fd98fcfecb7 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el @@ -60,14 +60,14 @@ (input-method . "hebrew") (unibyte-display . hebrew-iso-8bit) (sample-text . "Hebrew ,Hylem(B") - (documentation . "Right-to-left writing is not yet supported."))) + (documentation . "Bidirectional editing is supported."))) (set-language-info-alist "Windows-1255" '((coding-priority windows-1255) (coding-system windows-1255) (documentation . "\ Support for Windows-1255 encoding, e.g. for Yiddish. -Right-to-left writing is not yet supported."))) +Bidirectional editing is supported."))) (define-coding-system 'windows-1255 "windows-1255 (Hebrew) encoding (MIME: WINDOWS-1255)" diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el index 612d6cf053b..ad507546696 100644 --- a/lisp/org/org-docview.el +++ b/lisp/org/org-docview.el @@ -1,9 +1,8 @@ ;;; org-docview.el --- support for links to doc-view-mode buffers -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Jan Böcker +;; Author: Jan Böcker ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org ;; Version: 6.35i diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 65c05ae7487..cf199e69a33 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -444,12 +444,14 @@ in the same way as TABLE completes strings of the form (concat S2 S)." ;; I don't think such commands are usable before first setting up buffer-local ;; variables to parse args, so there's no point autoloading it. ;; ;;;###autoload -(defun pcomplete-std-complete () +(defun pcomplete-completions-at-point () "Provide standard completion using pcomplete's completion tables. Same as `pcomplete' but using the standard completion UI." - (interactive) ;; FIXME: it only completes the text before point, whereas the ;; standard UI may also consider text after point. + ;; FIXME: the `pcomplete' UI may be used internally during + ;; pcomplete-completions and then throw to `pcompleted', thus + ;; imposing the pcomplete UI over the standard UI. (catch 'pcompleted (let* ((pcomplete-stub) pcomplete-seen pcomplete-norm-func @@ -516,7 +518,7 @@ Same as `pcomplete' but using the standard completion UI." (directory-file-name f)) pcomplete-seen)))))) - (completion-in-region + (list beg (point) ;; Add a space at the end of completion. Use a terminator-regexp ;; that never matches since the terminator cannot appear @@ -527,7 +529,14 @@ Same as `pcomplete' but using the standard completion UI." (cons pcomplete-termination-string "\\`a\\`") table)) - pred)))) + :predicate pred)))) + + ;; I don't think such commands are usable before first setting up buffer-local + ;; variables to parse args, so there's no point autoloading it. + ;; ;;;###autoload +(defun pcomplete-std-complete () + (let ((completion-at-point-functions '(pcomplete-completions-at-point))) + (completion-at-point))) ;;; Pcomplete's native UI. diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index 0ce7d780d1f..f5fef76a009 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -109,7 +109,7 @@ "Additional expressions to highlight in Assembler mode.") ;;;###autoload -(defun asm-mode () +(define-derived-mode asm-mode prog-mode "Assembler" "Major mode for editing typical assembler code. Features a private abbrev table and the following bindings: @@ -128,13 +128,8 @@ Turning on Asm mode runs the hook `asm-mode-hook' at the end of initialization. Special commands: \\{asm-mode-map}" - (interactive) - (kill-all-local-variables) - (setq mode-name "Assembler") - (setq major-mode 'asm-mode) (setq local-abbrev-table asm-mode-abbrev-table) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(asm-font-lock-keywords)) + (set (make-local-variable 'font-lock-defaults) '(asm-font-lock-keywords)) (set (make-local-variable 'indent-line-function) 'asm-indent-line) ;; Stay closer to the old TAB behavior (was tab-to-tab-stop). (set (make-local-variable 'tab-always-indent) nil) @@ -157,8 +152,7 @@ Special commands: (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") (make-local-variable 'comment-end) (setq comment-end "") - (setq fill-prefix "\t") - (run-mode-hooks 'asm-mode-hook)) + (setq fill-prefix "\t")) (defun asm-indent-line () "Auto-indent the current line." diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 197b41506bd..64277dc4f82 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -31,6 +31,7 @@ (defvar comint-prompt-regexp) (defvar comint-process-echoes) +(defvar smie-indent-basic) (defgroup prolog nil "Major mode for editing and running Prolog under Emacs." @@ -98,6 +99,61 @@ When nil, send actual operating system end of file." (defvar prolog-mode-abbrev-table nil) (define-abbrev-table 'prolog-mode-abbrev-table ()) +(defconst prolog-smie-op-levels + ;; Rather than construct the operator levels table from the BNF, + ;; we directly provide the operator precedences from GNU Prolog's + ;; manual. The only problem is that GNU Prolog's manual uses + ;; precedence levels in the opposite sense (higher numbers bind less + ;; tightly) than SMIE, so we use negative numbers. + '(("." -10000 -10000) + (":-" -1200 -1200) + ("-->" -1200 -1200) + (";" -1100 -1100) + ("->" -1050 -1050) + ("," -1000 -1000) + ("\\+" -900 -900) + ("=" -700 -700) + ("\\=" -700 -700) + ("=.." -700 -700) + ("==" -700 -700) + ("\\==" -700 -700) + ("@<" -700 -700) + ("@=<" -700 -700) + ("@>" -700 -700) + ("@>=" -700 -700) + ("is" -700 -700) + ("=:=" -700 -700) + ("=\\=" -700 -700) + ("<" -700 -700) + ("=<" -700 -700) + (">" -700 -700) + (">=" -700 -700) + (":" -600 -600) + ("+" -500 -500) + ("-" -500 -500) + ("/\\" -500 -500) + ("\\/" -500 -500) + ("*" -400 -400) + ("/" -400 -400) + ("//" -400 -400) + ("rem" -400 -400) + ("mod" -400 -400) + ("<<" -400 -400) + (">>" -400 -400) + ("**" -200 -200) + ("^" -200 -200) + ;; Prefix + ;; ("+" 200 200) + ;; ("-" 200 200) + ;; ("\\" 200 200) + ) + "Precedence levels of infix operators.") + +(defconst prolog-smie-indent-rules + '((":-") + ("->")) + "Prolog indentation rules.") + (defun prolog-mode-variables () (make-local-variable 'paragraph-separate) (setq paragraph-separate (concat "%%\\|$\\|" page-delimiter)) ;'%%..' @@ -105,8 +161,10 @@ When nil, send actual operating system end of file." (setq paragraph-ignore-fill-prefix t) (make-local-variable 'imenu-generic-expression) (setq imenu-generic-expression '((nil "^\\sw+" 0))) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'prolog-indent-line) + (smie-setup prolog-smie-op-levels prolog-smie-indent-rules) + (set (make-local-variable 'forward-sexp-function) + 'smie-forward-sexp-command) + (set (make-local-variable 'smie-indent-basic) prolog-indent-width) (make-local-variable 'comment-start) (setq comment-start "%") (make-local-variable 'comment-start-skip) @@ -122,7 +180,7 @@ When nil, send actual operating system end of file." (define-key map "\C-c\C-l" 'inferior-prolog-load-file) (define-key map "\C-c\C-z" 'switch-to-prolog) map)) - + (easy-menu-define prolog-mode-menu prolog-mode-map "Menu for Prolog mode." ;; Mostly copied from scheme-mode's menu. ;; Not tremendously useful, but it's a start. @@ -136,85 +194,18 @@ When nil, send actual operating system end of file." )) ;;;###autoload -(defun prolog-mode () +(define-derived-mode prolog-mode prog-mode "Prolog" "Major mode for editing Prolog code for Prologs. Blank lines and `%%...' separate paragraphs. `%'s start comments. Commands: \\{prolog-mode-map} Entry to this mode calls the value of `prolog-mode-hook' if that value is non-nil." - (interactive) - (kill-all-local-variables) - (use-local-map prolog-mode-map) - (set-syntax-table prolog-mode-syntax-table) - (setq major-mode 'prolog-mode) - (setq mode-name "Prolog") (prolog-mode-variables) (set (make-local-variable 'comment-add) 1) - ;; font lock (setq font-lock-defaults '(prolog-font-lock-keywords nil nil nil - beginning-of-line)) - (run-mode-hooks 'prolog-mode-hook)) - -(defun prolog-indent-line () - "Indent current line as Prolog code. -With argument, indent any additional lines of the same clause -rigidly along with this one (not yet)." - (interactive "p") - (let ((indent (prolog-indent-level)) - (pos (- (point-max) (point)))) - (beginning-of-line) - (indent-line-to indent) - (if (> (- (point-max) pos) (point)) - (goto-char (- (point-max) pos))))) - -(defun prolog-indent-level () - "Compute Prolog indentation level." - (save-excursion - (beginning-of-line) - (skip-chars-forward " \t") - (cond - ((looking-at "%%%") 0) ;Large comment starts - ((looking-at "%[^%]") comment-column) ;Small comment starts - ((bobp) 0) ;Beginning of buffer - (t - (let ((empty t) ind more less) - (if (looking-at ")") - (setq less t) ;Find close - (setq less nil)) - ;; See previous indentation - (while empty - (forward-line -1) - (beginning-of-line) - (if (bobp) - (setq empty nil) - (skip-chars-forward " \t") - (if (not (or (looking-at "%[^%]") (looking-at "\n"))) - (setq empty nil)))) - (if (bobp) - (setq ind 0) ;Beginning of buffer - (setq ind (current-column))) ;Beginning of clause - ;; See its beginning - (if (looking-at "%%[^%]") - ind - ;; Real prolog code - (if (looking-at "(") - (setq more t) ;Find open - (setq more nil)) - ;; See its tail - (end-of-prolog-clause) - (or (bobp) (forward-char -1)) - (cond ((looking-at "[,(;>]") - (if (and more (looking-at "[^,]")) - (+ ind prolog-indent-width) ;More indentation - (max tab-width ind))) ;Same indentation - ((looking-at "-") tab-width) ;TAB - ((or less (looking-at "[^.]")) - (max (- ind prolog-indent-width) 0)) ;Less indentation - (t 0)) ;No indentation - ))) - ))) + beginning-of-line))) (defun end-of-prolog-clause () "Go to end of clause in this line." diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index eca6d5fbe7b..5f4028af89a 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -411,11 +411,7 @@ the car and cdr are the same symbol.") (modify-syntax-entry (pop list) (pop list) table)) table) -(defvar sh-mode-syntax-table nil - "The syntax table to use for Shell-Script mode. -This is buffer-local in every such buffer.") - -(defvar sh-mode-default-syntax-table +(defvar sh-mode-syntax-table (sh-mode-syntax-table () ?\# "<" ?\n ">#" @@ -436,7 +432,8 @@ This is buffer-local in every such buffer.") ?= "." ?< "." ?> ".") - "Default syntax table for shell mode.") + "The syntax table to use for Shell-Script mode. +This is buffer-local in every such buffer.") (defvar sh-mode-syntax-table-input '((sh . nil)) @@ -611,7 +608,7 @@ sign. See `sh-feature'." (defvar sh-header-marker nil "When non-nil is the end of header for prepending by \\[sh-execute-region]. That command is also used for setting this variable.") - +(make-variable-buffer-local 'sh-header-marker) (defcustom sh-beginning-of-command "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~[:alnum:]:]\\)" @@ -1533,57 +1530,41 @@ indicate what shell it is use `sh-alias-alist' to translate. If your shell gives error messages with line numbers, you can use \\[executable-interpret] with your script for an edit-interpret-debug cycle." - (make-local-variable 'skeleton-end-hook) - (make-local-variable 'paragraph-start) - (make-local-variable 'paragraph-separate) - (make-local-variable 'comment-start) - (make-local-variable 'comment-start-skip) - (make-local-variable 'require-final-newline) - (make-local-variable 'sh-header-marker) (make-local-variable 'sh-shell-file) (make-local-variable 'sh-shell) - (make-local-variable 'skeleton-pair-alist) - (make-local-variable 'skeleton-pair-filter-function) - (make-local-variable 'comint-dynamic-complete-functions) - (make-local-variable 'comint-prompt-regexp) - (make-local-variable 'font-lock-defaults) - (make-local-variable 'skeleton-filter-function) - (make-local-variable 'skeleton-newline-indent-rigidly) - (make-local-variable 'sh-shell-variables) - (make-local-variable 'sh-shell-variables-initialized) - (make-local-variable 'imenu-generic-expression) - (make-local-variable 'sh-indent-supported-here) - (make-local-variable 'skeleton-pair-default-alist) - (setq skeleton-pair-default-alist sh-skeleton-pair-default-alist) - (setq skeleton-end-hook (lambda () - (or (eolp) (newline) (indent-relative))) - paragraph-start (concat page-delimiter "\\|$") - paragraph-separate paragraph-start - comment-start "# " - comment-start-skip "#+[\t ]*" - local-abbrev-table sh-mode-abbrev-table - comint-dynamic-complete-functions sh-dynamic-complete-functions - ;; we can't look if previous line ended with `\' - comint-prompt-regexp "^[ \t]*" - imenu-case-fold-search nil - font-lock-defaults - `((sh-font-lock-keywords - sh-font-lock-keywords-1 sh-font-lock-keywords-2) - nil nil - ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil - (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords) - (font-lock-syntactic-face-function - . sh-font-lock-syntactic-face-function)) - skeleton-pair-alist '((?` _ ?`)) - skeleton-pair-filter-function 'sh-quoted-p - skeleton-further-elements '((< '(- (min sh-indentation - (current-column))))) - skeleton-filter-function 'sh-feature - skeleton-newline-indent-rigidly t - sh-indent-supported-here nil) + + (set (make-local-variable 'skeleton-pair-default-alist) + sh-skeleton-pair-default-alist) + (set (make-local-variable 'skeleton-end-hook) + (lambda () (or (eolp) (newline) (indent-relative)))) + + (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$")) + (set (make-local-variable 'paragraph-separate) paragraph-start) + (set (make-local-variable 'comment-start) "# ") + (set (make-local-variable 'comment-start-skip) "#+[\t ]*") + (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table) + (set (make-local-variable 'comint-dynamic-complete-functions) + sh-dynamic-complete-functions) + ;; we can't look if previous line ended with `\' + (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*") + (set (make-local-variable 'imenu-case-fold-search) nil) + (set (make-local-variable 'font-lock-defaults) + `((sh-font-lock-keywords + sh-font-lock-keywords-1 sh-font-lock-keywords-2) + nil nil + ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil + (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords) + (font-lock-syntactic-face-function + . sh-font-lock-syntactic-face-function))) + (set (make-local-variable 'skeleton-pair-alist) '((?` _ ?`))) + (set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p) + (set (make-local-variable 'skeleton-further-elements) + '((< '(- (min sh-indentation (current-column)))))) + (set (make-local-variable 'skeleton-filter-function) 'sh-feature) + (set (make-local-variable 'skeleton-newline-indent-rigidly) t) + (set (make-local-variable 'sh-indent-supported-here) nil) (set (make-local-variable 'defun-prompt-regexp) (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)")) - (set (make-local-variable 'parse-sexp-ignore-comments) t) ;; Parse or insert magic number for exec, and set all variables depending ;; on the shell thus determined. (sh-set-shell @@ -1737,21 +1718,20 @@ Calls the value of `sh-set-shell-hook' if set." no-query-flag insert-flag))) (let ((tem (sh-feature sh-require-final-newline))) (if (eq tem t) - (setq require-final-newline mode-require-final-newline))) - (setq - mode-line-process (format "[%s]" sh-shell) - sh-shell-variables nil - sh-shell-variables-initialized nil - imenu-generic-expression (sh-feature sh-imenu-generic-expression)) - (make-local-variable 'sh-mode-syntax-table) + (set (make-local-variable 'require-final-newline) + mode-require-final-newline))) + (setq mode-line-process (format "[%s]" sh-shell)) + (set (make-local-variable 'sh-shell-variables) nil) + (set (make-local-variable 'sh-shell-variables-initialized) nil) + (set (make-local-variable 'imenu-generic-expression) + (sh-feature sh-imenu-generic-expression)) (let ((tem (sh-feature sh-mode-syntax-table-input))) - (setq sh-mode-syntax-table - (if tem (apply 'sh-mode-syntax-table tem) - sh-mode-default-syntax-table))) - (set-syntax-table sh-mode-syntax-table) + (when tem + (set (make-local-variable 'sh-mode-syntax-table) + (apply 'sh-mode-syntax-table tem)) + (set-syntax-table sh-mode-syntax-table))) (dolist (var (sh-feature sh-variables)) (sh-remember-variable var)) - (make-local-variable 'indent-line-function) (if (setq sh-indent-supported-here (sh-feature sh-indent-supported)) (progn (message "Setting up indent for shell type %s" sh-shell) @@ -1764,7 +1744,7 @@ Calls the value of `sh-set-shell-hook' if set." (message "setting up indent stuff") ;; sh-mode has already made indent-line-function local ;; but do it in case this is called before that. - (setq indent-line-function 'sh-indent-line) + (set (make-local-variable 'indent-line-function) 'sh-indent-line) (if sh-make-vars-local (sh-make-vars-local)) (message "Indentation setup for shell type %s" sh-shell)) @@ -3463,20 +3443,15 @@ CODE can be nil, t or `lambda'. nil means to return the best completion of STRING, or nil if there is none. t means to return a list of all possible completions of STRING. `lambda' means to return t if STRING is a valid completion as it stands." - (let ((sh-shell-variables + (let ((vars (with-current-buffer sh-add-buffer (or sh-shell-variables-initialized (sh-shell-initialize-variables)) (nconc (mapcar (lambda (var) - (let ((name - (substring var 0 (string-match "=" var)))) - (cons name name))) + (substring var 0 (string-match "=" var))) process-environment) sh-shell-variables)))) - (case code - ((nil) (try-completion string sh-shell-variables predicate)) - (lambda (test-completion string sh-shell-variables predicate)) - (t (all-completions string sh-shell-variables predicate))))) + (complete-with-action code vars string predicate))) (defun sh-add (var delta) "Insert an addition of VAR and prefix DELTA for Bourne (type) shell." diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 1f981e5a3d7..e4df102f542 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -663,9 +663,9 @@ is changed." Starts `sql-interactive-mode' after doing some setup. -On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order to -start the sqlplus console, use \"plus33\" or something similar. You -will find the file in your Orant\\bin directory." +On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order +to start the sqlplus console, use \"plus33\" or something similar. +You will find the file in your Orant\\bin directory." :type 'file :group 'SQL) @@ -690,7 +690,7 @@ will find the file in your Orant\\bin directory." When non-nil, Emacs will scan text sent to sqlplus and prompt for replacement text for & placeholders as sqlplus does. This -is needed on Windows where sqlplus output is buffer and the +is needed on Windows where sqlplus output is buffered and the prompts are not shown until after the text is entered. You will probably want to issue the following command in sqlplus @@ -772,10 +772,10 @@ Starts `sql-interactive-mode' after doing some setup." :version "24.1" :group 'SQL) -;; Customization for SyBase +;; Customization for Sybase (defcustom sql-sybase-program "isql" - "Command to start isql by SyBase. + "Command to start isql by Sybase. Starts `sql-interactive-mode' after doing some setup." :type 'file @@ -2042,7 +2042,7 @@ See `sql-product-alist' for a list of products and supported features." (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) (defun sql-product-font-lock (keywords-only imenu) - "Configures font-lock and imenu with product-specific settings. + "Configure font-lock and imenu with product-specific settings. The KEYWORDS-ONLY flag is passed to font-lock to specify whether only keywords should be hilighted and syntactic hilighting @@ -2098,7 +2098,7 @@ also be configured." (defun sql-add-product-keywords (product keywords &optional append) "Add highlighting KEYWORDS for SQL PRODUCT. -PRODUCT should be a symbol, the name of a sql product, such as +PRODUCT should be a symbol, the name of a SQL product, such as `oracle'. KEYWORDS should be a list; see the variable `font-lock-keywords'. By default they are added at the beginning of the current highlighting list. If optional argument APPEND is @@ -2131,7 +2131,7 @@ adds a fontification pattern to fontify identifiers ending in ;;; Functions to switch highlighting (defun sql-highlight-product () - "Turns on the font highlighting for the SQL product selected." + "Turn on the font highlighting for the SQL product selected." (when (derived-mode-p 'sql-mode) ;; Setup font-lock (sql-product-font-lock nil t) @@ -2141,7 +2141,7 @@ adds a fontification pattern to fontify identifiers ending in (symbol-name sql-product)) "]")))) (defun sql-set-product (product) - "Set `sql-product' to product and enable appropriate highlighting." + "Set `sql-product' to PRODUCT and enable appropriate highlighting." (interactive (list (completing-read "SQL product: " (mapcar (lambda (info) (symbol-name (car info))) @@ -2416,7 +2416,7 @@ variable `sql-buffer'. See `sql-help' on how to create such a buffer." (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) (defun sql-make-alternate-buffer-name () - "Returns a string that can be used to rename a SQLi buffer. + "Return a string that can be used to rename a SQLi buffer. This is used to set `sql-alternate-buffer-name' within `sql-interactive-mode'." @@ -2475,7 +2475,7 @@ Inserts SELECT or commas if appropriate." (defun sql-placeholders-filter (string) "Replace placeholders in STRING. -Placeholders are words starting with and ampersand like &this." +Placeholders are words starting with an ampersand like &this." (when sql-oracle-scan-on (while (string-match "&\\(\\sw+\\)" string) @@ -2489,7 +2489,7 @@ Placeholders are words starting with and ampersand like &this." ;; Using DB2 interactively, newlines must be escaped with " \". ;; The space before the backslash is relevant. (defun sql-escape-newlines-filter (string) - "Escapes newlines in STRING. + "Escape newlines in STRING. Every newline in STRING will be preceded with a space and a backslash." (let ((result "") (start 0) mb me) (while (string-match "\n" string start) @@ -2508,7 +2508,7 @@ Every newline in STRING will be preceded with a space and a backslash." ;;; Input sender for SQLi buffers (defun sql-input-sender (proc string) - "Sends STRING to PROC after applying filters." + "Send STRING to PROC after applying filters." (let* ((product (with-current-buffer (process-buffer proc) sql-product)) (filter (sql-get-product-feature product :input-filter))) @@ -2575,7 +2575,7 @@ Every newline in STRING will be preceded with a space and a backslash." (sql-send-region (point-min) (point-max))) (defun sql-send-magic-terminator (buf str terminator) - "Sends TERMINATOR to buffer BUF if its not present in STR." + "Send TERMINATOR to buffer BUF if its not present in STR." (let (pat term) ;; If flag is merely on(t), get product-specific terminator (if (eq terminator t) @@ -2961,7 +2961,7 @@ The default comes from `process-coding-system-alist' and ;;;###autoload (defun sql-sybase () - "Run isql by SyBase as an inferior process. + "Run isql by Sybase as an inferior process. If buffer `*SQL*' exists but no process is running, make a new process. If buffer exists and a process is running, just switch to buffer diff --git a/lisp/simple.el b/lisp/simple.el index 5948536262c..48e1148ae6b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -422,6 +422,13 @@ Other major modes are defined by comparison with this one." "Parent major mode from which special major modes should inherit." (setq buffer-read-only t)) +;; Major mode meant to be the parent of programming modes. + +(define-derived-mode prog-mode fundamental-mode "Prog" + "Major mode for editing programming language source code." + (set (make-local-variable 'require-final-newline) mode-require-final-newline) + (set (make-local-variable 'parse-sexp-ignore-comments) t)) + ;; Making and deleting lines. (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) @@ -2070,7 +2077,11 @@ to `shell-command-history'." Like `shell-command' but if COMMAND doesn't end in ampersand, adds `&' surrounded by whitespace and executes the command asynchronously. -The output appears in the buffer `*Async Shell Command*'." +The output appears in the buffer `*Async Shell Command*'. + +In Elisp, you will often be better served by calling `start-process' +directly, since it offers more control and does not impose the use of a +shell (with its need to quote arguments)." (interactive (list (read-shell-command "Async shell command: " nil nil @@ -2131,7 +2142,11 @@ If the optional third argument ERROR-BUFFER is non-nil, it is a buffer or buffer name to which to direct the command's standard error output. If it is nil, error output is mingled with regular output. In an interactive call, the variable `shell-command-default-error-buffer' -specifies the value of ERROR-BUFFER." +specifies the value of ERROR-BUFFER. + +In Elisp, you will often be better served by calling `call-process' or +`start-process' directly, since it offers more control and does not impose +the use of a shell (with its need to quote arguments)." (interactive (list diff --git a/lisp/subr.el b/lisp/subr.el index 0cc05a78bc7..1c399f89b9c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3804,5 +3804,30 @@ which is higher than \"1alpha\"." (prin1-to-string (make-hash-table))))) (provide 'hashtable-print-readable)) +;; Moving with arrows in bidi-sensitive direction. +(defun right-arrow-command (&optional n) + "Move point N characters to the right (to the left if N is negative). +On reaching beginning or end of buffer, stop and signal error. + +Depending on the bidirectional context, this may move either forward +or backward in the buffer. This is in contrast with \\[forward-char] +and \\[backward-char], which see." + (interactive "^p") + (if (eq (current-bidi-paragraph-direction) 'left-to-right) + (forward-char n) + (backward-char n))) + +(defun left-arrow-command ( &optional n) + "Move point N characters to the left (to the right if N is negative). +On reaching beginning or end of buffer, stop and signal error. + +Depending on the bidirectional context, this may move either backward +or forward in the buffer. This is in contrast with \\[backward-char] +and \\[forward-char], which see." + (interactive "^p") + (if (eq (current-bidi-paragraph-direction) 'left-to-right) + (backward-char n) + (forward-char n))) + ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc ;;; subr.el ends here diff --git a/lisp/version.el b/lisp/version.el index 5cd0cc8d634..770409b9487 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -29,12 +29,6 @@ ;;; Code: -(defconst emacs-copyright "Copyright (C) 2010 Free Software Foundation, Inc." "\ -Short copyright string for this version of Emacs.") - -(defconst emacs-version "24.0.50" "\ -Version numbers of this version of Emacs.") - (defconst emacs-major-version (progn (string-match "^[0-9]+" emacs-version) (string-to-number (match-string 0 emacs-version))) "\ Major version number of this version of Emacs. This variable first existed in version 19.23.") diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index efdf26b529c..0b97b184d22 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -253,15 +253,16 @@ You should set this to t when using a non-system shell.\n\n")))) ;; (setq source-directory (file-name-as-directory ;; (expand-file-name ".." exec-directory))))) -(defun convert-standard-filename (filename) - "Convert a standard file's name to something suitable for the current OS. +(defun w32-convert-standard-filename (filename) + "Convert a standard file's name to something suitable for the MS-Windows. This means to guarantee valid names and perhaps to canonicalize certain patterns. -On Windows and DOS, replace invalid characters. On DOS, make -sure to obey the 8.3 limitations. On Windows, turn Cygwin names -into native names, and also turn slashes into backslashes if the -shell requires it (see `w32-shell-dos-semantics')." +This function is called by `convert-standard-filename'. + +Replace invalid characters and turn Cygwin names into native +names, and also turn slashes into backslashes if the shell +requires it (see `w32-shell-dos-semantics')." (save-match-data (let ((name (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index dfa61888467..7e8edb930ad 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,7 @@ +2010-05-15 Glenn Morris + + * Makefile.in (mostlyclean): Remove references to non-existent files. + 2010-05-13 Jan Djärv * lwlib-Xaw.c (make_dialog): Remove extra arg to XtVaGetSubresources. diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index c72b3920814..eac09174451 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in @@ -75,7 +75,7 @@ lwlib-Xm.o: lwlib-Xm.c lwlib-Xm.h lwlib.h lwlib-int.h lwlib-utils.h xlwmenu.o: xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h mostlyclean: - $(RM) *.o core errs ,* *.a .emacs_* make.log MakeOut \#* + $(RM) *.o core liblw.a \#* clean: mostlyclean distclean: clean diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 0c7752b0f66..fd320d85920 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,56 @@ +2010-05-18 Eli Zaretskii + + * sed1x.inp: Add copyright notice. + +2010-05-18 Glenn Morris + + * sed1v2.inp (RALLOC_OBJ): Edit to ralloc.o. + + * sed1v2.inp (GMALLOC_OBJ): Edit to gmalloc.o. + (VMLIMIT_OBJ): Edit to vm-limit.o. + +2010-05-17 Glenn Morris + + * sed1v2.inp (OLDXMENU_DEPS): Edit to empty. + * sed1x.inp (OLDXMENU_DEPS): Edit to ${OLDXMENU} ../src/${OLDXMENU}. + +2010-05-16 Glenn Morris + + * sed1v2.inp (TEMACS_LDFLAGS2): Edit to $(LDFLAGS). + + * sed1v2.inp (GNUSTEP_SYSTEM_LIBRARIES): Remove. + (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): Edit to empty. + +2010-05-15 Glenn Morris + + * sed1v2.inp (LIBXMENU): Edit to empty. + * sed1x.inp (LIBXMENU): Expect empty initial value. + + * sed1v2.inp (OLDXMENU): Edit to empty. + * sed1x.inp (OLDXMENU): Expect empty initial value. + + * sed1v2.inp (LIBX_OTHER): Edit to empty. + * sed1x.inp (LIBX_OTHER): Expect empty initial value. + + * sed1v2.inp (FONT_OBJ): Edit to empty for non-X case. + * sed1x.inp (FONT_OBJ): Edit to xfont.o for X case. + +2010-05-15 Eli Zaretskii + + * sed3v2.inp (INSTALLABLES): Edit out extra ${EXEEXT} after + "emacsclient". + (emacsserver, timer, wakeup): Remove edit-out commands. + + * sed1v2.inp (MSDOS_OBJ): Add w16select.o. + (TERMCAP_OBJ): Add termcap.o. + +2010-05-15 Glenn Morris + + * sed1v2.inp (OLDXMENU_TARGET): Edit to empty. + * sed1x.inp (OLDXMENU_TARGET): Edit to really-oldxmenu. + + * sed1v2.inp (LIBXT_OTHER): Edit to empty. + 2010-05-14 Glenn Morris * sed1v2.inp (ns_appdir, ns_appbindir, ns_appsrc): Edit to empty. diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index 2d1b2bf5f59..574910d2beb 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -52,6 +52,7 @@ s/\.h\.in/.h-in/ /^LD_SWITCH_X_SITE_AUX_RPATH *=/s/@LD_SWITCH_X_SITE_AUX_RPATH@// /^LD_SWITCH_SYSTEM *=/s/@LD_SWITCH_SYSTEM@// /^LD_SWITCH_SYSTEM_EXTRA *=/s/@LD_SWITCH_SYSTEM_EXTRA@// +/^TEMACS_LDFLAGS2 *=/s/@TEMACS_LDFLAGS2@/$(LDFLAGS)/ /^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@// /^LIB_GCC *=/s/@LIB_GCC@/-Lgcc/ /^LIB_STANDARD *=/s/@LIB_STANDARD@// @@ -77,10 +78,13 @@ s/\.h\.in/.h-in/ /^GCONF_LIBS *=/s/@GCONF_LIBS@// /^GTK_OBJ *=/s/@GTK_OBJ@// /^LIBS_TERMCAP *=/s/@LIBS_TERMCAP@// -/^TERMCAP_OBJ *=/s/@TERMCAP_OBJ@/tparam.o/ +/^TERMCAP_OBJ *=/s/@TERMCAP_OBJ@/termcap.o tparam.o/ /^LIBXMU *=/s/@LIBXMU@// /^LIBXSM *=/s/@LIBXSM@// /^LIBXTR6 *=/s/@LIBXTR6@// +/^LIBXT_OTHER *=/s/@LIBXT_OTHER@// +/^OLDXMENU_TARGET *=/s/@OLDXMENU_TARGET@// +/^OLDXMENU_DEPS *=/s/@OLDXMENU_DEPS@// /^XOBJ *=/s/@XOBJ@// /^TOOLKIT_LIBW *=/s/@TOOLKIT_LIBW@// /^LIBSOUND *=/s/@LIBSOUND@// @@ -89,7 +93,7 @@ s/\.h\.in/.h-in/ /^RSVG_CFLAGS *=/s/@RSVG_CFLAGS@// /^WIDGET_OBJ *=/s/@WIDGET_OBJ@// /^CYGWIN_OBJ *=/s/@CYGWIN_OBJ@// -/^MSDOS_OBJ *=/s/= */= dosfns.o msdos.o/ +/^MSDOS_OBJ *=/s/= */= dosfns.o msdos.o w16select.o/ /^MSDOS_SUPPORT *=/s/= */= $(MSDOS_SUPPORT_REAL)/ /^ns_appdir *=/s/@ns_appdir@// /^ns_appbindir *=/s/@ns_appbindir@// @@ -97,19 +101,24 @@ s/\.h\.in/.h-in/ /^NS_OBJ *=/s/@NS_OBJ@// /^NS_SUPPORT *=/s/@NS_SUPPORT@// /^GNU_OBJC_CFLAGS*=/s/@GNU_OBJC_CFLAGS@// -/^GNUSTEP_SYSTEM_LIBRARIES *=/s/@GNUSTEP_SYSTEM_LIBRARIES@// /^LIBRESOLV *=/s/@LIBRESOLV@// /^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@// /^GETLOADAVG_LIBS *=/s/@[^@\n]*@// /^START_FILES *=/s/@START_FILES@// /^OTHER_FILES *=/s/@OTHER_FILES@// /^XMENU_OBJ *=/s/@XMENU_OBJ@/xmenu.o/ -/^FONT_OBJ *=/s/@FONT_OBJ@/xfont.o/ +/^FONT_OBJ *=/s/@FONT_OBJ@// /^MOUSE_SUPPORT *=/s/@MOUSE_SUPPORT@/$(REAL_MOUSE_SUPPORT)/ /^TOOLTIP_SUPPORT *=/s/@TOOLTIP_SUPPORT@// /^WINDOW_SUPPORT *=/s/@WINDOW_SUPPORT@// /^LIBGPM *=/s/@LIBGPM@// /^EXEEXT *=/s/@EXEEXT@/.exe/ +/^OLDXMENU *=/s/@OLDXMENU@// +/^LIBXMENU *=/s/@LIBXMENU@// +/^LIBX_OTHER *=/s/@LIBX_OTHER@// +/^GMALLOC_OBJ *=/s/@GMALLOC_OBJ@/gmalloc.o/ +/^VMLIMIT_OBJ *=/s/@VMLIMIT_OBJ@/vm-limit.o/ +/^RALLOC_OBJ *=/s/@RALLOC_OBJ@/ralloc.o/ /^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/ /^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/ /^UNEXEC_OBJ *=/s/@unexec@/unexec.o/ @@ -118,6 +127,7 @@ s/\.h\.in/.h-in/ /^S_FILE *=/s!@[^@\n]*@!s/msdos.h! /^@SET_MAKE@$/s/@SET_MAKE@// /^@NS_IMPL_GNUSTEP_INC@/s/@NS_IMPL_GNUSTEP_INC@// +/^NS_IMPL_GNUSTEP_TEMACS_LDFLAGS *=/s/@NS_IMPL_GNUSTEP_TEMACS_LDFLAGS@// /^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC! /^.\${libsrc}make-doc/s!>.*$!! /^[ ]*$/d diff --git a/msdos/sed1x.inp b/msdos/sed1x.inp index bcdb0fec0ed..118b00c2538 100644 --- a/msdos/sed1x.inp +++ b/msdos/sed1x.inp @@ -1,14 +1,32 @@ # -sed1x.inp------------------------------------------------------------ # Extra configuration script for src/makefile for DesqView/X # ---------------------------------------------------------------------- +# +# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Emacs. +# +# This file is free software; as a special exception, the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# ---------------------------------------------------------------------- s!^ cd \${oldXMenudir}; \${MAKE}.*$! ${MAKE} -C ${oldXMenudir}.! s!^ @true *$! @rem! s/DOC/DOC-X/g -/^OLDXMENU *=/s!@OLDXMENU@!${oldXMenudir}libXMenu11.a! -/^LIBXMENU *=/s!@LIBXMENU@!${OLDXMENU}! -/^LIBX_OTHER *=/s!@LIBX_OTHER@!${LIBXT} ${LIBX_EXTRA}! +/^OLDXMENU *=/s!= *!= ${oldXMenudir}libXMenu11.a! +/^LIBXMENU *=/s!= *!= ${OLDXMENU}! +/^LIBX_OTHER *=/s!= *!= ${LIBXT} ${LIBX_EXTRA}! +/^OLDXMENU_TARGET *=/s!= *!= really-oldxmenu! +/^OLDXMENU_DEPS *=/s!= *!= ${OLDXMENU} ../src/${OLDXMENU}! /^LIBS_SYSTEM *=/s!= *!= -lxext -lsys! /^MSDOS_X_OBJ *=/s!= *!= w16select.o termcap.o! +/^FONT_OBJ *=/s!= *!= xfont.o! /^TOOLTIP_SUPPORT *=/s!= *!= ${lispsource}tooltip.elc! /^WINDOW_SUPPORT *=/s!= *!= $(BASE_WINDOW_SUPPORT) $(X_WINDOW_SUPPORT)! /^temacs *:/s!OLDXMENU!LIBXMENU! diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp index 323029ecf39..bc555cc0b08 100644 --- a/msdos/sed3v2.inp +++ b/msdos/sed3v2.inp @@ -44,11 +44,10 @@ /^EXEEXT *=/s!@EXEEXT@!! /^GETOPT_H *=/s!@GETOPT_H@!getopt.h! /^GETOPTOBJS *=/s!@GETOPTOBJS@!getopt.o getopt1.o! -/^INSTALLABLES/s/emacsclient *// +/^INSTALLABLES/s/emacsclient[^ ]* *// s!^ \./! ! -/^UTILITIES=/s/ wakeup// -/^UTILITIES=/s/ movemail// -/^UTILITIES=/s/ emacsserver// -/^UTILITIES=/s/ timer// +/^UTILITIES *=/,/^$/{ + s/movemail[^ ]* *// +} # arch-tag: 16f3be18-a45b-496c-b19c-e43840359de8 diff --git a/src/ChangeLog b/src/ChangeLog index 5d47f437d4a..b0965f8e514 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,125 @@ +2010-05-18 Juanma Barranquero + + * charset.c (load_charset_map_from_file): Don't call close after fclose. + +2010-05-18 Glenn Morris + + * s/gnu-linux.h: Combine two conditionals. + + * Makefile.in (otherobj): Include $(VMLIMIT_OBJ) separately from + $(POST_ALLOC_OBJ). + + * Makefile.in (RALLOC_OBJ): New, set by configure. + (rallocobj): Replace with the previous variable. + (otherobj): Use $RALLOC_OBJ. + + * s/gnu.h (REL_ALLOC) [DOUG_LEA_MALLOC]: + * s/gnu-linux.h (REL_ALLOC) [DOUG_LEA_MALLOC]: Move undef to configure. + + * Makefile.in (GMALLOC_OBJ, VMLIMIT_OBJ): New, set by configure. + (gmallocobj, vmlimitobj): Replace with previous two variables. + (otherobj): Use $GMALLOC_OBJ, $VMLIMIT_OBJ. + +2010-05-17 Glenn Morris + + * Makefile.in (OLDXMENU_DEPS): New, set by configure. + (stamp-oldxmenu): Use $OLDXMENU_DEPS. + +2010-05-16 Glenn Morris + + * Makefile.in (${ns_appbindir}Emacs, ns-app): Always define these rules. + + * Makefile.in (clean): Get rid of HAVE_NS conditional. + + * Makefile.in (ns_appdir, ns_appbindir): Now configure adds the + trailing "/". + + * Makefile.in (TEMACS_LDFLAGS2): New, set by configure. + (temacs${EXEEXT}): Combine the NS_IMPL_GNUSTEP case with the default. + + * Makefile.in (GNUSTEP_SYSTEM_LIBRARIES): Remove, unused. + (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New, set by configure. + (LD) [NS_IMPL_GNUSTEP]: Set to $(CC) -rdynamic. + (temacs${EXEEXT}): Remove $LOCALCPP, never defined or referenced. + Make most of the NS_IMPL_GNUSTEP case the same as the default case. + + * Makefile.in (temacs${EXEEXT}) [!NS_IMPL_GNUSTEP]: + Remove ${STARTFLAGS}, nothing ever sets it. + +2010-05-16 Dan Nicolaescu + + * m/ia64.h (UNEXEC): Remove, set in s/*.h. + +2010-05-16 Glenn Morris + + * Makefile.in (LIBX_BASE): Always define. + + * Makefile.in (LIBX_OTHER): Move out of cpp section. + + * Makefile.in (LIBXT): Always define. + +2010-05-15 Glenn Morris + + * Makefile.in (OLDXMENU, LIBXMENU, LIBX_OTHER): Always define. + + * Makefile.in (FONT_DRIVERS): Remove, replace with $FONT_OBJ. + (obj, SOME_MACHINE_OBJECTS): Use $FONT_OBJ. + +2010-05-15 Ken Raeburn + + * lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue. (Bug#5916) + (LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise. + + * emacs.c (main): Initialize initial-environment and + process-environment before generating from env, not after. + + Handle --version reasonably in CANNOT_DUMP configuration. + * emacs.c (emacs_version, emacs_copyright): New string variables. + (Vemacs_version, Vemacs_copyright): New Lisp_Object variables. + (syms_of_emacs): Defvar them, and initialize them from the C + string variables. + (main): If initialization hasn't been done, print initial version + info from the C strings, instead of starting an interactive session. + +2010-05-15 Eli Zaretskii + + * bidi.c (bidi_paragraph_init): Don't leave alone garbage values + of bidi_it->paragraph_dir. Call bidi_initialize if needed. + (bidi_paragraph_init): Remove redundant assertion that we are at + the beginning of a line after call to bidi_find_paragraph_start. + + * xdisp.c (Fcurrent_bidi_paragraph_direction): New function. + (syms_of_xdisp): Defsubr it. + + * Makefile.in: Fix MSDOS-related comments. + +2010-05-15 Glenn Morris + + * Makefile.in (OLDXMENU_TARGET): New, set by configure. + (really-lwlib, really-oldXMenu): Always define. + ($OLDXMENU): Depend on $OLDXMENU_TARGET. + + * Makefile.in: Simplify cpp conditional. + + * Makefile.in (${ns_appdir}): Simplify using umask. + + * Makefile.in (${ns_appdir}): Remove references to CVS-related files. + +2010-05-14 Stefan Monnier + + * eval.c (specbind): Remove left-over duplicate test. + Disallow let-binding frame-local vars. Add comment. + +2010-05-14 Eli Zaretskii + + Make the cache of bidi iterator states dynamically allocated. + * bidi.c (bidi_cache_shrink): New function. + (bidi_init_it): Call it. + (bidi_cache_iterator_state): Enlarge the cache if needed. + + * bidi.c (bidi_move_to_visually_next): Rename from + bidi_get_next_char_visually. All callers changed. + 2010-05-14 Kenichi Handa * dispextern.h (struct composition_it): New member reversed_p. @@ -6,10 +128,10 @@ ENDPOS < CHARPOS. (composition_reseat_it): Handle the case that ENDPOS < CHARPOS. Set CMP_IT->reversed_p. - (composition_update_it): Pay attention ot CMP_IT->reversed_p. + (composition_update_it): Pay attention to CMP_IT->reversed_p. - * xdisp.c (set_iterator_to_next): Call - composition_compute_stop_pos with negative ENDPOS if we are + * xdisp.c (set_iterator_to_next): + Call composition_compute_stop_pos with negative ENDPOS if we are scanning backward. Call composition_compute_stop_pos if scan direction is changed. (next_element_from_buffer): Call composition_compute_stop_pos with @@ -19,8 +141,7 @@ 2010-05-14 Kenichi Handa - * font.c (font_range): Return the range for the font found at - first. + * font.c (font_range): Return the range for the font found at first. 2010-05-14 Glenn Morris @@ -102,7 +223,6 @@ * xdisp.c (init_iterator): Don't turn on bidi reordering in unibyte buffers. See http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html. ->>>>>>> MERGE-SOURCE 2010-05-10 Glenn Morris @@ -11480,7 +11600,7 @@ definitions from xmenu.c. Suggested by Adrian Robert. * xmenu.c: Remove platform-independent menu definitions. - (menu_items menu_items_inuse, menu_items_allocated) + (menu_items, menu_items_inuse, menu_items_allocated) (menu_items_used, menu_items_n_panes) (menu_items_submenu_depth): Move to keyboard.h. (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) bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT} +## ns-app if HAVE_NS, else empty. OTHER_FILES = @OTHER_FILES@ CRT_DIR=@CRT_DIR@ @@ -114,6 +115,9 @@ LD_SWITCH_SYSTEM_EXTRA=@LD_SWITCH_SYSTEM_EXTRA@ ## Flags to pass to ld only for temacs. TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS) +## $LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason). +TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@ + ## Some systems define this to request special libraries. LIBS_SYSTEM=@LIBS_SYSTEM@ @@ -167,11 +171,43 @@ LIBXTR6=@LIBXTR6@ ## Only used if HAVE_X_WINDOWS. LIBXT_OTHER=@LIBXT_OTHER@ +## Only used if HAVE_X11 && !USE_GTK. +## really-lwlib if USE_X_TOOLKIT, else really-oldxmenu. +OLDXMENU_TARGET=@OLDXMENU_TARGET@ + +## If !HAVE_X11 || USE_GTK, empty. +## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a. +## Else ${oldXMenudir}libXMenu11.a. +OLDXMENU=@OLDXMENU@ + +## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty. +## We use stamp-xmenu with these two deps to both ensure that lwlib +## gets remade based on its dependencies in its own makefile, +## and remake temacs if lwlib gets changed by this. +OLDXMENU_DEPS=@OLDXMENU_DEPS@ + +## If !HAVE_X11 && HAVE_X_WINDOWS, -lXMenu (this case no longer possible). +## Else if !HAVE_X11 || USE_GTK, empty. +## Else $(OLDXMENU). +LIBXMENU=@LIBXMENU@ + XMENU_OBJ=@XMENU_OBJ@ XOBJ=@XOBJ@ TOOLKIT_LIBW=@TOOLKIT_LIBW@ +## Only used if HAVE_X11, in LIBX_OTHER. +LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER) + +## If HAVE_X11, $(LIBXT) $(LIBX_EXTRA), else empty. +LIBX_OTHER=@LIBX_OTHER@ + +## LIBXMENU is nil if !HAVE_X_WINDOWS. +## LD_SWITCH_X_SITE should not be used if not using X, but nothing +## sets it at present, and if something ever does, it should be +## configure, which should set it to nil in non-X builds. +LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE) + LIBSOUND= @LIBSOUND@ CFLAGS_SOUND= @CFLAGS_SOUND@ @@ -184,7 +220,7 @@ WIDGET_OBJ=@WIDGET_OBJ@ ## sheap.o if CYGWIN, otherwise empty. CYGWIN_OBJ=@CYGWIN_OBJ@ -## dosfns.o msdos.o if MSDOS. +## dosfns.o msdos.o w16select.o if MSDOS. MSDOS_OBJ = ## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. MSDOS_X_OBJ = @@ -194,16 +230,18 @@ MSDOS_SUPPORT_REAL = ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \ ## $MSDOS_SUPPORT_REAL if MSDOS. MSDOS_SUPPORT = -ns_appdir=@ns_appdir@/ -ns_appbindir=@ns_appbindir@/ +ns_appdir=@ns_appdir@ +ns_appbindir=@ns_appbindir@ ns_appsrc=@ns_appsrc@ NS_OBJ=@NS_OBJ@ NS_SUPPORT=@NS_SUPPORT@ -## Next two only set if NS_IMPL_GNUSTEP. +## Only set if NS_IMPL_GNUSTEP. GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ -GNUSTEP_SYSTEM_LIBRARIES=@GNUSTEP_SYSTEM_LIBRARIES@ -## Only used if HAVE_X_WINDOWS. +## Empty if !HAVE_X_WINDOWS +## xfont.o ftfont.o xftfont.o ftxfont.o if HAVE_XFT +## xfont.o ftfont.o ftxfont.o if HAVE_FREETYPE +## else xfont.o FONT_OBJ=@FONT_OBJ@ ## Used if HAVE_MOUSE. @@ -257,6 +295,10 @@ DEPFLAGS = -MMD -MF deps/$*.d /* If NS_IMPL_GNUSTEP, some definitions and includes are expanded here. */ @NS_IMPL_GNUSTEP_INC@ +/* FIXME move to LD_SWITCH_SYSTEM_TEMACS? + This uses ${CONFIG_SYSTEM_LIBS}, presumably set by the above include. */ +NS_IMPL_GNUSTEP_TEMACS_LDFLAGS=@NS_IMPL_GNUSTEP_TEMACS_LDFLAGS@ + /* DO NOT use -R. There is a special hack described in lastfile.c which is used instead. Some initialized data areas are modified at initial startup, then labeled as part of the text area when @@ -286,15 +328,6 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) #endif $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< -#ifdef HAVE_X_WINDOWS -OLDXMENU=@OLDXMENU@ -LIBXMENU=@LIBXMENU@ -LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER) -LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE) -LIBX_OTHER=@LIBX_OTHER@ -FONT_DRIVERS=$(FONT_OBJ) -#endif /* HAVE_X_WINDOWS */ - /* A macro which other sections of Makefile can redefine to munge the flags before they are passed to LD. This is helpful if you have @@ -336,6 +369,12 @@ LD=ld #endif /* not ORDINARY_LINK */ + +#ifdef NS_IMPL_GNUSTEP +LD=$(CC) -rdynamic +#endif + + /* lastfile must follow all files whose initialized data areas should be dumped as pure by dump-emacs. */ obj= 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 \ process.o callproc.o \ region-cache.o sound.o atimer.o \ doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ - $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS) + $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) /* Object files used on some machine or other. 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 \ fontset.o dbusbind.o \ nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ - w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS) + w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_OBJ) -gmallocobj = -rallocobj = -vmlimitobj = -#ifndef SYSTEM_MALLOC -#ifndef DOUG_LEA_MALLOC -gmallocobj = gmalloc.o -#endif +/* gmalloc.o if !SYSTEM_MALLOC && !DOUG_LEA_MALLOC, else empty. */ +GMALLOC_OBJ=@GMALLOC_OBJ@ -#ifdef REL_ALLOC -rallocobj = ralloc.o -#endif +/* vm-limit.o if !SYSTEM_MALLOC, else empty. */ +VMLIMIT_OBJ=@VMLIMIT_OBJ@ -vmlimitobj = vm-limit.o -#endif /* !SYSTEM_MALLOC */ +/* ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty. */ +RALLOC_OBJ=@RALLOC_OBJ@ /* Empty on Cygwin, lastfile.o elsewhere. */ PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@ -/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere. */ +/* lastfile.o on Cygwin, empty elsewhere. */ POST_ALLOC_OBJ=@POST_ALLOC_OBJ@ /* List of object files that make-docfile should not be told about. */ -otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \ - $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS) +otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \ + $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS) /* This is the platform-specific list of Lisp files loaded into the 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) \ all: emacs${EXEEXT} $(OTHER_FILES) +/* Does anyone ever pay attention to the load-path-shadows output here? */ emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} #ifdef CANNOT_DUMP rm -f emacs${EXEEXT} @@ -648,55 +682,42 @@ ${libsrc}make-docfile${EXEEXT}: buildobj.h: Makefile echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h -/* FIXME LOCALCPP not defined or mentioned anywhere. */ -temacs${EXEEXT}: $(LOCALCPP) $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} -#ifdef NS_IMPL_GNUSTEP - $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \ - -L$(GNUSTEP_SYSTEM_LIBRARIES) -lgnustep-gui -lgnustep-base \ - -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread ) -o temacs \ - ${obj} ${otherobj} ${LIBES} -#else - $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ - -o temacs ${START_FILES} ${obj} ${otherobj} \ - ${LIBES} -#endif +temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} + $(LD) YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \ + ${NS_IMPL_GNUSTEP_TEMACS_LDFLAGS} ) \ + ${TEMACS_LDFLAGS2} \ + -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES} prefix-args${EXEEXT}: prefix-args.o $(config_h) $(CC) $(LDFLAGS) prefix-args.o -o prefix-args -#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK) - -/* We use stamp-xmenu with these two deps to both ensure that lwlib - gets remade based on its dependencies in its own makefile, - and remake temacs if lwlib gets changed by this. */ -stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU) - touch stamp-oldxmenu -/* Supply an ordering for parallel make. */ -../src/$(OLDXMENU): ${OLDXMENU} - -#ifdef USE_X_TOOLKIT -$(OLDXMENU): really-lwlib +/* Only (possibly) used if HAVE_X11 && !USE_GTK, but no harm in always + defining. */ really-lwlib: cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' @true /* make -t should not create really-lwlib. */ .PHONY: really-lwlib -#else /* not USE_X_TOOLKIT */ -$(OLDXMENU): really-oldXMenu really-oldXMenu: cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' @true /* make -t should not create really-oldXMenu. */ .PHONY: really-oldXMenu -#endif /* not USE_X_TOOLKIT */ -#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */ -/* We don''t really need this, but satisfy the dependency. */ -stamp-oldxmenu: +/* We don''t really need this when OLDXMENU_DEPS is empty, but as + things stand we need something to satisfy the temacs dependency. */ +stamp-oldxmenu: ${OLDXMENU_DEPS} touch stamp-oldxmenu -#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */ + +/* HAVE_X11 implies HAVE_X_WINDOWS and HAVE_MENUS. */ +#if defined (HAVE_X11) && ! defined (USE_GTK) +/* Supply an ordering for parallel make. */ +../src/$(OLDXMENU): ${OLDXMENU} + +$(OLDXMENU): $(OLDXMENU_TARGET) +#endif /* HAVE_X11 && !USE_GTK */ ../config.status:: epaths.in @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) \ ${ns_appdir}: ${ns_appsrc} rm -fr ${ns_appdir} mkdir -p ${ns_appdir} - ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; tar xf - ) - ( cd ${ns_appdir} ; for subdir in `find . -type d ! -name CVS -print` ; do \ - chmod a+rx $${subdir} ; \ - rm -rf $${subdir}/CVS ; \ - rm -f $${subdir}/.cvsignore ; done ; ) + ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - ) +#endif /* HAVE_NS */ +/* These are only used if HAVE_NS, but no harm in always defining them. */ ${ns_appbindir}Emacs: emacs${EXEEXT} mkdir -p ${ns_appbindir} cp -f emacs${EXEEXT} ${ns_appbindir}Emacs ns-app: ${ns_appdir} ${ns_appbindir}Emacs -#endif /* HAVE_NS */ - mostlyclean: rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a rm -f ../etc/DOC @@ -994,9 +1011,8 @@ mostlyclean: clean: mostlyclean rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} -rm -rf deps -#ifdef HAVE_NS - rm -fr ${ns_appdir} -#endif + test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir} + /* bootstrap-clean is used to clean up just before a bootstrap. It should remove all files generated during a compilation/bootstrap, but not things like config.status or TAGS. */ @@ -1076,7 +1092,9 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS /* Since the .el.elc rule cannot specify an extra dependency, we do it here. */ ${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS) -${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) +/* VCSWITNESS points to the file that holds info about the current checkout. + We use it as a heuristic to decide when to rebuild loaddefs.el. */ +${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe} /* 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 . */ designed to be called once for every character in the buffer or string. - The main entry point is bidi_get_next_char_visually. Each time it + The main entry point is bidi_move_to_visually_next. Each time it is called, it finds the next character in the visual order, and returns its information in a special structure. The caller is then expected to process this character for display or any other - purposes, and call bidi_get_next_char_visually for the next - character. See the comments in bidi_get_next_char_visually for - more details about its algorithm that finds the next visual-order + purposes, and call bidi_move_to_visually_next for the next + character. See the comments in bidi_move_to_visually_next for more + details about its algorithm that finds the next visual-order character by resolving their levels on the fly. 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) /* Caching the bidi iterator states. */ -static struct bidi_it bidi_cache[1000]; /* FIXME: make this dynamically allocated! */ -static int bidi_cache_idx; -static int bidi_cache_last_idx; +#define BIDI_CACHE_CHUNK 200 +static struct bidi_it *bidi_cache; +static size_t bidi_cache_size = 0; +static int bidi_cache_idx; /* next unused cache slot */ +static int bidi_cache_last_idx; /* slot of last cache hit */ static INLINE void bidi_cache_reset (void) @@ -551,6 +553,17 @@ bidi_cache_reset (void) bidi_cache_last_idx = -1; } +static INLINE void +bidi_cache_shrink (void) +{ + if (bidi_cache_size > BIDI_CACHE_CHUNK) + { + bidi_cache_size = BIDI_CACHE_CHUNK * sizeof (struct bidi_it); + bidi_cache = (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size); + } + bidi_cache_reset (); +} + static INLINE void bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) { @@ -672,9 +685,13 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) if (idx < 0) { idx = bidi_cache_idx; - /* Don't overrun the cache limit. */ - if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1) - abort (); + /* Enlarge the cache as needed. */ + if (idx >= bidi_cache_size) + { + bidi_cache_size += BIDI_CACHE_CHUNK * sizeof (struct bidi_it); + bidi_cache = + (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size); + } /* Character positions should correspond to cache positions 1:1. If we are outside the range of cached positions, the cache is useless and must be reset. */ @@ -873,6 +890,9 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it) EMACS_INT pos; bidi_type_t type; + if (!bidi_initialized) + bidi_initialize (); + /* If we are inside a paragraph separator, we are just waiting for the separator to be exhausted; use the previous paragraph 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) middle of it. Find where this paragraph starts. */ bytepos = bidi_find_paragraph_start (pos, bytepos); - /* We should always be at the beginning of a new line at this - point. */ - if (!(bytepos == BEGV_BYTE || FETCH_CHAR (bytepos - 1) == '\n')) - abort (); - bidi_it->separator_limit = -1; bidi_it->new_paragraph = 0; ch = FETCH_CHAR (bytepos); @@ -940,7 +955,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it) /* Contrary to UAX#9 clause P3, we only default the paragraph direction to L2R if we have no previous usable paragraph direction. */ - if (bidi_it->paragraph_dir == NEUTRAL_DIR) + if (bidi_it->paragraph_dir != L2R && bidi_it->paragraph_dir != R2L) bidi_it->paragraph_dir = L2R; /* P3 and ``higher protocols'' */ if (bidi_it->paragraph_dir == R2L) 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) bidi_it->prev_for_neutral.type_after_w1 = bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */ + bidi_cache_shrink (); } /* 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) } void -bidi_get_next_char_visually (struct bidi_it *bidi_it) +bidi_move_to_visually_next (struct bidi_it *bidi_it) { int old_level, new_level, next_level; 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) n_entries++; } fclose (fp); - close (fd); load_charset_map (charset, head, n_entries, control_flag); 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, } DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p", - doc: /* Move point right N characters (left if N is negative). -On reaching end of buffer, stop and signal error. */) + doc: /* Move point N characters forward (backward if N is negative). +On reaching end or beginning of buffer, stop and signal error. + +Depending on the bidirectional context, the movement may be to the +right or to the left on the screen. This is in contrast with +\\[right-arrow-command], which see. */) (n) Lisp_Object n; { @@ -93,8 +97,12 @@ On reaching end of buffer, stop and signal error. */) } DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p", - doc: /* Move point left N characters (right if N is negative). -On attempt to pass beginning or end of buffer, stop and signal error. */) + doc: /* Move point N characters backward (forward if N is negative). +On attempt to pass beginning or end of buffer, stop and signal error. + +Depending on the bidirectional context, the movement may be to the +right or to the left on the screen. This is in contrast with +\\[left-arrow-command], which see. */) (n) Lisp_Object n; { 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) /* Search backward for a pattern that may be composed and the position of (possibly) the last character of the match is closest to (but not after) START. The reason for the last - character is that set_iterator_to_next works in reverse order - and, thus we must stop at the last character for composition + character is that set_iterator_to_next works in reverse order, + and thus we must stop at the last character for composition check. */ unsigned char *p; int len; - /* limit byte position used in fast_looking_at. This is the - byte position of the next character of START. */ + /* Limit byte position used in fast_looking_at. This is the + byte position of the character after START. */ EMACS_INT limit; if (NILP (string)) @@ -1191,7 +1191,7 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) len = 1; if (len > 0) { - /* Make CPOS points the last character of match. + /* Make CPOS point to the last character of match. Note that LEN is byte-length. */ bpos += len; 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; #ifdef HAVE_X11R6 #define HAVE_X_I18N -#elif !defined X11R5_INHIBIT_I18N -#define HAVE_X_I18N #endif /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */ @@ -1200,11 +1198,7 @@ typedef unsigned size_t; that the stack is continuous. */ #ifdef __GNUC__ # ifndef GC_SETJMP_WORKS - /* GC_SETJMP_WORKS is nearly always appropriate for GCC -- - see NON_SAVING_SETJMP in the target descriptions. */ - /* Exceptions (see NON_SAVING_SETJMP in target description) are - SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86. - Fixme: Deal with SVR3. */ + /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ # define GC_SETJMP_WORKS 1 # endif # 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; /* Defined in bidi.c */ extern void bidi_init_it P_ ((EMACS_INT, EMACS_INT, struct bidi_it *)); -extern void bidi_get_next_char_visually P_ ((struct bidi_it *)); +extern void bidi_move_to_visually_next P_ ((struct bidi_it *)); extern void bidi_paragraph_init P_ ((bidi_dir_t, struct bidi_it *)); extern int bidi_mirror_char P_ ((int)); 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 . */ #endif #endif +const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; +const char emacs_version[] = "24.0.50"; + extern void malloc_warning P_ ((char *)); extern void set_time_zone_rule P_ ((char *)); #ifdef HAVE_INDEX @@ -180,6 +183,10 @@ Lisp_Object Vprevious_system_messages_locale; Lisp_Object Vsystem_time_locale; Lisp_Object Vprevious_system_time_locale; +/* Copyright and version info. The version number may be updated by + Lisp code. */ +Lisp_Object Vemacs_copyright, Vemacs_version; + /* If non-zero, emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ int inhibit_window_system; @@ -802,35 +809,43 @@ main (int argc, char **argv) argc = 0; while (argv[argc]) argc++; - if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) - /* We don't know the version number unless this is a dumped Emacs. - So ignore --version otherwise. */ - && initialized) + if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args)) { - Lisp_Object tem, tem2; - tem = Fsymbol_value (intern_c_string ("emacs-version")); - tem2 = Fsymbol_value (intern_c_string ("emacs-copyright")); - if (!STRINGP (tem)) + const char *version, *copyright; + if (initialized) { - fprintf (stderr, "Invalid value of `emacs-version'\n"); - exit (1); - } - if (!STRINGP (tem2)) - { - fprintf (stderr, "Invalid value of `emacs-copyright'\n"); - exit (1); + Lisp_Object tem, tem2; + tem = Fsymbol_value (intern_c_string ("emacs-version")); + tem2 = Fsymbol_value (intern_c_string ("emacs-copyright")); + if (!STRINGP (tem)) + { + fprintf (stderr, "Invalid value of `emacs-version'\n"); + exit (1); + } + if (!STRINGP (tem2)) + { + fprintf (stderr, "Invalid value of `emacs-copyright'\n"); + exit (1); + } + else + { + version = SDATA (tem); + copyright = SDATA (tem2); + } } else { - printf ("GNU Emacs %s\n", SDATA (tem)); - printf ("%s\n", SDATA(tem2)); - printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); - printf ("You may redistribute copies of Emacs\n"); - printf ("under the terms of the GNU General Public License.\n"); - printf ("For more information about these matters, "); - printf ("see the file named COPYING.\n"); - exit (0); + version = emacs_version; + copyright = emacs_copyright; } + printf ("GNU Emacs %s\n", version); + printf ("%s\n", copyright); + printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); + printf ("You may redistribute copies of Emacs\n"); + printf ("under the terms of the GNU General Public License.\n"); + printf ("For more information about these matters, "); + printf ("see the file named COPYING.\n"); + exit (0); } if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) if (chdir (ch_to_dir) == -1) @@ -1528,6 +1543,11 @@ main (int argc, char **argv) ns_init_paths (); #endif + /* Initialize and GC-protect Vinitial_environment and + Vprocess_environment before set_initial_environment fills them + in. */ + if (!initialized) + syms_of_callproc (); /* egetenv is a pretty low-level facility, which may get called in many circumstances; it seems flimsy to put off initializing it until calling init_callproc. */ @@ -1577,7 +1597,6 @@ main (int argc, char **argv) syms_of_callint (); syms_of_casefiddle (); syms_of_casetab (); - syms_of_callproc (); syms_of_category (); syms_of_ccl (); syms_of_character (); @@ -2577,6 +2596,14 @@ This is nil during initialization. */); doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */); inhibit_x_resources = 0; + DEFVAR_LISP ("emacs-copyright", &Vemacs_copyright, + doc: /* Short copyright string for this version of Emacs. */); + Vemacs_copyright = build_string (emacs_copyright); + + DEFVAR_LISP ("emacs-version", &Vemacs_version, + doc: /* Version numbers of this version of Emacs. */); + Vemacs_version = build_string (emacs_version); + /* Make sure IS_DAEMON starts up as false. */ daemon_pipe[1] = 0; } 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 () specpdl_ptr = specpdl + count; } +/* specpdl_ptr->symbol is a field which describes which variable is + let-bound, so it can be properly undone when we unbind_to. + It can have the following two shapes: + - SYMBOL : if it's a plain symbol, it means that we have let-bound + a symbol that is not buffer-local (at least at the time + the let binding started). Note also that it should not be + aliased (i.e. when let-binding V1 that's aliased to V2, we want + to record V2 here). + - (SYMBOL WHERE . BUFFER) : this means that it is a let-binding for + variable SYMBOL which can be buffer-local. WHERE tells us + which buffer is affected (or nil if the let-binding affects the + global value of the variable) and BUFFER tells us which buffer was + current (i.e. if WHERE is non-nil, then BUFFER==WHERE, otherwise + BUFFER did not yet have a buffer-local value). */ + void specbind (symbol, value) Lisp_Object symbol, value; @@ -3339,7 +3354,10 @@ specbind (symbol, value) set_internal (symbol, value, Qnil, 1); break; } - case SYMBOL_LOCALIZED: case SYMBOL_FORWARDED: + case SYMBOL_LOCALIZED: + if (SYMBOL_BLV (sym)->frame_local) + error ("Frame-local vars cannot be let-bound"); + case SYMBOL_FORWARDED: { Lisp_Object ovalue = find_symbol_value (symbol); specpdl_ptr->func = 0; @@ -3376,6 +3394,7 @@ specbind (symbol, value) /* FIXME: The third value `current_buffer' is only used in let_shadows_buffer_binding_p which is itself only used in set_internal for local_if_set. */ + eassert (NILP (where) || EQ (where, cur_buf)); specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf)); /* If SYMBOL is a per-buffer variable which doesn't have a @@ -3460,13 +3479,10 @@ unbind_to (count, value) Fset_default (symbol, this_binding.old_value); /* If `where' is non-nil, reset the value in the appropriate local binding, but only if that binding still exists. */ - else if (BUFFERP (where)) - { - if (BUFFERP (where) - ? !NILP (Flocal_variable_p (symbol, where)) - : !NILP (Fassq (symbol, XFRAME (where)->param_alist))) - set_internal (symbol, this_binding.old_value, where, 1); - } + else if (BUFFERP (where) + ? !NILP (Flocal_variable_p (symbol, where)) + : !NILP (Fassq (symbol, XFRAME (where)->param_alist))) + set_internal (symbol, this_binding.old_value, where, 1); } /* If variable has a trivial value (no forwarding), we can 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) return o; } #else -/* This isn't quite right - it keeps the argument as an lvalue. - Making it const via casting would help avoid code actually - modifying the location in question, but the casting could cover - other type-related bugs. */ -#define LISP_MAKE_RVALUE(o) (o) +/* This is more portable to pre-C99 non-GCC compilers, but for + backwards compatibility GCC still accepts an old GNU extension + which caused this to only generate a warning. */ +#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o)) #endif #else /* USE_LISP_UNION_TYPE */ @@ -1461,9 +1460,9 @@ struct Lisp_Float }; #ifdef HIDE_LISP_IMPLEMENTATION -#define XFLOAT_DATA(f) (XFLOAT (f)->u.data_ + 0) +#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data_ : XFLOAT (f)->u.data_) #else -#define XFLOAT_DATA(f) (XFLOAT (f)->u.data + 0) +#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) /* This should be used only in alloc.c, which always disables HIDE_LISP_IMPLEMENTATION. */ #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 . */ /* Convert that into an integer that is 100 for a load average of 1.0 */ #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) -#ifdef __ELF__ -#undef UNEXEC -#define UNEXEC unexelf.o -#endif - #ifndef NOT_C_CODE #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 . */ reasonable place to select for it is in the machine description file. */ #define NO_SOCK_SIGIO -/* After adding support for a new system, modify the large case - statement in the `configure' script to recognize reasonable +/* After adding support for a new machine, modify the large case + statement in configure.in to recognize reasonable configuration names, and add a description of the system to `etc/MACHINES'. + Check for any tests of $machine in configure.in, and add an entry + for the new machine if needed. + If you've just fixed a problem in an existing configuration file, you should also check `etc/MACHINES' to make sure its descriptions 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 . */ /* This is used in list_system_processes. */ #define HAVE_PROCFS 1 - /* Define CLASH_DETECTION if you want lock files to be written so that Emacs can tell instantly when you try to modify a file that someone else has modified in his Emacs. */ @@ -126,11 +125,9 @@ along with GNU Emacs. If not, see . */ #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ ((FILE)->_pptr - (FILE)->_pbase) #endif /* !_IO_STDIO_H && ! __UCLIBC__ */ -#endif /* emacs */ -#ifdef emacs #define INTERRUPT_INPUT -#endif +#endif /* emacs */ #define SYSV_SYSTEM_DIR /* use dirent.h */ @@ -147,11 +144,6 @@ along with GNU Emacs. If not, see . */ #define NARROWPROTO 1 -/* Use mmap directly for allocating larger buffers. */ -#ifdef DOUG_LEA_MALLOC -#undef REL_ALLOC -#endif - /* Tell that garbage collector that setjmp is known to save all registers relevant for conservative garbage collection in the jmp_buf. */ /* 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 @@ /* Definitions file for GNU Emacs running on the GNU Hurd. - Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -28,11 +29,6 @@ along with GNU Emacs. If not, see . */ #define SIGNALS_VIA_CHARACTERS -/* Use mmap directly for allocating larger buffers. */ -#ifdef DOUG_LEA_MALLOC -#undef REL_ALLOC -#endif - /* GNU needs its own crt0, and libc defines data_start. */ #define ORDINARY_LINK #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 . */ /* ============================================================ */ /* After adding support for a new system, modify the large case - statement in the `configure' script to recognize reasonable + statement in configure.in to recognize reasonable configuration names, and add a description of the system to `etc/MACHINES'. + Check for any tests of $opsys in configure.in, and add an entry + for the new system if needed. + If you've just fixed a problem in an existing configuration file, you should also check `etc/MACHINES' to make sure its descriptions 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 . */ reordering engine which is called by set_iterator_to_next and returns the next character to display in the visual order. See commentary on bidi.c for more details. As far as redisplay is - concerned, the effect of calling bidi_get_next_char_visually, the + concerned, the effect of calling bidi_move_to_visually_next, the main interface of the reordering engine, is that the iterator gets magically placed on the buffer or string position that is to be displayed next. In other words, a linear iteration through the @@ -3918,7 +3918,7 @@ handle_invisible_prop (it) } do { - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); } while (it->stop_charpos <= it->bidi_it.charpos && it->bidi_it.charpos < newpos); @@ -5276,7 +5276,7 @@ iterate_out_of_display_property (it) while (it->bidi_it.charpos >= BEGV && it->prev_stop <= it->bidi_it.charpos && it->bidi_it.charpos < CHARPOS (it->position)) - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); /* Record the stop_pos we just crossed, for when we cross it back, maybe. */ if (it->bidi_it.charpos > CHARPOS (it->position)) @@ -6307,29 +6307,14 @@ set_iterator_to_next (it, reseat_p) else if (! it->cmp_it.reversed_p) { /* Composition created while scanning forward. */ - /* Update IT's char/byte positions to point the first + /* Update IT's char/byte positions to point to the first character of the next grapheme cluster, or to the character visually after the current composition. */ -#if 0 - /* Is it ok to do this directly? */ - IT_CHARPOS (*it) += it->cmp_it.nchars; - IT_BYTEPOS (*it) += it->cmp_it.nbytes; -#else - /* Or do we have to call bidi_get_next_char_visually - repeatedly (perhaps not to confuse some internal - state of bidi_it)? At least we must do this if we - have consumed all grapheme clusters in the current - composition because the next character will be in the - different bidi level. */ for (i = 0; i < it->cmp_it.nchars; i++) - bidi_get_next_char_visually (&it->bidi_it); - /* BTW, it seems that the name - bidi_get_next_char_visually is confusing because - it sounds like not advancing character position. - How about bidi_set_iterator_to_next? */ + bidi_move_to_visually_next (&it->bidi_it); IT_BYTEPOS (*it) = it->bidi_it.bytepos; IT_CHARPOS (*it) = it->bidi_it.charpos; -#endif + if (it->cmp_it.to < it->cmp_it.nglyphs) { /* Proceed to the next grapheme cluster. */ @@ -6337,7 +6322,7 @@ set_iterator_to_next (it, reseat_p) } else { - /* No more grapheme cluster in this composition. + /* No more grapheme clusters in this composition. Find the next stop position. */ EMACS_INT stop = it->stop_charpos; if (it->bidi_it.scan_dir < 0) @@ -6351,10 +6336,10 @@ set_iterator_to_next (it, reseat_p) else { /* Composition created while scanning backward. */ - /* Update IT's char/byte positions to point the last + /* Update IT's char/byte positions to point to the last character of the previous grapheme cluster, or the character visually after the current composition. */ - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); IT_BYTEPOS (*it) = it->bidi_it.bytepos; IT_CHARPOS (*it) = it->bidi_it.charpos; @@ -6365,7 +6350,7 @@ set_iterator_to_next (it, reseat_p) } else { - /* No more grapheme cluster in this composition. + /* No more grapheme clusters in this composition. Find the next stop position. */ EMACS_INT stop = it->stop_charpos; if (it->bidi_it.scan_dir < 0) @@ -6393,13 +6378,13 @@ set_iterator_to_next (it, reseat_p) direction (a.k.a. its base embedding level). */ if (it->bidi_it.new_paragraph) bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); IT_BYTEPOS (*it) = it->bidi_it.bytepos; IT_CHARPOS (*it) = it->bidi_it.charpos; if (prev_scan_dir != it->bidi_it.scan_dir) { - /* As scan direction was changed, we must re-compute - the stop position for composition. */ + /* As the scan direction was changed, we must + re-compute the stop position for composition. */ EMACS_INT stop = it->stop_charpos; if (it->bidi_it.scan_dir < 0) stop = -1; @@ -6873,7 +6858,7 @@ next_element_from_buffer (it) /* If we are at the beginning of a line, we can produce the next element right away. */ bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); } else { @@ -6891,7 +6876,7 @@ next_element_from_buffer (it) { /* Now return to buffer position where we were asked to get the next display element, and produce that. */ - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); } while (it->bidi_it.bytepos != orig_bytepos && it->bidi_it.bytepos < ZV_BYTE); @@ -7115,7 +7100,7 @@ next_element_from_composition (it) /* Resync the bidi iterator with IT's new position. FIXME: this doesn't support bidirectional text. */ while (it->bidi_it.charpos < IT_CHARPOS (*it)) - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); } return 0; } @@ -7131,7 +7116,7 @@ next_element_from_composition (it) correct (struct glyph)->charpos. */ int i; for (i = 0; i < it->cmp_it.nchars - 1; i++) - bidi_get_next_char_visually (&it->bidi_it); + bidi_move_to_visually_next (&it->bidi_it); IT_CHARPOS (*it) = it->bidi_it.charpos; IT_BYTEPOS (*it) = it->bidi_it.bytepos; it->position = it->current.pos; @@ -18256,6 +18241,84 @@ display_line (it) return row->displays_text_p; } +DEFUN ("current-bidi-paragraph-direction", Fcurrent_bidi_paragraph_direction, + Scurrent_bidi_paragraph_direction, 0, 1, 0, + doc: /* Return paragraph direction at point in BUFFER. +Value is either `left-to-right' or `right-to-left'. +If BUFFER is omitted or nil, it defaults to the current buffer. + +Paragraph direction determines how the text in the paragraph is displayed. +In left-to-right paragraphs, text begins at the left margin of the window +and the reading direction is generally left to right. In right-to-left +paragraphs, text begins at the right margin and is read from right to left. + +See also `bidi-paragraph-direction'. */) + (buffer) + Lisp_Object buffer; +{ + struct buffer *buf; + struct buffer *old; + + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + old = current_buffer; + } + + if (NILP (buf->bidi_display_reordering)) + return Qleft_to_right; + else if (!NILP (buf->bidi_paragraph_direction)) + return buf->bidi_paragraph_direction; + else + { + /* Determine the direction from buffer text. We could try to + use current_matrix if it is up to date, but this seems fast + enough as it is. */ + struct bidi_it itb; + EMACS_INT pos = BUF_PT (buf); + EMACS_INT bytepos = BUF_PT_BYTE (buf); + + if (buf != current_buffer) + set_buffer_temp (buf); + /* Find previous non-empty line. */ + if (pos >= ZV && pos > BEGV) + { + pos--; + bytepos = CHAR_TO_BYTE (pos); + } + while (FETCH_BYTE (bytepos) == '\n') + { + if (bytepos <= BEGV_BYTE) + break; + bytepos--; + pos--; + } + while (!CHAR_HEAD_P (FETCH_BYTE (bytepos))) + bytepos--; + itb.charpos = pos; + itb.bytepos = bytepos; + itb.first_elt = 1; + + bidi_paragraph_init (NEUTRAL_DIR, &itb); + if (buf != current_buffer) + set_buffer_temp (old); + switch (itb.paragraph_dir) + { + case L2R: + return Qleft_to_right; + break; + case R2L: + return Qright_to_left; + break; + default: + abort (); + } + } +} + /*********************************************************************** @@ -25955,6 +26018,7 @@ syms_of_xdisp () #endif defsubr (&Sformat_mode_line); defsubr (&Sinvisible_p); + defsubr (&Scurrent_bidi_paragraph_direction); staticpro (&Qmenu_bar_update_hook); Qmenu_bar_update_hook = intern_c_string ("menu-bar-update-hook");