# HG changeset patch # User Joakim # Date 1273756432 -7200 # Node ID fe07c47cf7a719dba86646ae2382c2d27da695dd # Parent e56f669f17ce9b7368f7edd67041cd83f64824af# Parent 75f27a9b3b3aa5501bdce70b08a44d9ac1b689d1 merge and fixes diff -r e56f669f17ce -r fe07c47cf7a7 .bzrignore --- a/.bzrignore Wed May 12 14:32:06 2010 +0200 +++ b/.bzrignore Thu May 13 15:13:52 2010 +0200 @@ -10,6 +10,7 @@ oo oo-spd autom4te.cache +*.dSYM *.elc *.exe DOC @@ -48,6 +49,7 @@ lisp/cus-load.el lisp/eshell/esh-groups.el lisp/finder-inf.el +nextstep/Emacs.app nt/config.log src/buildobj.h src/config.h diff -r e56f669f17ce -r fe07c47cf7a7 ChangeLog --- a/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,202 @@ +2010-05-12 Glenn Morris + + * configure.in (LIB_SRC_EXTRA_INSTALLABLES): Remove, unused. + + * configure.in (LIB_GCC): New output variable. + +2010-05-11 Glenn Morris + + * make-dist (msdos): No more mainmake. + + * configure.in: Generate lib-src/Makefile directly, do not run cpp. + * config.bat: Do not run cpp on lib-src/Makefile.in. + + * config.bat [HAVE_X11]: Run sed3x.inp on lib-src/Makefile. + +2010-05-10 Glenn Morris + + * configure.in (LIBS_SYSTEM): New output variable, replacing cpp. + + * configure.in (MAIL_USE_FLOCK, MAIL_USE_LOCKF): New AC_DEFINEs. + (BLESSMAIL_TARGET): New output variable. + +2010-05-08 Štěpán Němec (tiny change) + + * INSTALL: Fix typos. + +2010-05-08 Chong Yidong + + * configure.in: Add check for buggy version of GCC (Bug#6031). + +2010-05-08 Glenn Morris + + * configure.in (HAVE_LIBNCURSES): New local variable. + (TERMINFO, LIBS_TERMCAP, TERMCAP_OBJ): New output variables, + replacing cpp in src/s/*.h and src/Makefile.in. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-07 Stefan Monnier + + * configure.in: Add tests for `isnan' and `copysign'. + +2010-05-07 Eli Zaretskii + + * config.bat: Allow for 2 leading `#'s in comments in + src/Makefile.in. + +2010-05-07 Glenn Morris + + * configure.in (LD_SWITCH_SYSTEM): Set with configure, not cpp. + Merges logic from src/s/* and src/Makefile.in. + (LD_SWITCH_SYSTEM_TEMACS): New output variable. + +2010-05-07 Dan Nicolaescu + + Define START_FILES and LIB_STANDARD using autoconf. + * configure.in (START_FILES, LIB_STANDARD): New definitions, moved + here from src/s/*.h. + (HAVE_CRTIN): Remove, inline logic in the netbsd + START_FILES/LIB_STANDARD computation. + +2010-05-06 Glenn Morris + + * configure.in (AC_PROG_LN_S): Remove test, nothing uses @LN_S@. + + * Makefile.in (CPP, C_SWITCH_SYSTEM, ALLOCA, LN_S, C_SWITCH_X_SITE) + (LD_SWITCH_X_SITE): Remove unused variables. + +2010-05-04 Glenn Morris + + * configure.in (LD_SWITCH_X_SITE_AUX): Use AC_SUBST only, not AC_DEFINE + as well. + (LD_SWITCH_X_SITE_AUX_RPATH): New output variable. + + * configure.in (LD_SWITCH_SYSTEM_TEMACS): New output variable. + + * configure.in (C_SWITCH_MACHINE, C_SWITCH_SYSTEM): New output + variables, replacing c_switch_machine, c_switch_system. + * Makefile.in (C_SWITCH_SYSTEM): Use @C_SWITCH_SYSTEM@ rather than + @c_switch_system@. + +2010-05-03 Glenn Morris + + * configure.in (LIBXT_OTHER, LIBX_OTHER): New output variables. + + * make-dist: There are no more src/m/*.inp files. + +2010-05-01 Dan Nicolaescu + + * configure.in (LD_SWITCH_MACHINE, ld_switch_machine): Remove, unused. + (ac_link): Do not use ld_switch_machine. + +2010-05-01 Glenn Morris + + * configure.in (OTHER_OBJ): Remove. + (PRE_ALLOC_OBJ, POST_ALLOC_OBJ): New output variables. + +2010-04-30 Glenn Morris + + * configure.in (OTHER_OBJ): Always include vm-limit.o on Cygwin. + Elsewhere, maybe include it. + + * configure.in (TOOLKIT_LIBW) [HAVE_GTK]: Set to $GTK_LIBS. + (OLDXMENU, LIBXMENU): New output variables. + + * configure.in (OTHER_OBJ): New output variable. + +2010-04-28 Glenn Morris + + * configure.in (CYGWIN_OBJ): New output variable. + + * configure.in (GPM_MOUSE_SUPPORT): New output variable. + + * configure.in (FONT_OBJ): New output variable. + + * configure.in (LIBXMU): New output variable. + + * configure.in (NS_OBJ, NS_SUPPORT): New output variables. + + * configure.in (machine, canonical): On amdx86-64, check for a 32-bit + userland and maybe change values to i386 (move test from s/amdx86-64.h). + +2010-04-27 Glenn Morris + + * configure.in (LIBXTR6): New output variable. Move unixware special + case here from src/s/unixware.h. + + * configure.in (LUCID_LIBW, MOTIF_LIBW): No longer substitute + in Makefiles. + (TOOLKIT_LIBW): New output variable, replacing LUCID_LIBW/MOTIF_LIBW. + + * configure.in (HAVE_MOTIF_2_1): Remove unused variable. + (LIBXP): No longer substitute in Makefiles. + (MOTIF_LIBW): New output variable. Move system-specific settings here + from src/s files. + +2010-04-27 Dan Nicolaescu + + Reduce CPP usage. + * configure.in (LIB_X11_LIB): Remove, inline in the only user. + (unexec): Define unconditionally, all platforms define + UNEXEC. AC_SUBST it. + (UNEXEC_SRC): Remove, unused. + (C_SWITCH_X_SYSTEM): Define using autoconf, not cpp. + +2010-04-27 Glenn Morris + + * configure.in (HAVE_MOTIF_2_1, HAVE_LIBXP): Remove unused AC_DEFINEs, + replaced by LIBXP. + + * configure.in (--with-crt-dir): Doc fix (now valid for all platforms). + (CRT_DIR): On (powerpc64|sparc64)-*-linux-gnu*, default to /usr/lib64. + On hpux10-20, default to /lib. + + * configure.in (LUCID_LIBW, LIBXP, WIDGET_OBJ): New output variables. + +2010-04-26 Dan Nicolaescu + + * configure.in (LIBS_MACHINE): Remove, unused. + + * configure.in (LIB_MATH): New output variable. Set it for some systems. + +2010-04-24 Glenn Morris + + * configure.in (CRT_DIR): New output variable. + (--with-crt-dir): New option. (Bug#5655) + (HAVE_LIB64_DIR): Remove. + +2010-04-22 Dan Nicolaescu + + * configure.in (REAL_CFLAGS, CFLAGS): Restore -g for gcc. + +2010-04-22 Miles Bader + + * configure.in: Get rid of "unix" pre-defined macro when + preprocessing Makefile. (Bug#5857) + +2010-04-21 Andreas Schwab + + Avoid non-portable shell command negation + * configure.in: Revert last change. + +2010-04-21 Jan Djärv + + * configure.in: Change "if test ! -f" to "if ! test -f". + +2010-04-21 Glenn Morris + + * configure.in (LIBSELINUX_LIBS): Always substitute in Makefiles. + (GTK_OBJ, DBUS_OBJ, LIBXSM, XMENU_OBJ, XOBJ): New output variables. + +2010-04-21 Karel Klíč + + * configure.in: New option: --with(out)-selinux, on by default. + Set HAVE_LIBSELINUX if we find libselinux, and substitute + LIBSELINUX_LIBS in Makefiles. + 2010-04-01 Dan Nicolaescu * configure.in: Remove all references to LIBX11_SYSTEM. @@ -5680,7 +5879,7 @@ 1994-05-09 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) * configure.in: Remove AC_LANG_C call. Not needed with Autoconf - version > 1.8. + version > 1.8. 1994-05-08 Morten Welinder (terra@diku.dk) diff -r e56f669f17ce -r fe07c47cf7a7 INSTALL --- a/INSTALL Wed May 12 14:32:06 2010 +0200 +++ b/INSTALL Thu May 13 15:13:52 2010 +0200 @@ -408,7 +408,7 @@ switch to the compiler, and link against libfoo.a and libbar.a libraries in addition to the standard ones. -For some libraries, like Gtk+, fontconfig and ALSA, `configure' use +For some libraries, like Gtk+, fontconfig and ALSA, `configure' uses pkg-config to find where those libraries are installed. If you want pkg-config to look in special directories, you have to set the environment variable PKG_CONFIG_PATH to point to the directories @@ -466,7 +466,7 @@ documentation strings to be in the etc/DOC file (see src/Makefile.in if you wish to figure out how to do that). For all else, use site-init.el. Do not load byte-compiled code which -was build with a non-nil value of `byte-compile-dynamic'. +was built with a non-nil value of `byte-compile-dynamic'. If you set load-path to a different value in site-init.el or site-load.el, Emacs will use *precisely* that value when it starts up @@ -491,7 +491,7 @@ copying it, if you wish; then it automatically uses the sibling directories ../lisp, ../lib-src, ../info. -Or you can "install" the executable and the other Emacs into their +Or you can "install" the executable and the other files into their installed locations, with `make install'. By default, Emacs's files are installed in the following directories: diff -r e56f669f17ce -r fe07c47cf7a7 Makefile.in --- a/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -69,15 +69,9 @@ # ==================== Things `configure' Might Edit ==================== CC=@CC@ -CPP=@CPP@ -C_SWITCH_SYSTEM=@c_switch_system@ -ALLOCA=@ALLOCA@ -LN_S=@LN_S@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ CPPFLAGS=@CPPFLAGS@ -C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ -LD_SWITCH_X_SITE=@LD_SWITCH_X_SITE@ EXEEXT=@EXEEXT@ MAKEINFO=@MAKEINFO@ diff -r e56f669f17ce -r fe07c47cf7a7 README.imagemagick --- a/README.imagemagick Wed May 12 14:32:06 2010 +0200 +++ b/README.imagemagick Thu May 13 15:13:52 2010 +0200 @@ -5,6 +5,15 @@ This file will attempt to contain draft NEWS, Changelog and manual entries for the new functionality. +You might need to regenerate the configure scripts: +aclocal +automake +autoheader +autoconf +./configure --with-imagemagick + + + TODO - complete documentation drafts below - test with more systems, only tested on Fedora 12 so far, and the @@ -28,7 +37,7 @@ The new function (imagemagick-types) returns a list of image file extensions that your installation of imagemagick supports. -The function (imagemagic-register-types) will enable the imagemagick +The function (imagemagick-register-types) will enable the imagemagick support for the extensions in imagemagick-types minus the types listed in imagemagick-types-inhibit. diff -r e56f669f17ce -r fe07c47cf7a7 admin/CPP-DEFINES --- a/admin/CPP-DEFINES Wed May 12 14:32:06 2010 +0200 +++ b/admin/CPP-DEFINES Thu May 13 15:13:52 2010 +0200 @@ -55,9 +55,7 @@ HAVE_TERMIO HAVE_TERMIOS INTERRUPT_INPUT -MAIL_USE_FLOCK NARROWPROTO -NOMULTIPLEJOBS SEPCHAR SIGTYPE SYSTEM_TYPE @@ -68,7 +66,6 @@ EXPLICIT_SIGN_EXTEND LOAD_AVE_CVT LOAD_AVE_TYPE -NO_ARG_ARRAY NO_REMAP VIRT_ADDR_VARIES WORDS_BIG_ENDIAN @@ -99,13 +96,8 @@ BROKEN_SIGPTY BSD4_2 BSD4_3 -BSD_PGRPS BSD_SYSTEM CLASH_DETECTION -COFF_BSD_SYMBOLS -CRT0_DUMMIES -C_SWITCH_MACHINE -C_SWITCH_SYSTEM C_SWITCH_X_SYSTEM DATA_SEG_BITS DATA_START @@ -161,7 +153,6 @@ HAVE_INDEX HAVE_INET_SOCKETS HAVE_INVERSE_HYPERBOLIC -HAVE_LIB64_DIR HAVE_LIBKSTAT HAVE_LIBNCURSES HAVE_LIBPTHREADS @@ -217,32 +208,18 @@ HAVE_WORKING_VFORK HAVE_XRMSETDATABASE HPUX -IBMR2AIX INHIBIT_X11R6_XIM INTERNAL_TERMINAL IS_ANY_SEP IS_DIRECTORY_SEP KERNEL_FILE LDAV_SYMBOL -LD_SWITCH_MACHINE -LD_SWITCH_MACHINE_TEMACS -LD_SWITCH_SYSTEM -LD_SWITCH_SYSTEM_TEMACS -LD_SWITCH_SYSTEM_tmp -LD_SWITCH_X_DEFAULT -LIBS_MACHINE -LIBS_SYSTEM -LIBS_TERMCAP -LIBXMU -LIB_GCC -LIB_MATH -LIB_MOTIF -LIB_STANDARD LINKER LINUX_VERSION_CODE LISP_FLOAT_TYPE LNOFLSH LOCALTIME_CACHE +MAIL_USE_FLOCK MAIL_USE_LOCKF MAIL_USE_POP MAIL_USE_SYSTEM_LOCK @@ -250,38 +227,23 @@ MIN_PTY_KERNEL_VERSION -- only used on Mac MODE_LINE_BINARY_TEXT MUST_UNDEF__STDC__ -NEED_BSDTTY -NEED_ERRNO -NEED_LIBW -NEED_UNISTD_H NLIST_STRUCT NOT_C_CODE -NOT_USING_MOTIF NO_ABORT -NO_DIR_LIBRARY NO_EDITRES NO_MATHERR -NO_SHARED_LIBS NO_TERMIO NSIG NSIG_MINIMUM NULL NULL_DEVICE ORDINARY_LINK -OTHER_FILES O_APPEND -O_BINARY -O_CREAT -O_EXCL O_RDONLY O_RDWR -O_TEXT -O_TRUNC -O_WRONLY PAGESIZE PENDING_OUTPUT_COUNT POSIX -POSIX_SIGNALS PREFER_VSUSP PTY_ITERATION PTY_NAME_SPRINTF @@ -311,14 +273,11 @@ SYSTEM_PURESIZE_EXTRA SYSTEM_MALLOC SYSV_SYSTEM_DIR -Srandom TAB3 TABDLY TERM -TERMINFO TEXT_START THIS_IS_CONFIGURE -THIS_IS_MAKEFILE TIME_WITH_SYS_TIME TIOCSIGSEND TM_IN_SYS_TIME @@ -326,7 +285,6 @@ UNEXEC UNIX98_PTYS USE_CRT_DLL -USE_MAC_IMAGE_IO USE_TOOLKIT_SCROLL_BARS USG USG5 @@ -352,7 +310,6 @@ _WINSOCK_H __ELF__ __FreeBSD__ -__FreeBSD_version __GNUC__ __GNU_LIBRARY__ __GNUC_MINOR__ diff -r e56f669f17ce -r fe07c47cf7a7 admin/ChangeLog --- a/admin/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/admin/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,7 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-04-01 Eli Zaretskii * CPP-DEFINES (__DJGPP__, __GO32__): Remove, no longer used. diff -r e56f669f17ce -r fe07c47cf7a7 admin/notes/BRANCH --- a/admin/notes/BRANCH Wed May 12 14:32:06 2010 +0200 +++ b/admin/notes/BRANCH Thu May 13 15:13:52 2010 +0200 @@ -17,9 +17,8 @@ For example, "emacs-23" for Emacs 23.2 and later, "EMACS_23_1_RC" for 23.1, "EMACS_22_BASE" for 22.x, and "EMACS_21_1_RC" for 21.x. -Traditionally only bug-fixes were allowed in minor releases. -Recently (22.x, 23.2), self-contained new features were allowed on a -case-by-case basis. +Consult emacs-devel for exactly what kinds of changes are allowed +on what branch at any time. If you are looking at this file in a branch other than the trunk, there may be some branch-specific documentation below this line. diff -r e56f669f17ce -r fe07c47cf7a7 admin/notes/bugtracker --- a/admin/notes/bugtracker Wed May 12 14:32:06 2010 +0200 +++ b/admin/notes/bugtracker Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ * Quick-start guide -This is 95% of all you will ever need. +This is 95% of all you will ever need to know. ** How do I report a bug? Use M-x report-emacs-bug, or send mail to bug-gnu-emacs@gnu.org. @@ -34,8 +34,12 @@ For a list of all bugs, see http://debbugs.gnu.org/db/pa/lemacs.html This is a static page, updated once a day. There is also a dynamic -list, generated on request, but since there are many bug reports this -is slow and not recommended. +list, generated on request. This accepts various options, eg to see +the most recent bugs: + +http://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100 + +Or follow the links on the front page http://debbugs.gnu.org . ** How do I report a bug in Emacs now? The same way as you always did. Send mail to bug-gnu-emacs@gnu.org, @@ -92,6 +96,9 @@ in the subsequent discussion will end up creating a new bug. This is annoying. +(So annoying that a form of message-id tracking has been implemented +to hopefully stop this happening, but it is still better to use X-Debbugs-CC.) + If a new report contains X-Debbugs-CC in the input, this is converted to a real Cc header in the output. (See Bug#1720). It is also merged into the Resent-CC header (see below). @@ -191,8 +198,7 @@ Version: 23.0.60 Severity: minor -Optionally, add a sub-package, eg Package: emacs,calendar. -This can include tags. Some things (e.g. submitter) don't seem to +This can also include tags. Some things (e.g. submitter) don't seem to work here. Otherwise, send mail to the control server, control@debbugs.gnu.org. @@ -229,7 +235,7 @@ 123 # given bug number 123;mbox=yes # mbox version of given bug -package # bugs in given package (don't use "emacs" - too many bugs!) +package # bugs in given package from:submitter@email.address severity:severity # all bugs of given severity tag:tag # all bugs with given tag @@ -281,6 +287,9 @@ search box. The only piece you really need to add is the "users" portion, the rest has the same syntax as normal. +**** To browse bugs by usertag: +http://debbugs.gnu.org/cgi/pkgindex.cgi?indexon=users + **** To find all bugs usertagged by a given email address: http://debbugs.gnu.org/cgi/pkgreport.cgi?users=bug-gnu-emacs@gnu.org @@ -359,7 +368,7 @@ notfixed 123 23.0.60 *** To assign or reassign a bug to a package or list of packages: -reassign 1234 emacs,cc-mode +reassign 1234 emacs ** To remove spam from the tracker, move it to the `spam' pseudo-package: reassign 123 spam diff -r e56f669f17ce -r fe07c47cf7a7 admin/notes/cpp --- a/admin/notes/cpp Wed May 12 14:32:06 2010 +0200 +++ b/admin/notes/cpp Thu May 13 15:13:52 2010 +0200 @@ -1,11 +1,7 @@ ttn 2003-04-09 we use a C preprocesor not only in the normal compilation of .c files -into object files, but also for creating - - src/Makefile - lib-src/Makefile - +into object files, but also for creating src/Makefile. (delimited by comment "start of cpp stuff"). some cpp implementations insert whitespace in between tokens. diff -r e56f669f17ce -r fe07c47cf7a7 config.bat --- a/config.bat Wed May 12 14:32:06 2010 +0200 +++ b/config.bat Thu May 13 15:13:52 2010 +0200 @@ -197,7 +197,7 @@ rem Create "makefile" from "makefile.in". rm -f Makefile junk.c -sed -e "1,/== start of cpp stuff ==/s@^# .*$@@" 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 @@ -221,16 +221,17 @@ rem ---------------------------------------------------------------------- Echo Configuring the library source directory... cd lib-src -rem Create "makefile" from "makefile.in". -sed -e "1,/== start of cpp stuff ==/s@^##*[ ].*$@@" junk.c -gcc -E -traditional -I. -I../src junk.c | sed -e "s/^ / /" -e "/^#/d" -e "/^[ ]*$/d" >makefile.new If "%DJGPP_VER%" == "2" goto libsrc-v2 -sed -f ../msdos/sed3.inp Makefile +sed -f ../msdos/sed3.inp Makefile Goto libsrc2 :libsrc-v2 -sed -f ../msdos/sed3v2.inp Makefile +sed -f ../msdos/sed3v2.inp Makefile :libsrc2 -rm -f makefile.new junk.c +if "%X11%" == "" goto libsrc2a +mv Makefile makefile.tmp +sed -f ../msdos/sed3x.inp Makefile +rm -f makefile.tmp +:libsrc2a if "%nodebug%" == "" goto libsrc3 sed -e "/^CFLAGS *=/s/ *-gcoff//" makefile.tmp sed -e "/^ALL_CFLAGS *=/s/=/= -s/" Makefile diff -r e56f669f17ce -r fe07c47cf7a7 configure --- a/configure Wed May 12 14:32:06 2010 +0200 +++ b/configure Thu May 13 15:13:52 2010 +0200 @@ -639,8 +639,21 @@ ac_header_list= ac_func_list= ac_subst_vars='LTLIBOBJS +LIB_GCC +LD_SWITCH_SYSTEM_EXTRA +LD_SWITCH_SYSTEM_TEMACS +POST_ALLOC_OBJ +PRE_ALLOC_OBJ +CYGWIN_OBJ +LIBX_OTHER +LIBXMENU +OLDXMENU +LIBXT_OTHER +TOOLKIT_LIBW +WIDGET_OBJ +XOBJ +XMENU_OBJ OTHER_FILES -LIB_SRC_EXTRA_INSTALLABLES GNU_OBJC_CFLAGS GNUSTEP_SYSTEM_LIBRARIES GNUSTEP_SYSTEM_HEADERS @@ -652,11 +665,10 @@ opsysfile machfile X_TOOLKIT_TYPE +C_SWITCH_X_SYSTEM C_SWITCH_X_SITE -LD_SWITCH_X_SITE_AUX LD_SWITCH_X_SITE -c_switch_machine -c_switch_system +unexec gameuser gamedir bitmapdir @@ -677,15 +689,20 @@ COM_ERRLIB LIBRESOLV LIBHESIOD +TERMCAP_OBJ +LIBS_TERMCAP GETOPTOBJS GETOPT_H GETLOADAVG_LIBS KMEM_GROUP NEED_SETGID LIBOBJS +BLESSMAIL_TARGET LIBS_MAIL liblockfile ALLOCA +LIBXSM +GPM_MOUSE_SUPPORT LIBGPM LIBGIF LIBTIFF @@ -694,6 +711,7 @@ LIBXPM FREETYPE_LIBS FREETYPE_CFLAGS +FONT_OBJ M17N_FLT_LIBS M17N_FLT_CFLAGS LIBOTF_LIBS @@ -702,10 +720,15 @@ XFT_CFLAGS FONTCONFIG_LIBS FONTCONFIG_CFLAGS +LIBXMU +LIBXTR6 +LIBSELINUX_LIBS GCONF_LIBS GCONF_CFLAGS +DBUS_OBJ DBUS_LIBS DBUS_CFLAGS +GTK_OBJ GTK_LIBS GTK_CFLAGS IMAGEMAGICK_LIBS @@ -713,6 +736,11 @@ RSVG_LIBS RSVG_CFLAGS HAVE_XSERVER +LIB_STANDARD +NS_SUPPORT +NS_OBJ +LD_SWITCH_X_SITE_AUX_RPATH +LD_SWITCH_X_SITE_AUX XMKMF SET_MAKE CFLAGS_SOUND @@ -720,6 +748,13 @@ ALSA_CFLAGS PKG_CONFIG LIBSOUND +START_FILES +LIB_MATH +CRT_DIR +LIBS_SYSTEM +C_SWITCH_SYSTEM +C_SWITCH_MACHINE +LD_SWITCH_SYSTEM MAKEINFO GZIP_PROG INSTALL_INFO @@ -727,7 +762,6 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM -LN_S EGREP GREP CPP @@ -814,10 +848,12 @@ with_gpm with_dbus with_gconf +with_selinux with_makeinfo with_gtk with_gcc with_pkg_config_prog +with_crt_dir with_gnustep_conf enable_ns_self_contained enable_asserts @@ -1528,10 +1564,13 @@ console --without-dbus don't compile with D-Bus support --without-gconf don't compile with GConf support + --without-selinux don't compile with SELinux support --without-makeinfo don't require makeinfo for building manuals --with-pkg-config-prog=PATH path to pkg-config for finding GTK and librsvg + --with-crt-dir=DIR directory containing crtn.o etc. The default is + /usr/lib, or /usr/lib64 on some platforms. --with-gnustep-conf=PATH path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf @@ -2330,6 +2369,14 @@ fi +# Check whether --with-selinux was given. +if test "${with_selinux+set}" = set; then + withval=$with_selinux; +else + with_selinux=yes +fi + + ## For the times when you want to build Emacs but don't have ## a suitable makeinfo, and can live without the manuals. @@ -2375,6 +2422,15 @@ fi fi +CRT_DIR= + +# Check whether --with-crt-dir was given. +if test "${with_crt_dir+set}" = set; then + withval=$with_crt_dir; +fi + +CRT_DIR="${with_crt_dir}" + # Check whether --with-gnustep-conf was given. if test "${with_gnustep_conf+set}" = set; then @@ -2748,14 +2804,6 @@ ## NetBSD ports *-*-netbsd* ) opsys=netbsd - if test -f /usr/lib/crti.o; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CRTIN /**/ -_ACEOF - - fi - case "${canonical}" in alpha*-*-netbsd*) machine=alpha ;; i[3456]86-*-netbsd*) machine=intel386 ;; @@ -4996,17 +5044,6 @@ #### Some other nice autoconf tests. -{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5430,6 +5467,73 @@ fi fi + +## Although we're running on an amd64 kernel, we're actually compiling for +## the x86 architecture. The user should probably have provided an +## explicit --build to `configure', but if everything else than the kernel +## is running in i386 mode, we can help them out. +if test "$machine" = "amdx86-64"; then + { $as_echo "$as_me:$LINENO: checking whether i386 is declared" >&5 +$as_echo_n "checking whether i386 is declared... " >&6; } +if test "${ac_cv_have_decl_i386+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef i386 + (void) i386; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_i386=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_i386=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_i386" >&5 +$as_echo "$ac_cv_have_decl_i386" >&6; } + + if test "$ac_cv_have_decl_i386" = "yes"; then + canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'` + machine=intel386 + machfile="m/${machine}.h" + fi +fi + # Extract the first word of "install-info", so it can be a program name with args. set dummy install-info; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -5652,7 +5756,7 @@ if test "$MAKEINFO" = "no"; then if test "x${with_makeinfo}" = "xno"; then MAKEINFO=off - elif ! test -e $srcdir/info/emacs; then + elif test ! -e $srcdir/info/emacs; then { { $as_echo "$as_me:$LINENO: error: You do not seem to have makeinfo >= 4.6, and your source tree does not seem to have pre-built manuals in the \`info' directory. Either install a suitable version of makeinfo, or re-run configure @@ -5752,33 +5856,10 @@ echo ' #include "'${srcdir}'/src/'${opsysfile}'" #include "'${srcdir}'/src/'${machfile}'" -#ifndef LIBS_MACHINE -#define LIBS_MACHINE -#endif -#ifndef LIBS_SYSTEM -#define LIBS_SYSTEM -#endif -#ifndef C_SWITCH_SYSTEM -#define C_SWITCH_SYSTEM -#endif -#ifndef C_SWITCH_MACHINE -#define C_SWITCH_MACHINE -#endif -configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM -configure___ c_switch_system=C_SWITCH_SYSTEM -configure___ c_switch_machine=C_SWITCH_MACHINE - -#ifndef LIB_X11_LIB -#define LIB_X11_LIB -lX11 -#endif - -configure___ LIBX=LIB_X11_LIB - -#ifdef UNEXEC + +configure___ LIBX=-lX11 + configure___ unexec=UNEXEC -#else -configure___ unexec=unexec.o -#endif #ifdef SYSTEM_MALLOC configure___ system_malloc=yes @@ -5804,26 +5885,11 @@ #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH} #endif -#ifndef LD_SWITCH_MACHINE -#define LD_SWITCH_MACHINE -#endif - -#ifndef LD_SWITCH_SYSTEM -#define LD_SWITCH_SYSTEM -#endif - -#ifndef LD_SWITCH_X_SITE_AUX -#define LD_SWITCH_X_SITE_AUX -#endif - -configure___ ld_switch_system=LD_SWITCH_SYSTEM -configure___ ld_switch_machine=LD_SWITCH_MACHINE - #ifdef THIS_IS_CONFIGURE /* Get the CFLAGS for tests in configure. */ #ifdef __GNUC__ -configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' +configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' #else configure___ CFLAGS='${SPECIFIED_CFLAGS}' #endif @@ -5832,7 +5898,7 @@ /* Get the CFLAGS for real compilation. */ #ifdef __GNUC__ -configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' +configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' #else configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}' #endif @@ -5855,14 +5921,159 @@ fi rm ${tempcname} -ac_link="$ac_link $ld_switch_machine $ld_switch_system" + +LD_SWITCH_SYSTEM= +case "$opsys" in + freebsd) + ## Let `ld' find image libs and similar things in /usr/local/lib. + ## The system compiler, GCC, has apparently been modified to not + ## look there, contrary to what a stock GCC would do. + LD_SWITCH_SYSTEM=-L/usr/local/lib + ;; + + gnu-linux) + ## cpp test was "ifdef __mips__", but presumably this is equivalent... + test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0" + ;; + + netbsd) + LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib" + ;; + + openbsd) + ## Han Boetes says this is necessary, + ## otherwise Emacs dumps core on elf systems. + LD_SWITCH_SYSTEM="-Z" + ;; +esac + + +ac_link="$ac_link $LD_SWITCH_SYSTEM" + +## This is fun. Some settings of LD_SWITCH_SYSTEM reference +## LD_SWITCH_X_SITE_AUX, which has not been defined yet. When using +## cpp, it was expanded to null. Thus LD_SWITCH_SYSTEM had different +## values in configure and the Makefiles. How helpful. +## FIXME why not use LD_SWITCH_SYSTEM_TEMACS (or somesuch) instead? +case "$opsys" in + gnu-linux) + ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time. + LD_SWITCH_SYSTEM="$LD_SWITCH_SYSTEM \$(LD_SWITCH_X_SITE_AUX)" ;; + + netbsd|openbsd) + ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R. + LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;; +esac + + +C_SWITCH_MACHINE= +if test "$machine" = "alpha"; then + { $as_echo "$as_me:$LINENO: checking whether __ELF__ is declared" >&5 +$as_echo_n "checking whether __ELF__ is declared... " >&6; } +if test "${ac_cv_have_decl___ELF__+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef __ELF__ + (void) __ELF__; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___ELF__=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___ELF__=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___ELF__" >&5 +$as_echo "$ac_cv_have_decl___ELF__" >&6; } + + if test "$ac_cv_have_decl___ELF__" = "yes"; then + ## With ELF, make sure that all common symbols get allocated to in the + ## data section. Otherwise, the dump of temacs may miss variables in + ## the shared library that have been initialized. For example, with + ## GNU libc, __malloc_initialized would normally be resolved to the + ## shared library's .bss section, which is fatal. + if test "x$GCC" = "xyes"; then + C_SWITCH_MACHINE="-fno-common" + else + { { $as_echo "$as_me:$LINENO: error: What gives? Fix me if DEC Unix supports ELF now." >&5 +$as_echo "$as_me: error: What gives? Fix me if DEC Unix supports ELF now." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi + + + +C_SWITCH_SYSTEM= +## Some programs in src produce warnings saying certain subprograms +## are too complex and need a MAXMEM value greater than 2000 for +## additional optimization. --nils@exp-math.uni-essen.de +test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \ + C_SWITCH_SYSTEM="-ma -qmaxmem=4000" +## gnu-linux might need -D_BSD_SOURCE on old libc5 systems. +## It is redundant in glibc2, since we define _GNU_SOURCE. + + + +LIBS_SYSTEM= +case "$opsys" in + ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2. + aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;; + + freebsd) LIBS_SYSTEM="-lutil" ;; + + hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; + + sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;; + + ## Motif needs -lgen. + unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; +esac + + ### Make sure subsequent tests use flags consistent with the build flags. if test x"${OVERRIDE_CPPFLAGS}" != x; then CPPFLAGS="${OVERRIDE_CPPFLAGS}" else - CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS" + CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" fi @@ -6225,20 +6436,83 @@ -### The standard library on x86-64 and s390x GNU/Linux distributions can -### be located in either /usr/lib64 or /usr/lib. -### In some rare cases, /usr/lib64 exists but does not contain the -### relevant files (bug#1287). Hence test for crtn.o. -case "${canonical}" in - x86_64-*-linux-gnu* | s390x-*-linux-gnu* ) - if test -e /usr/lib64/crtn.o; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIB64_DIR 1 -_ACEOF - -fi -esac +## If user specified a crt-dir, use that unconditionally. +if test "X$CRT_DIR" = "X"; then + + case "$canonical" in + x86_64-*-linux-gnu* | s390x-*-linux-gnu*) + ## On x86-64 and s390x GNU/Linux distributions, the standard library + ## can be in a variety of places. We only try /usr/lib64 and /usr/lib. + ## For anything else (eg /usr/lib32), it is up the user to specify + ## the location (bug#5655). + ## Test for crtn.o, not just the directory, because sometimes the + ## directory exists but does not have the relevant files (bug#1287). + ## FIXME better to test for binary compatibility somehow. + test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64 + ;; + + powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;; + esac + + case "$opsys" in + hpux10-20) CRT_DIR=/lib ;; + esac + + ## Default is /usr/lib. + test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib + +else + + ## Some platforms don't use any of these files, so it is not + ## appropriate to put this test outside the if block. + test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \ + { { $as_echo "$as_me:$LINENO: error: crt*.o not found in specified location." >&5 +$as_echo "$as_me: error: crt*.o not found in specified location." >&2;} + { (exit 1); exit 1; }; } + +fi + + + +LIB_MATH=-lm +LIB_STANDARD= +START_FILES= + +case $opsys in + cygwin ) + LIB_MATH= + START_FILES='ecrt0.o' + ;; + darwin ) + ## Adding -lm confuses the dynamic linker, so omit it. + LIB_MATH= + START_FILES='pre-crt0.o' + ;; + freebsd ) + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o' + ;; + gnu-linux | gnu-kfreebsd ) + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o' + ;; + hpux10-20 | hpux11 ) + LIB_STANDARD=-lc + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o' + ;; + netbsd | openbsd ) + if test -f $(CRT_DIR)/crti.o; then + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o' + else + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o' + fi + ;; +esac + + + @@ -9614,17 +9888,19 @@ ## Workaround for bug in autoconf <= 2.62. ## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html ## No need to do anything special for these standard directories. -## This is an experiment, take it out if it causes problems. if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` fi +LD_SWITCH_X_SITE_AUX= +LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then if test -n "${x_libraries}"; then LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"` + LD_SWITCH_X_SITE_AUX_RPATH=`echo ${LD_SWITCH_X_SITE_AUX} | sed -e 's/-R/-Wl,-rpath,/'` fi x_default_search_path="" x_search_path=${x_libraries} @@ -9647,6 +9923,9 @@ fi done fi + + + if test "${x_includes}" != NONE && test -n "${x_includes}"; then C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` fi @@ -9696,6 +9975,7 @@ CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}" + LIB_STANDARD= fi if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for AppKit/AppKit.h" >&5 @@ -9882,6 +10162,9 @@ NS_HAVE_NSINTEGER=no fi fi + +NS_OBJ= +NS_SUPPORT= if test "${HAVE_NS}" = yes; then window_system=nextstep with_xft=no @@ -9891,10 +10174,15 @@ if test "${EN_NS_SELF_CONTAINED}" = yes; then prefix=${ns_appresdir} fi + NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o" + NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc" fi CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" + + + case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes @@ -10690,7 +10978,7 @@ REL_ALLOC=no fi -LIBS="$libsrc_libs $LIBS" +LIBS="$LIBS_SYSTEM $LIBS" { $as_echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 @@ -10908,6 +11196,18 @@ fi +## Note: when using cpp in s/aix4.2.h, this definition depended on +## HAVE_LIBPTHREADS. That was not defined earlier in configure when +## the system file was sourced. Hence the value of LIBS_SYSTEM +## added to LIBS in configure would never contain the pthreads part, +## but the value used in Makefiles might. FIXME? +## +## -lpthreads seems to be necessary for Xlib in X11R6, and should +## be harmless on older versions of X where it happens to exist. +test "$opsys" = "aix4-2" && \ + test $ac_cv_lib_pthreads_cma_open = yes && \ + LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads" + case ${host_os} in aix*) @@ -11484,11 +11784,9 @@ fi HAVE_IMAGEMAGICK=no -if test "${HAVE_X11}" = "yes" ; then - if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_REQUIRED=1 - IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" - +if test "${with_imagemagick}" != "no"; then + IMAGEMAGICK_REQUIRED=1 + IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" succeeded=no @@ -11586,18 +11884,18 @@ - if test ".${IMAGEMAGICK_CFLAGS}" != "."; then - HAVE_IMAGEMAGICK=yes + if test ".${IMAGEMAGICK_CFLAGS}" != "."; then + HAVE_IMAGEMAGICK=yes cat >>confdefs.h <<\_ACEOF #define HAVE_IMAGEMAGICK 1 _ACEOF - CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" - LIBS="$IMAGEMAGICK_LIBS $LIBS" - fi - fi -fi + CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" + LIBS="$IMAGEMAGICK_LIBS $LIBS" + fi +fi + HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then @@ -11707,6 +12005,7 @@ fi +GTK_OBJ= if test x"$pkg_check_gtk" = xyes; then @@ -11829,6 +12128,7 @@ #define USE_GTK 1 _ACEOF + GTK_OBJ=gtkutil.o USE_X_TOOLKIT=none if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then : @@ -11848,6 +12148,7 @@ fi + if test "${HAVE_GTK}" = "yes"; then if test "$with_toolkit_scroll_bars" != no; then @@ -12543,6 +12844,7 @@ fi HAVE_DBUS=no +DBUS_OBJ= if test "${with_dbus}" = "yes"; then succeeded=no @@ -12746,9 +13048,11 @@ fi done + DBUS_OBJ=dbusbind.o fi fi + HAVE_GCONF=no if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then @@ -12854,7 +13158,93 @@ fi fi +HAVE_LIBSELINUX=no +LIBSELINUX_LIBS= +if test "${with_selinux}" = "yes"; then + { $as_echo "$as_me:$LINENO: checking for lgetfilecon in -lselinux" >&5 +$as_echo_n "checking for lgetfilecon in -lselinux... " >&6; } +if test "${ac_cv_lib_selinux_lgetfilecon+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lselinux $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char lgetfilecon (); +int +main () +{ +return lgetfilecon (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_selinux_lgetfilecon=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_selinux_lgetfilecon=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_lgetfilecon" >&5 +$as_echo "$ac_cv_lib_selinux_lgetfilecon" >&6; } +if test "x$ac_cv_lib_selinux_lgetfilecon" = x""yes; then + HAVE_LIBSELINUX=yes +else + HAVE_LIBSELINUX=no +fi + + if test "$HAVE_LIBSELINUX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBSELINUX 1 +_ACEOF + + LIBSELINUX_LIBS=-lselinux + fi +fi + + HAVE_XAW3D=no +LUCID_LIBW= if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then if test "$with_xaw3d" != no; then { $as_echo "$as_me:$LINENO: checking for xaw3d" >&5 @@ -12921,6 +13311,7 @@ $as_echo "yes; using Lucid toolkit" >&6; } USE_X_TOOLKIT=LUCID HAVE_XAW3D=yes + LUCID_LIBW=-lXaw3d cat >>confdefs.h <<\_ACEOF #define HAVE_XAW3D 1 @@ -12989,6 +13380,7 @@ { $as_echo "$as_me:$LINENO: result: yes; using Lucid toolkit" >&5 $as_echo "yes; using Lucid toolkit" >&6; } USE_X_TOOLKIT=LUCID + LUCID_LIBW=-lXaw elif test x"${USE_X_TOOLKIT}" = xLUCID; then { { $as_echo "$as_me:$LINENO: error: Lucid toolkit requires X11/Xaw include files" >&5 $as_echo "$as_me: error: Lucid toolkit requires X11/Xaw include files" >&2;} @@ -13003,6 +13395,7 @@ X_TOOLKIT_TYPE=$USE_X_TOOLKIT +LIBXTR6= if test "${USE_X_TOOLKIT}" != "none"; then { $as_echo "$as_me:$LINENO: checking X11 toolkit version" >&5 $as_echo_n "checking X11 toolkit version... " >&6; } @@ -13070,6 +13463,11 @@ #define HAVE_X11XTR6 1 _ACEOF + LIBXTR6="-lSM -lICE" + case "$opsys" in + ## Use libw.a along with X11R6 Xt. + unixware) LIBXTR6="$LIBXTR6 -lw" ;; + esac else { $as_echo "$as_me:$LINENO: result: before 6" >&5 $as_echo "before 6" >&6; } @@ -13159,6 +13557,16 @@ test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS" fi + +LIBXMU=-lXmu +case "$machine" in + ## These machines don't supply Xmu. + hpux* | aix4-2 ) + test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU= + ;; +esac + + # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D. if test "${HAVE_X11}" = "yes"; then if test "${USE_X_TOOLKIT}" != "none"; then @@ -13240,6 +13648,7 @@ fi fi +LIBXP= if test "${USE_X_TOOLKIT}" = "MOTIF"; then { $as_echo "$as_me:$LINENO: checking for Motif version 2.1" >&5 $as_echo_n "checking for Motif version 2.1... " >&6; } @@ -13295,14 +13704,7 @@ fi { $as_echo "$as_me:$LINENO: result: $emacs_cv_motif_version_2_1" >&5 $as_echo "$emacs_cv_motif_version_2_1" >&6; } - HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1 if test $emacs_cv_motif_version_2_1 = yes; then - HAVE_LIBXP=no - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MOTIF_2_1 1 -_ACEOF - { $as_echo "$as_me:$LINENO: checking for XpCreateContext in -lXp" >&5 $as_echo_n "checking for XpCreateContext in -lXp... " >&6; } if test "${ac_cv_lib_Xp_XpCreateContext+set}" = set; then @@ -13369,16 +13771,9 @@ { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xp_XpCreateContext" >&5 $as_echo "$ac_cv_lib_Xp_XpCreateContext" >&6; } if test "x$ac_cv_lib_Xp_XpCreateContext" = x""yes; then - HAVE_LIBXP=yes -fi - - if test ${HAVE_LIBXP} = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBXP 1 -_ACEOF - - fi + LIBXP=-lXp +fi + else { $as_echo "$as_me:$LINENO: checking for LessTif where some systems put it" >&5 $as_echo_n "checking for LessTif where some systems put it... " >&6; } @@ -14438,6 +14833,15 @@ HAVE_LIBOTF=no 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. @@ -15732,6 +16136,7 @@ ### Use -lgpm if available, unless `--with-gpm=no'. HAVE_GPM=no LIBGPM= +GPM_MOUSE_SUPPORT= if test "${with_gpm}" != "no"; then if test "${ac_cv_header_gpm_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for gpm.h" >&5 @@ -15941,8 +16346,10 @@ _ACEOF LIBGPM=-lgpm - fi -fi + GPM_MOUSE_SUPPORT="\${lispsource}mouse.elc" + fi +fi + if test "${ac_cv_header_malloc_malloc_h+set}" = set; then @@ -16082,6 +16489,7 @@ +C_SWITCH_X_SYSTEM= ### Use NeXTstep API to implement GUI. if test "${HAVE_NS}" = "yes"; then @@ -16103,6 +16511,9 @@ #define NS_IMPL_GNUSTEP 1 _ACEOF + # See also .m.o rule in Makefile.in */ + # FIXME: are all these flags really needed? Document here why. */ + C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing" GNU_OBJC_CFLAGS="-fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi if test "${NS_HAVE_NSINTEGER}" = "yes"; then @@ -16120,6 +16531,7 @@ ### Use session management (-lSM -lICE) if available HAVE_X_SM=no +LIBXSM= if test "${HAVE_X11}" = "yes"; then if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for X11/SM/SMlib.h" >&5 @@ -16328,13 +16740,15 @@ #define HAVE_X_SM 1 _ACEOF + LIBXSM="-lSM -lICE" case "$LIBS" in *-lSM*) ;; - *) LIBS="-lSM -lICE $LIBS" ;; + *) LIBS="$LIBXSM $LIBS" ;; esac fi fi + # If netdb.h doesn't declare h_errno, we must declare it by hand. { $as_echo "$as_me:$LINENO: checking whether netdb declares h_errno" >&5 $as_echo_n "checking whether netdb declares h_errno... " >&6; } @@ -17326,6 +17740,58 @@ +## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to +## interlock access to the mail spool. The alternative is a lock file named +## /usr/spool/mail/$USER.lock. +mail_lock=no +case "$opsys" in + aix4-2) mail_lock="lockf" ;; + + gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;; + + ## On GNU/Linux systems, both methods are used by various mail programs. + ## I assume most people are using newer mailers that have heard of flock. + ## Change this if you need to. + ## Debian contains a patch which says: ``On Debian/GNU/Linux systems, + ## configure gets the right answers, and that means *NOT* using flock. + ## Using flock is guaranteed to be the wrong thing. See Debian Policy + ## for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the + ## Debian maintainer hasn't provided a clean fix for Emacs. + ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and + ## HAVE_MAILLOCK_H are defined, so the following appears to be the + ## correct logic. -- fx + ## We must check for HAVE_LIBLOCKFILE too, as movemail does. + ## liblockfile is a Free Software replacement for libmail, used on + ## Debian systems and elsewhere. -rfr. + gnu-*) + mail_lock="flock" + if test $have_mail = yes || test $have_lockfile = yes; then + test $ac_cv_header_maillock_h = yes && mail_lock=no + fi + ;; +esac + +BLESSMAIL_TARGET= +case "$mail_lock" in + flock) +cat >>confdefs.h <<\_ACEOF +#define MAIL_USE_FLOCK 1 +_ACEOF + ;; + + lockf) +cat >>confdefs.h <<\_ACEOF +#define MAIL_USE_LOCKF 1 +_ACEOF + ;; + + *) BLESSMAIL_TARGET="need-blessmail" ;; +esac + + + + + @@ -17406,7 +17872,7 @@ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ -cfmakeraw cfsetspeed +cfmakeraw cfsetspeed isnan copysign do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -21174,7 +21640,7 @@ # That is because we have not set up to link ncurses in lib-src. # It's better to believe a function is not available # than to expect to find it in ncurses. -# Also we need tputs and frieds to be able to build at all. +# Also we need tputs and friends to be able to build at all. have_tputs_et_al=true { $as_echo "$as_me:$LINENO: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } @@ -21280,9 +21746,137 @@ #define HAVE_LIBNCURSES 1 _ACEOF +## FIXME This was the cpp logic, but I am not sure it is right. +## The above test has not necessarily found libncurses. +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 +## darwin|gnu without ncurses. +TERMINFO=no +LIBS_TERMCAP= +case "$opsys" in + ## cygwin: Fewer environment variables to go wrong, more terminal types. + ## 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 ;; + + ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2. + ## The ncurses library has been moved out of the System framework in + ## Mac OS X 10.2. So if configure detects it, set the command-line + ## option to use it. + darwin|gnu*) + ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.) + if test "x$HAVE_LIBNCURSES" = "xyes"; then + TERMINFO=yes + LIBS_TERMCAP="-lncurses" + fi + ;; + + freebsd) + { $as_echo "$as_me:$LINENO: checking whether FreeBSD is new enough to use terminfo" >&5 +$as_echo_n "checking whether FreeBSD is new enough to use terminfo... " >&6; } + if test "${emacs_cv_freebsd_terminfo+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +#if __FreeBSD_version < 400000 +fail; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + emacs_cv_freebsd_terminfo=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + emacs_cv_freebsd_terminfo=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi + + + { $as_echo "$as_me:$LINENO: result: $emacs_cv_freebsd_terminfo" >&5 +$as_echo "$emacs_cv_freebsd_terminfo" >&6; } + + if test $emacs_cv_freebsd_terminfo = yes; then + TERMINFO=yes + LIBS_TERMCAP="-lncurses" + else + LIBS_TERMCAP="-ltermcap" + fi + ;; + +esac + +case "$opsys" in + ## hpux: Make sure we get select from libc rather than from libcurses + ## because libcurses on HPUX 10.10 has a broken version of select. + ## We used to use -lc -lcurses, but this may be cleaner. + hpux*|netbsd) LIBS_TERMCAP="-ltermcap" ;; + + openbsd) LIBS_TERMCAP="-lncurses" ;; + + ## Must use system termcap, if we use any termcap. It does special things. + sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;; +esac + +TERMCAP_OBJ=tparam.o +if test $TERMINFO = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TERMINFO 1 +_ACEOF + + + ## Default used to be -ltermcap. Add a case above if need something else. + test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses" + + TERMCAP_OBJ=terminfo.o +fi + + + # Do we have res_init, for detecting changes in /etc/resolv.conf? - resolv=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25866,6 +26460,16 @@ CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" +## Hack to detect a buggy GCC version. +if test "x$GCC" = xyes \ + && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \ + && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \ + && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then + { { $as_echo "$as_me:$LINENO: error: GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." >&5 +$as_echo "$as_me: error: GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." >&2;} + { (exit 1); exit 1; }; } +fi + #### Find out which version of Emacs this is. version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` @@ -25908,8 +26512,7 @@ - - +## Used in lwlib/Makefile.in. @@ -25951,28 +26554,28 @@ cat >>confdefs.h <<_ACEOF -#define LD_SWITCH_X_SITE_AUX ${LD_SWITCH_X_SITE_AUX} -_ACEOF - - -cat >>confdefs.h <<_ACEOF #define C_SWITCH_X_SITE ${C_SWITCH_X_SITE} _ACEOF -cat >>confdefs.h <<_ACEOF -#define UNEXEC_SRC ${UNEXEC_SRC} -_ACEOF - - +XMENU_OBJ= +XOBJ= if test "${HAVE_X_WINDOWS}" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_X_WINDOWS 1 _ACEOF -fi + 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" +fi + + + +WIDGET_OBJ= +MOTIF_LIBW= if test "${USE_X_TOOLKIT}" != "none" ; then + WIDGET_OBJ=widget.o cat >>confdefs.h <<\_ACEOF #define USE_X_TOOLKIT 1 @@ -25990,15 +26593,76 @@ #define USE_MOTIF 1 _ACEOF - fi -fi + MOTIF_LIBW=-lXm + case "$opsys" in + gnu-linux) + ## Paul Abrahams says this is needed. + MOTIF_LIBW="$MOTIF_LIBW -lXpm" + ;; + + unixware) + ## Richard Anthony Ryan + ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2. + MOTIF_LIBW="MOTIF_LIBW -lXimp" + ;; + + aix4-2) + ## olson@mcs.anl.gov says -li18n is needed by -lXm. + MOTIF_LIBW="$MOTIF_LIBW -li18n" + ;; + esac + MOTIF_LIBW="$MOTIF_LIBW $LIBXP" + fi +fi + + +TOOLKIT_LIBW= +case "$USE_X_TOOLKIT" in + MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;; + LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;; + none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;; +esac + + +if test "$USE_X_TOOLKIT" = "none"; then + LIBXT_OTHER="\$(LIBXSM)" +else + LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext" +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. if test "${HAVE_X11}" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_X11 1 _ACEOF -fi + + if test "$USE_X_TOOLKIT" = "none"; then + OLDXMENU="\${oldXMenudir}libXMenu11.a" + else + OLDXMENU="\${lwlibdir}liblw.a" + fi + LIBXMENU="\$(OLDXMENU)" + LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)" +else + OLDXMENU= + LIBXMENU="-lXMenu" + LIBX_OTHER= +fi + +if test "$HAVE_GTK" = "yes"; then + OLDXMENU= + LIBXMENU= +fi + + + + + if test "${HAVE_MENUS}" = "yes" ; then cat >>confdefs.h <<\_ACEOF @@ -26022,6 +26686,89 @@ fi +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" +else + CYGWIN_OBJ= + PRE_ALLOC_OBJ=lastfile.o + POST_ALLOC_OBJ="\$(vmlimitobj)" +fi + + + + + +case "$opsys" in + aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;; + + darwin) + ## The -headerpad option tells ld (see man page) to leave room at the + ## end of the header for adding load commands. Needed for dumping. + ## 0x690 is the total size of 30 segment load commands (at 56 + ## each); under Cocoa 31 commands are required. + if test "$HAVE_NS" = "yes"; then + libs_nsgui="-framework AppKit" + headerpad_extra=6C8 + else + libs_nsgui= + headerpad_extra=690 + fi + LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra" + ;; + + *) LD_SWITCH_SYSTEM_TEMACS= ;; +esac + + + +## This exists because src/Makefile.in did some extra fiddling around +## with LD_SWITCH_SYSTEM. The cpp logic was: +## #ifndef LD_SWITCH_SYSTEM +## #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF))) +## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to: +## not using gcc, darwin system not on an alpha (ie darwin, since +## darwin + alpha does not occur). +## Note that unlike L_S_S, this is not used in ac_link. +if test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \ + test "$opsys" = "darwin"; then + LD_SWITCH_SYSTEM_EXTRA="-X" +else + LD_SWITCH_SYSTEM_EXTRA= +fi + + + +LIB_GCC= +if test "x$GCC" = "xyes"; then + + case "$opsys" in + ## cygwin: don't link against static libgcc. + cygwin|freebsd|netbsd|openbsd) LIB_GCC= ;; + + gnu-*) + ## armin76@gentoo.org reported that the lgcc_s flag is necessary to + ## build on ARM EABI under GNU/Linux. (Bug#5518) + ## Note that m/arm.h never bothered to undefine LIB_GCC first. + if test "$machine" = "arm"; then + LIB_GCC="-lgcc_s" + else + ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then + ## immediately undefine it again and redefine it to empty. + ## Was the C_SWITCH_X_SITE part really necessary? +## LIB_GCC=`$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name` + LIB_GCC= + fi + ;; + + ## Ask GCC where to find libgcc.a. + *) LIB_GCC=`$(CC) -print-libgcc-file-name 2> /dev/null` ;; + esac +fi + + @@ -26069,6 +26816,7 @@ echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" +echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}" echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}" @@ -26118,7 +26866,7 @@ # 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. -cpp_undefs="`echo $srcdir $configuration $canonical | +cpp_undefs="`echo $srcdir $configuration $canonical unix | sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \ -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g'`" @@ -26144,7 +26892,7 @@ rm -f conftest* -ac_config_files="$ac_config_files Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile.c:src/Makefile.in lwlib/Makefile lisp/Makefile leim/Makefile" +ac_config_files="$ac_config_files Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile.c:src/Makefile.in lwlib/Makefile lisp/Makefile leim/Makefile" ac_config_commands="$ac_config_commands default" @@ -26753,7 +27501,7 @@ case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.in" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "lib-src/Makefile.c") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile.c:lib-src/Makefile.in" ;; + "lib-src/Makefile") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile" ;; "oldXMenu/Makefile") CONFIG_FILES="$CONFIG_FILES oldXMenu/Makefile" ;; "doc/emacs/Makefile") CONFIG_FILES="$CONFIG_FILES doc/emacs/Makefile" ;; "doc/misc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/misc/Makefile" ;; @@ -27399,22 +28147,6 @@ CPPFLAGS="$CPPFLAGS -traditional" fi -echo creating lib-src/Makefile -( cd lib-src - rm -f junk.c junk1.c junk2.c - sed -e '/start of cpp stuff/q' \ - < Makefile.c > junk1.c - sed -e '1,/start of cpp stuff/d'\ - -e 's,/\*\*/#\(.*\)$,/* \1 */,' \ - < Makefile.c > junk.c - $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \ - sed -e 's/^ / /' -e '/^#/d' -e '/^[ ]*$/d' > junk2.c - cat junk1.c junk2.c > Makefile.new - rm -f junk.c junk1.c junk2.c - chmod 444 Makefile.new - mv -f Makefile.new Makefile -) - echo creating src/Makefile ( cd src rm -f junk.c junk1.c junk2.c diff -r e56f669f17ce -r fe07c47cf7a7 configure.in --- a/configure.in Wed May 12 14:32:06 2010 +0200 +++ b/configure.in Thu May 13 15:13:52 2010 +0200 @@ -162,6 +162,7 @@ OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) OPTION_DEFAULT_ON([gconf],[don't compile with GConf support]) +OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support]) ## For the times when you want to build Emacs but don't have ## a suitable makeinfo, and can live without the manuals. @@ -186,6 +187,12 @@ fi fi +CRT_DIR= +AC_ARG_WITH([crt-dir],dnl +[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc. +The default is /usr/lib, or /usr/lib64 on some platforms.])]) +CRT_DIR="${with_crt_dir}" + AC_ARG_WITH([gnustep-conf],dnl [AS_HELP_STRING([--with-gnustep-conf=PATH],[path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])]) test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \ @@ -422,12 +429,6 @@ ## NetBSD ports *-*-netbsd* ) opsys=netbsd - if test -f /usr/lib/crti.o; then] -dnl The close and open brackets here are because this section is quoted -- -dnl see the `changequote' comment above. - AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.]) -[ fi - case "${canonical}" in alpha*-*-netbsd*) machine=alpha ;; i[3456]86-*-netbsd*) machine=intel386 ;; @@ -749,12 +750,25 @@ #### Some other nice autoconf tests. dnl checks for programs -AC_PROG_LN_S AC_PROG_CPP AC_PROG_INSTALL if test "x$RANLIB" = x; then AC_PROG_RANLIB fi + +## Although we're running on an amd64 kernel, we're actually compiling for +## the x86 architecture. The user should probably have provided an +## explicit --build to `configure', but if everything else than the kernel +## is running in i386 mode, we can help them out. +if test "$machine" = "amdx86-64"; then + AC_CHECK_DECL([i386]) + if test "$ac_cv_have_decl_i386" = "yes"; then + canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'` + machine=intel386 + machfile="m/${machine}.h" + fi +fi + AC_PATH_PROG(INSTALL_INFO, install-info) AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin) AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin) @@ -783,7 +797,7 @@ if test "$MAKEINFO" = "no"; then if test "x${with_makeinfo}" = "xno"; then MAKEINFO=off - elif ! test -e $srcdir/info/emacs; then + elif test ! -e $srcdir/info/emacs; then AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, and your source tree does not seem to have pre-built manuals in the `info' directory. Either install a suitable version of makeinfo, or re-run configure @@ -846,33 +860,10 @@ echo ' #include "'${srcdir}'/src/'${opsysfile}'" #include "'${srcdir}'/src/'${machfile}'" -#ifndef LIBS_MACHINE -#define LIBS_MACHINE -#endif -#ifndef LIBS_SYSTEM -#define LIBS_SYSTEM -#endif -#ifndef C_SWITCH_SYSTEM -#define C_SWITCH_SYSTEM -#endif -#ifndef C_SWITCH_MACHINE -#define C_SWITCH_MACHINE -#endif -configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM -configure___ c_switch_system=C_SWITCH_SYSTEM -configure___ c_switch_machine=C_SWITCH_MACHINE - -#ifndef LIB_X11_LIB -#define LIB_X11_LIB -lX11 -#endif - -configure___ LIBX=LIB_X11_LIB - -#ifdef UNEXEC + +configure___ LIBX=-lX11 + configure___ unexec=UNEXEC -#else -configure___ unexec=unexec.o -#endif #ifdef SYSTEM_MALLOC configure___ system_malloc=yes @@ -898,26 +889,11 @@ #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH} #endif -#ifndef LD_SWITCH_MACHINE -#define LD_SWITCH_MACHINE -#endif - -#ifndef LD_SWITCH_SYSTEM -#define LD_SWITCH_SYSTEM -#endif - -#ifndef LD_SWITCH_X_SITE_AUX -#define LD_SWITCH_X_SITE_AUX -#endif - -configure___ ld_switch_system=LD_SWITCH_SYSTEM -configure___ ld_switch_machine=LD_SWITCH_MACHINE - #ifdef THIS_IS_CONFIGURE /* Get the CFLAGS for tests in configure. */ #ifdef __GNUC__ -configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' +configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' #else configure___ CFLAGS='${SPECIFIED_CFLAGS}' #endif @@ -926,7 +902,7 @@ /* Get the CFLAGS for real compilation. */ #ifdef __GNUC__ -configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' +configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' #else configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}' #endif @@ -949,14 +925,104 @@ fi] rm ${tempcname} -ac_link="$ac_link $ld_switch_machine $ld_switch_system" + +LD_SWITCH_SYSTEM= +case "$opsys" in + freebsd) + ## Let `ld' find image libs and similar things in /usr/local/lib. + ## The system compiler, GCC, has apparently been modified to not + ## look there, contrary to what a stock GCC would do. + LD_SWITCH_SYSTEM=-L/usr/local/lib + ;; + + gnu-linux) + ## cpp test was "ifdef __mips__", but presumably this is equivalent... + test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0" + ;; + + netbsd) + LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib" + ;; + + openbsd) + ## Han Boetes says this is necessary, + ## otherwise Emacs dumps core on elf systems. + LD_SWITCH_SYSTEM="-Z" + ;; +esac +AC_SUBST(LD_SWITCH_SYSTEM) + +ac_link="$ac_link $LD_SWITCH_SYSTEM" + +## This is fun. Some settings of LD_SWITCH_SYSTEM reference +## LD_SWITCH_X_SITE_AUX, which has not been defined yet. When using +## cpp, it was expanded to null. Thus LD_SWITCH_SYSTEM had different +## values in configure and the Makefiles. How helpful. +## FIXME why not use LD_SWITCH_SYSTEM_TEMACS (or somesuch) instead? +case "$opsys" in + gnu-linux) + ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time. + LD_SWITCH_SYSTEM="$LD_SWITCH_SYSTEM \$(LD_SWITCH_X_SITE_AUX)" ;; + + netbsd|openbsd) + ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R. + LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;; +esac + + +C_SWITCH_MACHINE= +if test "$machine" = "alpha"; then + AC_CHECK_DECL([__ELF__]) + if test "$ac_cv_have_decl___ELF__" = "yes"; then + ## With ELF, make sure that all common symbols get allocated to in the + ## data section. Otherwise, the dump of temacs may miss variables in + ## the shared library that have been initialized. For example, with + ## GNU libc, __malloc_initialized would normally be resolved to the + ## shared library's .bss section, which is fatal. + if test "x$GCC" = "xyes"; then + C_SWITCH_MACHINE="-fno-common" + else + AC_MSG_ERROR([What gives? Fix me if DEC Unix supports ELF now.]) + fi + fi +fi +AC_SUBST(C_SWITCH_MACHINE) + + +C_SWITCH_SYSTEM= +## Some programs in src produce warnings saying certain subprograms +## are too complex and need a MAXMEM value greater than 2000 for +## additional optimization. --nils@exp-math.uni-essen.de +test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \ + C_SWITCH_SYSTEM="-ma -qmaxmem=4000" +## gnu-linux might need -D_BSD_SOURCE on old libc5 systems. +## It is redundant in glibc2, since we define _GNU_SOURCE. +AC_SUBST(C_SWITCH_SYSTEM) + + +LIBS_SYSTEM= +case "$opsys" in + ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2. + aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;; + + freebsd) LIBS_SYSTEM="-lutil" ;; + + hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; + + sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;; + + ## Motif needs -lgen. + unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; +esac +AC_SUBST(LIBS_SYSTEM) + ### Make sure subsequent tests use flags consistent with the build flags. if test x"${OVERRIDE_CPPFLAGS}" != x; then CPPFLAGS="${OVERRIDE_CPPFLAGS}" else - CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS" + CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" fi dnl For AC_FUNC_GETLOADAVG, at least: @@ -966,19 +1032,83 @@ AC_SYS_LARGEFILE -### The standard library on x86-64 and s390x GNU/Linux distributions can -### be located in either /usr/lib64 or /usr/lib. -### In some rare cases, /usr/lib64 exists but does not contain the -### relevant files (bug#1287). Hence test for crtn.o. -case "${canonical}" in - x86_64-*-linux-gnu* | s390x-*-linux-gnu* ) - if test -e /usr/lib64/crtn.o; then - AC_DEFINE(HAVE_LIB64_DIR, 1, - [Define to 1 if the directory /usr/lib64 exists.]) +## If user specified a crt-dir, use that unconditionally. +if test "X$CRT_DIR" = "X"; then + + case "$canonical" in + x86_64-*-linux-gnu* | s390x-*-linux-gnu*) + ## On x86-64 and s390x GNU/Linux distributions, the standard library + ## can be in a variety of places. We only try /usr/lib64 and /usr/lib. + ## For anything else (eg /usr/lib32), it is up the user to specify + ## the location (bug#5655). + ## Test for crtn.o, not just the directory, because sometimes the + ## directory exists but does not have the relevant files (bug#1287). + ## FIXME better to test for binary compatibility somehow. + test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64 + ;; + + powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;; + esac + + case "$opsys" in + hpux10-20) CRT_DIR=/lib ;; + esac + + ## Default is /usr/lib. + test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib + +else + + ## Some platforms don't use any of these files, so it is not + ## appropriate to put this test outside the if block. + test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \ + AC_MSG_ERROR([crt*.o not found in specified location.]) + fi + +AC_SUBST(CRT_DIR) + +LIB_MATH=-lm +LIB_STANDARD= +START_FILES= + +case $opsys in + cygwin ) + LIB_MATH= + START_FILES='ecrt0.o' + ;; + darwin ) + ## Adding -lm confuses the dynamic linker, so omit it. + LIB_MATH= + START_FILES='pre-crt0.o' + ;; + freebsd ) + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o' + ;; + gnu-linux | gnu-kfreebsd ) + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o' + ;; + hpux10-20 | hpux11 ) + LIB_STANDARD=-lc + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o' + ;; + netbsd | openbsd ) + if test -f $(CRT_DIR)/crti.o; then + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o' + else + LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o' + START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o' + fi + ;; esac -dnl This function defintion taken from Gnome 2.0 +AC_SUBST(LIB_MATH) +AC_SUBST(START_FILES) + +dnl This function definition taken from Gnome 2.0 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error @@ -1260,17 +1390,19 @@ ## Workaround for bug in autoconf <= 2.62. ## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html ## No need to do anything special for these standard directories. -## This is an experiment, take it out if it causes problems. if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` fi +LD_SWITCH_X_SITE_AUX= +LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then if test -n "${x_libraries}"; then LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"` + LD_SWITCH_X_SITE_AUX_RPATH=`echo ${LD_SWITCH_X_SITE_AUX} | sed -e 's/-R/-Wl,-rpath,/'` fi x_default_search_path="" x_search_path=${x_libraries} @@ -1293,6 +1425,9 @@ fi done fi +AC_SUBST(LD_SWITCH_X_SITE_AUX) +AC_SUBST(LD_SWITCH_X_SITE_AUX_RPATH) + if test "${x_includes}" != NONE && test -n "${x_includes}"; then C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` fi @@ -1343,6 +1478,7 @@ CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}" + LIB_STANDARD= fi AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes], [AC_MSG_ERROR([`--with-ns' was specified, but the include @@ -1356,6 +1492,9 @@ NS_HAVE_NSINTEGER=no fi fi + +NS_OBJ= +NS_SUPPORT= if test "${HAVE_NS}" = yes; then window_system=nextstep with_xft=no @@ -1365,9 +1504,14 @@ if test "${EN_NS_SELF_CONTAINED}" = yes; then prefix=${ns_appresdir} fi + NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o" + NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc" fi CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" +AC_SUBST(NS_OBJ) +AC_SUBST(NS_SUPPORT) +AC_SUBST(LIB_STANDARD) case "${window_system}" in x11 ) @@ -1456,7 +1600,7 @@ REL_ALLOC=no fi -LIBS="$libsrc_libs $LIBS" +LIBS="$LIBS_SYSTEM $LIBS" dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks, dnl and also adds -ldnet to LIBS, which Autoconf uses for checks. @@ -1470,6 +1614,18 @@ AC_CHECK_LIB(pthreads, cma_open) +## Note: when using cpp in s/aix4.2.h, this definition depended on +## HAVE_LIBPTHREADS. That was not defined earlier in configure when +## the system file was sourced. Hence the value of LIBS_SYSTEM +## added to LIBS in configure would never contain the pthreads part, +## but the value used in Makefiles might. FIXME? +## +## -lpthreads seems to be necessary for Xlib in X11R6, and should +## be harmless on older versions of X where it happens to exist. +test "$opsys" = "aix4-2" && \ + test $ac_cv_lib_pthreads_cma_open = yes && \ + LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads" + dnl Check for need for bigtoc support on IBM AIX case ${host_os} in @@ -1598,24 +1754,22 @@ fi HAVE_IMAGEMAGICK=no -if test "${HAVE_X11}" = "yes" ; then - if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_REQUIRED=1 - IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" - - PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, :, :) - AC_SUBST(IMAGEMAGICK_CFLAGS) - AC_SUBST(IMAGEMAGICK_LIBS) - - if test ".${IMAGEMAGICK_CFLAGS}" != "."; then - HAVE_IMAGEMAGICK=yes - AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) - CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" - LIBS="$IMAGEMAGICK_LIBS $LIBS" - fi - fi +if test "${with_imagemagick}" != "no"; then + IMAGEMAGICK_REQUIRED=1 + IMAGEMAGICK_MODULE="MagickWand >= $IMAGEMAGICK_REQUIRED" + PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, :, :) + AC_SUBST(IMAGEMAGICK_CFLAGS) + AC_SUBST(IMAGEMAGICK_LIBS) + + if test ".${IMAGEMAGICK_CFLAGS}" != "."; then + HAVE_IMAGEMAGICK=yes + AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) + CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" + LIBS="$IMAGEMAGICK_LIBS $LIBS" + fi fi + HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then GLIB_REQUIRED=2.6 @@ -1630,6 +1784,7 @@ fi +GTK_OBJ= if test x"$pkg_check_gtk" = xyes; then AC_SUBST(GTK_CFLAGS) @@ -1647,6 +1802,7 @@ else HAVE_GTK=yes AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.]) + GTK_OBJ=gtkutil.o USE_X_TOOLKIT=none if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then : @@ -1660,6 +1816,7 @@ fi fi +AC_SUBST(GTK_OBJ) if test "${HAVE_GTK}" = "yes"; then @@ -1731,14 +1888,17 @@ dnl other platforms. Support for higher D-Bus versions than 1.0 is dnl also not configured. HAVE_DBUS=no +DBUS_OBJ= if test "${with_dbus}" = "yes"; then PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no) if test "$HAVE_DBUS" = yes; then LIBS="$LIBS $DBUS_LIBS" AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.]) AC_CHECK_FUNCS([dbus_watch_get_unix_fd]) + DBUS_OBJ=dbusbind.o fi fi +AC_SUBST(DBUS_OBJ) dnl GConf has been tested under GNU/Linux only. dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6. @@ -1750,9 +1910,22 @@ fi fi +dnl SELinux is available for GNU/Linux only. +HAVE_LIBSELINUX=no +LIBSELINUX_LIBS= +if test "${with_selinux}" = "yes"; then + AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no) + if test "$HAVE_LIBSELINUX" = yes; then + AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.]) + LIBSELINUX_LIBS=-lselinux + fi +fi +AC_SUBST(LIBSELINUX_LIBS) + dnl Do not put whitespace before the #include statements below. dnl Older compilers (eg sunos4 cc) choke on it. HAVE_XAW3D=no +LUCID_LIBW= if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then if test "$with_xaw3d" != no; then AC_MSG_CHECKING(for xaw3d) @@ -1770,6 +1943,7 @@ AC_MSG_RESULT([yes; using Lucid toolkit]) USE_X_TOOLKIT=LUCID HAVE_XAW3D=yes + LUCID_LIBW=-lXaw3d AC_DEFINE(HAVE_XAW3D, 1, [Define to 1 if you have the Xaw3d library (-lXaw3d).]) else @@ -1785,6 +1959,7 @@ if test $emacs_cv_xaw = yes; then AC_MSG_RESULT([yes; using Lucid toolkit]) USE_X_TOOLKIT=LUCID + LUCID_LIBW=-lXaw elif test x"${USE_X_TOOLKIT}" = xLUCID; then AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files]) else @@ -1796,6 +1971,7 @@ X_TOOLKIT_TYPE=$USE_X_TOOLKIT +LIBXTR6= if test "${USE_X_TOOLKIT}" != "none"; then AC_MSG_CHECKING(X11 toolkit version) AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6, @@ -1809,6 +1985,11 @@ AC_MSG_RESULT(6 or newer) AC_DEFINE(HAVE_X11XTR6, 1, [Define to 1 if you have the X11R6 or newer version of Xt.]) + LIBXTR6="-lSM -lICE" + case "$opsys" in + ## Use libw.a along with X11R6 Xt. + unixware) LIBXTR6="$LIBXTR6 -lw" ;; + esac else AC_MSG_RESULT(before 6) fi @@ -1824,6 +2005,18 @@ AC_CHECK_LIB(Xmu, XmuConvertStandardSelection) test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS" fi +AC_SUBST(LIBXTR6) + +dnl FIXME the logic here seems weird, but this is what cpp was doing. +dnl Why not just test for libxmu in the normal way? +LIBXMU=-lXmu +case "$machine" in + ## These machines don't supply Xmu. + hpux* | aix4-2 ) + test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU= + ;; +esac +AC_SUBST(LIBXMU) # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D. if test "${HAVE_X11}" = "yes"; then @@ -1832,6 +2025,7 @@ fi fi +LIBXP= if test "${USE_X_TOOLKIT}" = "MOTIF"; then AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1, [AC_TRY_COMPILE([#include ], @@ -1841,16 +2035,8 @@ Motif version prior to 2.1. #endif], emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)]) - HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1 if test $emacs_cv_motif_version_2_1 = yes; then - HAVE_LIBXP=no - AC_DEFINE(HAVE_MOTIF_2_1, 1, - [Define to 1 if you have Motif 2.1 or newer.]) - AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes) - if test ${HAVE_LIBXP} = yes; then - AC_DEFINE(HAVE_LIBXP, 1, - [Define to 1 if you have the Xp library (-lXp).]) - fi + AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp) else AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif, # We put this in CFLAGS temporarily to precede other -I options @@ -2052,6 +2238,15 @@ HAVE_LIBOTF=no 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) @@ -2213,6 +2408,7 @@ ### Use -lgpm if available, unless `--with-gpm=no'. HAVE_GPM=no LIBGPM= +GPM_MOUSE_SUPPORT= if test "${with_gpm}" != "no"; then AC_CHECK_HEADER(gpm.h, [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)]) @@ -2220,13 +2416,16 @@ if test "${HAVE_GPM}" = "yes"; then AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).]) LIBGPM=-lgpm + GPM_MOUSE_SUPPORT="\${lispsource}mouse.elc" fi fi AC_SUBST(LIBGPM) +AC_SUBST(GPM_MOUSE_SUPPORT) dnl Check for malloc/malloc.h on darwin AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the header file.])]) +C_SWITCH_X_SYSTEM= ### Use NeXTstep API to implement GUI. if test "${HAVE_NS}" = "yes"; then AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.]) @@ -2236,6 +2435,9 @@ fi if test "${NS_IMPL_GNUSTEP}" = "yes"; then AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.]) + # See also .m.o rule in Makefile.in */ + # FIXME: are all these flags really needed? Document here why. */ + C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing" GNU_OBJC_CFLAGS="-fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi if test "${NS_HAVE_NSINTEGER}" = "yes"; then @@ -2249,18 +2451,21 @@ ### Use session management (-lSM -lICE) if available HAVE_X_SM=no +LIBXSM= if test "${HAVE_X11}" = "yes"; then AC_CHECK_HEADER(X11/SM/SMlib.h, [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)]) if test "${HAVE_X_SM}" = "yes"; then AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).]) + LIBXSM="-lSM -lICE" case "$LIBS" in *-lSM*) ;; - *) LIBS="-lSM -lICE $LIBS" ;; + *) LIBS="$LIBXSM $LIBS" ;; esac fi fi +AC_SUBST(LIBXSM) # If netdb.h doesn't declare h_errno, we must declare it by hand. AC_CACHE_CHECK(whether netdb declares h_errno, @@ -2319,6 +2524,48 @@ AC_CHECK_HEADERS(maillock.h) AC_SUBST(LIBS_MAIL) +## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to +## interlock access to the mail spool. The alternative is a lock file named +## /usr/spool/mail/$USER.lock. +mail_lock=no +case "$opsys" in + aix4-2) mail_lock="lockf" ;; + + gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;; + + ## On GNU/Linux systems, both methods are used by various mail programs. + ## I assume most people are using newer mailers that have heard of flock. + ## Change this if you need to. + ## Debian contains a patch which says: ``On Debian/GNU/Linux systems, + ## configure gets the right answers, and that means *NOT* using flock. + ## Using flock is guaranteed to be the wrong thing. See Debian Policy + ## for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the + ## Debian maintainer hasn't provided a clean fix for Emacs. + ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and + ## HAVE_MAILLOCK_H are defined, so the following appears to be the + ## correct logic. -- fx + ## We must check for HAVE_LIBLOCKFILE too, as movemail does. + ## liblockfile is a Free Software replacement for libmail, used on + ## Debian systems and elsewhere. -rfr. + gnu-*) + mail_lock="flock" + if test $have_mail = yes || test $have_lockfile = yes; then + test $ac_cv_header_maillock_h = yes && mail_lock=no + fi + ;; +esac + +BLESSMAIL_TARGET= +case "$mail_lock" in + flock) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;; + + lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;; + + *) BLESSMAIL_TARGET="need-blessmail" ;; +esac +AC_SUBST(BLESSMAIL_TARGET) + + AC_CHECK_FUNCS(gethostname getdomainname dup2 \ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \ @@ -2328,7 +2575,7 @@ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ -cfmakeraw cfsetspeed) +cfmakeraw cfsetspeed isnan copysign) AC_CHECK_HEADERS(sys/un.h) @@ -2364,7 +2611,7 @@ # That is because we have not set up to link ncurses in lib-src. # It's better to believe a function is not available # than to expect to find it in ncurses. -# Also we need tputs and frieds to be able to build at all. +# Also we need tputs and friends to be able to build at all. have_tputs_et_al=true AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap], , have_tputs_et_al=false) if test "$have_tputs_et_al" != true; then @@ -2375,9 +2622,82 @@ # Must define this when any termcap library is found. AC_DEFINE(HAVE_LIBNCURSES, 1, [Define to 1 if you have the `ncurses' library (-lncurses).]) +## FIXME This was the cpp logic, but I am not sure it is right. +## The above test has not necessarily found libncurses. +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 +## darwin|gnu without ncurses. +TERMINFO=no +LIBS_TERMCAP= +case "$opsys" in + ## cygwin: Fewer environment variables to go wrong, more terminal types. + ## 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 ;; + + ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2. + ## The ncurses library has been moved out of the System framework in + ## Mac OS X 10.2. So if configure detects it, set the command-line + ## option to use it. + darwin|gnu*) + ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.) + if test "x$HAVE_LIBNCURSES" = "xyes"; then + TERMINFO=yes + LIBS_TERMCAP="-lncurses" + fi + ;; + + freebsd) + AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo]) + AC_CACHE_VAL(emacs_cv_freebsd_terminfo, + [AC_TRY_LINK([#include ], +[#if __FreeBSD_version < 400000 +fail; +#endif +], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)]) + + AC_MSG_RESULT($emacs_cv_freebsd_terminfo) + + if test $emacs_cv_freebsd_terminfo = yes; then + TERMINFO=yes + LIBS_TERMCAP="-lncurses" + else + LIBS_TERMCAP="-ltermcap" + fi + ;; + +esac + +case "$opsys" in + ## hpux: Make sure we get select from libc rather than from libcurses + ## because libcurses on HPUX 10.10 has a broken version of select. + ## We used to use -lc -lcurses, but this may be cleaner. + hpux*|netbsd) LIBS_TERMCAP="-ltermcap" ;; + + openbsd) LIBS_TERMCAP="-lncurses" ;; + + ## Must use system termcap, if we use any termcap. It does special things. + sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;; +esac + +TERMCAP_OBJ=tparam.o +if test $TERMINFO = yes; then + AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.]) + + ## Default used to be -ltermcap. Add a case above if need something else. + test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses" + + TERMCAP_OBJ=terminfo.o +fi +AC_SUBST(LIBS_TERMCAP) +AC_SUBST(TERMCAP_OBJ) + # Do we have res_init, for detecting changes in /etc/resolv.conf? - resolv=no AC_TRY_LINK([#include #include @@ -2687,6 +3007,14 @@ CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" +## Hack to detect a buggy GCC version. +if test "x$GCC" = xyes \ + && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \ + && test x"`echo $CFLAGS | grep '\-O@<:@23@:>@'`" != x \ + && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then + AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'.]) +fi + #### Find out which version of Emacs this is. [version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`] @@ -2721,12 +3049,12 @@ AC_SUBST(bitmapdir) AC_SUBST(gamedir) AC_SUBST(gameuser) -AC_SUBST(c_switch_system) -AC_SUBST(c_switch_machine) +AC_SUBST(unexec) AC_SUBST(LD_SWITCH_X_SITE) -AC_SUBST(LD_SWITCH_X_SITE_AUX) AC_SUBST(C_SWITCH_X_SITE) +AC_SUBST(C_SWITCH_X_SYSTEM) AC_SUBST(CFLAGS) +## Used in lwlib/Makefile.in. AC_SUBST(X_TOOLKIT_TYPE) AC_SUBST(machfile) AC_SUBST(opsysfile) @@ -2739,7 +3067,6 @@ AC_SUBST(GNUSTEP_SYSTEM_HEADERS) AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES) AC_SUBST(GNU_OBJC_CFLAGS) -AC_SUBST(LIB_SRC_EXTRA_INSTALLABLES) AC_SUBST(OTHER_FILES) AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", @@ -2756,35 +3083,101 @@ HAVE_X_WINDOWS above and your X libraries aren't in a place that your loader can find on its own, you might want to add "-L/..." or something similar.]) -AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX}, - [Define LD_SWITCH_X_SITE_AUX with an -R option - in case it's needed (for Solaris, for example).]) AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE}, [Define C_SWITCH_X_SITE to contain any special flags your compiler may need to deal with X Windows. For instance, if you've defined HAVE_X_WINDOWS above and your X include files aren't in a place that your compiler can find on its own, you might want to add "-I/..." or something similar.]) -AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC}, - [Define to the unexec source file name.]) - + +XMENU_OBJ= +XOBJ= 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" fi +AC_SUBST(XMENU_OBJ) +AC_SUBST(XOBJ) + +WIDGET_OBJ= +MOTIF_LIBW= if test "${USE_X_TOOLKIT}" != "none" ; then + WIDGET_OBJ=widget.o AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.]) if test "${USE_X_TOOLKIT}" = "LUCID"; then AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.]) elif test "${USE_X_TOOLKIT}" = "MOTIF"; then AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.]) + MOTIF_LIBW=-lXm + case "$opsys" in + gnu-linux) + ## Paul Abrahams says this is needed. + MOTIF_LIBW="$MOTIF_LIBW -lXpm" + ;; + + unixware) + ## Richard Anthony Ryan + ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2. + MOTIF_LIBW="MOTIF_LIBW -lXimp" + ;; + + aix4-2) + ## olson@mcs.anl.gov says -li18n is needed by -lXm. + MOTIF_LIBW="$MOTIF_LIBW -li18n" + ;; + esac + MOTIF_LIBW="$MOTIF_LIBW $LIBXP" fi fi +AC_SUBST(WIDGET_OBJ) + +TOOLKIT_LIBW= +case "$USE_X_TOOLKIT" in + MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;; + LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;; + none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;; +esac +AC_SUBST(TOOLKIT_LIBW) + +if test "$USE_X_TOOLKIT" = "none"; then + LIBXT_OTHER="\$(LIBXSM)" +else + LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext" +fi +AC_SUBST(LIBXT_OTHER) + +## 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. if test "${HAVE_X11}" = "yes" ; then AC_DEFINE(HAVE_X11, 1, [Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs expects to use version 10.]) + + if test "$USE_X_TOOLKIT" = "none"; then + OLDXMENU="\${oldXMenudir}libXMenu11.a" + else + OLDXMENU="\${lwlibdir}liblw.a" + fi + LIBXMENU="\$(OLDXMENU)" + LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)" +else + OLDXMENU= + LIBXMENU="-lXMenu" + LIBX_OTHER= fi + +if test "$HAVE_GTK" = "yes"; then + OLDXMENU= + LIBXMENU= +fi + +AC_SUBST(OLDXMENU) +AC_SUBST(LIBXMENU) +AC_SUBST(LIBX_OTHER) + if test "${HAVE_MENUS}" = "yes" ; then AC_DEFINE(HAVE_MENUS, 1, [Define to 1 if you have mouse menus. @@ -2802,6 +3195,90 @@ fi +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" +else + CYGWIN_OBJ= + PRE_ALLOC_OBJ=lastfile.o + POST_ALLOC_OBJ="\$(vmlimitobj)" +fi +AC_SUBST(CYGWIN_OBJ) +AC_SUBST(PRE_ALLOC_OBJ) +AC_SUBST(POST_ALLOC_OBJ) + + +case "$opsys" in + aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;; + + darwin) + ## The -headerpad option tells ld (see man page) to leave room at the + ## end of the header for adding load commands. Needed for dumping. + ## 0x690 is the total size of 30 segment load commands (at 56 + ## each); under Cocoa 31 commands are required. + if test "$HAVE_NS" = "yes"; then + libs_nsgui="-framework AppKit" + headerpad_extra=6C8 + else + libs_nsgui= + headerpad_extra=690 + fi + LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra" + ;; + + *) LD_SWITCH_SYSTEM_TEMACS= ;; +esac +AC_SUBST(LD_SWITCH_SYSTEM_TEMACS) + + +## This exists because src/Makefile.in did some extra fiddling around +## with LD_SWITCH_SYSTEM. The cpp logic was: +## #ifndef LD_SWITCH_SYSTEM +## #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF))) +## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to: +## not using gcc, darwin system not on an alpha (ie darwin, since +## darwin + alpha does not occur). +## Note that unlike L_S_S, this is not used in ac_link. +if test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \ + test "$opsys" = "darwin"; then + LD_SWITCH_SYSTEM_EXTRA="-X" +else + LD_SWITCH_SYSTEM_EXTRA= +fi +AC_SUBST(LD_SWITCH_SYSTEM_EXTRA) + + +LIB_GCC= +if test "x$GCC" = "xyes"; then + + case "$opsys" in + ## cygwin: don't link against static libgcc. + cygwin|freebsd|netbsd|openbsd) LIB_GCC= ;; + + gnu-*) + ## armin76@gentoo.org reported that the lgcc_s flag is necessary to + ## build on ARM EABI under GNU/Linux. (Bug#5518) + ## Note that m/arm.h never bothered to undefine LIB_GCC first. + if test "$machine" = "arm"; then + LIB_GCC="-lgcc_s" + else + ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then + ## immediately undefine it again and redefine it to empty. + ## Was the C_SWITCH_X_SITE part really necessary? +## LIB_GCC=`$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name` + LIB_GCC= + fi + ;; + + ## Ask GCC where to find libgcc.a. + *) LIB_GCC=`$(CC) -print-libgcc-file-name 2> /dev/null` ;; + esac +fi dnl if $GCC +AC_SUBST(LIB_GCC) + + AH_TOP([/* GNU Emacs site configuration template file. Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @@ -2888,9 +3365,6 @@ parallel this exactly since GNUstep is multi-OS. */ #ifdef HAVE_NS # ifdef NS_IMPL_GNUSTEP -/* See also .m.o rule in Makefile.in */ -/* FIXME: are all these flags really needed? Document here why. */ -# define C_SWITCH_X_SYSTEM -D_REENTRANT -fPIC -fno-strict-aliasing /* GNUstep needs a bit more pure memory. Of the existing knobs, SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ # define SYSTEM_PURESIZE_EXTRA 30000 @@ -3103,6 +3577,7 @@ echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" +echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}" echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}" @@ -3152,7 +3627,7 @@ # 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. -[cpp_undefs="`echo $srcdir $configuration $canonical | +[cpp_undefs="`echo $srcdir $configuration $canonical unix | sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \ -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g'`"] @@ -3166,7 +3641,7 @@ CPP_NEED_TRADITIONAL=no, CPP_NEED_TRADITIONAL=yes) -AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \ +AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \ doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \ doc/lispref/Makefile src/Makefile.c:src/Makefile.in \ lwlib/Makefile lisp/Makefile leim/Makefile, [ @@ -3190,22 +3665,6 @@ CPPFLAGS="$CPPFLAGS -traditional" fi -echo creating lib-src/Makefile -( cd lib-src - rm -f junk.c junk1.c junk2.c - sed -e '/start of cpp stuff/q' \ - < Makefile.c > junk1.c - sed -e '1,/start of cpp stuff/d'\ - -e 's,/\*\*/#\(.*\)$,/* \1 */,' \ - < Makefile.c > junk.c - $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \ - sed -e 's/^ / /' -e '/^#/d' -e '/^[ ]*$/d' > junk2.c - cat junk1.c junk2.c > Makefile.new - rm -f junk.c junk1.c junk2.c - chmod 444 Makefile.new - mv -f Makefile.new Makefile -) - echo creating src/Makefile ( cd src rm -f junk.c junk1.c junk2.c diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/ChangeLog --- a/doc/emacs/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,83 @@ +2010-05-08 Chong Yidong + + * building.texi (GDB Graphical Interface): Remove misleading comparison + to an IDE (Bug#6128). + +2010-05-08 Štěpán Němec (tiny change) + + * programs.texi (Man Page): + * misc.texi (Invoking emacsclient): + * mini.texi (Repetition): + * mark.texi (Setting Mark): Fix typos. + +2010-05-08 Chong Yidong + + * misc.texi (Printing): Document htmlfontify-buffer. + +2010-05-08 Glenn Morris + + * calendar.texi (Displaying the Diary, Format of Diary File): + Fix external cross-references for TeX format output. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-02 Jan Djärv + + * cmdargs.texi (Initial Options): Mention --chdir. + +2010-04-21 Jan Djärv + + * frames.texi (Tool Bars): Add tool-bar-style. + +2010-04-21 Glenn Morris + + * ack.texi, emacs.texi (Acknowledgments): Add SELinux support. + +2010-04-18 Chong Yidong + + * programs.texi (Semantic): New node. + + * maintaining.texi (EDE): New node. + + * emacs.texi: Update node listing. + + * misc.texi (Gnus): Use the `C-h i' keybinding for info. + +2010-04-18 Glenn Morris + + * emacs.texi (Acknowledgments): Remove duplicate. + + * maintaining.texi (VC Directory Commands): Mention stashes and shelves. + +2010-04-18 Glenn Morris + + * dired.texi (Misc Dired Features): Mention VC diff and log. + * maintaining.texi (Old Revisions, VC Change Log): + Mention that diff and log work in Dired buffers. + + * help.texi (Help Summary): Mention M-x info-finder. + + * ack.texi (Acknowledgments): Add mpc.el. + + * custom.texi (Specifying File Variables, Directory Variables): + Document new commands for manipulating local variable lists. + +2010-04-18 Glenn Morris + + * trouble.texi (Contributing): Add cindex entry. + Mention etc/CONTRIBUTE. + +2010-04-18 Chong Yidong + + * mark.texi (Persistent Mark): Copyedits. Replace undo example with + query-replace (Bug#5774). + +2010-04-16 Glenn Morris + + * ack.texi, emacs.texi (Acknowledgments): Update for Org changes. + 2010-04-11 Jan Djärv * xresources.texi (Lucid Resources): Mention faceName for dialogs. diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/ack.texi --- a/doc/emacs/ack.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/ack.texi Thu May 13 15:13:52 2010 +0200 @@ -252,11 +252,11 @@ Carsten Dominik wrote Ref@TeX{}, a package for setting up labels and cross-references in La@TeX{} documents; and co-wrote IDLWAVE mode (q.v.@:). He was the main author of Org mode, for maintaining notes, -todo lists, and project planning. Thomas Baumann, Lennart Borgman, -Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip Jackson, -Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte, Andy -Stewart, David O'Toole, John Wiegley, and Piotr Zielinski also wrote -various Org mode components. +todo lists, and project planning. Thomas Baumann, Jan Bcker, Lennart +Borgman, Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip +Jackson, Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte, +Paul Sexton, Ulf Stegemann, Andy Stewart, David O'Toole, John Wiegley, +and Piotr Zielinski also wrote various Org mode components. @item Scott Draves wrote @file{tq.el}, help functions for maintaining @@ -574,6 +574,10 @@ Emacs. @item +Karel Kl@'{@dotless{i}}@v{c} contributed SELinux support, for preserving the +Security-Enchanced Linux context of files on backup and copy. + +@item Shuhei Kobayashi wrote @file{hex-util.el}, for operating on hexadecimal strings; support for HMAC (Keyed-Hashing for Message Authentication); and a Lisp implementation of the SHA1 Secure Hash Algorithm. @@ -801,8 +805,9 @@ @file{reveal.el}, a minor mode for automatically revealing invisible text; @file{smerge-mode.el}, a minor mode for resolving @code{diff3} conflicts; @file{diff-mode.el}, a mode for viewing and editing context -diffs; @file{css-mode.el} for Cascading Style Sheets; and -@file{bibtex-style.el} for BibTeX Style files. +diffs; @file{css-mode.el} for Cascading Style Sheets; +@file{bibtex-style.el} for BibTeX Style files; and @file{mpc.el}, a +client for the ``Music Player Daemon''. @item Morioka Tomohiko wrote several packages for MIME support in Gnus and diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/building.texi --- a/doc/emacs/building.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/building.texi Thu May 13 15:13:52 2010 +0200 @@ -836,12 +836,11 @@ @subsection GDB Graphical Interface The command @code{gdb} starts GDB in a graphical interface, using -Emacs windows for display program state information. In effect, this -makes Emacs into an IDE (interactive development environment). With -it, you do not need to use textual GDB commands; you can control the -debugging session with the mouse. For example, you can click in the -fringe of a source buffer to set a breakpoint there, or on a stack -frame in the stack buffer to select that frame. +Emacs windows for display program state information. With it, you do +not need to use textual GDB commands; you can control the debugging +session with the mouse. For example, you can click in the fringe of a +source buffer to set a breakpoint there, or on a stack frame in the +stack buffer to select that frame. This mode requires telling GDB that its ``screen size'' is unlimited, so it sets the height and width accordingly. For correct diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/calendar.texi --- a/doc/emacs/calendar.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/calendar.texi Thu May 13 15:13:52 2010 +0200 @@ -1082,7 +1082,7 @@ shown either in the buffer or in the mode line, depending on the display method you choose @iftex -(@pxref{Diary Display,, emacs-xtra}). +(@pxref{Diary Display,,, emacs-xtra, Specialized Emacs Features}). @end iftex @ifnottex (@pxref{Diary Display}). @@ -1186,7 +1186,7 @@ This entry will have a different appearance if you use the simple diary display @iftex -(@pxref{Diary Display,, emacs-xtra}). +(@pxref{Diary Display,,, emacs-xtra, Specialized Emacs Features}). @end iftex @ifnottex (@pxref{Diary Display}). diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/cmdargs.texi --- a/doc/emacs/cmdargs.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/cmdargs.texi Thu May 13 15:13:52 2010 +0200 @@ -193,6 +193,15 @@ other files for them. @table @samp +@item -chdir @var{directory} +@opindex -chdir +@itemx --chdir=@var{directory} +@opindex --chdir +@cindex change Emacs directory +Change to @var{directory} before doing anything else. This is mainly used +by session management in X so that Emacs starts in the same directory as it +stopped. This makes desktop saving and restoring easier. + @item -t @var{device} @opindex -t @itemx --terminal=@var{device} diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/custom.texi --- a/doc/emacs/custom.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/custom.texi Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Customization, Quitting, Amusements, Top @chapter Customization @@ -1086,11 +1087,22 @@ pair with a colon and semicolon as shown above. The special variable/value pair @code{mode: @var{modename};}, if present, specifies a major or minor mode; if you use this to specify a major -mode, it should come first in the line. The @var{value}s are are used +mode, it should come first in the line. The @var{value}s are used literally, and not evaluated. - Here is an example that specifies Lisp mode and sets two variables -with numeric values: +@findex add-file-local-variable-prop-line +@findex delete-file-local-variable-prop-line +@findex copy-dir-locals-to-file-locals-prop-line + You can use the command @code{add-file-local-variable-prop-line} +instead of adding entries by hand. It prompts for a variable +and value, and adds them to the first line in the appropriate way. +The command @code{delete-file-local-variable-prop-line} deletes a +variable from the line. The command +@code{copy-dir-locals-to-file-locals-prop-line} copies directory-local +variables (@pxref{Directory Variables}) to the first line. + + Here is an example first line that specifies Lisp mode and sets two +variables with numeric values: @smallexample ;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*- @@ -1144,6 +1156,17 @@ example above is for the C programming language, where comment lines start with @samp{/*} and end with @samp{*/}. +@findex add-file-local-variable +@findex delete-file-local-variable +@findex copy-dir-locals-to-file-locals + You can construct the local variables list yourself, or use the +command @code{add-file-local-variable}. This prompts for a variable +and value, and adds them to the list. If necessary, it also adds the +start and end markers. The command @code{delete-file-local-variable} +deletes a variable from the list. The command +@code{copy-dir-locals-to-file-locals} copies directory-local variables +(@pxref{Directory Variables}) to the list. + As with the @samp{-*-} line, the variables in a local variables list are used literally, and are not evaluated first. If you want to split a long string across multiple lines of the file, you can use @@ -1323,6 +1346,16 @@ subdirectory of the directory where you put the @file{.dir-locals.el} file. +@findex add-dir-local-variable +@findex delete-dir-local-variable +@findex copy-file-locals-to-dir-locals + You can edit the @file{.dir-locals.el} file by hand, or use the +command @code{add-dir-local-variable}. This prompts for a mode (or +subdirectory), variable and value, and adds an entry to the file. +The command @code{delete-dir-local-variable} deletes an entry. The +command @code{copy-file-locals-to-dir-locals} copies file local +variables (@pxref{File Variables}) to the @file{.dir-locals.el} file. + @findex dir-locals-set-class-variables @findex dir-locals-set-directory-class Another method of specifying directory-local variables is to explicitly diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/dired.texi --- a/doc/emacs/dired.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/dired.texi Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Dired, Calendar/Diary, Rmail, Top @chapter Dired, the Directory Editor @@ -1339,6 +1340,11 @@ it added to the kill ring, so you can use it to display the list of currently marked files in the echo area. +@cindex Dired and version control + If the directory you are visiting is under version control +(@pxref{Version Control}), then the normal VC diff and log commands +will operate on the selected files. + @findex dired-compare-directories The command @kbd{M-x dired-compare-directories} is used to compare the current Dired buffer with another directory. It marks all the files diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/emacs.texi --- a/doc/emacs/emacs.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/emacs.texi Thu May 13 15:13:52 2010 +0200 @@ -649,6 +649,7 @@ * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. * Glasses:: Making identifiersLikeThis more readable. +* Semantic:: Suite of editing tools based on source code parsing. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, Java, and Pike modes. @@ -763,6 +764,7 @@ * Change Log:: Maintaining a change history for your program. * Tags:: Go directly to any function in your program in one command. Tags remembers which file it is in. +* EDE:: An integrated development environment for Emacs. * Emerge:: A convenient way of merging two versions of a program. Version Control @@ -1346,13 +1348,13 @@ Joe Arceneaux, Miles Bader, David Bakhash, Juanma Barranquero, Eli Barzilay, Thomas Baumann, Steven L.@: Baur, Jay Belanger, Alexander L.@: Belikoff, Boaz Ben-Zvi, Karl Berry, Anna M.@: Bigatti, Ray Blaak, Jim -Blandy, Johan Bockg@aa{}rd, Lennart Borgman, Per Bothner, Terrence -Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin Broadey, -Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe Buehler, -W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chong -Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James Clark, -Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag, Baoqiu -Cui, Doug Cutting, Mathias Dahl, Satyaki Das, Vivek Dasmohapatra, +Blandy, Johan Bockg@aa{}rd, Jan Bcker, Lennart Borgman, Per Bothner, +Terrence Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin +Broadey, Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe +Buehler, W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, +Chong Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James +Clark, Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag, +Baoqiu Cui, Doug Cutting, Mathias Dahl, Satyaki Das, Vivek Dasmohapatra, Michael DeCorte, Gary Delp, Matthieu Devin, Eri Ding, Jan Dj@"{a}rv, Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni, Dmitry Dzhus, John Eaton, Rolf Ebert, Paul Eggert, Stephen Eglen, Torbj@"orn @@ -1373,18 +1375,18 @@ Jones, Simon Josefsson, Arne J@o{}rgensen, Tomoji Kagatani, Brewster Kahle, Tokuya Kameshima, Lute Kamstra, David Kastrup, David Kaufman, Henry Kautz, Taichi Kawabata, Howard Kaye, Michael Kifer, Richard King, -Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.@: Kolodney, -David M.@: Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian -Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte, -Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus, -Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter -Liljenberg, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, -Juri Linkov, Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey, -Dave Love, Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher -J.@: Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick, -Simon Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland -McGrath, Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard, -Brad Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan +Peter Kleiweg, Karel Kl@'{@dotless{i}}@v{c}, Shuhei Kobayashi, Pavel +Kobiakov, Larry K.@: Kolodney, David M.@: Koppelman, Koseki Yoshinori, +Robert Krawitz, Sebastian Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel +LaLiberte, Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus, +Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg, +Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov, +Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey, Dave Love, +Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher J.@: +Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick, Simon +Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland McGrath, +Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard, Brad +Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan Monnier, Morioka Tomohiko, Keith Moore, Jan Moringen, Glenn Morris, Diane Murray, Sen Nagata, Erik Naggum, Thomas Neumann, Thien-Thi Nguyen, Mike Newton, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, Jeff @@ -1403,22 +1405,22 @@ Schleicher, Gregor Schmid, Michael Schmidt, Ronald S. Schnell, Philippe Schnoebelen, Jan Schormann, Alex Schroeder, Stephen Schoef, Raymond Scholz, Eric Schulte, Andreas Schwab, Randal Schwartz, Oliver Seidel, -Manuel Serrano, Hovav Shacham, Stanislav Shalunov, Marc Shapiro, Richard -Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey, Lynn Slater, Chris -Smith, David Smith, Paul D.@: Smith, Andre Spiegel, Michael Staats, -William Sommerfeld, Michael Staats, Reiner Steib, Sam Steingold, Ake -Stenhoff, Peter Stephenson, Ken Stevens, Andy Stewart, Jonathan -Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman, Olaf -Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge, Jens -T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc Teirlinck, -David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman, Daiki Ueno, -Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke, Didier Verna, -Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan Vromans, Inge -Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, Morten -Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed Wilkinson, -Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley, Francis -J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka, Yamamoto -Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya +Manuel Serrano, Paul Sexton, Hovav Shacham, Stanislav Shalunov, Marc +Shapiro, Richard Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey, +Lynn Slater, Chris Smith, David Smith, Paul D.@: Smith, William +Sommerfeld, Andre Spiegel, Michael Staats, Ulf Stegemann, Reiner Steib, +Sam Steingold, Ake Stenhoff, Peter Stephenson, Ken Stevens, Andy Stewart, +Jonathan Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman, +Olaf Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge, +Jens T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc +Teirlinck, David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman, +Daiki Ueno, Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke, +Didier Verna, Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan +Vromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, +Morten Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed +Wilkinson, Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley, +Francis J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka, +Yamamoto Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya Zakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski, Shenghuo Zhu, Piotr Zielinski, Ian T.@: Zimmermann, Reto Zimmermann, Neal Ziring, Teodor Zlatanov, and Detlev Zundel. diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/frames.texi --- a/doc/emacs/frames.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/frames.texi Thu May 13 15:13:52 2010 +0200 @@ -1262,6 +1262,13 @@ You can turn display of tool bars on or off with @kbd{M-x tool-bar-mode} or by customizing the option @code{tool-bar-mode}. +@vindex tool-bar-style +@cindex Tool Bar style + When Emacs is compiled with GTK+ support, tool bars can have text and images. +Customize @code{tool-bar-style} to select style. The default style is +the same as for the desktop in the Gnome case. If no default is found, +the tool bar uses just images. + @node Dialog Boxes @section Using Dialog Boxes @cindex dialog boxes diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/help.texi --- a/doc/emacs/help.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/help.texi Thu May 13 15:13:52 2010 +0200 @@ -133,7 +133,9 @@ @item C-h n Display news of recent Emacs changes (@code{view-emacs-news}). @item C-h p -Find packages by topic keyword (@code{finder-by-keyword}). +Find packages by topic keyword (@code{finder-by-keyword}). For an +alternative interface to the same information, try the @code{info-finder} +command. @item C-h r Display the Emacs manual in Info (@code{info-emacs-manual}). @item C-h s diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/maintaining.texi --- a/doc/emacs/maintaining.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/maintaining.texi Thu May 13 15:13:52 2010 +0200 @@ -14,6 +14,7 @@ * Change Log:: Maintaining a change history for your program. * Tags:: Go directly to any function in your program in one command. Tags remembers which file it is in. +* EDE:: An integrated development environment for Emacs. @ifnottex * Emerge:: A convenient way of merging two versions of a program. @end ifnottex @@ -653,7 +654,8 @@ @item C-x v = Compare the files in the current fileset with the working revision(s) you started from (@code{vc-diff}). With a prefix argument, prompt for -two revisions of the current fileset and compare them. +two revisions of the current fileset and compare them. You can call +this command from a Dired buffer (@pxref{Dired}). @item C-x v D Compare the entire tree corresponding to the current fileset with the @@ -895,6 +897,7 @@ Buffer}.) Point is centered at the revision of the file currently being visited. With a prefix argument, the command prompts for the revision to center on, and the maximum number of revisions to display. +You can call this command from a Dired buffer (@pxref{Dired}). @findex vc-print-root-log Type @kbd{C-x v L} (@code{vc-print-root-log}) to display a @@ -1145,9 +1148,14 @@ @kbd{M-s a C-M-s} does an incremental search on the marked files. - Commands are also accessible from the VC-dir menu. Note that some VC -backends use the VC-dir menu to make available extra backend specific -commands. +@cindex stashes in version control +@cindex shelves in version control + Commands are also accessible from the VC-dir menu. Note that some +VC backends use the VC-dir menu to make available extra, +backend-specific, commands. For example, Git and Bazaar allow you to +manipulate @dfn{stashes} and @dfn{shelves}. (These provide a +mechanism to temporarily store uncommitted changes somewhere out of +the way, and bring them back at a later time.) Normal VC commands with the @kbd{C-x v} prefix work in VC directory buffers. Some single-key shortcuts are available as well; @kbd{=}, @@ -2260,6 +2268,69 @@ @include emerge-xtra.texi @end ifnottex +@node EDE +@section Emacs Development Environment +@cindex EDE (Emacs Development Environment) +@cindex Emacs Development Environment +@cindex Integrated development environment + +EDE (@dfn{Emacs Development Environment}) is a package that simplifies +the task of creating, building, and debugging large programs with +Emacs. It provides some of the features of an IDE, or @dfn{Integrated +Development Environment}, in Emacs. + +This section provides a brief description of EDE usage. +@ifnottex +For full details, see @ref{Top, EDE,, ede, Emacs Development Environment}. +@end ifnottex +@iftex +For full details on Ede, type @kbd{C-h i} and then select the EDE +manual. +@end iftex + + EDE is implemented as a global minor mode (@pxref{Minor Modes}). To +enable it, type @kbd{M-x global-ede-mode} or click on the +@samp{Project Support (EDE)} item in the @samp{Tools} menu. You can +also enable EDE each time you start Emacs, by adding the following +line to your initialization file: + +@smallexample +(global-ede-mode t) +@end smallexample + +@noindent +Activating EDE adds a menu named @samp{Development} to the menu bar. +Many EDE commands, including the ones described below, can be invoked +from this menu. + + EDE organizes files into @dfn{projects}, which correspond to +directory trees. The @dfn{project root} is the topmost directory of a +project. To define a new project, visit a file in the desired project +root and type @kbd{M-x ede-new}. This command prompts for a +@dfn{project type}, which refers to the underlying method that EDE +will use to manage the project (@pxref{Creating a Project, EDE,, ede, +Emacs Development Environment}). The most common project types are +@samp{Make}, which uses Makefiles, and @samp{Automake}, which uses GNU +Automake (@pxref{Top, Automake,, automake, Automake}). In both cases, +EDE also creates a file named @file{Project.ede}, which stores +information about the project. + + A project may contain one or more @dfn{targets}. A target can be an +object file, executable program, or some other type of file, which is +``built'' from one or more of the files in the project. + + To add a new @dfn{target} to a project, type @kbd{C-c . t} +(@code{M-x ede-new-target}). This command also asks if you wish to +``add'' the current file to that target, which means that the target +is to be built from that file. After you have defined a target, you +can add more files to it by typing @kbd{C-c . a} +(@code{ede-add-file}). + + To build a target, type @kbd{C-c . c} (@code{ede-compile-target}). +To build all the targets in the project, type @kbd{C-c . C} +(@code{ede-compile-project}). EDE uses the file types to guess how +the target should be built. + @ignore arch-tag: b9d83dfb-82ea-4ff6-bab5-05a3617091fb @end ignore diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/mark.texi --- a/doc/emacs/mark.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/mark.texi Thu May 13 15:13:52 2010 +0200 @@ -80,7 +80,7 @@ character in @acronym{ASCII}; usually, typing @kbd{C-@key{SPC}} on a text terminal gives the character @kbd{C-@@}. This key is also bound to @code{set-mark-command}, so unless you are unlucky enough to have -an text terminal that behaves differently, you might as well think of +a text terminal that behaves differently, you might as well think of @kbd{C-@@} as @kbd{C-@key{SPC}}.}. This sets the mark where point is, and activates it. You can then move point away, leaving the mark behind. @@ -387,10 +387,10 @@ @findex transient-mark-mode To turn off Transient Mark mode, type @kbd{M-x transient-mark-mode}. -This command toggles the mode; you can use the same command to turn -Transient Mark mode on again. You can also turn off Transient Mark -mode using the menu bar: in the @samp{Options} menu, toggle the -@samp{Active Region Highlighting} menu item. +This command toggles the mode; you can use the same command to turn it +on again. You can also toggle Transient Mark mode using the +@samp{Active Region Highlighting} menu item in the @samp{Options} +menu. Here are the details of how Emacs behaves when Transient Mark mode is off: @@ -415,13 +415,12 @@ @kbd{C-s}, first set the mark where point was. @item -Some commands, which ordinarily operate on the region when the mark is -active, instead act on the entire buffer. For instance, @kbd{C-x u} -normally reverses changes within the region if the mark is active; -when Transient Mark mode is off, it acts on the entire buffer. -However, you can type @kbd{C-u C-x u} to make it operate on the -region. @xref{Undo}. Other commands that act this way are identified -in their own documentation. +Some commands, which ordinarily act on the region when the mark is +active, no longer do so. For example, normally @kbd{M-%} +(@code{query-replace}) performs replacements within the region, if the +mark is active. When Transient Mark mode is off, it always operates +from point to the end of the buffer. Commands that act this way are +identified in their own documentation. @end itemize While Transient Mark mode is off, you can activate it temporarily @@ -437,9 +436,9 @@ @item C-u C-x C-x @kindex C-u C-x C-x -Activate the mark without changing it; enable Transient Mark mode just -once, until the mark is deactivated. (This is the @kbd{C-x C-x} -command, @code{exchange-point-and-mark}, with a prefix argument.) +Activate the mark and enable Transient Mark mode temporarily, until +the mark is next deactivated. (This is the @kbd{C-x C-x} command, +@code{exchange-point-and-mark}, with a prefix argument.) @end table These commands set or activate the mark, and enable Transient Mark diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/mini.texi --- a/doc/emacs/mini.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/mini.texi Thu May 13 15:13:52 2010 +0200 @@ -601,7 +601,7 @@ unchanged. You can also change the command by editing the Lisp expression before you execute it. The repeated command is added to the front of the command history unless it is identical to the most -recently item. +recent item. Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r}, diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/misc.texi --- a/doc/emacs/misc.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/misc.texi Thu May 13 15:13:52 2010 +0200 @@ -203,7 +203,7 @@ For full details, see @ref{Top, Gnus,, gnus, The Gnus Manual}. @end ifnottex @iftex -For full details on Gnus, type @kbd{M-x info} and then select the Gnus +For full details on Gnus, type @kbd{C-h i} and then select the Gnus manual. @end iftex @@ -1528,7 +1528,7 @@ @kbd{C-x #} (@code{server-edit}) in its buffer. This saves the file and sends a message back to the @command{emacsclient} program, telling it to exit. Programs that use @env{EDITOR} usually wait for the -``editor''---in the case @command{emacsclient}---to exit before doing +``editor''---in this case @command{emacsclient}---to exit before doing something else. You can also call @command{emacsclient} with multiple file name @@ -1701,8 +1701,14 @@ Emacs provides commands for printing hard copies of either an entire buffer or just part of one, with or without page headers. You can invoke the printing commands directly, as detailed in the following -section, or using the @samp{File} menu on the menu bar. See also the -hardcopy commands of Dired (@pxref{Misc File Ops}) and the diary +section, or using the @samp{File} menu on the menu bar. + +@findex htmlfontify-buffer + Aside from the commands described in this section, you can also +``print'' an Emacs buffer to HTML with @kbd{M-x htmlfontify-buffer}. +This command converts the current buffer to a HTML file, replacing +Emacs faces with CSS-based markup. In addition, see the hardcopy +commands of Dired (@pxref{Misc File Ops}) and the diary (@pxref{Displaying the Diary}). @table @kbd diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/programs.texi --- a/doc/emacs/programs.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/programs.texi Thu May 13 15:13:52 2010 +0200 @@ -39,6 +39,7 @@ * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. * Glasses:: Making identifiersLikeThis more readable. +* Semantic:: Suite of editing tools based on source code parsing. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, Java, and Pike modes. @@ -1201,7 +1202,7 @@ your machine; the list of available manual pages is computed automatically the first time you invoke @code{woman}. The word at point in the current buffer is used to suggest the default for the -name the manual page. +name of the manual page. With a numeric argument, @kbd{M-x woman} recomputes the list of the manual pages used for completion. This is useful if you add or delete @@ -1387,6 +1388,73 @@ of the programming language major modes in which you normally want to use Glasses mode. +@node Semantic +@section Semantic +@cindex Semantic package + +Semantic is a package that provides language-aware editing commands +based on @code{source code parsers}. This section provides a brief +description of Semantic; +@ifnottex +for full details, see @ref{Top, Semantic,, semantic, Semantic}. +@end ifnottex +@iftex +for full details, type @kbd{C-h i} (@code{info}) and then select the +Semantic manual. +@end iftex + + Most of the ``language aware'' features in Emacs, such as font lock +(@pxref{Font Lock}), rely on ``rules of thumb''@footnote{Regular +expressions and syntax tables.} that usually give good results but are +never completely exact. In contrast, the parsers used by Semantic +have an exact understanding of programming language syntax. This +allows Semantic to provide search, navigation, and completion commands +that are powerful and precise. + + To begin using Semantic, type @kbd{M-x semantic-mode} or click on +the menu item named @samp{Source Code Parsers (Semantic)} in the +@samp{Tools} menu. This enables Semantic mode, a global minor mode. + + When Semantic mode is enabled, Emacs automatically attempts to +parses each file you visit. Currently, Semantic understands C, C++, +Scheme, Javascript, Java, HTML, and Make. Within each parsed buffer, +the following commands are available: + +@table @kbd +@item C-c , j +@kindex C-c , j +Prompt for the name of a function defined in the current file, and +move point there (@code{semantic-complete-jump-local}). + +@item C-c , J +@kindex C-c , J +Prompt for the name of a function defined in any file Emacs has +parsed, and move point there (@code{semantic-complete-jump}). + +@item C-c , @key{SPC} +@kindex C-c , @key{SPC} +Display a list of possible completions for the symbol at point +(@code{semantic-complete-analyze-inline}). This also activates a set +of special keybindings for choosing a completion: @key{RET} accepts +the current completion, @kbd{M-n} and @kbd{M-p} cycle through possible +completions, @key{TAB} completes as far as possible and then cycles, +and @kbd{C-g} or any other key aborts completion. + +@item C-c , l +@kindex C-c , l +Display a list of the possible completions of the symbol at point, in +another window (@code{semantic-analyze-possible-completions}). +@end table + +@noindent +In addition to the above commands, the Semantic package provides a +variety of other ways to make use of parser information. For +instance, you can use it to display a list of completions when Emacs +is idle. +@ifnottex +@xref{Top, Semantic,, semantic, Semantic}, for details. +@end ifnottex + @node Misc for Programs @section Other Features Useful for Editing Programs diff -r e56f669f17ce -r fe07c47cf7a7 doc/emacs/trouble.texi --- a/doc/emacs/trouble.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/emacs/trouble.texi Thu May 13 15:13:52 2010 +0200 @@ -1008,6 +1008,7 @@ @node Contributing, Service, Bugs, Top @section Contributing to Emacs Development +@cindex contributing to Emacs If you would like to help pretest Emacs releases to assure they work well, or if you would like to work on improving Emacs, please contact @@ -1027,6 +1028,9 @@ See the Emacs project page @url{http://savannah.gnu.org/projects/emacs/} for details. +For more information on how to contribute, see the @file{etc/CONTRIBUTE} +file in the Emacs distribution. + @node Service, Copying, Contributing, Top @section How To Get Help with GNU Emacs diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispintro/ChangeLog --- a/doc/lispintro/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispintro/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,7 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-03-10 Chong Yidong * Branch for 23.2. @@ -13,8 +17,7 @@ 2009-12-09 David Robinow (tiny change) - * makefile.w32-in: Use parenthesis for macros for nmake - compatibility. + * makefile.w32-in: Use parenthesis for macros for nmake compatibility. 2009-12-03 Glenn Morris @@ -72,7 +75,7 @@ 2009-02-22 Karl Berry - * emacs-lisp-intro.texi (Default Configuration): fix dup word "by by". + * emacs-lisp-intro.texi (Default Configuration): Fix dup word "by by". 2009-02-20 Juanma Barranquero @@ -306,11 +309,11 @@ 2006-08-21 Robert J. Chassell * emacs-lisp-intro.texi: Deleted in directory copy of texinfo.tex - and pointed towards ../man/texinfo.tex so only one file - needs updating. Added comment of what to do when building on own. + and pointed towards ../man/texinfo.tex so only one file + needs updating. Added comment of what to do when building on own. * texinfo.tex: Changed to version 2006-02-13.16 - to enable a DVI build using the more recent versions of TeX. + to enable a DVI build using the more recent versions of TeX. 2006-05-25 David Kastrup diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/ChangeLog --- a/doc/lispref/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,57 @@ +2010-05-08 Štěpán Němec (tiny change) + + * windows.texi (Textual Scrolling): + * tips.texi (Coding Conventions): + * minibuf.texi (Minibuffer History): + * maps.texi (Standard Keymaps): + * loading.texi (Where Defined): + * edebug.texi (Instrumenting): Fix typos. + +2010-05-08 Chong Yidong + + * keymaps.texi (Menu Bar): Document :advertised-binding property. + + * functions.texi (Obsolete Functions): + Document set-advertised-calling-convention. + + * minibuf.texi (Basic Completion): Document completion-in-region. + (Programmed Completion): Document completion-annotate-function. + + * commands.texi (Reading One Event): Document read-key. + (Distinguish Interactive): Document KIND arg to + called-interactively-p. Delete obsolete interactive-p. + + * elisp.texi (Top): Update node description. + +2010-05-08 Eli Zaretskii + + * nonascii.texi (Character Properties): + Document unicode-category-table. Add an index entry for Unicode + general category. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-04-20 Juanma Barranquero + + * locals.texi (Standard Buffer-Local Variables): + Remove @ignore'd reference to `direction-reversed'. + +2010-04-14 Juri Linkov + + Fix @deffn without category. + + * abbrevs.texi (Abbrev Expansion): Replace @deffn with @defun + for `abbrev-insert'. + + * buffers.texi (Indirect Buffers): Add category `Command' + to @deffn of `clone-indirect-buffer'. + + * windows.texi (Cyclic Window Ordering): Replace @deffn with @defun + for `next-window' and `previous-window'. Add category `Command' + to @deffn of `pop-to-buffer'. + 2010-04-01 Chong Yidong * nonascii.texi (Text Representations): Don't mark diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/abbrevs.texi --- a/doc/lispref/abbrevs.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/abbrevs.texi Thu May 13 15:13:52 2010 +0200 @@ -281,7 +281,7 @@ returns @code{nil} even though expansion did occur. @end deffn -@deffn abbrev-insert abbrev &optional name start end +@defun abbrev-insert abbrev &optional name start end This function inserts the abbrev expansion of @code{abbrev}, replacing the text between @code{start} and @code{end}. If @code{start} is omitted, it defaults to point. @code{name}, if non-@code{nil}, should @@ -289,7 +289,7 @@ figure out whether to adjust the capitalization of the expansion. The function returns @code{abbrev} if the abbrev was successfully inserted. -@end deffn +@end defun @deffn Command abbrev-prefix-mark &optional arg This command marks the current location of point as the beginning of diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/buffers.texi --- a/doc/lispref/buffers.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/buffers.texi Thu May 13 15:13:52 2010 +0200 @@ -1135,7 +1135,7 @@ buffer, not from @var{base-buffer}. @end deffn -@deffn clone-indirect-buffer newname display-flag &optional norecord +@deffn Command clone-indirect-buffer newname display-flag &optional norecord This function creates and returns a new indirect buffer that shares the current buffer's base buffer and copies the rest of the current buffer's attributes. (If the current buffer is not indirect, it is diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/commands.texi --- a/doc/lispref/commands.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/commands.texi Thu May 13 15:13:52 2010 +0200 @@ -696,71 +696,67 @@ because it allows callers to say ``treat this call as interactive.'' But you can also do the job by testing @code{called-interactively-p}. -@defun called-interactively-p +@defun called-interactively-p kind This function returns @code{t} when the calling function was called using @code{call-interactively}. -If the containing function was called by Lisp evaluation (or with -@code{apply} or @code{funcall}), then it was not called interactively. +The argument @var{kind} should be either the symbol @code{interactive} +or the symbol @code{any}. If it is @code{interactive}, then +@code{called-interactively-p} returns @code{t} only if the call was +made directly by the user---e.g., if the user typed a key sequence +bound to the calling function, but @emph{not} if the user ran a +keyboard macro that called the function (@pxref{Keyboard Macros}). If +@var{kind} is @code{any}, @code{called-interactively-p} returns +@code{t} for any kind of interactive call, including keyboard macros. + +If in doubt, use @code{any}; the only known proper use of +@code{interactive} is if you need to decide whether to display a +helpful message while a function is running. + +A function is never considered to be called interactively if it was +called via Lisp evaluation (or with @code{apply} or @code{funcall}). @end defun - Here's an example of using @code{called-interactively-p}: +@noindent +Here is an example of using @code{called-interactively-p}: @example @group (defun foo () (interactive) - (when (called-interactively-p) - (message "foo")) - 'haha) - @result{} foo + (when (called-interactively-p 'any) + (message "Interactive!") + 'foo-called-interactively)) @end group @group ;; @r{Type @kbd{M-x foo}.} - @print{} foo + @print{} Interactive! @end group @group (foo) - @result{} haha + @result{} nil @end group @end example - Here is another example that contrasts direct and indirect -calls to @code{called-interactively-p}. +@noindent +Here is another example that contrasts direct and indirect calls to +@code{called-interactively-p}. @example @group (defun bar () (interactive) - (setq foobar (list (foo) (called-interactively-p)))) - @result{} bar + (message "%s" (list (foo) (called-interactively-p 'any)))) @end group @group ;; @r{Type @kbd{M-x bar}.} -;; @r{This does not display a message.} -@end group - -@group -foobar - @result{} (nil t) + @print{} (nil t) @end group @end example - If you want to treat commands run in keyboard macros just like calls -from Lisp programs, test @code{interactive-p} instead of -@code{called-interactively-p}. - -@defun interactive-p -This function returns @code{t} if the containing function (the one -whose code includes the call to @code{interactive-p}) was called in -direct response to user input. This means that it was called with the -function @code{call-interactively}, and that a keyboard macro is -not running, and that Emacs is not running in batch mode. -@end defun - @node Command Loop Info @comment node-name, next, previous, up @section Information from the Command Loop @@ -2309,10 +2305,8 @@ @cindex reading a single event @cindex event, reading only one - The lowest level functions for command input are those that read a -single event. - -None of the three functions below suppresses quitting. + The lowest level functions for command input are @code{read-event}, +@code{read-char}, and @code{read-char-exclusive}. @defun read-event &optional prompt inherit-input-method seconds This function reads and returns the next event of command input, waiting @@ -2409,11 +2403,31 @@ gets a character. The arguments work as in @code{read-event}. @end defun + None of the above functions suppress quitting. + @defvar num-nonmacro-input-events This variable holds the total number of input events received so far from the terminal---not counting those generated by keyboard macros. @end defvar + We emphasize that, unlike @code{read-key-sequence}, the functions +@code{read-event}, @code{read-char}, and @code{read-char-exclusive} do +not perform the translations described in @ref{Translation Keymaps}. +If you wish to read a single key taking these translations into +account, use the function @code{read-key}: + +@defun read-key &optional prompt +This function reads a single key. It is ``intermediate'' between +@code{read-key-sequence} and @code{read-event}. Unlike the former, it +reads a single key, not a key sequence. Unlike the latter, it does +not return a raw event, but decodes and translates the user input +according to @code{input-decode-map}, @code{local-function-key-map}, +and @code{key-translation-map} (@pxref{Translation Keymaps}). + +The argument @var{prompt} is either a string to be displayed in the +echo area as a prompt, or @code{nil}, meaning not to display a prompt. +@end defun + @node Event Mod @subsection Modifying and Translating Input Events diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/edebug.texi --- a/doc/lispref/edebug.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/edebug.texi Thu May 13 15:13:52 2010 +0200 @@ -186,7 +186,7 @@ While Edebug is active, the command @kbd{I} (@code{edebug-instrument-callee}) instruments the definition of the -function or macro called by the list form after point, if is not already +function or macro called by the list form after point, if it is not already instrumented. This is possible only if Edebug knows where to find the source for that function; for this reason, after loading Edebug, @code{eval-region} records the position of every definition it diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/elisp.texi --- a/doc/lispref/elisp.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/elisp.texi Thu May 13 15:13:52 2010 +0200 @@ -649,7 +649,6 @@ Completion * Basic Completion:: Low-level functions for completing strings. - (These are too low level to use the minibuffer.) * Minibuffer Completion:: Invoking the minibuffer with completion. * Completion Commands:: Minibuffer commands that do completion. * High-Level Completion:: Convenient special cases of completion diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/functions.texi --- a/doc/lispref/functions.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/functions.texi Thu May 13 15:13:52 2010 +0200 @@ -1197,7 +1197,7 @@ @end defun You can define a function as an alias and declare it obsolete at the -same time using the macro @code{define-obsolete-function-alias}. +same time using the macro @code{define-obsolete-function-alias}: @defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring This macro marks the function @var{obsolete-name} obsolete and also @@ -1210,6 +1210,33 @@ @end example @end defmac +In addition, you can mark a certain a particular calling convention +for a function as obsolete: + +@defun set-advertised-calling-convention function signature +This function specifies the argument list @var{signature} as the +correct way to call @var{function}. This causes the Emacs byte +compiler to issue a warning whenever it comes across an Emacs Lisp +program that calls @var{function} any other way (however, it will +still allow the code to be byte compiled). + +For instance, in old versions of Emacs the @code{sit-for} function +accepted three arguments, like this + +@smallexample + (sit-for seconds milliseconds nodisp) +@end smallexample + +However, calling @code{sit-for} this way is considered obsolete +(@pxref{Waiting}). The old calling convention is deprecated like +this: + +@smallexample +(set-advertised-calling-convention + 'sit-for '(seconds &optional nodisp)) +@end smallexample +@end defun + @node Inline Functions @section Inline Functions @cindex inline functions diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/keymaps.texi --- a/doc/lispref/keymaps.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/keymaps.texi Thu May 13 15:13:52 2010 +0200 @@ -2470,9 +2470,13 @@ @cindex menu bar Most window systems allow each frame to have a @dfn{menu bar}---a -permanently displayed menu stretching horizontally across the top of the -frame. The items of the menu bar are the subcommands of the fake -``function key'' @code{menu-bar}, as defined in the active keymaps. +permanently displayed menu stretching horizontally across the top of +the frame. (In order for a frame to display a menu bar, its +@code{menu-bar-lines} parameter must be greater than zero. +@xref{Layout Parameters}.) + + The items of the menu bar are the subcommands of the fake ``function +key'' @code{menu-bar}, as defined in the active keymaps. To add an item to the menu bar, invent a fake ``function key'' of your own (let's call it @var{key}), and make a binding for the key sequence @@ -2490,13 +2494,6 @@ from the keymaps that would be active if @code{overriding-local-map} were @code{nil}. @xref{Active Keymaps}. - In order for a frame to display a menu bar, its @code{menu-bar-lines} -parameter must be greater than zero. Emacs uses just one line for the -menu bar itself; if you specify more than one line, the other lines -serve to separate the menu bar from the windows in the frame. We -recommend 1 or 2 as the value of @code{menu-bar-lines}. @xref{Layout -Parameters}. - Here's an example of setting up a menu bar item: @example @@ -2535,8 +2532,8 @@ @end example @noindent -@code{edit} is the fake function key used by the global map for the -@samp{Edit} menu bar item. The main reason to suppress a global +Here, @code{edit} is the fake function key used by the global map for +the @samp{Edit} menu bar item. The main reason to suppress a global menu bar item is to regain space for mode-specific items. @defvar menu-bar-final-items @@ -2557,6 +2554,23 @@ in the usual case. @end defvar +Next to every menu bar item, Emacs displays a key binding that runs +the same command (if such a key binding exists). This serves as a +convenient hint for users who do not know the key binding. If a +command has multiple bindings, Emacs normally displays the first one +it finds. You can specify one particular key binding by assigning an +@code{:advertised-binding} symbol property to the command. For +instance, the following tells Emacs to show @kbd{C-/} for the +@code{undo} menu item: + +@smallexample +(put 'undo :advertised-binding [?\C-/]) +@end smallexample + +@noindent +If the @code{:advertised-binding} property specifies a key binding +that the command does not actually have, it is ignored. + @node Tool Bar @subsection Tool bars @cindex tool bar diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/loading.texi --- a/doc/lispref/loading.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/loading.texi Thu May 13 15:13:52 2010 +0200 @@ -823,7 +823,7 @@ @code{load-history}. @defvar load-history -This value of this variable is an alist that associates the names of +The value of this variable is an alist that associates the names of loaded library files with the names of the functions and variables they defined, as well as the features they provided or required. diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/locals.texi --- a/doc/lispref/locals.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/locals.texi Thu May 13 15:13:52 2010 +0200 @@ -85,6 +85,9 @@ @item case-fold-search @xref{Searching and Case}. +@item comment-column +@xref{Comments,,, emacs, The GNU Emacs Manual}. + @item ctl-arrow @xref{Usual Display}. @@ -94,9 +97,6 @@ @item cursor-type @xref{Cursor Parameters}. -@item comment-column -@xref{Comments,,, emacs, The GNU Emacs Manual}. - @item default-directory @xref{File Name Expansion}. @@ -106,11 +106,6 @@ @item desktop-save-buffer @xref{Desktop Save Mode}. -@ignore -@item direction-reversed -Does not work yet. -@end ignore - @item enable-multibyte-characters @ref{Text Representations}. diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/maps.texi --- a/doc/lispref/maps.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/maps.texi Thu May 13 15:13:52 2010 +0200 @@ -163,7 +163,7 @@ @item key-translation-map A keymap for translating keys. This one overrides ordinary key -bindings, unlike @code{local- function-key-map}. @xref{Translation +bindings, unlike @code{local-function-key-map}. @xref{Translation Keymaps}. @item kmacro-map diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/minibuf.texi --- a/doc/lispref/minibuf.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/minibuf.texi Thu May 13 15:13:52 2010 +0200 @@ -511,7 +511,7 @@ @defopt history-length The value of this variable specifies the maximum length for all history lists that don't specify their own maximum lengths. If the -value is @code{t}, that means there no maximum (don't delete old +value is @code{t}, that means there is no maximum (don't delete old elements). The value of @code{history-length} property of the history list variable's symbol, if set, overrides this variable for that particular history list. @@ -626,7 +626,6 @@ @menu * Basic Completion:: Low-level functions for completing strings. - (These are too low level to use the minibuffer.) * Minibuffer Completion:: Invoking the minibuffer with completion. * Completion Commands:: Minibuffer commands that do completion. * High-Level Completion:: Convenient special cases of completion @@ -640,31 +639,23 @@ @node Basic Completion @subsection Basic Completion Functions - The completion functions @code{try-completion}, -@code{all-completions} and @code{test-completion} have nothing in -themselves to do with minibuffers. We describe them in this chapter -so as to keep them near the higher-level completion features that do -use the minibuffer. - - If you store a completion alist in a variable, you should mark the -variable as ``risky'' with a non-@code{nil} -@code{risky-local-variable} property. + The following completion functions have nothing in themselves to do +with minibuffers. We describe them here to keep them near the +higher-level completion features that do use the minibuffer. @defun try-completion string collection &optional predicate This function returns the longest common substring of all possible completions of @var{string} in @var{collection}. The value of @var{collection} must be a list of strings or symbols, an alist, an -obarray, a hash table, or a function that implements a virtual set of -strings (see below). +obarray, a hash table, or a completion function (@pxref{Programmed +Completion}). Completion compares @var{string} against each of the permissible -completions specified by @var{collection}; if the beginning of the -permissible completion equals @var{string}, it matches. If no permissible -completions match, @code{try-completion} returns @code{nil}. If only -one permissible completion matches, and the match is exact, then -@code{try-completion} returns @code{t}. Otherwise, the value is the -longest initial sequence common to all the permissible completions that -match. +completions specified by @var{collection}. If no permissible +completions match, @code{try-completion} returns @code{nil}. If there +is just one matching completion, and the match is exact, it returns +@code{t}. Otherwise, it returns the longest initial sequence common +to all possible matching completions. If @var{collection} is an alist (@pxref{Association Lists}), the permissible completions are the elements of the alist that are either @@ -688,13 +679,13 @@ If @var{collection} is a hash table, then the keys that are strings are the possible completions. Other keys are ignored. -You can also use a symbol that is a function as @var{collection}. Then -the function is solely responsible for performing completion; +You can also use a symbol that is a function as @var{collection}. +Then the function is solely responsible for performing completion; @code{try-completion} returns whatever this function returns. The function is called with three arguments: @var{string}, @var{predicate} -and @code{nil}. (The reason for the third argument is so that the same +and @code{nil} (the reason for the third argument is so that the same function can be used in @code{all-completions} and do the appropriate -thing in either case.) @xref{Programmed Completion}. +thing in either case). @xref{Programmed Completion}. If the argument @var{predicate} is non-@code{nil}, then it must be a function of one argument, unless @var{collection} is a hash table, in @@ -823,6 +814,10 @@ it returns, @code{test-completion} returns in turn. @end defun +If you store a completion alist in a variable, you should mark the +variable as ``risky'' with a non-@code{nil} +@code{risky-local-variable} property. @xref{File Local Variables}. + @defvar completion-ignore-case If the value of this variable is non-@code{nil}, Emacs does not consider case significant in completion. Note, however, that this @@ -855,6 +850,23 @@ @end smallexample @end defmac +The function @code{completion-in-region} provides a convenient way to +perform completion on an arbitrary stretch of text in an Emacs buffer: + +@defun completion-in-region start end collection &optional predicate +This function completes the text in the current buffer between the +positions @var{start} and @var{end}, using @var{collection}. The +argument @var{collection} has the same meaning as in +@code{try-completion} (@pxref{Basic Completion}). + +This function inserts the completion text directly into the current +buffer. Unlike @code{completing-read} (@pxref{Minibuffer +Completion}), it does not activate the minibuffer. + +For this function to work, point must be somewhere between @var{start} +and @var{end}. +@end defun + @node Minibuffer Completion @subsection Completion and the Minibuffer @cindex minibuffer completion @@ -869,12 +881,12 @@ @var{prompt}, which must be a string. The actual completion is done by passing @var{collection} and -@var{predicate} to the function @code{try-completion}. This happens -in certain commands bound in the local keymaps used for completion. -Some of these commands also call @code{test-completion}. Thus, if -@var{predicate} is non-@code{nil}, it should be compatible with -@var{collection} and @code{completion-ignore-case}. @xref{Definition -of test-completion}. +@var{predicate} to the function @code{try-completion} (@pxref{Basic +Completion}). This happens in certain commands bound in the local +keymaps used for completion. Some of these commands also call +@code{test-completion}. Thus, if @var{predicate} is non-@code{nil}, +it should be compatible with @var{collection} and +@code{completion-ignore-case}. @xref{Definition of test-completion}. The value of the optional argument @var{require-match} determines how the user may exit the minibuffer: @@ -1603,8 +1615,10 @@ Sometimes it is not possible to create an alist or an obarray containing all the intended possible completions. In such a case, you -can supply your own function to compute the completion of a given string. -This is called @dfn{programmed completion}. +can supply your own function to compute the completion of a given +string. This is called @dfn{programmed completion}. Emacs uses +programmed completion when completing file names (@pxref{File Name +Completion}). To use this feature, pass a symbol with a function definition as the @var{collection} argument to @code{completing-read}. The function @@ -1659,9 +1673,6 @@ function. So you must arrange for any function you wish to use for completion to be encapsulated in a symbol. - Emacs uses programmed completion when completing file names. -@xref{File Name Completion}. - @defun completion-table-dynamic function This function is a convenient way to write a function that can act as programmed completion function. The argument @var{function} should be @@ -1671,6 +1682,19 @@ and the interface for programmed completion functions. @end defun +@defvar completion-annotate-function +The value of this variable, if non-@code{nil}, should be a function +for ``annotating'' the entries in the @samp{*Completions*} buffer. +The function should accept a single argument, the completion string +for an entry. It should return an additional string to display next +to that entry in the @samp{*Completions*} buffer, or @code{nil} if no +additional string is to be displayed. + +The function can determine the collection used for the current +completion via the variable @code{minibuffer-completion-table} +(@pxref{Completion Commands}). +@end defvar + @node Yes-or-No Queries @section Yes-or-No Queries @cindex asking the user questions diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/nonascii.texi --- a/doc/lispref/nonascii.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/nonascii.texi Thu May 13 15:13:52 2010 +0200 @@ -375,6 +375,7 @@ value is a string consisting of upper-case Latin letters A to Z, digits, spaces, and hyphen @samp{-} characters. +@cindex unicode general category @item general-category This property corresponds to the Unicode @code{General_Category} property. The value is a symbol whose name is a 2-letter abbreviation @@ -501,13 +502,18 @@ @var{propname} for the character @var{char}. @end defun -@defvar char-script-table +@defvar unicode-category-table The value of this variable is a char-table (@pxref{Char-Tables}) that -specifies, for each character, a symbol whose name is the script to -which the character belongs, according to the Unicode Standard -classification of the Unicode code space into script-specific blocks. -This char-table has a single extra slot whose value is the list of all -script symbols. +specifies, for each character, its Unicode @code{General_Category} +property as a symbol. +@end defvar + +@defvar char-script-table +The value of this variable is a char-table that specifies, for each +character, a symbol whose name is the script to which the character +belongs, according to the Unicode Standard classification of the +Unicode code space into script-specific blocks. This char-table has a +single extra slot whose value is the list of all script symbols. @end defvar @defvar char-width-table diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/tips.texi --- a/doc/lispref/tips.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/tips.texi Thu May 13 15:13:52 2010 +0200 @@ -90,7 +90,7 @@ If a file requires certain other Lisp programs to be loaded beforehand, then the comments at the beginning of the file should say so. Also, use @code{require} to make sure they are loaded. -x@xref{Named Features}. +@xref{Named Features}. @item If a file @var{foo} uses a macro defined in another file @var{bar}, diff -r e56f669f17ce -r fe07c47cf7a7 doc/lispref/windows.texi --- a/doc/lispref/windows.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/lispref/windows.texi Thu May 13 15:13:52 2010 +0200 @@ -525,7 +525,7 @@ In general, within each set of siblings at any level in the window tree (@pxref{Window Tree}), the order is left to right, or top to bottom. -@deffn next-window &optional window minibuf all-frames +@defun next-window &optional window minibuf all-frames @cindex minibuffer window, and @code{next-window} This function returns the window following @var{window} in the cyclic ordering of windows. This is the window @kbd{C-x o} selects if typed @@ -588,13 +588,13 @@ @result{} # @end group @end example -@end deffn - -@deffn previous-window &optional window minibuf all-frames +@end defun + +@defun previous-window &optional window minibuf all-frames This function returns the window preceding @var{window} in the cyclic ordering of windows. The other arguments specify which windows to include in the cycle, as in @code{next-window}. -@end deffn +@end defun @deffn Command other-window count &optional all-frames This function selects another window in the cyclic ordering of windows. @@ -827,7 +827,7 @@ unless @var{norecord} is non-@code{nil}. @end deffn -@deffn pop-to-buffer buffer-or-name &optional other-window norecord +@deffn Command pop-to-buffer buffer-or-name &optional other-window norecord This command makes @var{buffer-or-name} the current buffer and switches to it in some window, preferably not the window previously selected. The ``popped-to'' window becomes the selected window. Its frame is @@ -1661,8 +1661,8 @@ @end defopt @defopt scroll-step -This variable is an older variant of @code{scroll-conservatively}. The -difference is that it if its value is @var{n}, that permits scrolling +This variable is an older variant of @code{scroll-conservatively}. +The difference is that if its value is @var{n}, that permits scrolling only by precisely @var{n} lines, not a smaller number. This feature does not work with @code{scroll-margin}. The default value is zero. @end defopt diff -r e56f669f17ce -r fe07c47cf7a7 doc/man/ChangeLog --- a/doc/man/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/doc/man/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,11 +1,15 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-03-10 Chong Yidong * Branch for 23.2. 2010-01-09 Chong Yidong - * emacs.1: Copyedits. Update options -Q, -mm and --daemon. Remove - deprecated --unibyte option. + * emacs.1: Copyedits. Update options -Q, -mm and --daemon. + Remove deprecated --unibyte option. 2009-06-21 Chong Yidong diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/ChangeLog --- a/doc/misc/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,96 @@ +2010-05-08 Štěpán Němec (tiny change) + + * url.texi (HTTP language/coding, Customization): + * message.texi (Header Commands, Responses): + * cl.texi (Argument Lists): Fix typos. + +2010-05-08 Chong Yidong + + * ede.texi (EDE Mode): Refer to init file rather than `.emacs'. + Note that Development menu is always available. + (Creating a project): Fix terminology. + (Add/Remove files): Fix typo. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-01 Daniel E. Doherty (tiny change) + + * calc.texi (Tutorial): Use "^{\prime}" to indicate primes. + +2010-05-01 Michael Albinus + + * tramp.texi (Inline methods, Default Method): + Mention `tramp-inline-compress-start-size'. + +2010-04-18 Teodor Zlatanov + + * gnus.texi (Gnus Versions, Oort Gnus): Mention the Git repo instead of + the CVS repo. Put the Git repo in the news section. + + * gnus-coding.texi (Gnus Maintainance Guide): Fix title typo. + Removed some mentions of CVS. Mention the new Git repo. + +2010-04-18 Andreas Seltenreich + + * gnus.texi (Score File Format): Fix typo. Reported by Štěpán Němec. + (Mail Group Commands): Add index entry. + +2010-04-18 Glenn Morris + + * info.texi (Search Index): Mention Emacs's Info-virtual-index. + +2010-04-18 Jay Belanger + + * calc.texi (Radix modes): Mention that the option prefix will + turn on twos-complement mode. + (Inverse and Hyperbolic Flags): Mention the Option flag. + +2010-04-15 Carsten Dominik + + * org.texi (LaTeX and PDF export): Add a footnote about xetex. + (LaTeX/PDF export commands): Rename and Move section. + (Sectioning structure): Update. + (References): New use case for field coordinates. + (The export dispatcher): Rename from ASCII export. + (Setting up the staging area): Document the availability of + encryption for MobileOrg. + (Images and tables): Document how to reference labels. + (Index entries): New section. + (Generating an index): New section. + (Column width and alignment): Document that now + means a fixed width, not a maximum width. + (Publishing options): Document the :email option. + (Beamer class export): Fix bug in the BEAMER example. + (Refiling notes): Document refile logging. + (In-buffer settings): Document refile logging keywords. + (Drawers): Document `C-c C-z' command. + (Agenda commands): Mention the alternative key `C-c C-z'. + (Special properties): Document the BLOCKED property. + (The spreadsheet): Mention the formula editor. + (References): Document field coordinates. + (Publishing action): Correct the documentation for the + publishing function. + (The date/time prompt): Document that we accept dates + like month/day/year. + (Cooperation): Document the changes in table.el support. + (Faces for TODO keywords, Faces for TODO keywords) + (Priorities): Document the easy colors. + (Visibility cycling): Document the new double prefix + arg for `org-reveal'. + (Cooperation): Remember.el is part of Emacs. + (Clean view): Mention that `wrap-prefix' is also set by + org-indent-mode. + (Agenda commands): Add information about prefix args to + scheduling and deadline commands. + (Search view): Point to the docstring of + `org-search-view' for more details. + (Agenda commands): Document that `>' prompts for a date. + (Setting tags): Document variable + org-complete-tags-always-offer-all-agenda-tags. + (Column attributes): Cross-reference special properties. + 2010-04-10 Michael Albinus Synchronize with Tramp repository. @@ -500,7 +593,7 @@ (Agenda commands): Document new bulk commands. (Plain lists): Document new behavior of `org-cycle-include-plain-lists'. - Hyphenation only in TeX. + Hyphenation only in TeX. (Clocking work time): Document the key to update effort estimates. (Clocking work time): Document the clock time display. @@ -1567,7 +1660,7 @@ 2008-06-15 Reiner Steib * gnus.texi (Mail Source Customization): Correct values of - `mail-source-delete-incoming'. Reported by Tassilo Horn. + `mail-source-delete-incoming'. Reported by Tassilo Horn. (Oort Gnus): Fix version comment for mml-dnd-protocol-alist. 2008-06-14 Reiner Steib diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/calc.texi --- a/doc/misc/calc.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/calc.texi Thu May 13 15:13:52 2010 +0200 @@ -6234,7 +6234,7 @@ @end ifnottex @tex \beforedisplay -$$ x_{\rm new} = x - {f(x) \over f'(x)} $$ +$$ x_{\rm new} = x - {f(x) \over f^{\prime}(x)} $$ \afterdisplay @end tex @@ -7901,7 +7901,7 @@ @tex \turnoffactive \beforedisplay -$$ 9 a + 3 b + c - 511 n' $$ +$$ 9 a + 3 b + c - 511 n^{\prime} $$ \afterdisplay @end tex @@ -12289,15 +12289,21 @@ toggle the Inverse and/or Hyperbolic flags and then execute the corresponding base command (@code{calc-sin} in this case). -The Inverse and Hyperbolic flags apply only to the next Calculator -command, after which they are automatically cleared. (They are also -cleared if the next keystroke is not a Calc command.) Digits you -type after @kbd{I} or @kbd{H} (or @kbd{K}) are treated as prefix -arguments for the next command, not as numeric entries. The same -is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means to -subtract and keep arguments). - -The third Calc prefix flag, @kbd{K} (keep-arguments), is discussed +@kindex O +@pindex calc-option +The @kbd{O} key (@code{calc-option}) sets another flag, the +@dfn{Option Flag}, which also can alter the subsequent Calc command in +various ways. + +The Inverse, Hyperbolic and Option flags apply only to the next +Calculator command, after which they are automatically cleared. (They +are also cleared if the next keystroke is not a Calc command.) Digits +you type after @kbd{I}, @kbd{H} or @kbd{O} (or @kbd{K}) are treated as +prefix arguments for the next command, not as numeric entries. The +same is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means +to subtract and keep arguments). + +Another Calc prefix flag, @kbd{K} (keep-arguments), is discussed elsewhere. @xref{Keep Arguments}. @node Calculation Modes, Simplification Modes, Inverse and Hyperbolic, Mode Settings @@ -13175,12 +13181,13 @@ entirety.) @cindex Two's complements -With the binary, octal and hexadecimal display modes, Calc can -display @expr{w}-bit integers using two's complement notation. This -option is selected with the key sequences @kbd{C-u d 2}, @kbd{C-u d 8} -and @kbd{C-u d 6}, respectively, and a negative word size might be -appropriate (@pxref{Binary Functions}). In two's complement -notation, the integers in the (nearly) symmetric interval from +Calc can display @expr{w}-bit integers using two's complement +notation, although this is most useful with the binary, octal and +hexadecimal display modes. This option is selected by using the +@kbd{O} option prefix before setting the display radix, and a negative word +size might be appropriate (@pxref{Binary Functions}). In two's +complement notation, the integers in the (nearly) symmetric interval +from @texline @math{-2^{w-1}} @infoline @expr{-2^(w-1)} to @@ -35461,6 +35468,7 @@ @r{ @: M @: @: @:calc-more-recursion-depth@:} @r{ @: I M @: @: @:calc-less-recursion-depth@:} @r{ a@: N @: @: 5 @:evalvn@:(a)} +@r{ @: O @:command @: 32 @:@:Option} @r{ @: P @: @: @:@:pi} @r{ @: I P @: @: @:@:gamma} @r{ @: H P @: @: @:@:e} diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/cl.texi --- a/doc/misc/cl.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/cl.texi Thu May 13 15:13:52 2010 +0200 @@ -356,7 +356,7 @@ calls to it may be expanded into in-line code by the byte compiler. This is analogous to the @code{defsubst} form; @code{defsubst*} uses a different method (compiler macros) which -works in all version of Emacs, and also generates somewhat more +works in all versions of Emacs, and also generates somewhat more efficient inline expansions. In particular, @code{defsubst*} arranges for the processing of keyword arguments, default values, etc., to be done at compile-time whenever possible. diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/ede.texi --- a/doc/misc/ede.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/ede.texi Thu May 13 15:13:52 2010 +0200 @@ -129,27 +129,26 @@ @node EDE Mode, Creating a project, EDE Project Concepts, top @chapter @ede{} Mode -@ede{} is implemented as a minor-mode, which augments other modes such +@ede{} is implemented as a minor mode, which augments other modes such as C mode, and Texinfo mode. You can enable @ede{} for all buffers by running the command @code{global-ede-mode}, or by putting this in your -@file{~/.emacs} file: +init file: @example (global-ede-mode t) @end example -When @ede{} is active for a given buffer, the menu item -``Development'' appears. This menu provides several menu items for -high-level @ede{} commands. These menu items, and their corresponding -keybindings, are independent of the type of project you are actually -working on. +Activating @ede{} adds a menu named @samp{Development} to the menu +bar. This menu provides several menu items for high-level @ede{} +commands. These menu items, and their corresponding keybindings, are +independent of the type of project you are actually working on. @node Creating a project, Modifying your project, EDE Mode, top @chapter Creating a project To create a new project, first visit a file that you want to include -in that project. If you have a hierarchy of directories, choose a -file in the topmost directory first. From this buffer, type @kbd{M-x +in that project. If you have a hierarchy of directories, first visit +a file in the topmost directory. From this buffer, type @kbd{M-x ede-new}, or click on the @samp{Create Project} item in the @samp{Development} menu. @@ -220,8 +219,8 @@ @node Add/Remove target, Add/Remove files, Modifying your project, Modifying your project @section Add/Remove target -To create a new target, type @kbd{C-c . t} (@code{M-x ede-new-target}) -or use the @samp{Add Target} menu item in the @samp{Project Options} +To create a new target, type @kbd{C-c . t} (@code{ede-new-target}) or +use the @samp{Add Target} menu item in the @samp{Project Options} submenu. This prompts for a target name, and adds the current buffer to that target. @@ -237,7 +236,7 @@ @section Add/Remove files To add the current file to an existing target, type @kbd{C-c . a} -(@code{ede-add-file}), or or use the @samp{Add File} menu item in the +(@code{ede-add-file}), or use the @samp{Add File} menu item in the @samp{Target Options} submenu. You can add a file to more than one target; this is OK. diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/gnus-coding.texi --- a/doc/misc/gnus-coding.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/gnus-coding.texi Thu May 13 15:13:52 2010 +0200 @@ -32,16 +32,16 @@ @titlepage -@title Gnus Coding Style and Maintainance Guide +@title Gnus Coding Style and Maintenance Guide @author by Reiner Steib @insertcopying @end titlepage -@c Obviously this is only a very rudimentary draft. We put it in CVS -@c anyway hoping that it might annoy someone enough to fix it. ;-) -@c Fixing only a paragraph also is appreciated. +@c Obviously this is only a very rudimentary draft. We put it in the +@c repository anyway hoping that it might annoy someone enough to fix +@c it. ;-) Fixing only a paragraph also is appreciated. @ifnottex @node Top @@ -255,15 +255,17 @@ @section Stable and development versions -The development of Gnus normally is done on the CVS trunk, i.e. there -are no separate branches to develop and test new features. Most of the -time, the trunk is developed quite actively with more or less daily -changes. Only after a new major release, e.g. 5.10.1, there's usually a -feature period of several months. After the release of Gnus 5.10.6 the -development of new features started again on the trunk while the 5.10 -series is continued on the stable branch (v5-10) from which more stable -releases will be done when needed (5.10.8, @dots{}). -@ref{Gnus Development, ,Gnus Development, gnus, The Gnus Newsreader} +The development of Gnus normally is done on the Git repository trunk +as of April 19, 2010 (formerly it was done in CVS; the repository is +at http://git.gnus.org), i.e. there are no separate branches to +develop and test new features. Most of the time, the trunk is +developed quite actively with more or less daily changes. Only after +a new major release, e.g. 5.10.1, there's usually a feature period of +several months. After the release of Gnus 5.10.6 the development of +new features started again on the trunk while the 5.10 series is +continued on the stable branch (v5-10) from which more stable releases +will be done when needed (5.10.8, @dots{}). @ref{Gnus Development, +,Gnus Development, gnus, The Gnus Newsreader} Stable releases of Gnus finally become part of Emacs. E.g. Gnus 5.8 became a part of Emacs 21 (relabeled to Gnus 5.9). The 5.10 series @@ -333,8 +335,12 @@ @item For general Gnus development changes, of course you just make the -change on the Gnus CVS trunk and it goes into Emacs a few years +change on the Gnus Git trunk and it goes into Emacs a few years later... :-) + +With the new Git repository, we'll probably set up something to +automatically synchronize with Emacs when possible. CVS was much less +powerful for this kind of synchronization. @end itemize Of course in any case, if you just can't wait for me to sync your diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/gnus.texi --- a/doc/misc/gnus.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/gnus.texi Thu May 13 15:13:52 2010 +0200 @@ -11331,6 +11331,7 @@ @item B DEL @kindex B DEL (Summary) +@cindex deleting mail @findex gnus-summary-delete-article @c @icon{gnus-summary-mail-delete} Delete the mail article. This is ``delete'' as in ``delete it from your @@ -21843,7 +21844,7 @@ When you enter the group the first time, you will only see the new threads. You then raise the score of the threads that you find -interesting (with @kbd{I T} or @kbd{I S}), and ignore (@kbd{C y}) the +interesting (with @kbd{I T} or @kbd{I S}), and ignore (@kbd{c y}) the rest. Next time you enter the group, you will see new articles in the interesting threads, plus any new threads. @@ -27111,6 +27112,10 @@ On the January 4th 2004, No Gnus was begun. +On April 19, 2010 Gnus development was moved to Git. See +http://git.gnus.org for details (http://www.gnus.org will be updated +with the information when possible). + If you happen upon a version of Gnus that has a prefixed name -- ``(ding) Gnus'', ``September Gnus'', ``Red Gnus'', ``Quassia Gnus'', ``Pterodactyl Gnus'', ``Oort Gnus'', ``No Gnus'' -- don't panic. @@ -28507,7 +28512,7 @@ hierarchy. @c FIXME: `gnus-load' is mentioned in README, which is not included in -@c CVS. We should find a better place for this item. +@c the repository. We should find a better place for this item. @item @code{(require 'gnus-load)} diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/info.texi --- a/doc/misc/info.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/info.texi Thu May 13 15:13:52 2010 +0200 @@ -15,7 +15,8 @@ documentation system. Copyright @copyright{} 1989, 1992, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -1050,6 +1051,13 @@ want to read the description of what the @kbd{C-l} key does, type @kbd{iC-l@key{RET}} literally. +@findex Info-virtual-index +@kindex I @r{(Info mode)} +Emacs provides the command @code{Info-virtual-index}, bound to the +@kbd{I} key. This behaves like @kbd{i}, but constructs a virtual +info node displaying the results of an index search, making it easier +to select the one you want. + @findex info-apropos @findex index-apropos If you aren't sure which manual documents the topic you are looking diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/message.texi --- a/doc/misc/message.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/message.texi Thu May 13 15:13:52 2010 +0200 @@ -659,7 +659,7 @@ @findex message-insert-disposition-notification-to Insert a request for a disposition notification. (@code{message-insert-disposition-notification-to}). -This means that if the recipient support RFC 2298 she might send you a +This means that if the recipient supports RFC 2298 she might send you a notification that she received the message. @item M-x message-insert-importance-high @@ -2387,7 +2387,7 @@ @item wide reply A @dfn{wide reply} is a mail response that includes @emph{all} entities -mentioned in the message you are responded to. All mailboxes from the +mentioned in the message you are responding to. All mailboxes from the following headers will be concatenated to form the outgoing @code{To}/@code{Cc} headers: diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/org.texi --- a/doc/misc/org.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/org.texi Thu May 13 15:13:52 2010 +0200 @@ -3,8 +3,8 @@ @setfilename ../../info/org @settitle The Org Manual -@set VERSION 6.33x -@set DATE November 2009 +@set VERSION 6.35i +@set DATE April 2010 @c Version and Contact Info @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage} @@ -45,7 +45,7 @@ @copying This manual is for Org version @value{VERSION}. -Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation +Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation @quotation Permission is granted to copy, distribute and/or modify this document @@ -304,6 +304,7 @@ * Images and tables:: Tables and Images will be included * Literal examples:: Source code examples with special formatting * Include files:: Include additional files into a document +* Index entries:: * Macro replacement:: Use macros to create complex output * Embedded LaTeX:: LaTeX can be freely used inside Org documents @@ -333,7 +334,7 @@ * Selective export:: Using tags to select and exclude trees * Export options:: Per-file export settings * The export dispatcher:: How to access exporter commands -* ASCII export:: Exporting to plain ASCII +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF * DocBook export:: Exporting to DocBook @@ -355,10 +356,11 @@ La@TeX{} and PDF export * LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure * Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Sectioning structure:: Changing sectioning in La@TeX{} output * Tables in LaTeX export:: Options for exporting tables to La@TeX{} * Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation DocBook export @@ -384,7 +386,8 @@ * Publishing action:: Setting the function doing the publishing * Publishing options:: Tweaking HTML export * Publishing links:: Which links keep working after publishing? -* Project page index:: Publishing a list of project files +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages Sample configuration @@ -876,7 +879,8 @@ and the hierarchy above. Useful for working near a location that has been exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command (@pxref{Agenda commands}). With a prefix argument show, on each -level, all sibling headings. +level, all sibling headings. With double prefix arg, also show the entire +subtree of the parent. @kindex C-c C-x b @item C-c C-x b Show the current subtree in an indirect buffer@footnote{The indirect @@ -1388,7 +1392,15 @@ press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for storing properties (@pxref{Properties and Columns}), and you can also arrange for state change notes (@pxref{Tracking TODO state changes}) and clock times -(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. +(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. If you +want to store a quick note in the LOGBOOK drawer, in a similar way as this is +done by state changes, use + +@table @kbd +@kindex C-c C-z +@item C-c C-z +Add a time-stamped note to the LOGBOOK drawer. +@end table @node Blocks, Footnotes, Drawers, Document Structure @section Blocks @@ -1815,13 +1827,13 @@ also the alignment of a column is determined automatically from the fraction of number-like versus non-number fields in the column. -Sometimes a single field or a few fields need to carry more text, -leading to inconveniently wide columns. To limit@footnote{This feature -does not work on XEmacs.} the width of a column, one field anywhere in -the column may contain just the string @samp{} where @samp{N} is an -integer specifying the width of the column in characters. The next -re-align will then set the width of this column to no more than this -value. +Sometimes a single field or a few fields need to carry more text, leading to +inconveniently wide columns. Or maybe you want to make a table with several +columns having a fixed width, regardless of content. To set@footnote{This +feature does not work on XEmacs.} the width of a column, one field anywhere +in the column may contain just the string @samp{} where @samp{N} is an +integer specifying the width of the column in characters. The next re-align +will then set the width of this column to this value. @example @group @@ -1926,11 +1938,13 @@ The table editor makes use of the Emacs @file{calc} package to implement spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to -derive fields from other fields. While fully featured, Org's -implementation is not identical to other spreadsheets. For example, -Org knows the concept of a @emph{column formula} that will be -applied to all non-header fields in a column without having to copy the -formula to each relevant field. +derive fields from other fields. While fully featured, Org's implementation +is not identical to other spreadsheets. For example, Org knows the concept +of a @emph{column formula} that will be applied to all non-header fields in a +column without having to copy the formula to each relevant field. There is +also a formula debugger, and a formula editor with features for highlighting +fields in the table corresponding to the references at the point in the +formula, moving these references by arrow keys @menu * References:: How to refer to another field or range @@ -2038,6 +2052,28 @@ see the @samp{E} mode switch below). If there are no non-empty fields, @samp{[0]} is returned to avoid syntax errors in formulas. +@subsubheading Field coordinates in formulas +@cindex field coordinates +@cindex coordinates, of field +@cindex row, of field coordinates +@cindex column, of field coordinates + +For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to +get the row or column number of the field where the formula result goes. +The traditional Lisp formula equivalents are @code{org-table-current-dline} +and @code{org-table-current-column}. Examples: + +@example +if(@@# % 2, $#, string("")) @r{column number on odd lines only} +$3 = remote(FOO, @@@@#$2) @r{copy column 2 from table FOO into} + @r{column 3 of the current table} +@end example + +@noindent For the second example, table FOO must have at least as many rows +as the current table. Inefficient@footnote{The computation time scales as +O(N^2) because table FOO is parsed for each field to be copied.} for large +number of rows. + @subsubheading Named references @cindex named references @cindex references, named @@ -2127,8 +2163,11 @@ @code{org-calc-default-modes}. @example -p20 @r{switch the internal precision to 20 digits} -n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format} +p20 @r{set the internal Calc calculation precision to 20 digits} +n3 s3 e2 f4 @r{Normal, scientific, engineering, or fixed} + @r{format of the result of Calc passed back to Org.} + @r{Calc formatting is unlimited in precision as} + @r{long as the Calc calculation precision is greater.} D R @r{angle modes: degrees, radians} F S @r{fraction and symbolic modes} N @r{interpret all fields as numbers, use 0 for non-numbers} @@ -2138,8 +2177,16 @@ @end example @noindent -In addition, you may provide a @code{printf} format specifier to -reformat the final result. A few examples: +Unless you use large integer numbers or high-precision-calculation +and -display for floating point numbers you may alternatively provide a +@code{printf} format specifier to reformat the Calc result after it has been +passed back to Org instead of letting Calc already do the +formatting@footnote{The @code{printf} reformatting is limited in precision +because the value passed to it is converted into an @code{integer} or +@code{double}. The @code{integer} is limited in size by truncating the +signed value to 32 bits. The @code{double} is limited in precision to 64 +bits overall which leaves approximately 16 significant decimal digits.}. +A few examples: @example $1+$2 @r{Sum of first and second field} @@ -2756,10 +2803,13 @@ /home/dominik/images/jupiter.jpg @r{same as above} file:papers/last.pdf @r{file, relative path} ./papers/last.pdf @r{same as above} +file:/myself@@some.where:papers/last.pdf @r{file, path on remote machine} +/myself@@some.where:papers/last.pdf @r{same as above} file:sometextfile::NNN @r{file with line number to jump to} file:projects.org @r{another Org file} file:projects.org::some words @r{text search in Org file} file:projects.org::*task title @r{heading search in Org file} +docview:papers/last.pdf::NNN @r{open file in doc-view mode at page NNN} id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID} news:comp.emacs @r{Usenet link} mailto:adent@@galaxy.net @r{Mail link} @@ -3075,6 +3125,7 @@ [[file:~/code/main.c::255]] [[file:~/xx.org::My Target]] [[file:~/xx.org::*My Target]] +[[file:~/xx.org::#my-custom-id]] [[file:~/xx.org::/regexp/]] @end example @@ -3089,6 +3140,8 @@ the linked file. @item *My Target In an Org file, restrict search to headlines. +@item #my-custom-id +Link to a heading with a @code{CUSTOM_ID} property @item /regexp/ Do a regular expression search for @code{regexp}. This uses the Emacs command @code{occur} to list all matches in a separate window. If the @@ -3451,15 +3504,16 @@ @lisp @group (setq org-todo-keyword-faces - '(("TODO" . org-warning) - ("DEFERRED" . shadow) - ("CANCELED" . (:foreground "blue" :weight bold)))) + '(("TODO" . org-warning) ("STARTED" . "yellow") + ("CANCELED" . (:foreground "blue" :weight bold)))) @end group @end lisp -While using a list with face properties as shown for CANCELED -@emph{should} work, this does not aways seem to be the case. If -necessary, define a special face and use that. +While using a list with face properties as shown for CANCELED @emph{should} +work, this does not aways seem to be the case. If necessary, define a +special face and use that. A string is interpreted as a color. The variable +@code{org-faces-easy-properties} determines if that color is interpreted as a +foreground or a background color. @node TODO dependencies, , Faces for TODO keywords, TODO extensions @subsection TODO dependencies @@ -3764,11 +3818,13 @@ @end example @noindent +@vindex org-priority-faces By default, Org mode supports three priorities: @samp{A}, @samp{B}, and -@samp{C}. @samp{A} is the highest priority. An entry without a cookie -is treated as priority @samp{B}. Priorities make a difference only in -the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have -no inherent meaning to Org mode. +@samp{C}. @samp{A} is the highest priority. An entry without a cookie is +treated as priority @samp{B}. Priorities make a difference only in the +agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have no +inherent meaning to Org mode. The cookies can be highlighted with special +faces by customizing the variable @code{org-priority-faces}. Priorities can be attached to any outline tree entries; they do not need to be TODO items. @@ -4233,6 +4289,26 @@ window is not even shown for single-key tag selection, it comes up only when you press an extra @kbd{C-c}. +@vindex org-complete-tags-always-offer-all-agenda-tags +As said before, when setting tags and @code{org-tag-alist} is nil, then the +list of tags in the current buffer is used. Normally, this behavior is very +convenient, except in org remember buffers (@pxref{Remember}), because there +are no tags that can be calculated dynamically. Here, you most probably want +to have completion for all tags in all agenda files. This can be done by +setting @code{org-complete-tags-always-offer-all-agenda-tags} to non-nil in +those buffers. + +@lisp +(add-hook 'org-remember-mode-hook + (lambda () + (set (make-local-variable + 'org-complete-tags-always-offer-all-agenda-tags) + t))) +@end lisp + +Of course, you can also set it to @code{t} globally if you always want to +have completion of all tags in all agenda files. + @node Tag searches, , Setting tags, Tags @section Tag searches @cindex tag searches @@ -4407,6 +4483,7 @@ @cindex property, special, TIMESTAMP @cindex property, special, TIMESTAMP_IA @cindex property, special, CLOCKSUM +@cindex property, special, BLOCKED @c guessing that ITEM is needed in this area; also, should this list be sorted? @cindex property, special, ITEM @example @@ -4422,6 +4499,7 @@ TIMESTAMP_IA @r{The first inactive timestamp in the entry.} CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}} @r{must be run first to compute the values.} +BLOCKED @r{"t" if task is currently blocked by children or siblings} ITEM @r{The content of the entry.} @end example @@ -4845,7 +4923,7 @@ A timestamp is a specification of a date (possibly with a time or a range of times) in a special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue -12:00-12:30>}@footnote{This is inspired by the standard ISO 6801 date/time +12:00-12:30>}@footnote{This is inspired by the standard ISO 8601 date/time format. To use an alternative format, see @ref{Custom time format}.}. A timestamp can appear anywhere in the headline or body of an Org tree entry. Its presence causes entries to be shown on specific dates in the agenda @@ -5020,8 +5098,10 @@ @example 3-2-5 --> 2003-02-05 +2/5/3 --> 2003-02-05 14 --> @b{2006}-@b{06}-14 12 --> @b{2006}-@b{07}-12 +2/5 --> @b{2003}-02-05 Fri --> nearest Friday (defaultdate or later) sep 15 --> @b{2006}-09-15 feb 15 --> @b{2007}-02-15 @@ -5945,13 +6025,13 @@ will continue to run after the note was filed away. The handler will then store the note in the file and under the headline -specified in the template, or it will use the default file and headline. -The window configuration will be restored, sending you back to the working -context before the call to Remember. To re-use the location found -during the last call to Remember, exit the Remember buffer with -@kbd{C-0 C-c C-c}, i.e. specify a zero prefix argument to @kbd{C-c C-c}. -Another special case is @kbd{C-2 C-c C-c} which files the note as a child of -the currently clocked item. +specified in the template, or it will use the default file and headline. The +window configuration will be restored, sending you back to the working +context before the call to Remember. To re-use the location found during the +last call to Remember, exit the Remember buffer with @kbd{C-0 C-c C-c}, +i.e. specify a zero prefix argument to @kbd{C-c C-c}. Another special case +is @kbd{C-2 C-c C-c} which files the note as a child of the currently clocked +item, and @kbd{C-3 C-c C-c} files as a sibling of the currently clocked item. @vindex org-remember-store-without-prompt If you want to store the note directly to a different place, use @@ -6170,6 +6250,7 @@ @vindex org-refile-use-outline-path @vindex org-outline-path-complete-in-steps @vindex org-refile-allow-creating-parent-nodes +@vindex org-log-refile Refile the entry or region at point. This command offers possible locations for refiling the entry and lets you select one with completion. The item (or all items in the region) is filed below the target heading as a subitem. @@ -6183,6 +6264,10 @@ @code{org-outline-path-complete-in-steps}. If you would like to be able to create new nodes as new parents for refiling on the fly, check the variable @code{org-refile-allow-creating-parent-nodes}. +When the variable @code{org-log-refile}@footnote{with corresponding +@code{#+STARTUP} keywords @code{logrefile}, @code{lognoterefile}, +and @code{nologrefile}} is set, a time stamp or a note will be +recorded when an entry has been refiled. @kindex C-u C-c C-w @item C-u C-c C-w Use the refile interface to jump to a heading. @@ -6618,8 +6703,8 @@ #+CATEGORY: Holiday %%(org-calendar-holiday) ; special function for holiday names #+CATEGORY: Ann -%%(diary-anniversary 14 5 1956) Arthur Dent is %d years old -%%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old +%%(diary-anniversary 5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old +%%(diary-anniversary 10 2 1869) Mahatma Gandhi would be %d years old @end example @subsubheading Anniversaries from BBDB @@ -6936,7 +7021,9 @@ will search for note entries that contain the keywords @code{computer} and @code{wifi}, but not the keyword @code{ethernet}, and which are also not matched by the regular expression @code{8\.11[bg]}, meaning to -exclude both 8.11b and 8.11g. +exclude both 8.11b and 8.11g. The first @samp{+} is necessary to turn on +word search, other @samp{+} characters are optional. For more details, see +the docstring of the command @code{org-search-view}. @vindex org-agenda-text-search-extra-files Note that in addition to the agenda files, this command will also search @@ -7245,6 +7332,7 @@ Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}. @c @kindex v l +@kindex v L @kindex l @item v l @ @r{or short} @ l @vindex org-log-done @@ -7256,6 +7344,7 @@ @code{org-agenda-log-mode-items}. When called with a @kbd{C-u} prefix, show all possible logbook entries, including state changes. When called with two prefix args @kbd{C-u C-u}, show only logging information, nothing else. +@kbd{v L} is equivalent to @kbd{C-u v l}. @c @kindex v [ @kindex [ @@ -7523,8 +7612,9 @@ @itemx S-@key{down} Decrease the priority of the current item. @c +@kindex C-c C-z @kindex z -@item z +@item z @ @r{or also} @ C-c C-z @vindex org-log-into-drawer Add a note to the entry. This note will be recorded, and then files to the same location where state change notes are put. Depending on @@ -7536,11 +7626,11 @@ @c @kindex C-c C-s @item C-c C-s -Schedule this item +Schedule this item, with prefix arg remove the scheduling timestamp @c @kindex C-c C-d @item C-c C-d -Set a deadline for this item. +Set a deadline for this item, with prefix arg remove the deadline. @c @kindex k @item k @@ -7576,9 +7666,8 @@ @c @kindex > @item > -Change the timestamp associated with the current line to today. -The key @kbd{>} has been chosen, because it is the same as @kbd{S-.} -on my keyboard. +Change the timestamp associated with the current line. The key @kbd{>} has +been chosen, because it is the same as @kbd{S-.} on my keyboard. @c @kindex I @item I @@ -7601,7 +7690,7 @@ @cindex remote editing, bulk, from agenda @kindex m -@item s +@item m Mark the entry at point for bulk action. @kindex u @@ -7615,7 +7704,9 @@ @kindex B @item B Bulk action: act on all marked entries in the agenda. This will prompt for -another key to select the action to be applied: +another key to select the action to be applied. The prefix arg to @kbd{B} +will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove +these special timestamps. @example r @r{Prompt for a single refile target and move all entries. The entries} @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.} @@ -8117,6 +8208,7 @@ * Images and tables:: Tables and Images will be included * Literal examples:: Source code examples with special formatting * Include files:: Include additional files into a document +* Index entries:: * Macro replacement:: Use macros to create complex output * Embedded LaTeX:: LaTeX can be freely used inside Org documents @end menu @@ -8333,7 +8425,8 @@ the @file{table.el} package will be exported properly. For Org mode tables, the lines before the first horizontal separator line will become table header lines. You can use the following lines somewhere before the table to assign -a caption and a label for cross references: +a caption and a label for cross references, and in the text you can refer to +the object with @code{\ref@{tab:basic-data@}}: @example #+CAPTION: This is the caption for the next table (or link) @@ -8468,7 +8561,7 @@ @end table -@node Include files, Macro replacement, Literal examples, Markup +@node Include files, Index entries, Literal examples, Markup @section Include files @cindex include files, markup rules @@ -8499,8 +8592,25 @@ Visit the include file at point. @end table - -@node Macro replacement, Embedded LaTeX, Include files, Markup +@node Index entries, Macro replacement, Include files, Markup +@section Index enries +@cindex index entries, for publishing + +You can specify entries that will be used for generating an index during +publishing. This is done by lines starting with @code{#+INDEX}. An entry +the contains an exclamation mark will create a sub item. See @ref{Generating +an index} for more information. + +@example +* Curriculum Vitae +#+INDEX: CV +#+INDEX: Application!CV +@end example + + + + +@node Macro replacement, Embedded LaTeX, Index entries, Markup @section Macro replacement @cindex macro replacement, during export @cindex #+MACRO @@ -8791,7 +8901,7 @@ * Selective export:: Using tags to select and exclude trees * Export options:: Per-file export settings * The export dispatcher:: How to access exporter commands -* ASCII export:: Exporting to plain ASCII +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF * DocBook export:: Exporting to DocBook @@ -8905,7 +9015,7 @@ H: @r{set the number of headline levels for export} num: @r{turn on/off section-numbers} toc: @r{turn on/off table of contents, or set level limit (integer)} -\n: @r{turn on/off line-break-preservation} +\n: @r{turn on/off line-break-preservation (DOES NOT WORK)} @@: @r{turn on/off quoted HTML tags} :: @r{turn on/off fixed-width sections} |: @r{turn on/off tables} @@ -8923,6 +9033,7 @@ LaTeX: @r{turn on/off La@TeX{} fragments} skip: @r{turn on/off skipping the text before the first heading} author: @r{turn on/off inclusion of author name/email into exported file} +email: @r{turn on/off inclusion of author email into exported file} creator: @r{turn on/off inclusion of creator info into exported file} timestamp: @r{turn on/off inclusion creation time into exported file} d: @r{turn on/off inclusion of drawers} @@ -8938,7 +9049,7 @@ @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and @code{EXPORT_OPTIONS}. -@node The export dispatcher, ASCII export, Export options, Exporting +@node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting @section The export dispatcher @cindex dispatcher, for export commands @@ -8970,12 +9081,15 @@ not set, or force processing in the current Emacs process if set. @end table -@node ASCII export, HTML export, The export dispatcher, Exporting -@section ASCII export +@node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting +@section ASCII/Latin-1/UTF-8 export @cindex ASCII export +@cindex Latin-1 export +@cindex UTF-8 export ASCII export produces a simple and very readable version of an Org-mode -file. +file, containing only plain ASCII. Latin-1 and UTF-8 export augment the file +with special characters and symbols available in these encodings. @cindex region, active @cindex active region @@ -8996,8 +9110,18 @@ @kindex C-c C-e A @item C-c C-e A Export to a temporary buffer, do not create a file. +@kindex C-c C-e n +@kindex C-c C-e N +@item C-c C-e n @ @ @r{and} @ @ C-c C-e N +Like the above commands, but use Latin-1 encoding. +@kindex C-c C-e u +@kindex C-c C-e U +@item C-c C-e u @ @ @r{and} @ @ C-c C-e U +Like the above commands, but use UTF-8 encoding. @kindex C-c C-e v a -@item C-c C-e v a +@kindex C-c C-e v n +@kindex C-c C-e v u +@item C-c C-e v a @ @ @r{and} @ @ C-c C-e v n @ @ @r{and} @ @ C-c C-e v u Export only the visible part of the document. @end table @@ -9025,7 +9149,7 @@ the text and the link in a note before the next heading. See the variable @code{org-export-ascii-links-to-notes} for details and other options. -@node HTML export, LaTeX and PDF export, ASCII export, Exporting +@node HTML export, LaTeX and PDF export, ASCII/Latin-1/UTF-8 export, Exporting @section HTML export @cindex HTML export @@ -9378,19 +9502,25 @@ @cindex Guerry, Bastien Org mode contains a La@TeX{} exporter written by Bastien Guerry. With -further processing, this backend is also used to produce PDF output. Since -the La@TeX{} output uses @file{hyperref} to implement links and cross -references, the PDF output file will be fully linked. +further processing@footnote{The default LaTeX output is designed for +processing with pdftex or latex. It includes packages that are not +compatible with xetex and possibly luatex. See the variables +@code{org-export-latex-default-packages-alist} and +@code{org-export-latex-packages-alist}.}, this backend is also used to +produce PDF output. Since the La@TeX{} output uses @file{hyperref} to +implement links and cross references, the PDF output file will be fully +linked. @menu * LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure * Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Sectioning structure:: Changing sectioning in La@TeX{} output * Tables in LaTeX export:: Options for exporting tables to La@TeX{} * Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation @end menu -@node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export +@node LaTeX/PDF export commands, Header and sectioning, LaTeX and PDF export, LaTeX and PDF export @subsection La@TeX{} export commands @cindex region, active @@ -9449,7 +9579,41 @@ @noindent creates two levels of headings and does the rest as items. -@node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export +@node Header and sectioning, Quoting LaTeX code, LaTeX/PDF export commands, LaTeX and PDF export +@subsection Header and sectioning structure +@cindex La@TeX{} class +@cindex La@TeX{} sectioning structure +@cindex La@TeX{} header +@cindex header, for LaTeX files +@cindex sectioning structure, for LaTeX export + +By default, the La@TeX{} output uses the class @code{article}. + +@vindex org-export-latex-default-class +@vindex org-export-latex-classes +@vindex org-export-latex-default-packages-alist +@vindex org-export-latex-packages-alist +@cindex #+LATEX_HEADER +@cindex #+LATEX_CLASS +@cindex #+LATEX_CLASS_OPTIONS +@cindex property, LATEX_CLASS +@cindex property, LATEX_CLASS_OPTIONS +You can change this globally by setting a different value for +@code{org-export-latex-default-class} or locally by adding an option like +@code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:} +property that applies when exporting a region containing only this (sub)tree. +The class must be listed in @code{org-export-latex-classes}. This variable +defines a header template for each class@footnote{Into which the values of +@code{org-export-latex-default-packages-alist} and +@code{org-export-latex-packages-alist} are spliced.}, and allows you to +define the sectioning structure for each class. You can also define your own +classes there. @code{#+LaTeX_CLASS_OPTIONS} or a @code{LaTeX_CLASS_OPTIONS} +property can specify the options for the @code{\documentclass} macro. You +can also use @code{#+LATEX_HEADER: \usepackage@{xyz@}} to add lines to the +header. See the docstring of @code{org-export-latex-classes} for more +information. + +@node Quoting LaTeX code, Tables in LaTeX export, Header and sectioning, LaTeX and PDF export @subsection Quoting La@TeX{} code Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly @@ -9473,28 +9637,8 @@ #+END_LaTeX @end example -@node Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export -@subsection Sectioning structure -@cindex La@TeX{} class -@cindex La@TeX{} sectioning structure - -By default, the La@TeX{} output uses the class @code{article}. - -@vindex org-export-latex-default-class -@vindex org-export-latex-classes -@cindex #+LATEX_HEADER -@cindex #+LATEX_CLASS -@cindex property, LATEX_CLASS -You can change this globally by setting a different value for -@code{org-export-latex-default-class} or locally by adding an option like -@code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:} -property that applies when exporting a region containing only this (sub)tree. -The class should be listed in @code{org-export-latex-classes}, where you can -also define the sectioning structure for each class, as well as defining -additional classes. You can also use @code{#+LATEX_HEADER: -\usepackage@{xyz@}} to add lines to the header. - -@node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export + +@node Tables in LaTeX export, Images in LaTeX export, Quoting LaTeX code, LaTeX and PDF export @subsection Tables in La@TeX{} export @cindex tables, in La@TeX{} export @@ -9515,7 +9659,7 @@ @end example -@node Images in LaTeX export, , Tables in LaTeX export, LaTeX and PDF export +@node Images in LaTeX export, Beamer class export, Tables in LaTeX export, LaTeX and PDF export @subsection Images in La@TeX{} export @cindex images, inline in La@TeX{} @cindex inlining images in La@TeX{} @@ -9555,6 +9699,133 @@ If you need references to a label created in this way, write @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}. +@node Beamer class export, , Images in LaTeX export, LaTeX and PDF export +@subsection Beamer class export + +The LaTeX class @file{beamer} allows to produce high quality presentations +using LaTeX and pdf processing. Org-mode has special support for turning an +Org-mode file or tree into a @file{beamer} presentation. + +When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS: +beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is +@code{beamer}, a special export mode will turn the file or tree into a beamer +presentation. Any tree with not-to-deep level nesting should in principle be +exportable as a beamer presentation. By default, the top-level entries (or +the first level below the selected subtree heading) will be turned into +frames, and the outline structure below this level will become itemize lists. +You can also configure the variable @code{org-beamer-frame-level} to a +different level - then the hierarchy above frames will produce the sectioning +structure of the presentation. + +A template for useful in-buffer settings or properties can be inserted into +the buffer with @kbd{M-x org-beamer-settings-template}. Among other things, +this will install a column view format which is very handy for editing +special properties used by beamer. + +You can influence the structure of the presentation using the following +properties: + +@table @code +@item BEAMER_env +The environment that should be used to format this entry. Valid environments +are defined in the constant @code{org-beamer-environments-default}, and you +can define more in @code{org-beamer-environments-extra}. If this property is +set, the entry will also get a @code{:B_environment:} tag to make this +visible. This tag has no semantic meaning, it is only a visual aid. +@item BEAMER_envargs +The beamer-special arguments that should be used for the environment, like +@code{[t]} or @code{[<+->]} of @code{<2-3>}. If the @code{BEAMER_col} +property is also set, something like @code{C[t]} can be added here as well to +set an options argument for the implied @code{columns} environment. +@code{c[t]} will set an option for the implied @code{column} environment. +@item BEAMER_col +The width of a column that should start with this entry. If this property is +set, the entry will also get a @code{:BMCOL:} property to make this visible. +Also this tag is only a visual aid. When his is a plain number, it will be +interpreted as a fraction of @code{\textwidth}. Otherwise it will be assumed +that you have specified the units, like @samp{3cm}. The first such property +in a frame will start a @code{columns} environment to surround the columns. +This environment is closed when an entry has a @code{BEAMER_col} property +with value 0 or 1, or automatically at the end of the frame. +@item BEAMER_extra +Additional commands that should be inserted after the environment has been +opened. For example, when creating a frame, this can be used to specify +transitions. +@end table + +Frames will automatically receive a @code{fragile} option if they contain +source code that uses the verbatim environment. Special @file{beamer} +specific code can be inserted using @code{#+BEAMER:} and +@code{#+BEGIN_beamer...#+end_beamer} constructs, similar to other export +backends, but with the difference that @code{#+LaTeX:} stuff will be included +in the presentation as well. + +Outline nodes with @code{BEAMER_env} property value @samp{note} or +@samp{noteNH} will be formatted as beamer notes, i,e, they will be wrapped +into @code{\note@{...@}}. The former will include the heading as part of the +note text, the latter will ignore the heading of that node. To simplify note +generation, it is actually enough to mark the note with a @emph{tag} (either +@code{:B_note:} or @code{:B_noteNH:}) instead of creating the +@code{BEAMER_env} property. + +You can turn on a special minor mode @code{org-beamer-mode} for editing +support with + +@example +#+STARTUP: beamer +@end example + +@table @kbd +@kindex C-c C-b +@item C-c C-b +In @code{org-beamer-mode}, this key offers fast selection of a beamer +environment or the @code{BEAMER_col} property. +@end table + +Column view provides a great way to set the environment of a node and other +important parameters. Make sure you are using a COLUMN format that is geared +toward this special purpose. The command @kbd{M-x +org-beamer-settings-template} does define such a format. + +Here is a simple example Org document that is intended for beamer export. + +@smallexample +#+LaTeX_CLASS: beamer +#+TITLE: Example Presentation +#+AUTHOR: Carsten Dominik +#+LaTeX_CLASS_OPTIONS: [presentation] +#+BEAMER_FRAME_LEVEL: 2 +#+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@} +#+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex) + +* This is the first structural section + +** Frame 1 \\ with a subtitle +*** Thanks to Eric Fraga :BMCOL:B_block: + :PROPERTIES: + :BEAMER_env: block + :BEAMER_envargs: C[t] + :BEAMER_col: 0.5 + :END: + for the first viable beamer setup in Org +*** Thanks to everyone else :BMCOL:B_block: + :PROPERTIES: + :BEAMER_col: 0.5 + :BEAMER_env: block + :BEAMER_envargs: <2-> + :END: + for contributing to the discussion +**** This will be formatted as a beamer note :B_note: +** Frame 2 \\ where we will not use columns +*** Request :B_block: + Please test this stuff! + :PROPERTIES: + :BEAMER_env: block + :END: +@end smallexample + +For more information, see the documentation on Worg. + @node DocBook export, Freemind export, LaTeX and PDF export, Exporting @section DocBook export @cindex DocBook export @@ -9883,7 +10154,8 @@ * Publishing action:: Setting the function doing the publishing * Publishing options:: Tweaking HTML export * Publishing links:: Which links keep working after publishing? -* Project page index:: Publishing a list of project files +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages @end menu @node Project alist, Sources and destinations, Configuration, Configuration @@ -9929,11 +10201,15 @@ the Emacs @file{tramp} package. Or you can publish to a local directory and use external tools to upload your website (@pxref{Uploading files}). @item @code{:preparation-function} -@tab Function called before starting the publishing process, for example, to -run @code{make} for updating files to be published. +@tab Function or list of functions to be called before starting the +publishing process, for example, to run @code{make} for updating files to be +published. The project property list is scoped into this call as the +variable @code{project-plist}. @item @code{:completion-function} -@tab Function called after finishing the publishing process, for example, to -change permissions of the resulting files. +@tab Function or list of functions called after finishing the publishing +process, for example, to change permissions of the resulting files. The +project property list is scoped into this call as the variable +@code{project-plist}. @end multitable @noindent @@ -9994,10 +10270,11 @@ @tab Non-nil means, publish htmlized source. @end multitable -The function must accept two arguments: a property list containing at least a -@code{:publishing-directory} property, and the name of the file to be -published. It should take the specified file, make the necessary -transformation (if any) and place the result into the destination folder. +The function must accept three arguments: a property list containing at least +a @code{:publishing-directory} property, the name of the file to be +published, and the path to the publishing directory of the output file. It +should take the specified file, make the necessary transformation (if any) +and place the result into the destination folder. @node Publishing options, Publishing links, Publishing action, Configuration @subsection Options for the HTML/La@TeX{} exporters @@ -10033,6 +10310,7 @@ @vindex org-export-with-fixed-width @vindex org-export-with-timestamps @vindex org-export-author-info +@vindex org-export-email @vindex org-export-creator-info @vindex org-export-with-tables @vindex org-export-highlight-first-table-line @@ -10081,6 +10359,7 @@ @item @code{:fixed-width} @tab @code{org-export-with-fixed-width} @item @code{:timestamps} @tab @code{org-export-with-timestamps} @item @code{:author-info} @tab @code{org-export-author-info} +@item @code{:email-info} @tab @code{org-export-email-info} @item @code{:creator-info} @tab @code{org-export-creator-info} @item @code{:tables} @tab @code{org-export-with-tables} @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line} @@ -10117,7 +10396,7 @@ any) during publishing. Options set within a file (@pxref{Export options}), however, override everything. -@node Publishing links, Project page index, Publishing options, Configuration +@node Publishing links, Sitemap, Publishing options, Configuration @subsection Links between published files @cindex links, publishing @@ -10154,31 +10433,48 @@ function is @code{org-publish-validate-link} which checks if the given file is part of any project in @code{org-publish-project-alist}. -@node Project page index, , Publishing links, Configuration -@subsection Project page index -@cindex index, of published pages - -The following properties may be used to control publishing of an -index of files or a summary page for a given project. +@node Sitemap, Generating an index, Publishing links, Configuration +@subsection Generating a sitemap +@cindex sitemap, of published pages + +The following properties may be used to control publishing of +a map of files for a given project. @multitable @columnfractions 0.25 0.75 -@item @code{:auto-index} -@tab When non-nil, publish an index during @code{org-publish-current-project} +@item @code{:auto-sitemap} +@tab When non-nil, publish a sitemap during @code{org-publish-current-project} or @code{org-publish-all}. -@item @code{:index-filename} -@tab Filename for output of index. Defaults to @file{sitemap.org} (which +@item @code{:sitemap-filename} +@tab Filename for output of sitemap. Defaults to @file{sitemap.org} (which becomes @file{sitemap.html}). -@item @code{:index-title} -@tab Title of index page. Defaults to name of file. - -@item @code{:index-function} -@tab Plug-in function to use for generation of index. -Defaults to @code{org-publish-org-index}, which generates a plain list +@item @code{:sitemap-title} +@tab Title of sitemap page. Defaults to name of file. + +@item @code{:sitemap-function} +@tab Plug-in function to use for generation of the sitemap. +Defaults to @code{org-publish-org-sitemap}, which generates a plain list of links to all files in the project. @end multitable +@node Generating an index, , Sitemap, Configuration +@subsection Generating an index +@cindex index, in a publishing project + +Org-mode can generate an index across the files of a publishing project. + +@multitable @columnfractions 0.25 0.75 +@item @code{:makeindex} +@tab When non-nil, generate in index in the file @file{theindex.org} and +publish it as @file{theindex.html}. +@end multitable + +The file will be create when first publishing a project with the +@code{:makeindex} set. The file only contains a statement @code{#+include: +"theindex.inc"}. You can then built around this include statement by adding +a title, style information etc. + @node Uploading files, Sample configuration, Configuration, Publishing @section Uploading files @cindex rsync @@ -10561,6 +10857,9 @@ @cindex @code{logredeadline}, STARTUP keyword @cindex @code{lognoteredeadline}, STARTUP keyword @cindex @code{nologredeadline}, STARTUP keyword +@cindex @code{logrefile}, STARTUP keyword +@cindex @code{lognoterefile}, STARTUP keyword +@cindex @code{nologrefile}, STARTUP keyword @example logdone @r{record a timestamp when an item is marked DONE} lognotedone @r{record timestamp and a note when DONE} @@ -10576,6 +10875,9 @@ logredeadline @r{record a timestamp when deadline changes} lognoteredeadline @r{record a note when deadline changes} nologredeadline @r{do not record when a deadline date changes} +logrefile @r{record a timestamp when refiling} +lognoterefile @r{record a note when refiling} +nologrefile @r{do not record when refiling} @end example @vindex org-hide-leading-stars @vindex org-odd-levels-only @@ -10695,9 +10997,6 @@ If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to the entire table. @item -If the cursor is inside a table created by the @file{table.el} package, -activate that table. -@item If the current buffer is a Remember buffer, close the note and file it. With a prefix argument, file it, without further interaction, to the default location. @@ -10752,16 +11051,19 @@ If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind of view can be achieved dynamically at display time using @code{org-indent-mode}. In this minor mode, all lines are prefixed for -display with the necessary amount of space. Also headlines are prefixed with -additional stars, so that the amount of indentation shifts by -two@footnote{See the variable @code{org-indent-indentation-per-level}.} -spaces per level. All headline stars but the last one are made invisible -using the @code{org-hide} face@footnote{Turning on @code{org-indent-mode} -sets @code{org-hide-leading-stars} to @code{t} and -@code{org-adapt-indentation} to @code{nil}.} - see below under @samp{2.} for -more information on how this works. You can turn on @code{org-indent-mode} -for all files by customizing the variable @code{org-startup-indented}, or you -can turn it on for individual files using +display with the necessary amount of space@footnote{@code{org-indent-mode} +also sets the @code{wrap-prefix} property, such that @code{visual-line-mode} +(or purely setting @code{word-wrap}) wraps long lines (including headlines) +correctly indented. }. Also headlines are prefixed with additional stars, +so that the amount of indentation shifts by two@footnote{See the variable +@code{org-indent-indentation-per-level}.} spaces per level. All headline +stars but the last one are made invisible using the @code{org-hide} +face@footnote{Turning on @code{org-indent-mode} sets +@code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to +@code{nil}.} - see below under @samp{2.} for more information on how this +works. You can turn on @code{org-indent-mode} for all files by customizing +the variable @code{org-startup-indented}, or you can turn it on for +individual files using @example #+STARTUP: indent @@ -10941,7 +11243,7 @@ @cindex @file{remember.el} @cindex Wiegley, John Org cooperates with remember, see @ref{Remember}. -@file{Remember.el} is not part of Emacs, find it on the web. +As of Emacs 23, @file{Remember.el} is part of the Emacs distribution. @item @file{speedbar.el} by Eric M. Ludlam @cindex @file{speedbar.el} @cindex Ludlam, Eric M. @@ -10957,20 +11259,18 @@ @cindex @file{table.el} @cindex Ota, Takaaki -Complex ASCII tables with automatic line wrapping, column- and -row-spanning, and alignment can be created using the Emacs table -package by Takaaki Ota (@uref{http://sourceforge.net/projects/table}, -and also part of Emacs 22). -When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode -will call @command{table-recognize-table} and move the cursor into the -table. Inside a table, the keymap of Org mode is inactive. In order -to execute Org mode-related commands, leave the table. +Complex ASCII tables with automatic line wrapping, column- and row-spanning, +and alignment can be created using the Emacs table package by Takaaki Ota +(@uref{http://sourceforge.net/projects/table}, and also part of Emacs 22). +Org-mode will recognize these tables and export them properly. Because of +interference with other Org-mode functionality, you unfortunately cannot edit +these tables directly in the buffer. Instead, you need to use the command +@kbd{C-c '} to edit them, similar to source code snippets. @table @kbd -@kindex C-c C-c -@item C-c C-c -Recognize @file{table.el} table. Works when the cursor is in a -table.el table. +@kindex C-c ' +@item C-c ' +Edit a @file{table.el} table. Works when the cursor is in a table.el table. @c @kindex C-c ~ @item C-c ~ @@ -10980,7 +11280,7 @@ @code{org-convert-table} for the restrictions under which this is possible. @end table -@file{table.el} is part of Emacs 22. +@file{table.el} is part of Emacs since Emacs 22. @item @file{footnote.el} by Steven L. Baur @cindex @file{footnote.el} @cindex Baur, Steven L. @@ -11707,6 +12007,10 @@ Skip current entry if it has a deadline. @item '(org-agenda-skip-entry-if 'scheduled 'deadline) Skip current entry if it has a deadline, or if it is scheduled. +@item '(org-agenda-skip-entry-if 'todo '("TODO" "WAITING")) +Skip current entry if the TODO keyword is TODO or WAITING. +@item '(org-agenda-skip-entry-if 'todo 'done) +Skip current entry if the TODO keyword marks a DONE state. @item '(org-agenda-skip-entry-if 'timestamp) Skip current entry if it has any timestamp, may also be deadline or scheduled. @item '(org-agenda-skip-entry 'regexp "regular expression") @@ -11900,6 +12204,15 @@ values and check if VALUE is in this list. @end defun +@defopt org-property-allowed-value-functions +Hook for functions supplying allowed values for specific. +The functions must take a single argument, the name of the property, and +return a flat list of allowed values. If @samp{:ETC} is one of +the values, use the values as completion help, but allow also other values +to be entered. The functions must return @code{nil} if they are not +responsible for this property. +@end defopt + @node Using the mapping API, , Using the property API, Hacking @section Using the mapping API @cindex API, for mapping @@ -12044,11 +12357,14 @@ Org-mode has commands to prepare a directory with files for @i{MobileOrg}, and to read captured notes from there. If Emacs can directly write to the -WebDAV directory accessed by @i{MobileOrg}, just point to this directory -using the variable @code{org-mobile-directory}. Using the @file{tramp} -method, @code{org-mobile-directory} may point to a remote directory -accessible through, for example, -@file{ssh/scp}: +WebDAV directory@footnote{If you are using a public server, you might prefer +to encrypt the files on the server. This can be done with Org-mode 6.35 and +MobileOrg 1.2. On the Emacs side, configure the variables +@code{org-mobile-use-encryption} and @code{org-mobile-encryption-password}.} +accessed by @i{MobileOrg}, just point to this directory using the variable +@code{org-mobile-directory}. Using the @file{tramp} method, +@code{org-mobile-directory} may point to a remote directory accessible +through, for example, @file{ssh/scp}: @smallexample (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/") @@ -12195,6 +12511,8 @@ @item @i{Alex Bochannek} provided a patch for rounding timestamps. @item +@i{Jan Böcker} wrote @file{org-docview.el}. +@item @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files. @item @i{Tom Breton} wrote @file{org-choose.el}. @@ -12336,6 +12654,8 @@ @i{Eric Schulte} wrote @file{org-plot.el} and (together with @i{Dan Davison}) Org Babel, and contributed various patches, small features and modules. @item +@i{Paul Sexton} wrote @file{org-ctags.el}. +@item Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s @file{organizer-mode.el}. @item @@ -12365,6 +12685,8 @@ @i{J@"urgen Vollmer} contributed code generating the table of contents in HTML output. @item +@i{Samuel Wales} has provided important feedback and bug reports. +@item @i{Chris Wallace} provided a patch implementing the @samp{QUOTE} keyword. @item @@ -12379,7 +12701,7 @@ patches directly to Org, including the attachment system (@file{org-attach.el}), integration with Apple Mail (@file{org-mac-message.el}), hierarchical dependencies of TODO items, habit -tracking (@file{org-habits.el}) and support for pcomplete. +tracking (@file{org-habits.el}). @item @i{Carsten Wimmer} suggested some changes and helped fix a bug in linking to Gnus. diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/tramp.texi Binary file doc/misc/tramp.texi has changed diff -r e56f669f17ce -r fe07c47cf7a7 doc/misc/url.texi --- a/doc/misc/url.texi Wed May 12 14:32:06 2010 +0200 +++ b/doc/misc/url.texi Thu May 13 15:13:52 2010 +0200 @@ -313,7 +313,7 @@ variables, the value is a string; it can specify a single choice, or it can be a comma-separated list. -Normally this list ordered by descending preference. However, each +Normally, this list is ordered by descending preference. However, each element can be followed by @samp{;q=@var{priority}} to specify its preference level, a decimal number from 0 to 1; e.g., for @code{url-mime-language-string}, @w{@code{"de, en-gb;q=0.8, @@ -1120,11 +1120,11 @@ @defopt url-debug @cindex debugging -Specifies the types of debug messages the library which are logged to +Specifies the types of debug messages which are logged to the @code{*URL-DEBUG*} buffer. @code{t} means log all messages. A number means log all messages and show them with @code{message}. -If may also be a list of the types of messages to be logged. +It may also be a list of the types of messages to be logged. @end defopt @defopt url-personal-mail-address @end defopt diff -r e56f669f17ce -r fe07c47cf7a7 etc/AUTHORS --- a/etc/AUTHORS Wed May 12 14:32:06 2010 +0200 +++ b/etc/AUTHORS Thu May 13 15:13:52 2010 +0200 @@ -92,7 +92,7 @@ Alexander Becher: changed vc-annotate.el -Alexander Klimov: changed man.el +Alexander Klimov: changed calc-graph.el man.el Alexander Kreuzer: changed nnrss.el @@ -167,9 +167,9 @@ Andreas Politz: changed editfns.c elp.el ido.el term.el Andreas Schwab: changed Makefile.in configure.in lisp.h xdisp.c files.el - coding.c alloc.c process.c print.c editfns.c fileio.c fns.c dired.el + coding.c alloc.c process.c fileio.c print.c editfns.c fns.c dired.el xterm.c keyboard.c simple.el eval.c info.el buffer.c sysdep.c emacs.c - and 483 other files + and 485 other files Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus.el nnslashdot.el gnus-util.el mm-url.el mm-uu.el url-http.el xterm.c @@ -435,8 +435,8 @@ and co-wrote longlines.el and changed xdisp.c simple.el files.el display.texi frames.texi files.texi emacs.texi keyboard.c cus-edit.el faces.el xterm.c - Makefile.in xfaces.c font.c startup.el xfns.c misc.texi image.c - compile.el custom.texi text.texi and 633 other files + Makefile.in misc.texi xfaces.c font.c startup.el xfns.c compile.el + image.c custom.texi configure.in and 635 other files Chris Chase: co-wrote idlw-shell.el idlwave.el @@ -868,7 +868,7 @@ and changed msdos.c makefile.w32-in Makefile.in files.el info.el rmail.el fileio.c mainmake.v2 pc-win.el startup.el config.bat simple.el msdos.h dired.c w32.c frame.c internal.el menu-bar.el process.c INSTALL - xfaces.c and 602 other files + xfaces.c and 603 other files Elias Oltmanns: changed tls.el gnus-agent.el gnus-int.el gnus-srvr.el gnus.el @@ -1002,7 +1002,7 @@ Florian Weimer: changed message.el gnus.el coding.c gnus-sum.el gnus.texi mm-decode.el mm-util.el -Francesc Rocher: changed startup.el MORE.STUFF cus-start.el gnus.el +Francesc Rocher: changed MORE.STUFF startup.el cus-start.el gnus.el gnus.png gnus.svg macterm.c splash.png splash.svg splash8.xpm w32term.c xdisp.c xterm.c @@ -1131,9 +1131,9 @@ Glenn Morris: wrote check-declare.el and changed Makefile.in calendar.el diary-lib.el rmail.el f90.el cal-menu.el cal-hebrew.el fortran.el holidays.el configure.in - cal-islam.el bytecomp.el calendar.texi cal-bahai.el files.el appt.el - cal-china.el emacs.texi rmailsum.el simple.el startup.el - and 975 other files + cal-islam.el bytecomp.el calendar.texi cal-bahai.el emacs.texi files.el + appt.el cal-china.el rmailsum.el simple.el startup.el + and 976 other files Glynn Clements: wrote gamegrid.el snake.el tetris.el @@ -1346,7 +1346,7 @@ and changed gtkutil.c xterm.c xfns.c configure.in xterm.h xmenu.c x-win.el Makefile.in gtkutil.h keyboard.c frame.c frames.texi config.in emacs.c xselect.c xresources.texi startup.el alloc.c cus-start.el - xlwmenu.c process.c and 203 other files + xlwmenu.c frame.h and 203 other files Jan Moringen: co-wrote cpp.el @@ -1635,7 +1635,7 @@ Juanma Barranquero: changed makefile.w32-in subr.el files.el faces.el bs.el help-fns.el w32fns.c org.el server.el simple.el emacsclient.c desktop.el buffer.c mule-cmds.el ido.el window.c xdisp.c allout.el - keyboard.c replace.el eval.c and 930 other files + keyboard.c replace.el eval.c and 932 other files Juergen Hoetzel: changed url-handlers.el @@ -1657,7 +1657,7 @@ and changed info.el isearch.el simple.el replace.el dired-aux.el startup.el grep.el compile.el dired.el files.el faces.el display.texi menu-bar.el descr-text.el cus-edit.el bindings.el man.el image-mode.el - ispell.el text.texi dired-x.el and 280 other files + ispell.el text.texi dired-x.el and 281 other files Justin Bogner: changed fortune.el @@ -1770,7 +1770,7 @@ and co-wrote ps-def.el ps-mule.el ps-print.el ps-samp.el quail.el and changed coding.c mule-cmds.el mule.el fontset.c charset.c fontset.el xdisp.c xterm.c font.c fileio.c Makefile.in mule-conf.el characters.el - fns.c mule-diag.el ccl.c charset.h ftfont.c xfaces.c coding.h + fns.c mule-diag.el ftfont.c ccl.c charset.h xfaces.c coding.h japanese.el and 377 other files Kenichi Okada: co-wrote sasl-cram.el sasl-digest.el @@ -1969,7 +1969,7 @@ Magnus Henoch: changed url-http.el ispell.el url.el dbusbind.c dns.el url-gw.el url-parse.el url-proxy.el autoinsert.el cl.texi configure.in cyrillic.el dbus.el gnus.texi hashcash.el log-edit.el message.el - org-latex.el org-table.el process.c rcirc.el and 7 other files + org-latex.el org-table.el process.c rcirc.el and 8 other files Malcolm Purvis: changed spam-stat.el @@ -2432,7 +2432,7 @@ eudc-vars.el eudc.el eudcb-bbdb.el eudcb-ldap.el eudcb-ph.el ldap.el and changed ph.el -Óscar Fuentes: changed emacsclient.c ido.el vc-bzr.el +Óscar Fuentes: changed ido.el emacsclient.c vc-bzr.el P. E. Jareth Hein: changed gnus-util.el @@ -2951,7 +2951,9 @@ Steinar Bang: changed imap.el -Štěpán Němec: changed subr.el vc-git.el +Štěpán Němec: changed INSTALL cl.texi edebug.texi loading.texi maps.texi + mark.texi message.texi mini.texi minibuf.texi misc.texi programs.texi + subr.el tips.texi url.texi vc-git.el windows.texi Stephan Stahl: changed which-func.el buff-menu.el buffer.c dired-x.texi ediff-mult.el @@ -3080,7 +3082,7 @@ and changed spam.el gnus.el gnus-sum.el gnus.texi nnimap.el netrc.el spam-stat.el gnus-start.el gnus-util.el nnmail.el encrypt.el message.el gnus-encrypt.el mail-source.el assistant.el auth.texi imap.el - nnbabyl.el nnfolder.el nnmbox.el nnmh.el and 48 other files + nnbabyl.el nnfolder.el nnmbox.el nnmh.el and 51 other files Terje Rosten: changed xfns.c version.el xterm.c xterm.h diff -r e56f669f17ce -r fe07c47cf7a7 etc/ChangeLog --- a/etc/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/etc/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,28 @@ +2010-05-08 Chong Yidong + + * PROBLEMS: Document gcc-4.5 bug (Bug#6031). + +2010-05-08 Kenichi Handa + + * HELLO: Adjust Burmese for Unicode 5.2 encoding. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-07 Eli Zaretskii + + * HELLO: Reorder Arabic greetings into logical order (they were + mistakenly changed to visual order by the 2010-03-28 change). + +2010-04-18 Francesc Rocher + + * MORE.STUFF: Add a new entry for QWE. + +2010-04-18 Stefan Monnier + + * HELLO (Mathematics): Prefer Unicode charset. + 2010-03-30 Chong Yidong * images/icons/hicolor/scalable/apps/emacs.svg: Put preamble after @@ -1814,7 +1839,7 @@ 2006-11-05 Slawomir Nowaczyk * emacs.py (eargs): Provide eldoc message for builtin types. - Make sure eargs always outputs sentinel, to avoid Emacs freeze. + Make sure eargs always outputs sentinel, to avoid Emacs freeze. 2006-10-22 Chong Yidong @@ -4621,8 +4646,8 @@ 1990-01-19 David Lawrence (tale@cocoa-puffs) * timer.c, getdate.y (new files) and Makefile: - Sub-process support for run-at-time in timer.el. - Doesn't yet work correctly for USG. + Sub-process support for run-at-time in timer.el. + Doesn't yet work correctly for USG. 1990-01-10 Jim Kingdon (kingdon@pogo) diff -r e56f669f17ce -r fe07c47cf7a7 etc/HELLO --- a/etc/HELLO Wed May 12 14:32:06 2010 +0200 +++ b/etc/HELLO Thu May 13 15:13:52 2010 +0200 @@ -4,10 +4,10 @@ Europe: ,A!(BHola!, Gr,A|_(B Gott, Hyv,Add(B p,Ad(Biv,Add(B, Tere ,Au(Bhtust, Bon,Cu(Bu Cze,B6f(B!, Dobr,B}(B den, ,L7T`PRabRcYbU(B!, ,FCei\(B ,Fsar(B, $,1J2J0J;J0J@JOJ=J1J0(B Africa: $(3!A!,!>(B - Middle/Near East: ,Hylem(B, ,GecjdY(B ,GeGdqSdG(B + Middle/Near East: ,Hylem(B, ,GGdSqdGe(B ,GYdjce(B South Asia: $,19h9n9x:-9d:'(B, $,15h5n5x6-5d6'(B, $,1?(?.?8?M>u?>?0(B, $,1@H@N@X@m@5@^@P@"(B, $,1;6;A;#;?;,;G(B, $,1AFAzB4AvB=B AqB*(B, $,1-=U=~=p=B(B, $(7"7"!#C!;"E"S"G!;"7"2"[!;"D"["#"G!>(B - South East Asia: $,1\'\f\:\V\4\?\]\:(B, (1JP:R-4U(B, $,1H9H$HYrmH"HH3gGO<6b727>(B) $,17(7.787M6u7>70(B Braille $,2(3(1('('(5(B -Burmese ($,1H9HYH;H4HYrlH9HL(B) $,1H9H$HYrmH"HRJRERG(B) (1JP:R-4U(B / (1"mcKib*!4U(B Malayalam ($,1@N@R@O@^@S@"(B) $,1@H@N@X@m@5@^@P@"(B Maltese (il-Malti) Bon,Cu(Bu / Sa,C11(Ba -Mathematics $B"O(B p $A!J(B world $(O#@(B hello p $A!u(B +Mathematics $,1x (B p $,1x((B world $,1s"(B hello p $,2!a(B Nederlands, Vlaams Hallo / Dag Norwegian (norsk) Hei / God dag Oriya ($,1:s;\;?:f(B) $,1;6;A;#;?;,;G(B diff -r e56f669f17ce -r fe07c47cf7a7 etc/MORE.STUFF --- a/etc/MORE.STUFF Wed May 12 14:32:06 2010 +0200 +++ b/etc/MORE.STUFF Thu May 13 15:13:52 2010 +0200 @@ -215,6 +215,10 @@ * Quack: Quack enhances Emacs support for Scheme. + * QWE: + QWE's not WEB for Emacs is a quasi-WYSIWYG literate programming system for + Emacs that can be used with almost every programming language. + * Session: Session Management for Emacs. diff -r e56f669f17ce -r fe07c47cf7a7 etc/NEWS --- a/etc/NEWS Wed May 12 14:32:06 2010 +0200 +++ b/etc/NEWS Thu May 13 15:13:52 2010 +0200 @@ -30,20 +30,25 @@ These provide no new functionality, they just remove the need to edit lib-src/Makefile by hand in order to use the associated features. +--- +** There is a new configure option --with-crt-dir. +This is only useful if your crt*.o files are in a non-standard location. + +** Configure links against libselinux if it is found. +You can disable this by using --without-selinux. + * Startup Changes in Emacs 24.1 * Changes in Emacs 24.1 +** Completion can cycle, depending on completion-cycle-threshold. + ** auto-mode-case-fold is now enabled by default. +++ ** Emacs now supports display and editing of bidirectional text. -Warning: This is still very much experimental! The existing support -is minimal, and when it's turned on (see below), many features are -likely to give unexpected results, or break, or even crash! Use at -your own risk! See the node "Bidirectional Editing" in the Emacs Manual for some initial documentation. @@ -62,12 +67,34 @@ bidirectionality" class implementation of the Unicode Bidirectional Algorithm. +Note that some advanced display features, such as overlay strings and +`display' text properties, do not yet work correctly when +bidirectional text is reordered for display. + ** GTK scroll-bars are now placed on the right by default. Use `set-scroll-bar-mode' to change this. +** GTK tool bars can have just text, just images or images and text. +Customize `tool-bar-style' to choose style. On a Gnome desktop, the default +is taken from the desktop settings. + ** Lucid menus and dialogs can display antialiased fonts if Emacs is built with Xft. +** Basic SELinux support has been added. +This requires Emacs to be linked with libselinux at build time. + +*** Emacs preserves the SELinux file context when backing up, and +optionally when copying files. To this end, copy-file has an extra +optional argument, and backup-buffer and friends include the SELinux +context in their return values. + +*** The new functions file-selinux-context and set-file-selinux-context +get and set the SELinux context of a file. + +*** Tramp offers handlers for file-selinux-context and set-file-selinux-context +for remote machines which support SELinux. + ** New scrolling commands `scroll-up-command' and `scroll-down-command' (bound to C-v/[next] and M-v/[prior]) does not signal errors at top/bottom of buffer at first key-press (instead moves to top/bottom of buffer) @@ -76,16 +103,31 @@ ** New scrolling commands `scroll-up-line' and `scroll-down-line' scroll a line instead of full screen. -** New variable `scroll-preserve-screen-position-commands' defines -a list of scroll command affected by `scroll-preserve-screen-position. +** New property `scroll-command' should be set on a command's symbol to +define it as a scroll command affected by `scroll-preserve-screen-position. * Editing Changes in Emacs 24.1 +** completion-at-point is now an alias for complete-symbol. + +** mouse-region-delete-keys has been deleted. + +** If delete-file is called with a prefix argument, it really deletes, +regardless of the value of `delete-by-moving-to-trash'. + * Changes in Specialized Modes and Packages in Emacs 24.1 +** Archive Mode has basic support to browse 7z archives. + +** In ido-mode, C-v is no longer bound to ido-toggle-vc. +The reason is that this interferes with cua-mode. + ** partial-completion-mode is now obsolete. +You can get a comparable behavior with: +(setq completion-styles '(partial-completion initials)) +(setq completion-pcm-complete-word-inserts-delimiters t) ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags. ** Customize @@ -104,28 +146,54 @@ ** VC and related modes -*** New VC commands: vc-log-incoming and vc-log-outgoing. +*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file. *** vc-dir for Bzr supports viewing shelve contents and shelving snapshots. *** Special markup can be added to log-edit buffers. - -**** For Bzr, adding an -Author: NAME -line will add "--author NAME" to the "bzr commit" command. - -**** For Git, adding an -Author: NAME -line will add "--author NAME" to the "git commit" command. - -**** For Hg, adding an -Author: NAME -line will add "--user NAME" to the "hg commit" command. +The log-edit buffers are expected to have a format similar to email messages +with headers of the form: + Author: + Summary: + Fixes: +Some backends handle some of those headers specially, but any unknown header +is just left as is in the message, so it is not lost. ** Directory local variables can apply to file-less buffers. For example, adding "(diff-mode . ((mode . whitespace)))" to your -.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* -buffers. +.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers. + +** SQL Mode enhancements. + +*** Several variables have been marked as safe local variables. +The variables `sql-product', `sql-user', `sql-server', and +`sql-database' can now be safely used as local variables. + +*** Added ability to login with a port on MySQL. +The custom variable `sql-port' can be specified for connection to +MySQL servers. + +*** Custom variables control prompting for login parameters. +Each supported product has a custom variable `sql-*-login-params' +which is a list of the parameters to be prompted for before a +connection is established. + +*** Added option `sql-send-terminator'. +When set makes sure that each command sent with `sql-send-*' commands +are properly terminated and submitted to the SQL processor. + +*** Added option `sql-oracle-scan-on'. +When set commands sent to Oracle's SQL*Plus are scanned for strings +starting with an ampersand and the user is asked for replacement +text. In general, the SQL*Plus option SCAN should be set OFF under +SQL interactive mode. + +*** SQL interactive mode will replace tabs with spaces. +This prevents the comand interpretter for MySQL and Postgres from +listing object name completions when being sent text via +`sql-send-*' functions. + +*** An API for manipulating SQL product definitions has been added. ** s-region.el is now declared obsolete, superceded by shift-select-mode enabled by default in 23.1. @@ -146,11 +214,20 @@ * Incompatible Lisp Changes in Emacs 24.1 +** Test for special mode-class was moved from view-file to view-buffer. + ** Passing a nil argument to a minor mode function now turns the mode ON unconditionally. * Lisp changes in Emacs 24.1 +** define-minor-mode accepts a new keyword :variable. + +** delete-file now accepts an optional second arg, FORCE, which says +to always delete and ignore the value of delete-by-moving-to-trash. + +** buffer-substring-filters is obsoleted by filter-buffer-substring-functions. + ** New completion style `substring'. ** Image API diff -r e56f669f17ce -r fe07c47cf7a7 etc/NEWS.23 --- a/etc/NEWS.23 Wed May 12 14:32:06 2010 +0200 +++ b/etc/NEWS.23 Thu May 13 15:13:52 2010 +0200 @@ -14,93 +14,81 @@ You can narrow news to a specific version by calling `view-emacs-news' with a prefix argument or by typing C-u C-h C-n. - -Temporary note: - +++ indicates that the appropriate manual has already been updated. - --- means no change in the manuals is called for. -When you add a new item, please add it without either +++ or --- -so we will look at it and add it to the manual. - * Installation Changes in Emacs 23.2 -** New configure options for Emacs developers +** New configure options for Emacs developers. These are not new features; only the configure flags are new. ---- + *** --enable-profiling builds Emacs with profiling enabled. This might not work on all platforms. ---- + *** --enable-checking[=OPTIONS] builds emacs with extra runtime checks. ---- ** `make install' now consistently ignores umask, creating a world-readable install. ** Emacs compiles with Gconf support, if it is detected. Use the configure option --without-gconf to disable this. +This is used by the `font-use-system-font' feature (see below). * Startup Changes in Emacs 23.2 -+++ + ** The command-line option -Q (--quick) also inhibits loading X resources. However, if Emacs is compiled with the Lucid or Motif toolkit, X resource settings for the graphical widgets are still applied. On Windows, the -Q option causes Emacs to ignore Registry settings, but environment variables set on the Registry are still honored. -+++ + *** The new variable `inhibit-x-resources' shows whether X resources were loaded. -+++ ** New command-line option -mm (--maximized) maximizes the initial frame. * Changes in Emacs 23.2 -+++ ** The maximum size of buffers (and the largest fixnum) is doubled. On typical 32bit systems, buffers can now be up to 512MB. ---- ** The default value of `trash-directory' is now nil. This means that `move-file-to-trash' trashes files according to freedesktop.org specifications, the same method used by the Gnome, KDE, and XFCE desktops. (This change has no effect on Windows, which uses `system-move-file-to-trash' for trashing.) -+++ ** The pointer now becomes invisible when typing. Customize `make-pointer-invisible' to disable this feature. ** Font changes -+++ + *** Emacs can use the system default monospaced font in Gnome. To enable this feature, set `font-use-system-font' to non-nil (it is nil by default). If the system default changes, Emacs changes also. This feature requires Gconf support, which is automatically included at compile-time if configure detects the gconf libraries (you can disable this with the configure option --without-gconf). ---- + *** On X11, Emacs reacts to Xft changes made by configuration tools, via the XSETTINGS mechanism. This includes antialias, hinting, hintstyle, RGBA, DPI and lcdfilter changes. -+++ ** Killing a buffer with a running process now asks for confirmation. To remove this query, remove `process-kill-buffer-query-function' from `kill-buffer-query-functions', or set the appropriate process flag with `set-process-query-on-exit-flag'. ** File-local variable changes -+++ + *** Specifying a minor mode as a local variables enables that mode, unconditionally. The previous behavior, toggling the mode, was neither reliable nor generally desirable. -*** New commands for adding and removing file-local variables: +*** There are new commands for adding and removing file-local variables: `add-file-local-variable', `delete-file-local-variable', `add-file-local-variable-prop-line', and `delete-file-local-variable-prop-line'. -*** New commands for adding and removing directory-local variables, +*** There are new commands for adding and removing directory-local variables, and copying them to and from file-local variable lists: `add-dir-local-variable', `delete-dir-local-variable', `copy-dir-locals-to-file-locals', @@ -108,55 +96,63 @@ `copy-file-locals-to-dir-locals'. ** Internationalization changes -+++ + *** Unibyte sessions are now considered obsolete. This refers to the EMACS_UNIBYTE environment variable as well as the --unibyte, --multibyte, --no-multibyte, and --no-unibyte command line arguments. Customizing enable-multibyte-characters and setting default-enable-multibyte-characters are also deprecated. ---- + *** New coding system `utf-8-hfs'. This is suitable for default-file-name-coding-system on Mac OS X; see international/ucs-normalize.el. ---- ** Function arguments in *Help* buffers are now shown in upper-case. Customize `help-downcase-arguments' to t to show them in lower-case. +** New command `async-shell-command', bound globally to `M-&'. +This executes the command asynchronously, similar to calling `M-!' and +manually adding an ampersand to the end of the command. With `M-&', +you don't need the ampersand. The output appears in the buffer +`*Async Shell Command*'. + +** When running in a new enough xterm (newer than version 242), Emacs +asks xterm what the background color is and it sets up faces +accordingly for a dark background if needed (the current default is to +consider the background light). + * Editing Changes in Emacs 23.2 ** Kill-ring and selection changes -+++ + *** If `select-active-regions' is t, any active region automatically becomes the primary selection (for interaction with other window applications). If you enable this, you might want to bind `mouse-yank-primary' to Mouse-2. -+++ + *** When `save-interprogram-paste-before-kill' is non-nil, the kill commands save the interprogram-paste selection into the kill ring before doing anything else. This avoids losing the selection. -+++ + *** When `kill-do-not-save-duplicates' is non-nil, identical subsequent kills are not duplicated in the `kill-ring'. ** Completion changes *** The new command `completion-at-point' provides mode-sensitive completion. -+++ + *** tab-always-indent set to `complete' lets TAB do completion as well. -+++ + *** The new completion-style `initials' is available. For instance, this can complete M-x lch to list-command-history. ---- + *** The new variable `completions-format' determines how completions are displayed in the *Completions* buffer. If you set it to `vertical', completions are sorted vertically in columns. -+++ ** The default value of `blink-matching-paren-distance' is increased. ---- ** M-n provides more default values in the minibuffer for commands that read file names. These include the file name at point (when ffap is loaded without ffap-bindings), the file name on the current line @@ -164,56 +160,44 @@ (for Dired commands that operate on several directories, such as copy, rename, or diff). -+++ ** M-r is bound to the new `move-to-window-line-top-bottom'. This moves point to the window center, top and bottom on successive invocations, in the same spirit as the C-l (recenter-top-bottom) command. -+++ ** The new variable `recenter-positions' determines the default cycling order of C-l (`recenter-top-bottom'). -+++ ** The abbrevs file is now a file named abbrev_defs in user-emacs-directory; but the old location, ~/.abbrev_defs, is used if that file exists. + * Changes in Specialized Modes and Packages in Emacs 23.2 ** The bookmark menu has a narrowing search via bookmark-bmenu-search. -** LaTeX mode now provides completion (via completion-at-point). - ---- -** sym-comp.el is now declared obsolete, superceded by completion-at-point. - -** lucid.el and levents.el are now declared obsolete. - -** pcomplete provides a new command `pcomplete-std-completion' which -is similar to `pcomplete' but using the standard completion UI code. - ** Calc -+++ + *** The Calc settings file is now a file named calc.el in user-emacs-directory; but the old location, ~/.calc.el, is used if that file exists. ---- + *** Graphing commands (`g f' etc.) now work on MS-Windows, if you have the native Windows port of Gnuplot version 3.8 or later installed. ** Calendar and diary -+++ + *** Fancy diary display is now the default. If you prefer the simple display, customize `diary-display-function'. -+++ + *** The diary's fancy display now enables view-mode. ---- + *** The command `calendar-current-date' accepts an optional argument giving an offset from today. ** Desktop ---- + *** The default value for `desktop-buffers-not-to-save' is nil. This means Desktop will try restoring all buffers, when you restart your Emacs session. Also, `desktop-buffers-not-to-save' is only @@ -222,23 +206,37 @@ `desktop-files-not-to-save' instead. ** Dired -+++ + *** The new variable `dired-auto-revert-buffer', if non-nil, causes Dired buffers to be reverted automatically on revisiting them. ** DocView -+++ + *** When `doc-view-continuous' is non-nil, scrolling a line on the page edge advances to the next/previous page. +** Elint + +*** Elint now uses compilation-mode. + +*** Elint can now scan individual files and whole directories, +and can be run in batch mode. + +*** Elint does a more thorough initialization, and recognizes more built-in +functions and variables. Customize `elint-scan-preloaded' if you want +to sacrifice some accuracy for a faster startup. + +*** Elint attempts some basic understanding of featurep and (f)boundp tests. + +*** Customize `elint-ignored-warnings' to suppress some warnings. + ** GDB-UI *** Toolbar functionality for reverse debugging. Display of STL -collections as watch expressions. These features require GDB 7.0 -or later. +collections as watch expressions. These features require GDB 7.0 or later. ** Grep -+++ + *** A new command `zrgrep' searches recursively in gzipped files. ** Info @@ -250,7 +248,8 @@ manual that generates an Info file which gives the same information through a menu structure. -+++ +** LaTeX mode now provides completion (via completion-at-point). + ** Message mode is now the default mode for composing mail. The default for `mail-user-agent' is now message-user-agent, so the @@ -260,7 +259,6 @@ for several years. It provides several features that are absent in Mail mode, such as MIME handling. ---- *** If the user has not customized mail-user-agent, `compose-mail' checks for Mail mode customizations, and issues a warning if these customizations are found. This alerts users who may otherwise be @@ -268,107 +266,87 @@ To disable this check, set compose-mail-user-agent-warnings to nil. ---- ** The default value of mail-interactive is t, since Emacs 23.1. (This was not announced at the time.) It means that when sending mail, Emacs will wait for the process sending mail to return. If you experience delays when sending mail, you may wish to set this to nil. -+++ ** nXML mode is now the default for editing XML files. +** pcomplete provides a new command `pcomplete-std-completion' which +is similar to `pcomplete' but using the standard completion UI code. + ** Shell (and other comint modes) -+++ + *** M-s is no longer bound to `comint-next-matching-input'. -+++ + *** M-r is now bound to `comint-history-isearch-backward-regexp'. This starts an incremental search of the comint/shell input history. -+++ + *** ansi-color is now enabled by default in Shell mode. To disable it, set ansi-color-for-comint-mode to nil. ** Tramp -+++ + *** New connection methods "rsyncc", "imap" and "imaps". On systems which support GVFS-Fuse, Tramp offers also the new connection methods "dav", "davs", "obex" and "synce". ** VC and related modes -+++ + *** When using C-x v v or C-x v i on a unregistered file that is in a directory not controlled by any VCS, ask the user what VC backend to use to create a repository, create a new repository and register the file. -+++ + *** New command `vc-root-print-log', bound to `C-x v L'. This displays a `*vc-change-log*' buffer showing the history of the version-controlled directory tree as a whole. -+++ + *** New command `vc-root-diff', bound to `C-x v D'. This is similar to `vc-diff', but compares the entire directory tree of the current VC directory with its working revision. -+++ + *** `C-x v l' and `C-x v L' do not show the full log by default. The number of entries shown can be chosen interactively with a prefix argument, or by customizing vc-log-show-limit. The `*vc-change-log*' buffer now contains buttons at the end of the buffer, which can be used to increase the number of entries shown. RCS, SCCS, and CVS do not support this feature. ---- + *** vc-annotate supports annotations through file copies and renames, it displays the old names for the files and it can show logs/diffs for the corresponding lines. Currently only Git and Mercurial take advantage of this feature. ---- + *** The log command in vc-annotate can display a single log entry instead of redisplaying the full log. The RCS, CVS and SCCS VC backends do not support this. ---- + *** When a file is not found, VC will not try to check it out of RCS anymore. *** Diff and log operations can be used from Dired buffers. *** vc-git changes -**** The short log format for git makes use of the graph display, so -it's not supported on git versions earlier than 1.5. - -**** Support for operating with stashes has been added to vc-dir: the stash list is -displayed in the *vc-dir* header, stashes can be created, removed, applied and -their content displayed. - -**** vc-dir displays the stash status - -**** vc-dir requires at least git-1.5.5. +**** The short log format for git makes use of the graph display, +so it's not supported on git versions earlier than 1.5.6. + +**** vc-dir uses the --relative option of git, and so requires at least +git version 1.5.5. + +**** Support for operating with stashes has been added to vc-dir: +the stash list is displayed in the *vc-dir* header, stashes can be +created, removed, applied and their content displayed. *** vc-bzr supports operating with shelves: the shelve list is displayed in the *vc-dir* header, shelves can be created, removed and applied. ---- + *** log-edit-strip-single-file-name controls whether or not single filenames are stripped when copying text from the ChangeLog to the *VC-Log* buffer. -** Elint ---- -*** Elint now uses compilation-mode. ---- -*** Elint can now scan individual files and whole directories, -and can be run in batch mode. ---- -*** Elint does a more thorough initialization, and recognizes more built-in -functions and variables. Customize `elint-scan-preloaded' if you want -to sacrifice some accuracy for a faster startup. ---- -*** Elint attempts some basic understanding of featurep and (f)boundp tests. ---- -*** Customize `elint-ignored-warnings' to suppress some warnings. - ** Miscellaneous -+++ -*** The new command `async-shell-command' bound globally to `M-&' executes -the command asynchronously without the need to manually add ampersand to -the end of the command. Its output appears in the buffer `*Async Shell -Command*'. -+++ + *** Interactively `multi-isearch-buffers' and `multi-isearch-buffers-regexp' read buffer names to search, one by one, ended with RET. With a prefix argument, they ask for a regexp, and search in buffers whose names match @@ -376,19 +354,20 @@ `multi-isearch-files-regexp' read file names to search, one by one, ended with RET. With a prefix argument, they ask for a wildcard, and search in file buffers whose file names match the specified wildcard. -+++ + *** Autorevert Tail mode now works also for remote files. -+++ -*** The new built-in commands `su' and `sudo' support Tramp. -That means, they change `default-directory' to the new users value, -and let commands run under that user permissions. It works even when + +*** The new eshell built-in commands `su' and `sudo' support Tramp. +Thus, they change `default-directory' to reflect the new user id, and +let commands run under that user's permissions. This works even when `default-directory' is already remote. Calling the external commands -is possible by `*su' or `*sudo', repectively. ---- -*** When running in a new enough xterm (newer than version 242), Emacs -asks xterm what the background color is and it sets up faces -accordingly for a dark background if needed (the current default is to -consider the background light). +is possible via `*su' or `*sudo', respectively. + +** Obsolete packages + +*** sym-comp.el is now obsolete, superseded by completion-at-point. + +*** lucid.el and levents.el are now obsolete. * New Modes and Packages in Emacs 23.2 @@ -422,7 +401,6 @@ ** htmlfontify.el turns a fontified Emacs buffer into an HTML page. -+++ ** js.el is a new major mode for JavaScript files. ** imap-hash.el is a new library to address IMAP mailboxes as hashtables. @@ -430,7 +408,6 @@ * Incompatible Lisp Changes in Emacs 23.2 -+++ ** The Lisp reader turns integers that are too large/small into floats. For instance, on machines where `536870911' is the largest integer, reading `536870912' gives the floating-point object `536870912.0'. @@ -438,7 +415,6 @@ This change only concerns the Lisp reader; it does not affect how actual integer objects overflow. ---- ** Several obsolete functions removed. The functions have been obsolete since Emacs 19, and are unlikely to be in use: @@ -448,24 +424,23 @@ time-stamp-yyyy-mm-dd, time-stamp-yymmdd, time-stamp-hh:mm:ss, time-stamp-hhmm, baud-rate ---- ** Support for generating Emacs 18 compatible bytecode (by setting the variable `byte-compile-compatibility') has been removed. -** In image-mode.el `image-mode-maybe' is obsolete. Instead, you can -either use `image-mode' that displays an image file as the actual image -inititally, or `image-mode-as-text' when you want to display an image file -as text inititally. `image-mode-as-text' is a combination of a non-image -mode from `auto-mode-alist' (or Fundamental mode) and `image-minor-mode'. -`image-minor-mode' provides `C-c C-c' key binding to toggle image display. +** In image-mode.el `image-mode-maybe' is obsolete. +Instead, you can either use `image-mode' (which displays an image file +as the actual image initially), or `image-mode-as-text' (when you want +to display an image file as text initially). `image-mode-as-text' is a +combination of a non-image mode from `auto-mode-alist' (or Fundamental +mode) and `image-minor-mode'. `image-minor-mode' provides a `C-c C-c' +key binding to toggle image display. `image-toggle-display-text' removes image properties. `image-toggle-display-image' adds image properties. -`image-toggle-display' toggles between `image-mode-as-text' and -`image-mode'. +`image-toggle-display' toggles between `image-mode-as-text' and `image-mode'. * Lisp changes in Emacs 23.2 ---- + ** All the default-FOO variables that hold the default value of the FOO variable, are now declared obsolete. @@ -473,10 +448,10 @@ It reads a single key, but obeys input and escape sequence decoding. ** Frame parameter changes -+++ + *** You can give the `fullscreen' frame parameter the value `maximized'. This maximizes the frame. -+++ + *** The new frame parameter `sticky' makes Emacs frames sticky in virtual desktops. @@ -490,23 +465,23 @@ *** New function `completion-in-region' to use the standard completion facilities on a particular region of text. -+++ + *** The 4th arg to all-completions (aka hide-spaces) is declared obsolete. *** completion-annotate-function specifies how to compute annotations for completions displayed in *Completions*. ** Minibuffer changes ---- + *** read-file-name-predicate is obsolete. It was used to pass the predicate to read-file-name-internal because read-file-name-internal abused its `pred' argument to pass the current directory, but this hack is not needed any more. ** Changes to file-manipulation functions -+++ + *** `delete-directory' has an optional parameter RECURSIVE. -+++ + *** New function `copy-directory', which copies a directory recursively. ** called-interactively-p now takes one argument and replaces interactive-p @@ -521,34 +496,33 @@ of bindings. ** Network and process changes -+++ + *** start-process-shell-command and start-file-process-shell-command now only take a single `command' argument. -+++ + *** The new variable `process-file-side-effects' should be set to nil if a `process-file' call does not change a remote file. This allows file name handlers such as Tramp to optimizations. -+++ + *** make-network-process can now also create `seqpacket' Unix sockets. ** Loading changes ---- + *** eval-next-after-load is obsolete. -+++ + *** New hook `after-load-functions' run after loading an Elisp file. ** Byte compilation changes ---- + *** Changing the file-names generated by byte-compilation by redefining the function `byte-compile-dest-file' before loading bytecomp.el is obsolete. Instead, customize byte-compile-dest-file-function. ---- + *** `byte-compile-warnings' has new members, `constants' and `suspicious'. ** New macro with-silent-modifications to tweak text properties without affecting the buffer's modification state. -+++ ** Hash tables have a new printed representation that is readable. The feature `hashtable-print-readable' identifies this new functionality. @@ -561,17 +535,14 @@ ucs-normalize-HFS-NFD-region, ucs-normalize-HFS-NFD-string, ucs-normalize-HFS-NFC-region, ucs-normalize-HFS-NFC-string. -+++ ** Face aliases can now be marked as obsolete, using the macro `define-obsolete-face-alias'. -+++ ** New function `window-full-height-p', analogous to the full-width version. * Changes in Emacs 23.2 on non-free operating systems ---- ** On MS-Windows, `display-time' now displays the system load average as well as the time, as it does on GNU and Unix. @@ -1379,11 +1350,11 @@ ** Gnus *** The Gnus package has been updated -There are many news features, bug fixes and improvements; see the file +There are many new features, bug fixes and improvements; see the file GNUS-NEWS or the node "No Gnus" in the Gnus manual for details. *** In Emacs 23, Gnus uses Emacs' new internal coding system `utf-8-emacs' for -saving articles drafts and ~/.newsrc.eld. These file may not be read +saving articles, drafts, and ~/.newsrc.eld. These file may not be read correctly in Emacs 22 and below. If you want to Gnus across different Emacs versions, you may set `mm-auto-save-coding-system' to `emacs-mule'. @@ -1436,8 +1407,8 @@ *** `C-h C-h' in Isearch mode displays isearch-specific Help screen, `C-h b' displays all Isearch key bindings, `C-h k' displays the full documentation of the given Isearch key sequence, `C-h m' displays -documentation of Isearch mode. All the rest Help commands exit Isearch mode -and execute their global definitions. +documentation for Isearch mode. All the other Help commands exit +Isearch mode and execute their global definitions. *** When started in the minibuffer, Isearch searches in the minibuffer history. See `Minibuffer changes', above. diff -r e56f669f17ce -r fe07c47cf7a7 etc/PROBLEMS --- a/etc/PROBLEMS Wed May 12 14:32:06 2010 +0200 +++ b/etc/PROBLEMS Thu May 13 15:13:52 2010 +0200 @@ -167,6 +167,17 @@ * Crash bugs +** Emacs crashes when running in a terminal, if compiled with GCC 4.5.0 +This version of GCC is buggy: see + + http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6031 + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43904 + +You can work around this error in gcc-4.5 by omitting sibling call +optimization. To do this, configure Emacs with + + CFLAGS="-g -O2 -fno-optimize-sibling-calls" ./configure + ** Emacs crashes in x-popup-dialog. This can happen if the dialog widget cannot find the font it wants to diff -r e56f669f17ce -r fe07c47cf7a7 etc/enriched.doc --- a/etc/enriched.doc Wed May 12 14:32:06 2010 +0200 +++ b/etc/enriched.doc Thu May 13 15:13:52 2010 +0200 @@ -219,7 +219,7 @@ paragraph properly filled all the time, without slowing down editing too much. Refill mode is a start at this, but needs - improvment. + improvement. + Refill after yank. [Refill mode does that.] @@ -272,4 +272,4 @@ 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 . + along with this program. If not, see <. diff -r e56f669f17ce -r fe07c47cf7a7 etc/refcards/orgcard.tex --- a/etc/refcards/orgcard.tex Wed May 12 14:32:06 2010 +0200 +++ b/etc/refcards/orgcard.tex Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,6 @@ % Reference Card for Org Mode -\def\orgversionnumber{6.33x} -\def\versionyear{2009} % latest update +\def\orgversionnumber{6.35i} +\def\versionyear{2010} % latest update \def\year{2010} % latest copyright year %**start of header @@ -11,10 +11,6 @@ % Specify how many you want here. \columnsperpage=3 -% Set letterpaper to 0 for A4 paper, 1 for letter (US) paper. Useful -% only when columnsperpage is 2 or 3. -\letterpaper=0 - % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for % a landscape layout. \input pdflayout.sty @@ -22,7 +18,7 @@ % Nothing else needs to be changed below this line. % Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, -% 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +% 2006, 2007, 2008, 2009 Free Software Foundation, Inc. % This file is part of GNU Emacs. @@ -279,12 +275,12 @@ \section{Getting Started} % -\vskip -2mm -\beginexample% -(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode)) -(define-key global-map "\\C-cl" 'org-store-link)$^1$ -(define-key global-map "\\C-ca" 'org-agenda)$^1$ -\endexample +%\vskip -2mm +%\beginexample% +%(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode)) +%(define-key global-map "\\C-cl" 'org-store-link)$^1$ +%(define-key global-map "\\C-ca" 'org-agenda)$^1$ +%\endexample % \metax{To read the on-line documentation try}{M-x org-info} @@ -374,9 +370,9 @@ {\bf Regions} -\key{cut rectangular region}{C-c C-x C-w} -\key{copy rectangular region}{C-c C-x M-w} -\key{paste rectangular region}{C-c C-x C-y} +\metax{cut/copy/paste rectangular region}{C-c C-x C-w/M-w/C-y} +%\key{copy rectangular region}{C-c C-x M-w} +%\key{paste rectangular region}{C-c C-x C-y} \key{fill paragraph across selected cells}{C-c C-q} {\bf Miscellaneous} diff -r e56f669f17ce -r fe07c47cf7a7 leim/ChangeLog --- a/leim/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/leim/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,11 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-04-06 Chong Yidong + + * quail/vntelex.el: Fix "af" rule (Bug#5836). + 2010-03-27 Eli Zaretskii * makefile.w32-in ($(TIT), $(MISC_DIC), leim-list.el): Enclose the diff -r e56f669f17ce -r fe07c47cf7a7 leim/quail/vntelex.el --- a/leim/quail/vntelex.el Wed May 12 14:32:06 2010 +0200 +++ b/leim/quail/vntelex.el Thu May 13 15:13:52 2010 +0200 @@ -285,7 +285,7 @@ ("Dd" ?,2p(B) ;("$$" ?$,1tK(B) ; U+20AB DONG SIGN (#### check) - ("aff" ["aff"]) + ("aff" ["af"]) ("AFF" ["AF"]) ("Aff" ["Af"]) ("ass" ["as"]) diff -r e56f669f17ce -r fe07c47cf7a7 lib-src/ChangeLog --- a/lib-src/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lib-src/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,61 @@ +2010-05-12 Glenn Morris + + * Makefile.in (INSTALLABLES): Remove @LIB_SRC_EXTRA_INSTALLABLES@. + +2010-05-11 Glenn Morris + + * Makefile.in (.m.o): Remove, there are no .m files. + (BASE_CFLAGS): New variable. + (ALL_CFLAGS, LINK_CFLAGS, CPP_CFLAGS): Use $BASE_CFLAGS. + (check): Update the message. + (update-game-score${EXEEXT}): Do not use $MOVE_FLAGS. + + * Makefile.in: Convert comments to makefile format. + + * Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset. + (config.h) [MSDOS]: Do not include. + +2010-05-10 Glenn Morris + + * Makefile.in (LIBS_SYSTEM): Set with configure, not cpp. + (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM. + (NOT_C_CODE): Remove, no longer used. + (config.h) [!MSDOS]: No longer include. + (LOADLIBES): Use LIBS_SYSTEM as a variable. + + * Makefile.in (BLESSMAIL_TARGET): Set with configure, not cpp. + +2010-05-08 Christoph (tiny change) + + * makefile.w32-in (OTHER_PLATFORM_SUPPORT): Use parenthesis + for macros for nmake compatibility. + +2010-05-08 Glenn Morris + + * Makefile.in (THIS_IS_MAKEFILE): Remove, unused. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-06 Glenn Morris + + * Makefile.in: Minimize blessmail-related cpp usage. + (BLESSMAIL_TARGET): New variable. + (MOVEMAIL_NEEDS_BLESSING): Remove, replace by above variable. + (blessmail): Always define this rule. + (need-blessmail): New rule, split out from maybe-blessmail. + (maybe-blessmail): Use BLESSMAIL_TARGET. + +2010-05-04 Glenn Morris + + * Makefile.in: Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ rather than + @c_switch_system@, @c_switch_machine@. + +2010-04-26 Dan Nicolaescu + + * Makefile.in (LIBS_MACHINE): Remove all uses, unused. + 2010-04-12 Dan Nicolaescu * Makefile.in (ALL_CFLAGS, LINK_CFLAGS, CPP_CFLAGS): Move to the @@ -2988,7 +3046,7 @@ 2000-03-02 Gerd Moellmann - * etags.c (lisp_suffixes) Add `LSP'. + * etags.c (lisp_suffixes): Add `LSP'. 2000-02-10 Francesco Potortì diff -r e56f669f17ce -r fe07c47cf7a7 lib-src/Makefile.in --- a/lib-src/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/lib-src/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,6 @@ # Makefile for lib-src subdirectory in GNU Emacs. # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This file is part of GNU Emacs. @@ -32,10 +31,11 @@ CC=@CC@ CFLAGS=@CFLAGS@ version=@version@ +## Used in $archlibdir. configuration=@configuration@ EXEEXT=@EXEEXT@ -C_SWITCH_SYSTEM=@c_switch_system@ -C_SWITCH_MACHINE=@c_switch_machine@ +C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ +C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ # Program name transformation. TRANSFORM = @program_transform_name@ @@ -108,7 +108,7 @@ # Things that a user might actually run, # which should be installed in bindir. -INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} @LIB_SRC_EXTRA_INSTALLABLES@ +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, @@ -128,10 +128,13 @@ # Specify additional -D flags for movemail. Options: # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking). # See the comments about locking in movemail.c. Normally the values -# in ../src/[ms]/*.h should be correct and you should not need to do anything. -# If neither flag is set, blessmail is used. +# set by configure should be correct and you should not need to do anything. +# If neither flag is set, you need to use blessmail. MOVE_FLAGS= +## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail. +BLESSMAIL_TARGET=@BLESSMAIL_TARGET@ + ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4 KRB4LIB=@KRB4LIB@ ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425 @@ -152,65 +155,34 @@ ## Extra libraries to use when linking movemail. LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) +## Some systems define this to request special libraries. +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. -ALL_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} -LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS} -CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS} - -# ========================== start of cpp stuff ======================= -/* From here on, comments must be done in C syntax. */ - -#define THIS_IS_MAKEFILE -#define NOT_C_CODE -#include "../src/config.h" - -/* Some s/SYSTEM.h files define this to request special libraries. */ -#ifndef LIBS_SYSTEM -#define LIBS_SYSTEM -#endif +BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src -/* Some m/MACHINE.h files define this to request special libraries. */ -#ifndef LIBS_MACHINE -#define LIBS_MACHINE -#endif +ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} +LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} +CPP_CFLAGS = ${BASE_CFLAGS} ${CPPFLAGS} ${CFLAGS} -#undef MOVEMAIL_NEEDS_BLESSING -#ifndef MAIL_USE_FLOCK -#ifndef MAIL_USE_LOCKF -#define MOVEMAIL_NEEDS_BLESSING -#endif -#endif - -#ifdef MOVEMAIL_NEEDS_BLESSING -#define BLESSMAIL blessmail -#else -#define BLESSMAIL -#endif - -LOADLIBES=LIBS_SYSTEM LIBS_MACHINE +LOADLIBES=$(LIBS_SYSTEM) -.SUFFIXES: .m - -/* This is the default compilation command. - But we should never rely on it, because some make version - failed to find it for getopt.o. - Using an explicit command made it work. */ +## This is the default compilation command. +## But we should never rely on it, because some make version failed to +## find it for getopt.o. +## Using an explicit command made it work. .c.o: ${CC} -c ${CPP_CFLAGS} $< -.m.o: - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< - all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} -/* These targets copy the scripts into the build directory -so that they can be run from there in an uninstalled Emacs. -The "-" is prepended because some versions of cp barf when -srcdir is the current directory, and thus the file will be -copied into itself. */ +## These targets copy the scripts into the build directory so that +## they can be run from there in an uninstalled Emacs. +## The "-" is prepended because some versions of cp barf when srcdir +## is the current directory, and thus the file will be copied into itself. rcs2log: $(srcdir)/rcs2log -cp -p $(srcdir)/rcs2log rcs2log @@ -223,16 +195,15 @@ vcdiff: $(srcdir)/vcdiff -cp -p $(srcdir)/vcdiff vcdiff -#ifdef MOVEMAIL_NEEDS_BLESSING +## Only used if we need blessmail, but no harm in always defining. +## This makes the actual blessmail executable. blessmail: $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el chmod +x blessmail -#endif -maybe-blessmail: BLESSMAIL -#ifdef MOVEMAIL_NEEDS_BLESSING -/* Don\'t charge ahead and do it! Let the installer decide. - ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT} */ +## This checks if we need to run blessmail. +## Do not charge ahead and do it! Let the installer decide. +need-blessmail: blessmail @if [ `wc -l when the system - does not have one that works with the given compiler. */ +## We need the following in order to create a when the system +## does not have one that works with the given compiler. GETOPT_H = @GETOPT_H@ getopt.h: getopt_.h cp $(srcdir)/getopt_.h $@-t @@ -351,8 +324,8 @@ ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse -/* We depend on etags to assure that parallel makes don\'t write two - etags.o files on top of each other. */ +## 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 @@ -375,7 +348,7 @@ movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS) $(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?). */ +## 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 @@ -394,8 +367,10 @@ $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS) - $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} 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 \ -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" + +## Makefile ends here. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog --- a/lisp/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,1100 @@ +2010-05-12 Alan Mackenzie + + * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun): + Push the mark at the start of these functions when appropriate. + +2010-05-12 Stefan Monnier + + * minibuffer.el (completion-cycle-threshold): New custom var. + (completion--do-completion): Use it. + (minibuffer-complete): Use cycling if appropriate. + +2010-05-11 Juanma Barranquero + + * dirtrack.el (dirtrackp): Remove defcustom; don't make automatically + buffer-local (it's an obsolete alias for `dirtrack-mode') (bug#6173). + +2010-05-11 Juri Linkov + + * scroll-all.el (scroll-all-check-to-scroll): + Add `scroll-up-command' and `scroll-down-command' (bug#6164). + +2010-05-11 Stefan Monnier + + * iimage.el (iimage-mode-map): Move initialization into declaration. + (iimage-mode-buffer): Use with-silent-modifications. + Simplify calling convention. Adjust callers. + (iimage-mode): Don't run hook redundantly. + + * minibuffer.el (completion-pcm--pattern->regex): + Fix last change (bug#6160). + +2010-05-10 Juri Linkov + + Remove nodes visited during Isearch from the Info history. + * info.el (Info-isearch-initial-history) + (Info-isearch-initial-history-list): New variables. + (Info-isearch-start): Record initial values of + Info-isearch-initial-history and Info-isearch-initial-history-list. + Add Info-isearch-end to isearch-mode-end-hook. + (Info-isearch-end): New function. + +2010-05-10 Michael Albinus + + * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in + format string, in order to work around a bug in pdksh. + Reported by Gilles Pion . + (tramp-handle-verify-visited-file-modtime): Do not send a command + when the connection is not established. + (tramp-handle-set-file-times): Simplify the check for utc. + +2010-05-10 Juanma Barranquero + + Fix use of `filter-buffer-substring' (rework previous change). + * emulation/cua-base.el (cua--filter-buffer-noprops): New function. + (cua-repeat-replace-region): + * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle): + * emulation/cua-gmrk.el (cua-copy-region-to-global-mark) + (cua-cut-region-to-global-mark): Use it. + +2010-05-09 Michael R. Mauger + + * progmodes/sql.el: Version 2.1. + (sql-product-alist): Redesign structure of product info. + (sql-product, sql-user, sql-server, sql-database): Safe variables. + (sql-port, sql-port-history): New variables. + (sql-interactive-product): New variable. + (sql-send-terminator): New variable. + (sql-imenu-generic-expression): Add "Types" imenu entry. + (sql-oracle-login-params, sql-sqlite-login-params) + (sql-mysql-login-params, sql-solid-login-params) + (sql-sybase-login-params, sql-informix-login-params) + (sql-ingres-login-params, sql-ms-login-params) + (sql-postgres-login-params, sql-interbase-login-params) + (sql-db2-login-params, sql-linter-login-params) + (sql-oracle-scan-on): New variables. + (sql-mode-map): Add C-c C-i to start interactive mode. + (sql-mode-menu): Update existing menu entries. + (sql-font-lock-keywords-builder): Compile-time font-lock optimization. + (sql-mode-oracle-font-lock-keywords) + (sql-mode-postgres-font-lock-keywords) + (sql-mode-ms-font-lock-keywords) + (sql-mode-sybase-font-lock-keywords) + (sql-mode-informix-font-lock-keywords) + (sql-mode-interbase-font-lock-keywords) + (sql-mode-ingres-font-lock-keywords) + (sql-mode-solid-font-lock-keywords) + (sql-mode-mysql-font-lock-keywords) + (sql-mode-sqlite-font-lock-keywords) + (sql-mode-db2-font-lock-keywords) + (sql-mode-linter-font-lock-keywords): Update initialization to + reduce run-time complexity. + (sql-add-product, sql-del-product): New functions. + (sql-set-product-feature, sql-get-product-feature): New functions. + (sql-product-font-lock): Update product API. + (sql-add-product-keywords): New function. + (sql-highlight-product): Update product API. + (sql-help-list-products): New function. + (sql-help): Dynamically lists free and non-free products. + (sql-get-login): Correct bug in handling history and added + prompt for port. + (sql-copy-column): Copy without properties. + (sqli-input-sender): Apply filters to SQLi input. + (sql-query-placeholders-and-send): Obey `sql-oracle-scan-on' setting. + Implement as a filter. + (sql-escape-newlines-filter): Implement as a filter. + (sql-remove-tabs-filter): New function. + (sql-send-magic-terminator): New function. + (sql-send-string): Implement magic terminator. + (sql-send-region): Use `sql-send-string'. + (sql-interactive-mode): Use product API. + (sql-product-interactive): Use product API. + (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql) + (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase) + (sql-db2, sql-linter): Use `sql-product-interactive'. + (sql-connect): New function. + (sql-connect-oracle, sql-connect-sybase, sql-connect-informix) + (sql-connect-sqlite, sql-connect-mysql, sql-connect-solid) + (sql-connect-ingres, sql-connect-ms, sql-connect-postgres) + (sql-connect-interbase, sql-connect-db2, sql-connect-linter): + Use `sql-connect'. + +2010-05-09 Stefan Monnier + + * minibuffer.el (completion-pcm-complete-word-inserts-delimiters): + New custom variable. + (completion-pcm--string->pattern): Use it. + (completion-pcm--pattern->regex, completion-pcm--pattern->string): + Make it handle any symbol as `any'. + (completion-pcm--merge-completions): Extract common suffix for the new + `prefix' symbol as well. + (completion-substring--all-completions): Use the new `prefix' symbol. + +2010-05-09 Michael Albinus + + * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if + not bound. + (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. + (tramp-compat-funcall): New defmacro. + (tramp-compat-line-beginning-position) + (tramp-compat-line-end-position) + (tramp-compat-temporary-file-directory) + (tramp-compat-make-temp-file, tramp-compat-file-attributes) + (tramp-compat-copy-file, tramp-compat-copy-directory) + (tramp-compat-delete-file, tramp-compat-delete-directory) + (tramp-compat-number-sequence, tramp-compat-process-running-p) + * net/tramp.el (top, with-progress-reporter) + (tramp-rfn-eshadow-setup-minibuffer) + (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) + (tramp-handle-dired-compress-file, tramp-handle-shell-command) + (tramp-completion-mode-p, tramp-check-for-regexp) + (tramp-open-connection-setup-interactive-shell) + (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) + (tramp-time-diff, tramp-coding-system-change-eol-conversion) + (tramp-set-process-query-on-exit-flag, tramp-unload-tramp) + * net/tramp-cmds.el (tramp-cleanup-all-connections) + (tramp-reporter-dump-variable, tramp-load-report-modules) + (tramp-append-tramp-buffers) + * net/tramp-gvfs.el (tramp-gvfs-handle-file-selinux-context): Use it. + + * net/tramp-imap.el (top): Autoload `epg-make-context'. + +2010-05-08 Stefan Monnier + + * progmodes/compile.el (compilation-buffer-modtime): Rename from + buffer-modtime. Adjust users. + +2010-05-08 Chong Yidong + + * international/mule.el (auto-coding-alist): Only purecopy + car of each item, not the whole list (Bug#6083). + +2010-05-08 Chong Yidong + + * progmodes/js.el (js-mode): Make paragraph variables local before + calling c-setup-paragraph-variables (Bug#6071). + +2010-05-08 Eli Zaretskii + + * composite.el (compose-region, reference-point-alist): Fix typos + in the doc strings. + +2010-05-08 Alexander Klimov (tiny change) + + * calc/calc-graph.el (calc-graph-plot): Use the proper form for + gnuplot's "set" command. + +2010-05-08 Juanma Barranquero + + * abbrev.el (last-abbrev-text): Doc fix. + (abbrev-prefix-mark): Don't escape parenthesis. + +2010-05-08 Andreas Schwab + + * composite.el (find-composition): Doc fix. + +2010-05-08 Juanma Barranquero + + * progmodes/sql.el (sql-electric-stuff): Fix typo in tag. + (sql-oracle-program, sql-sqlite-options) + (sql-query-placeholders-and-send): Doc fixes. + (sql-set-product, sql-interactive-mode): Reflow docstrings. + (sql-imenu-generic-expression, sql-buffer) + (sql-mode-ansi-font-lock-keywords, sql-mode-oracle-font-lock-keywords) + (sql-mode-postgres-font-lock-keywords, sql-mode-ms-font-lock-keywords) + (sql-mode-sybase-font-lock-keywords) + (sql-mode-informix-font-lock-keywords) + (sql-mode-interbase-font-lock-keywords) + (sql-mode-ingres-font-lock-keywords, sql-mode-solid-font-lock-keywords) + (sql-mode-mysql-font-lock-keywords, sql-mode-sqlite-font-lock-keywords) + (sql-mode-db2-font-lock-keywords, sql-mode-font-lock-keywords) + (sql-product-feature, sql-highlight-product) + (comint-line-beginning-position, sql-rename-buffer) + (sql-toggle-pop-to-buffer-after-send-region sql-oracle) + (sql-sybase, sql-informix, sql-sqlite, sql-mysql, sql-solid) + (sql-ingres, sql-ms, sql-postgres, sql-interbase, sql-db2, sql-linter): + Fix typos in docstrings. + +2010-05-08 Juri Linkov + + * info.el (Info-fontify-node): Put Info-breadcrumbs to the `display' + property instead of `invisible' and `after-string' (bug#5998). + +2010-05-08 Juri Linkov + + * image-mode.el (image-mode-as-text): Fix typo in docstring. + +2010-05-08 Juanma Barranquero + + * filecache.el (file-cache-add-directory-list) + (file-cache-add-directory-recursively): Fix typos in docstrings. + +2010-05-08 Kenichi Handa + + * language/indian.el (gurmukhi-composable-pattern): Fix typo. + (gujarati-composable-pattern): Fix typo. + +2010-05-08 Kenichi Handa + + * language/indian.el (oriya-composable-pattern) + (tamil-composable-pattern, malayalam-composable-pattern): + Add two-part vowels to "v" (vowel sign). + +2010-05-08 Chong Yidong + + * files.el (copy-directory): Handle symlinks (Bug#5982). + +2010-05-08 Dan Nicolaescu + + * vc-hg.el (vc-hg-state): Use HGRCPATH, not HGRC. + (vc-hg-working-revision): Likewise. Use hg parents, not hg parent + (Bug#5846). + +2010-05-08 Glenn Morris + + * emacs-lisp/lisp.el (lisp-completion-at-point): Give it a doc string. + + * minibuffer.el (completion-at-point): Doc fix. + +2010-05-08 Stefan Monnier + + * electric.el (Electric-command-loop): Minor tweak. + + * ebuff-menu.el (electric-buffer-list): Try and make it behave a bit + better with dedicated windows. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-07 Deniz Dogan (tiny change) + Stefan Monnier + + Highlight vendor specific properties. + * textmodes/css-mode.el (css-proprietary-nmstart-re): New var. + (css-proprietary-property): New face. + (css-font-lock-keywords): Use them. + +2010-05-07 Eli Zaretskii + + * cus-start.el (all): Add native condition for tool-bar-* symbols. + +2010-05-07 Stefan Monnier + + * textmodes/dns-mode.el (auto-mode-alist): Add entry for .zone files. + * files.el (auto-mode-alist): Remove redundant entries. + + * files.el (auto-save-mode): Move to simple.el to fix bootstrap. + * 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) + + * lisp/epg.el (epg-key-capablity-alist): Add "D" flag (Bug#5592). + +2010-05-07 Katsumi Yamaoka + + * mail/binhex.el (binhex-decode-region-internal) + * mail/uudecode.el (uudecode-decode-region-internal) + * net/dns.el (dns-read-string-name, dns-write, dns-read) + (dns-read-type, dns-query) + * pgg-parse.el (pgg-parse-armor) + * pgg.el (pgg-verify-region) + * sha1.el (sha1-string-external): Don't run set-buffer-multibyte for + XEmacs. + + * net/imap.el (imap-disable-multibyte): Redefine it as a macro. + +2010-05-07 Juanma Barranquero + + * progmodes/cperl-mode.el (cperl-mode-unload-function): New function. + + Fix use of `filter-buffer-substring' (4th arg NOPROPS removed). + * emulation/cua-base.el (cua-repeat-replace-region): + * emulation/cua-gmrk.el (cua-copy-region-to-global-mark) + (cua-cut-region-to-global-mark): + Remove text properties with `set-text-properties'. + +2010-05-06 Michael Albinus + + * net/tramp.el (top, with-progress-reporter): + Use `symbol-function' inside `funcall'. + + * net/tramp-compat.el (tramp-compat-file-attributes) + (tramp-compat-delete-file, tramp-compat-delete-directory): + Handle only `wrong-number-of-arguments' error. + + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Fix typo. + (tramp-gvfs-handle-file-selinux-context): Use `symbol-function' + inside `funcall'. + +2010-05-06 Stefan Monnier + + * minibuffer.el (completion--sreverse, completion--common-suffix): + New functions. + (completion-pcm--merge-completions): Extract common suffix when safe. + + * emacs-lisp/easy-mmode.el (define-minor-mode): + Make :variable more flexible. + * files.el (auto-save-mode): Use it to define using define-minor-mode. + +2010-05-05 Juri Linkov + + Add `slow' and `history' tags to the desktop data. + + * info.el (Info-virtual-nodes) [*Index*]: Add `slow' tag. + (Info-virtual-files) [*Apropos*]: Add `slow' tag. + (Info-finder-find-node): Require `finder.el' to be able + to restore node from the desktop. + (Info-desktop-buffer-misc-data): Save all nodes. Save additional + data `Info-history' and `slow' tag in the assoc list. + (Info-restore-desktop-buffer): Don't restore nodes with the + `slow' tag. Restore `Info-history'. + +2010-05-05 Michael Albinus + + Add FORCE argument to `delete-file'. + + * net/ange-ftp.el (ange-ftp-del-tmp-name): Make it a defun, + forcing to delete the temporary file. + (ange-ftp-delete-file): Add FORCE arg. + (ange-ftp-rename-remote-to-remote) + (ange-ftp-rename-local-to-remote, ange-ftp-rename-remote-to-local) + (ange-ftp-load, ange-ftp-compress, ange-ftp-uncompress): + Force file deletion. + + * net/tramp-compat.el (tramp-compat-delete-file): New defun. + + * net/tramp.el (tramp-handle-delete-file): Add FORCE arg. + (tramp-handle-make-symbolic-link, tramp-handle-load) + (tramp-do-copy-or-rename-file-via-buffer) + (tramp-do-copy-or-rename-file-directly) + (tramp-do-copy-or-rename-file-out-of-band) + (tramp-handle-process-file, tramp-handle-call-process-region) + (tramp-handle-shell-command, tramp-handle-file-local-copy) + (tramp-handle-insert-file-contents, tramp-handle-write-region) + (tramp-delete-temp-file-function): Use `tramp-compat-delete-file'. + + * net/tramp-fish.el (tramp-fish-handle-delete-file): Add FORCE arg. + (tramp-fish-handle-make-symbolic-link) + (tramp-fish-handle-process-file): Use `tramp-compat-delete-file'. + + * net/tramp-ftp.el (tramp-ftp-file-name-handler): + Use `tramp-compat-delete-file'. + + * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Add FORCE arg. + (tramp-gvfs-handle-write-region): Use `tramp-compat-delete-file'. + + * net/tramp-imap.el (tramp-imap-handle-delete-file): Add FORCE arg. + (tramp-imap-do-copy-or-rename-file): Use `tramp-compat-delete-file'. + + * net/tramp-smb.el (tramp-smb-handle-delete-file): Add FORCE arg. + (tramp-smb-handle-copy-file, tramp-smb-handle-file-local-copy) + (tramp-smb-handle-rename-file, tramp-smb-handle-write-region): Use + `tramp-compat-delete-file'. + +2010-05-05 Stefan Monnier + + Minor cleanups. + * subr.el (add-minor-mode): Use push. + * mail/supercite.el (sc-electric-mode): Use more descriptive arg name. + * emulation/edt.el (edt-select-mode): Simplify. + + Use define-minor-mode in more cases. + * term/tvi970.el (tvi970-set-keypad-mode): + * simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode) + (normal-erase-is-backspace-mode): + * scroll-bar.el (scroll-bar-mode): Use it and define-minor-mode. + (set-scroll-bar-mode-1): (Re)move to its sole caller. + (get-scroll-bar-mode): New function. + * emacs-lisp/cl-macs.el (eq): Handle a non-variable first arg. + + Use define-minor-mode for less obvious cases. + * emacs-lisp/easy-mmode.el (define-minor-mode): Add :variable keyword. + * emacs-lisp/cl-macs.el (terminal-parameter, eq): Add setf method. + * international/iso-ascii.el (iso-ascii-mode): + * frame.el (auto-raise-mode, auto-lower-mode): + * composite.el (global-auto-composition-mode): Use define-minor-mode. + +2010-05-04 Michael Albinus + + * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args' + in order to see error messages for failed logins. + +2010-05-03 Chong Yidong + + * diff.el (diff-sentinel): + + * epg.el (epg--make-temp-file, epg-decrypt-string) + (epg-verify-string, epg-sign-string, epg-encrypt-string): + + * jka-compr.el (jka-compr-partial-uncompress) + (jka-compr-call-process, jka-compr-write-region, jka-compr-load): + + * server.el (server-sentinel): Use delete-file's new FORCE arg + (Bug#6070). + +2010-05-03 Stefan Monnier + + Use define-minor-mode where applicable. + * view.el (view-mode): + * type-break.el (type-break-query-mode) + (type-break-mode-line-message-mode): + * textmodes/reftex.el (reftex-mode): + * term/vt100.el (vt100-wide-mode): + * tar-mode.el (tar-subfile-mode): + * savehist.el (savehist-mode): + * ibuf-ext.el (ibuffer-auto-mode): + * composite.el (auto-composition-mode): + * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode): + Use define-minor-mode. + (vhdl-mode): Use static mode-line format. + (vhdl-mode-line-update): Delete. + (vhdl-create-mode-menu, vhdl-activate-customizations) + (vhdl-hs-minor-mode): Don't bother calling it. + +2010-05-02 Stefan Monnier + + * simple.el (with-wrapper-hook): Move. + (buffer-substring-filters): Mark obsolete. + (filter-buffer-substring-functions): New variable. + (filter-buffer-substring): Use it. Remove unused arg `noprops'. + + Use a mode-line spec rather than a static string in Semantic. + * cedet/semantic/util-modes.el: + (semantic-minor-modes-format): New var to replace... + (semantic-minor-modes-status): Remove. + (semantic-mode-line-update): Construct a mode-line spec rather than + a static string so that mouse buttons can be used on individual minor + modes and so that semantic-mode-line-update only needs to be called + when global settings are changed. + (semantic-add-minor-mode, semantic-toggle-minor-mode-globally): + Call semantic-mode-line-update. + (semantic-toggle-minor-mode-globally): Don't assume mode is on + minor-mode-alist, check semantic-minor-mode-alist as well. + (semantic-stickyfunc-mode, semantic-show-parser-state-auto-marker) + (semantic-show-parser-state-marker, semantic-show-parser-state-mode) + (semantic-show-unmatched-syntax-mode, semantic-highlight-edits-mode): + * cedet/semantic/mru-bookmark.el (semantic-mru-bookmark-mode): + * cedet/semantic/idle.el (semantic-idle-scheduler-mode) + (define-semantic-idle-service, semantic-idle-summary-mode): + * cedet/semantic/decorate/mode.el (semantic-decoration-mode): + Don't call semantic-mode-line-update any more. + +2010-05-02 Stefan Monnier + + Use define-minor-mode in CEDET where applicable. + + * cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode): + Use define-minor-mode. + + * cedet/semantic/util-modes.el (semantic-add-minor-mode): + Remove unused arg `keymap' and code redundant with define-minor-mode. + (semantic-toggle-minor-mode-globally): Only handle arg -1 and 1. + (semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode) + (semantic-highlight-func-mode, global-semantic-show-parser-state-mode) + (global-semantic-highlight-edits-mode, semantic-highlight-edits-mode) + (semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode) + (global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode): + Use define-minor-mode. + (semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup) + (semantic-show-unmatched-syntax-mode-setup) + (semantic-show-parser-state-mode-setup) + (semantic-highlight-func-mode-setup): Inline into sole caller. + + * cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode) + (semantic-mru-bookmark-mode): Use define-minor-mode. + (semantic-mru-bookmark-mode-setup): Inline into sole caller. + + * cedet/semantic/idle.el (define-semantic-idle-service): + Use define-minor-mode and inline setup function into its sole caller. + (semantic-idle-scheduler-mode-setup) + (semantic-idle-summary-mode-setup): Inline into sole caller. + (global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode): + Use define-minor-mode. + + * cedet/semantic/decorate/mode.el (global-semantic-decoration-mode) + (semantic-decoration-mode): Use define-minor-mode. + (semantic-decoration-mode-setup): Inline into sole caller. + + * cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration. + (ede-dired-minor-mode): Use define-minor-mode and derived-mode-p. + (ede-dired-add-to-target): Use dolist. + +2010-05-01 Toru TSUNEYOSHI + Michael Albinus + + Implement compression for inline methods. + + * net/tramp.el (tramp-inline-compress-start-size): New defcustom. + (tramp-copy-size-limit): Allow also nil. + (tramp-inline-compress-commands): New defconst. + (tramp-find-inline-compress, tramp-get-inline-compress) + (tramp-get-inline-coding): New defuns. + (tramp-get-remote-coding, tramp-get-local-coding): Remove, + replaced by `tramp-get-inline-coding'. + (tramp-handle-file-local-copy, tramp-handle-write-region) + (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'. + +2010-05-01 Stefan Monnier + + * bindings.el (mode-line-abbrev-mode, mode-line-auto-fill-mode): + Remove unused functions. + + * emacs-lisp/lisp-mode.el (lisp-mode): Use define-derived-mode. + Set find-tag-default-function as a variable rather than a property. + + * minibuffer.el (tags-completion-at-point-function): Move to etags.el. + * progmodes/etags.el (tags-completion-at-point-function): + Remove left over interactive spec. Add autoloading stub. + (complete-tag): Use tags-completion-at-point-function. + +2010-04-30 Chong Yidong + + * minibuffer.el (tags-completion-at-point-function): Fix return value. + +2010-04-30 Eli Zaretskii + + * composite.el (compose-region, reference-point-alist): Fix typos + in the doc strings. + +2010-04-29 Chong Yidong + + * ido.el (ido-init-completion-maps): Remove C-v binding. + (ido-minibuffer-setup): Don't set cua-inhibit-cua-keys (Bug#5765). + +2010-04-29 Chong Yidong + + * minibuffer.el (tags-completion-at-point-function): New function. + (completion-at-point-functions): Use it. + + * cedet/semantic.el (semantic-completion-at-point-function): New function. + (semantic-mode): Use semantic-completion-at-point-function for + completion-at-point-functions instead. + + * progmodes/etags.el (complete-tag): Revert last change. + +2010-04-29 Alan Mackenzie + + * progmodes/cc-mode.el (c-extend-region-for-CPP): Fix an + off-by-one error (in end of macro position). + +2010-04-29 Stefan Monnier + + * net/browse-url.el (browse-url-firefox-program): Use iceweasel if + firefox is absent. Don't autoload. + (browse-url-galeon-program): Don't autoload. + +2010-04-28 Chong Yidong + + * bindings.el (complete-symbol): Move into minibuffer.el. + + * minibuffer.el (complete-tag): Move from etags.el. If tags + completion cannot be performed, return nil instead of signalling + an error. + (completion-at-point): Make it an alias for complete-symbol. + (complete-symbol): Move from bindings.el, and replace with the + body of completion-at-point. + + * progmodes/etags.el (complete-tag): Move to minibuffer.el. + + * cedet/semantic.el (semantic-mode): When enabled, add + semantic-ia-complete-symbol to completion-at-point-functions. + + * cedet/semantic/ia.el (semantic-ia-complete-symbol): Return nil + if Semantic is not active. + +2010-04-28 Michael Albinus + + * net/tramp.el (tramp-remote-selinux-p): New defun. + (tramp-handle-file-selinux-context) + (tramp-handle-set-file-selinux-context): Use it. + +2010-04-28 Sam Steingold + + * progmodes/bug-reference.el (bug-reference-url-format): Mark as + `safe-local-variable' if the value is a string or a symbol with + the property `bug-reference-url-format'. + +2010-04-28 Chong Yidong + + * progmodes/bug-reference.el (bug-reference-url-format): Revert + 2010-04-27 change due to security risk. + +2010-04-28 Stefan Monnier + + Make it possible to locally disable a globally enabled mode. + * simple.el (fundamental-mode): Run fundamental-mode-hook. + * emacs-lisp/derived.el (define-derived-mode): Use fundamental-mode + rather than kill-all-local-variables so it runs fundamental-mode-hook. + * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): + Use fundamental-mode-hook to run MODE-enable-in-buffers earlier, so + that subsequent hooks get a chance to disable it. + +2010-04-27 Stefan Monnier + + * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): + Avoid re-enabling a minor mode after the user turned the minor mode + off if MODE-enable-in-buffers is run twice (typically once from + fundamental-mode's after-change-major-mode-hook and a second time from + run-mode-hook's own after-change-major-mode-hook). + + * emacs-lisp/lisp.el (lisp-complete-symbol): Fail gracefully. + +2010-04-27 Sam Steingold + + * progmodes/bug-reference.el (bug-reference-url-format): Mark as + `safe-local-variable' if the value is a string or a function, as + documented and implemented on 2010-04-02. + +2010-04-27 Juanma Barranquero + + * ido.el (ido-buffer-internal): Bind `ido-use-virtual-buffers' to nil + when method is 'kill. + +2010-04-27 Agustín Martín + + * ispell.el (ispell-init-process): Fix personal dictionary condition + in default directory check. + (ispell-init-process,ispell-kill-ispell,kill-buffer-hook): + Kill ispell process when killing its associated buffer. + +2010-04-27 Jan Djärv + + * desktop.el (desktop-kill): ask-if-new: Ask if desktop file exists, + but we aren't using it. + +2010-04-25 Jan Djärv + + * tool-bar.el (tool-bar-local-item-from-menu): Revert unintended + checkin in rev 100010. + +2010-04-24 Glenn Morris + + * emacs-lisp/authors.el (authors-obsolete-files-regexps): + Ignore VCS-ignore files, and deleted nextstep preferences files. + (authors-ignored-files): Ignore deleted cedet test files, and "*.el". + (authors-ambiguous-files): New list. + (authors-valid-file-names): Add some deleted files. + (authors-renamed-files-alist): Add font-setting.el, edt-user.doc. + (authors-disambiguate-file-name): New function. (Bug#5501) + (authors-canonical-file-name): Doc fix. + Don't warn about obsolete files. + (authors-canonical-file-name, authors-scan-el): + Use authors-disambiguate-file-name. + + * hfy-cmap.el (htmlfontify-load-rgb-file, hfy-fallback-colour-values): + Add autoload cookies. + (htmlfontify-unload-rgb-file, hfy-fallback-colour-values): Add docs. + (generated-autoload-file): Set file-local value to "htmlfontify.el". + * htmlfontify.el (caddr, cadddr): Remove fallback definitions. + They have definitions / compiler macros in cl.el. + (htmlfontify-load-rgb-file, hfy-fallback-colour-values): + Replace manual autoloads with generated ones. + (htmlfontify-unload-rgb-file): Remove autoload. + * Makefile.in (autoloads): Ensure htmlfontify.el is writable. + +2010-04-23 Stefan Monnier + + * emacs-lisp/bytecomp.el (byte-compile-set-default): New function. + (byte-compile-setq-default): Optimize for the + single-var case and don't call byte-compile-form in this case to avoid + inf-loop with byte-compile-set-default. + + * progmodes/compile.el (compilation-start): Abbreviate default directory. + +2010-04-23 Michael Albinus + + Implement SELINUX backends. + + * net/tramp.el (tramp-file-name-handler-alist): + Add `file-selinux-context' and `set-file-selinux-context'. + (tramp-handle-file-selinux-context) + (tramp-handle-set-file-selinux-context): New defuns. + (tramp-handle-copy-file, tramp-do-copy-or-rename-file): + Handle PRESERVE-SELINUX-CONTEXT. + + * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): + Add `file-selinux-context' and `set-file-selinux-context'. + (tramp-gvfs-handle-file-selinux-context) + (tramp-gvfs-handle-set-file-selinux-context): New defuns. + (tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT. + + * net/ange-ftp.el (ange-ftp-copy-file): + * net/tramp-fish.el (tramp-fish-handle-copy-file): + * net/tramp-imap.el (tramp-imap-handle-copy-file): + * net/tramp-smb.el (tramp-smb-handle-copy-file): + Add PRESERVE-SELINUX-CONTEXT. + +2010-04-22 Michael Albinus + + Synchronize with Tramp repository. + + * net/tramp.el (with-connection-property, tramp-completion-mode-p) + (tramp-action-process-alive, tramp-action-out-of-band) + (tramp-check-for-regexp, tramp-file-name-p, tramp-equal-remote) + (tramp-exists-file-name-handler): Fix docstring. + (with-progress-reporter): New defmacro. + (tramp-do-copy-or-rename-file, tramp-handle-dired-compress-file) + (tramp-maybe-open-connection): Use it. + +2010-04-22 Noah Lavine (tiny change) + + Detect ssh 'ControlMaster' argument automatically in some cases. + + * net/tramp.el (tramp-detect-ssh-controlmaster): New defun. + (tramp-default-method): Use it. + +2010-04-22 Michael Albinus + + * net/tramp.el (tramp-handle-copy-file): Add new optional + parameter `preserve-selinux-context'. + (tramp-file-name-for-operation): Add `set-file-selinux-context'. + +2010-04-22 Michael Albinus + + * net/tramp.el (tramp-completion-handle-file-name-all-completions): + Ensure, that non remote files are still checked. Oops. + +2010-04-21 Michael Albinus + + Fix Bug#5840. + + * icomplete.el (icomplete-completions): Use `non-essential'. + + * net/tramp.el (tramp-connectable-p): New defun. + (tramp-handle-expand-file-name) + (tramp-completion-handle-file-name-all-completions) + (tramp-completion-handle-file-name-completion): Use it. + +2010-04-21 Stefan Monnier + + * emacs-lisp/lisp.el (lisp-completion-at-point): Try and handle errors. + +2010-04-21 Jan Djärv + + * vc-dir.el (vc-dir-tool-bar-map): Add :label on some tool bar items. + + * tool-bar.el (tool-bar-setup): Add :label on some tool bar items. + + * loadup.el: Load dynamic-setting.el if feature dynamic-setting + is present. + + * info.el (info-tool-bar-map): Add labels. + + * cus-start.el (all): Add tool-bar-style and tool-bar-max-label-size. + + * cus-edit.el (custom-commands): Add labels for tool bar. + (custom-buffer-create-internal, Custom-mode): Adjust for + labels in custom-commands. + + * dynamic-setting.el: Renamed from font-setting.el. + +2010-04-21 John Wiegley + + * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o + toggles the use of virtual buffers. + (ido-buffer-internal): Guard `ido-use-virtual-buffers' global + value. + (ido-toggle-virtual-buffers): New function. + +2010-04-21 Juanma Barranquero + + Use `define-derived-mode'; fix window selection; doc fixes. + * play/tetris.el (tetris, tetris-update-speed-function) + (tetris-tty-colors, tetris-x-colors, tetris-move-bottom) + (tetris-move-left, tetris-move-right, tetris-rotate-prev) + (tetris-rotate-next, tetris-end-game, tetris-start-game) + (tetris-pause-game): Fix typos in docstrings. + (tetris-mode-map, tetris-null-map): + Move initialization into declaration. + (tetris-mode): Define with `define-derived-mode'; + set show-trailing-whitespace to nil. + (tetris): Prefer window already displaying the "*Tetris*" buffer. + +2010-04-21 Karel Klíč + + * files.el (backup-buffer): Handle SELinux context, and return it + if a backup was made by renaming. + (backup-buffer-copy): Set SELinux context to the target file. + (basic-save-buffer): Set SELinux context of the newly written file. + (basic-save-buffer-1): Now it also returns any SELinux context. + (basic-save-buffer-2): Set SELinux context of the newly created file, + and return it. + * net/tramp.el (tramp-file-name-for-operation): + Add file-selinux-context. + +2010-04-21 Stefan Monnier + + Make the log-edit comments use RFC822 format throughout. + + * vc.el (vc-checkin, vc-modify-change-comment): + Adjust to new vc-start/finish-logentry. + (vc-find-conflicted-file): New command. + (vc-transfer-file): Adjust to new vc-checkin. + (vc-next-action): Improve scoping. + + * vc-hg.el (vc-hg-log-edit-mode): Remove. + (vc-hg-checkin): Remove extra arg. Use log-edit-extract-headers. + + * vc-git.el (vc-git-log-edit-mode): Remove. + (vc-git-checkin): Remove extra arg. Use log-edit-extract-headers. + (vc-git-commits-coding-system): Rename from git-commits-coding-system. + + * vc-dispatcher.el (vc-log-edit): Shorten names for log-edit-show-files. + (vc-start-logentry): Remove argument `extra'. + (vc-finish-logentry): Remove extra args. + + * vc-bzr.el (vc-bzr-log-edit-mode): Remove. + (vc-bzr-checkin): Remove extra arg. Use log-edit-extract-headers. + (vc-bzr-conflicted-files): New function. + + * log-edit.el (log-edit-extra-flags) + (log-edit-before-checkin-process): Remove. + (log-edit-summary, log-edit-header, log-edit-unknown-header): New faces. + (log-edit-headers-alist): New var. + (log-edit-header-contents-regexp): New const. + (log-edit-match-to-eoh): New function. + (log-edit-font-lock-keywords): Use them. + (log-edit): Insert a "Summary:" header as default. + (log-edit-mode): Mark font-lock rules as case-insensitive. + (log-edit-done): Cleanup headers. + (log-view-process-buffer): Remove. + (log-edit-extract-headers): New function to replace it. + +2010-04-20 Juanma Barranquero + + * subr.el (default-direction-reversed): Remove obsolescence info. + +2010-04-20 Stefan Monnier + + * vc-dispatcher.el (vc-finish-logentry): Don't mess so badly with the + windows/frames. + + * emacs-lisp/lisp.el (lisp-completion-at-point): Complete around point. + I.e. include text after point in the completion region. + Also, return nil when we're not after/in a symbol. + + * international/mule-cmds.el (view-hello-file): Don't fiddle with the + default enable-multibyte-characters. + +2010-04-19 Stefan Monnier + + * international/mule.el: Help the user choose a valid coding-system. + (read-buffer-file-coding-system): New function. + (set-buffer-file-coding-system): Use it. Prompt the user if the + coding-system cannot encode all the chars. + + * vc-bzr.el: Use standard *vc* and *vc-diff* buffers. + (vc-bzr-shelve-show, vc-bzr-shelve-apply) + (vc-bzr-shelve-apply-and-keep, vc-bzr-shelve-snapshot): + Don't use *vc-bzr-shelve*. + +2010-04-19 Chong Yidong + + * cedet/ede/pmake.el (ede-proj-makefile-insert-variables): + Don't destroy list before using it. + +2010-04-19 Dan Nicolaescu + + Fix the version number for added files. + * vc-hg.el (vc-hg-working-revision): Check if the file is + registered after hg parent fails (Bug#5961). + +2010-04-19 Glenn Morris + + * htmlfontify.el (htmlfontify-buffer) + (htmlfontify-copy-and-link-dir): Autoload entry points. + +2010-04-19 Magnus Henoch + + * vc-hg.el (vc-hg-annotate-extract-revision-at-line): Expand file + name relative to the project root (Bug#5960). + +2010-04-19 Glenn Morris + + * vc-git.el (vc-git-print-log): Doc fix. + +2010-04-19 Óscar Fuentes + + * ido.el (ido-file-internal): Fix 2009-12-02 change. + +2010-04-19 Christoph (tiny change) + + * progmodes/grep.el (grep-compute-defaults): Fix handling of host + default settings (Bug#5928). + +2010-04-19 Glenn Morris + + * progmodes/fortran.el (fortran-match-and-skip-declaration): + New function. + (fortran-font-lock-keywords-3): Use it. (Bug#1385) + +2010-04-19 Kenichi Handa + + * language/indian.el (malayalam-composable-pattern): Fix previous + change (add U+0D4D "SIGN VIRAMA"). + (oriya-composable-pattern): Add U+0B30 and fix typo in the regexp. + (tamil-composable-pattern): Fix typo in the regexp. + (telugu-composable-pattern): Fix U+0C4D and typo in the regexp. + (kannada-composable-pattern): Fix U+0CB0 and typo in the regexp. + (malayalam-composable-pattern): Fix U+0D4D and typo in the regexp. + +2010-04-19 Chong Yidong + + * textmodes/tex-mode.el (latex-mode): Revert 2008-03-03 change to + paragraph-separate (Bug#5821). + +2010-04-19 Juri Linkov + + Put breadcrumbs on overlay instead of inserting to buffer (bug#5809). + + * info.el (Info-find-node-2): Comment out code that skips + breadcrumbs line. + (Info-mouse-follow-link): New command. + (Info-link-keymap): New keymap. + (Info-breadcrumbs): Rename from `Info-insert-breadcrumbs'. + Return a string with links instead of inserting breadcrumbs + to the Info buffer. + (Info-fontify-node): Comment out code that inserts breadcrumbs. + Instead of putting the `invisible' text property over the Info + header, make an overlay over the Info header with the `invisible' + property and `after-string' set to the string returned by + `Info-breadcrumbs'. + +2010-04-19 Chong Yidong + + * help.el (help-window-setup-finish): Doc fix (Bug#5830). + Reported by monkey@sandpframing.com. + +2010-04-19 Stefan Monnier + + * tmm.el (tmm-prompt): Remove obsolete call to x-popup-menu. + (tmm-get-keymap): Add key-binding shortcuts now that they're not + available in the "keyseq cache" any more. + + * custom.el (defcustom): Add edebug spec. + +2010-04-18 Juri Linkov + + Test for special mode-class in view-buffer instead of view-file (bug#5513). + + * view.el (view-file, view-buffer): Move test for special mode-class + from view-file to view-buffer. + + * tar-mode.el (tar-extract): Turn if's into one cond + like in arc-mode.el. + +2010-04-18 Juri Linkov + + Add 7z archive format support (bug#5475). + + * arc-mode.el (archive-zip-extract): Try to find 7z executable. + (archive-7z-extract): New defcustom. + (archive-find-type): Add magic string for 7z. + (archive-extract-by-stdout): Add new optional arg `stderr-file'. + If `stderr-file' is non-nil, use `(t stderr-file)' for the + `buffer' arg of `call-process'. + (archive-zip-extract): Check `archive-zip-extract' for "7z" and + call the function `archive-7z-extract' with the variable + `archive-7z-extract' let-bound to `archive-zip-extract'. + (archive-7z-summarize, archive-7z-extract): New functions. + + * international/mule.el (auto-coding-alist): + * files.el (auto-mode-alist): Add 7z file extension. + +2010-04-18 Stefan Monnier + + * loadup.el: Setup hash-cons for pure data. + + Fix duplicate entries in cedet's loaddefs.el files. + * emacs-lisp/autoload.el (autoload-file-load-name): Be more clever. + Should make most file-local generated-autoload-file unnecessary. + (print-readably): Silence warnings. + (autoload-find-destination): Take load-name as an arg to make sure + it's the same as the one that will be in the file. + (autoload-generate-file-autoloads): Adjust to above changes. + Try to make the dataflow a bit simpler. + + * cvs-status.el (cvs-refontify): Remove unused. + +2010-04-18 Jay Belanger + + * calc.el (calc-mode-map): Bind "O" to `calc-missing-key'. + + * calc-bin.el (calc-radix): Have the "O" option turn on + twos-complement mode. + +2010-04-17 Jay Belanger + + * calc-ext.el (calc-init-extensions): Add keybinding for 'calc-option'. + Add `calc-option-prefix-help' to calc-help autoloads. + (calc-inverse): Add "Option" to message, as appropriate. + (calc-hyperbolic): Add "Option" to message, as appropriate. + (calc-option, calc-is-option): New functions. + + * calc-help.el (calc-full-help): Add `calc-option-help'. + (calc-option-prefix-help): New function. + + * calc-misc.el (calc-help): Add "Option" entry. + + * calc.el (calc-local-var-list): Add `calc-option-flag'. + (calc-option-flag): New variable. + (calc-do): Set `calc-option-flag to nil. + (calc-set-mode-line): Add "Opt " as appropriate. + +2010-04-16 Juri Linkov + + Move scrolling commands from simple.el to window.el + because their primitives are implemented in window.c. + + * simple.el (scroll-error-top-bottom) + (scroll-up-command, scroll-down-command, scroll-up-line) + (scroll-down-line, scroll-other-window-down) + (beginning-of-buffer-other-window, end-of-buffer-other-window): + * window.el (scroll-error-top-bottom) + (scroll-up-command, scroll-down-command, scroll-up-line) + (scroll-down-line, scroll-other-window-down) + (beginning-of-buffer-other-window, end-of-buffer-other-window): + Move from simple.el to window.el because their primitives are + implemented in window.c. + +2010-04-16 Juri Linkov + + * isearch.el (isearch-lookup-scroll-key): Check both + `isearch-scroll' and `scroll-command' properties. + (scroll-up, scroll-down): Remove `isearch-scroll' property. + + * mwheel.el (mwheel-scroll): Remove `isearch-scroll' property. + + * simple.el (scroll-up-command, scroll-down-command) + (scroll-up-line, scroll-down-line): Remove `isearch-scroll' property. + +2010-04-15 Juri Linkov + + * simple.el (scroll-up-command, scroll-down-command) + (scroll-up-line, scroll-down-line): Put `scroll-command' + property on the these symbols. Remove them from + `scroll-preserve-screen-position-commands'. + + * mwheel.el (mwheel-scroll): Put `scroll-command' and + `isearch-scroll' properties on the `mwheel-scroll' symbol. + Remove it from `scroll-preserve-screen-position-commands'. + + * isearch.el (isearch-allow-scroll): Doc fix. + +2010-04-15 Michael Albinus + + * net/tramp.el (tramp-error-with-buffer): Don't show the + connection buffer when we are in completion mode. + (tramp-file-name-handler): Catch the error for some operations + when we are in completion mode. This gives the user the chance to + correct the file name in the minibuffer. + +2010-04-15 Glenn Morris + + * progmodes/verilog-mode.el (verilog-forward-sexp): Avoid free variable. + 2010-04-15 Juanma Barranquero Simplify by using `define-derived-mode'. @@ -231,32 +1328,31 @@ 2010-04-07 Michael McNamara - * progmodes/verilog-mode.el (verilog-forward-sexp): + * progmodes/verilog-mode.el (verilog-forward-sexp): (verilog-calc-1): Support "disable fork" and "fork wait" multi word keywords, suggested by Steve Pearlmutter. - (verilog-pretty-declarations): Support lineup of declarations in + (verilog-pretty-declarations): Support lineup of declarations in port lists. - (verilog-skip-backward-comments, verilog-skip-forward-comment-p): - fix bug for /* / comments - (verilog-backward-syntactic-ws, verilog-forward-syntactic-ws): + (verilog-skip-backward-comments, verilog-skip-forward-comment-p): + fix bug for /* / comments + (verilog-backward-syntactic-ws, verilog-forward-syntactic-ws): Speed up and simplfy as this is never called with a bound. - (verilog-pretty-declarations): Enhance to line up declarations - inside a parameter list, suggested by Alan Morgan. - (verilog-pretty-expr): Tune assignment regular expression match - string for corner cases; also use markers instead of character - number as indent changes the later. + (verilog-pretty-declarations): Enhance to line up declarations + inside a parameter list, suggested by Alan Morgan. + (verilog-pretty-expr): Tune assignment regular expression match + string for corner cases; also use markers instead of character + number as indent changes the later. 2010-04-07 Wilson Snyder - * progmodes/verilog-mode.el (verilog-type-keywords): Fix pulldown as missing - keyword. - (verilog-read-sub-decls-line): Fix comments in AUTO_TEMPLATE - causing truncation of AUTOWIRE signals. Reported by Bruce - Tennant. - (verilog-auto-inst, verilog-auto-inst-port): Add vl_mbits for - AUTO_TEMPLATEs needing multiple array bits. Suggested by Bruce - Tennant. - (verilog-keywords): + * progmodes/verilog-mode.el (verilog-type-keywords): Fix pulldown + as missing keyword. + (verilog-read-sub-decls-line): Fix comments in AUTO_TEMPLATE + causing truncation of AUTOWIRE signals. Reported by Bruce Tennant. + (verilog-auto-inst, verilog-auto-inst-port): Add vl_mbits for + AUTO_TEMPLATEs needing multiple array bits. Suggested by Bruce + Tennant. + (verilog-keywords): (verilog-1800-2005-keywords, verilog-1800-2009-keywords): Add IEEE 1800-2009 keywords, including "global.". @@ -419,7 +1515,7 @@ 2010-03-31 Stefan Monnier - Make tmm-menubar work for the Buffers menu again. + Make tmm-menubar work for the Buffers menu again (bug#5726). * tmm.el (tmm-prompt): Also handle keymap entries in the form of vectors rather than cons cells, as used in menu-bar-update-buffers. @@ -500,7 +1596,7 @@ values. 2010-03-29 Phil Hagelberg - Chong Yidong + Chong Yidong * subr.el: Extend progress reporters to perform "spinning". (progress-reporter-update, progress-reporter-do-update): @@ -1067,7 +2163,7 @@ * image-mode.el (image-toggle-display-image): Replace `create-image' with `create-animated-image'. -2010-03-09 Miles Bader > +2010-03-09 Miles Bader * vc-git.el (vc-git-print-log): Use "tformat:" for shortlog, instead of "format:"; this ensures that the output is @@ -1143,11 +2239,6 @@ * calendar/cal-hebrew.el (holiday-hebrew-passover): Fix date of Yom HaAtzma'ut when it falls on a Monday (rule changed in 2004). -2010-03-01 Alan Mackenzie - - * progmodes/cc-engine.el (c-remove-stale-state-cache): - Correct previous patch. - 2010-03-01 Kenichi Handa * language/burmese.el (burmese-composable-pattern): Rename from @@ -1159,11 +2250,6 @@ (otf-script-alist): Likewise. (setup-default-fontset): Likewise. Re-fix :otf spec. -2010-03-01 Alan Mackenzie - - * cc-engine.el (c-remove-stale-state-cache): Take account of when - `good-pos' is in the same macro as `here'. Fixes bug#5649. - 2010-02-28 Katsumi Yamaoka * menu-bar.el (menu-bar-manuals-menu): Fix typo. @@ -1229,16 +2315,6 @@ * mail/sendmail.el (send-mail-function): Autoload the call to custom-initialize-delay, not otherwise preserved in loaddefs.el. -2010-02-25 Alan Mackenzie - - * progmodes/cc-engine.el (c-clear-<-pair-props) - (c-clear->-pair-props): Correct to wipe category text props, not - syntax-table ones. - - * progmodes/cc-mode.el (c-after-change): Remove any hard - syntax-table properties for <, > which, e.g., C-y has - inopportunely converted from category properties. - 2010-02-24 Chong Yidong * files.el (hack-local-variables-filter): For eval forms, also @@ -1576,33 +2652,6 @@ (doc-view-pdf->png): Don't rely on doc-view-pdf/ps->png for the few windows that are not yet showing images. -2010-02-04 Alan Mackenzie - - Change strategy for marking < and > as template delimiters: mark - them strictly in matching pairs. - - * cc-mode.el (c-before-change): - Use c-get-state-before-change-functions. - (c-common-init): Adapt to use - c-get-state-before-change-functions (note plural). - - * cc-langs.el (c-no-parens-syntax-table): New syntax table, used - for searching syntactically for matching s. - (c-get-state-before-change-functions): New language variable (note - the plural) which supersedes c-get-state-before-change-function. - - * cc-engine.el (c-clear-<-pair-props, c-clear->-pair-props) - (c-clear-<>-pair-props, c-clear-<-pair-props-if-match-after) - (c-clear->-pair-props-if-match-before) - (c-before-change-check-<>-operators): New functions. - (c-after-change-check-<>-operators): Use macro - c-unmark-<->-as-paren. - - * cc-defs.el (c-search-backward-char-property): New macro. - - * cc-cmds.el (c-electric-lt-gt): Do not set text properties on < - and > any more. (These will be handled by font locking.) - 2010-02-04 Michael Albinus * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call @@ -4190,7 +5239,7 @@ * Makefile.in (ELCFILES): Adapt to subword.el move. 2009-11-21 Thierry Volpiatto - Stefan Monnier + Stefan Monnier * bookmark.el (bookmark-bmenu-bookmark-column): Remove var. (bookmark-bmenu-list): Save name on `bookmark-name-prop' text-prop. @@ -8276,7 +9325,7 @@ indent buffer only if called interactively (Bug#4452). 2009-09-19 Juanma Barranquero - Eli Zaretskii + Eli Zaretskii This fixes bug#4197 (merged to bug#865, though not identical). * server.el (server-auth-dir): Add docstring note about FAT32. @@ -9093,7 +10142,7 @@ Don't call substitute-in-file-name on diary-file. 2009-09-03 Eduard Wiebe - Stefan Monnier + Stefan Monnier * mail/footnote.el (footnote-prefix): Make it a defcustom. (footnote-mode-map): Move initialization into the declaration. @@ -10204,7 +11253,7 @@ * progmodes/hideshow.el (hs-special-modes-alist): Add js-mode entry. 2009-08-14 Daniel Colascione - Karl Landstrom + Karl Landstrom * progmodes/js.el: New file. @@ -11971,7 +13020,7 @@ XZ is the successor to LZMA: 2009-06-22 Dmitry Dzhus - Nick Roberts + Nick Roberts * progmodes/gdb-mi.el: Pull further modified changes from Dmitry's repository (http://sphinx.net.ru/hg/gdb-mi/). diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.1 --- a/lisp/ChangeLog.1 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.1 Thu May 13 15:13:52 2010 +0200 @@ -990,7 +990,7 @@ * info.el: (Info-select-node): Was searching unboundedly for "execute:". (Info-follow-reference): Was called Info-footnote. - Also, handle presence of spaces and newlines in ref names. + Also, handle presence of spaces and newlines in ref names. (Info-extract-menu-node-name): Handle presence of spaces and newlines in the node name. (Info-menu): Handle presence of spaces and newlines in item @@ -1465,7 +1465,7 @@ 1985-10-28 Richard M. Stallman (rms@prep) * rmail.el, rmailsum.el, rmailkwd.el, rmailmsc.el, - rmailout.el, rmailedit.el: + * rmailout.el, rmailedit.el: Install thoroughly rewritten rmail with many new features. * debug.el (debug, debugger-mode): @@ -3100,7 +3100,7 @@ (also, mail-yank-ignored-headers had a typo) * rmail.el (rmail-get-new-mail, convert-to-babyl-format, ...) - loaddefs.el + * loaddefs.el: Remodularize inbox parsing. Add support(?) for mmdf inboxes. Note that I can't seem to define definitive documentation of what this format is; however the code installed seems to work diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.12 --- a/lisp/ChangeLog.12 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.12 Thu May 13 15:13:52 2010 +0200 @@ -32509,7 +32509,7 @@ (bibtex-field-list, bibtex-find-crossref): Fix typos in error messages. 2005-01-24 Dan Nicolaescu - Juri Linkov + Juri Linkov * textmodes/reftex-global.el (reftex-isearch-push-state-function) (reftex-isearch-pop-state-function, reftex-isearch-isearch-search) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.13 --- a/lisp/ChangeLog.13 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.13 Thu May 13 15:13:52 2010 +0200 @@ -721,7 +721,7 @@ char-width-table. Don't make ethiopic and tibetan double column. * textmodes/fill.el (fill-find-break-point-function-table): - Don't set it up in defvar. + Don't set it up in defvar. (fill-nospace-between-words-table): New variable. (fill-delete-newlines): Check fill-nospace-between-words-table instead of charset property nospace-between-words. @@ -1872,8 +1872,8 @@ 2008-02-01 Dave Love * emacs-lisp/byte-opt.el (side-effect-free-fns): - Add string-make-unibyte string-make-multibyte string-to-multibyte - string-as-multibyte string-as-unibyte. + Add string-make-unibyte string-make-multibyte string-to-multibyte + string-as-multibyte string-as-unibyte. 2008-02-01 Dave Love @@ -3983,7 +3983,7 @@ * ibuffer.el (ibuffer-mode): Fix typo in previous change. 2008-01-17 Vinicius Jose Latorre - Miles Bader + Miles Bader * blank-mode.el: New file. Minor mode to visualize (HARD) SPACE, TAB, NEWLINE. Miles Bader wrote the original code @@ -5479,7 +5479,7 @@ (verilog-insert-indices): Escape braces in doc strings. 2007-12-08 Michael McNamara - Wilson Snyder + Wilson Snyder * progmodes/verilog-mode.el: New file. @@ -13484,7 +13484,7 @@ Use native Emacs functions, when appropriate. 2007-08-01 Dan Nicolaescu - Stefan Monnier + Stefan Monnier * vc.el: Document new VC operation `extra-menu'. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.14 --- a/lisp/ChangeLog.14 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.14 Thu May 13 15:13:52 2010 +0200 @@ -1029,7 +1029,7 @@ * paren.el (show-paren-function): * simple.el (kill-forward-chars, kill-backward-chars): - Use (+/- (point) N), instead of `forward-point'. + Use (+/- (point) N), instead of `forward-point'. 2009-03-19 Glenn Morris @@ -3012,12 +3012,12 @@ Don't activate node nil. (Bug#1569) 2009-01-22 Paul Reilly - Henrik Enberg - Alex Schroeder - Chong Yidong - Richard M Stallman - Glenn Morris - Juanma Barranquero + Henrik Enberg + Alex Schroeder + Chong Yidong + Richard M Stallman + Glenn Morris + Juanma Barranquero * mail/rmail.el: Code implementing Rmail-mbox functionality. (rmail-attribute-header, rmail-keyword-header) @@ -4310,7 +4310,7 @@ was orderly adjusted, nil otherwise. 2008-12-12 Juanma Barranquero - Stefan Monnier + Stefan Monnier * server.el (server-sentinel): Uncomment code to delete connection file. (server-start): Save the connection file in the server property list. @@ -4369,7 +4369,7 @@ terminal variable assignment. 2008-12-10 Yukihiro Matsumoto - Nobuyoshi Nakada + Nobuyoshi Nakada * progmodes/ruby-mode.el: New file. @@ -5599,7 +5599,7 @@ New aliases, to satisfy `define-derived-mode' expectations. 2008-11-15 Glenn Morris - Martin Rudalics + Martin Rudalics * emacs-lisp/find-func.el (find-function-advised-original): New. (find-function-C-source, find-function-noselect): @@ -10308,8 +10308,8 @@ (newsticker--treeview-propertize-tag): Show item title in tooltip. 2008-06-20 Martin Blais - Stefan Merten - David Goodger + Stefan Merten + David Goodger * textmodes/rst.el: New file. @@ -10627,7 +10627,7 @@ * term/linux.el (terminal-init-linux): Load t-mouse. 2008-06-13 Stefan Monnier - Drew Adams + Drew Adams * info.el (Info-breadcrumbs-depth): New var. (Info-insert-breadcrumbs): New function. @@ -18798,7 +18798,7 @@ for useful options. 2008-03-01 Dan Nicolaescu - Glenn Morris + Glenn Morris * emacs-lisp/bytecomp.el (byte-recompile-directory) (byte-compile-file, batch-byte-compile, batch-byte-compile-file): diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.5 --- a/lisp/ChangeLog.5 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.5 Thu May 13 15:13:52 2010 +0200 @@ -7051,7 +7051,7 @@ * ediff.el (ediff-toggle-read-only, ediff-patch-file): Check out version controlled files before their buffers are modified. (ediff-local-checkout-flag, ediff-toggle-read-only-function): - New variables. + New variables. * ediff.el (ediff-find-file, ediff-patch-file): Were getting confused by symbolic links. Fixed. @@ -8050,7 +8050,7 @@ 1994-07-23 enami tsugutomo * lisp/add-log.el (add-log-current-defun): Skip doc string - correctly even if it ends with line that starts space. + correctly even if it ends with line that starts space. 1994-07-22 Ed Reingold @@ -9194,11 +9194,11 @@ * solar.el (solar-sunrise, solar-sunset): Fix doc string. (solar-time-string): Rewritten. (solar-adj-time-for-dst): New function. - (solar-sunrise-sunset, diary-sabbath-candles, - solar-equinoxes-solstices): Revised to use the rewritten and new fcns. + (solar-sunrise-sunset, diary-sabbath-candles) + (solar-equinoxes-solstices): Revised to use the rewritten and new fcns. * calendar.el (solar-holidays): Revised to use the rewritten and - new fcns. + new fcns. * lunar.el (lunar-phase): Revised to use the rewritten and new fcns. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.6 --- a/lisp/ChangeLog.6 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.6 Thu May 13 15:13:52 2010 +0200 @@ -3687,7 +3687,7 @@ When changing the environment, avoid need for setenv. 1996-01-05 Karl Eichwalder - Karl Fogel + Karl Fogel * bookmark.el: "cyclic.com" addresses changed to "red-bean.com". (bookmark-bmenu-mode-map): Don't bind C-k. @@ -5837,7 +5837,7 @@ 1995-10-09 Roland McGrath * etags.el (tags-table-check-computed-list): Map - tags-expand-table-name over lists of included tables. + tags-expand-table-name over lists of included tables. 1995-10-09 Erik Naggum diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.7 --- a/lisp/ChangeLog.7 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.7 Thu May 13 15:13:52 2010 +0200 @@ -2749,7 +2749,7 @@ * abbrev.el: Likewise. 1998-05-26 Emilio Lopes - Karl Fogel + Karl Fogel * bookmark.el: Changes so bookmark list mode works with Info: (bookmark-jump-noselect): Use an inner save-window-excursion. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ChangeLog.9 --- a/lisp/ChangeLog.9 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ChangeLog.9 Thu May 13 15:13:52 2010 +0200 @@ -2739,8 +2739,8 @@ 2001-06-27 Francesco Potortì - * uniquify.el: (uniquify-rationalize-file-buffer-names): - Undo previous change. + * uniquify.el (uniquify-rationalize-file-buffer-names): + Undo previous change. 2001-06-27 Francesco Potortì @@ -12205,7 +12205,7 @@ 2000-09-05 Stefan Monnier - * vc.el: (toplevel): Don't require `dired' at run-time. + * vc.el (toplevel): Don't require `dired' at run-time. (vc-dired-resynch-file): Remove autoload cookie. 2000-09-05 Andre Spiegel @@ -12998,7 +12998,7 @@ `vc-locking-user' semantics. (vc-backend-merge): Remove. - * vc-rcs.el, vc-scc.el: (vc-{sc,r}cs-check{in,out}): Update 'vc-state + * vc-rcs.el, vc-scc.el (vc-{sc,r}cs-check{in,out}): Update 'vc-state rather than 'vc-locking-user. * vc-rcs-hooks.el (vc-rcs-consult-headers): Adapt to new `vc-state'. @@ -15318,8 +15318,8 @@ leading comma nicely. Extended to handle member initializers too. - * cc-engine.el: (c-beginning-of-inheritance-list, - c-guess-basic-syntax): Fixed recognition of inheritance lists + * cc-engine.el (c-beginning-of-inheritance-list) + (c-guess-basic-syntax): Fixed recognition of inheritance lists when the lines begins with a comma. * cc-vars.el (c-offsets-alist): Changed default for @@ -19574,7 +19574,7 @@ (backward-kill-word): Revert addition of * to interactive spec -- it's a feature. - * paragraphs.el: (kill-paragraph, backward-kill-paragraph) + * paragraphs.el (kill-paragraph, backward-kill-paragraph) (backward-kill-sentence, kill-sentence): Likewise. * gud.el (gud-jdb-build-class-source-alist): Prepend space to @@ -19918,7 +19918,7 @@ 2000-02-10 Dave Love - * wid-edit.el: (widgets) [defgroup]: Remove url link. + * wid-edit.el (widgets) [defgroup]: Remove url link. (widget-color-choice-list, widget-color-history, widget-mouse-help): Deleted. (widget-specify-field, widget-specify-button): Don't use diff -r e56f669f17ce -r fe07c47cf7a7 lisp/Makefile.in --- a/lisp/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/lisp/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -151,7 +151,7 @@ autoloads: $(LOADDEFS) doit chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \ $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \ - $(lisp)/dired.el $(lisp)/ibuffer.el + $(lisp)/dired.el $(lisp)/ibuffer.el $(lisp)/htmlfontify.el cd $(lisp); $(setwins_almost); \ echo Directories: $$wins; \ $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins diff -r e56f669f17ce -r fe07c47cf7a7 lisp/abbrev.el --- a/lisp/abbrev.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/abbrev.el Thu May 13 15:13:52 2010 +0200 @@ -338,7 +338,7 @@ Abbrev to be expanded starts here rather than at beginning of word. This way, you can expand an abbrev with a prefix: insert the prefix, use this command, then insert the abbrev. This command inserts a -temporary hyphen after the prefix \(until the intended abbrev +temporary hyphen after the prefix (until the intended abbrev expansion occurs). If the prefix is itself an abbrev, this command expands it, unless ARG is non-nil. Interactively, ARG is the prefix argument." @@ -460,7 +460,7 @@ (defvar last-abbrev-text nil "The exact text of the last abbrev expanded. -nil if the abbrev has already been unexpanded.") +It is nil if the abbrev has already been unexpanded.") (defvar last-abbrev-location 0 "The location of the start of the last abbrev expanded.") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/allout.el --- a/lisp/allout.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/allout.el Thu May 13 15:13:52 2010 +0200 @@ -2239,13 +2239,13 @@ (allout-show-to-offshoot))) ;;;_ #3 Internal Position State-Tracking -- "allout-recent-*" funcs -;;; All the basic outline functions that directly do string matches to -;;; evaluate heading prefix location set the variables -;;; `allout-recent-prefix-beginning' and `allout-recent-prefix-end' -;;; when successful. Functions starting with `allout-recent-' all -;;; use this state, providing the means to avoid redundant searches -;;; for just-established data. This optimization can provide -;;; significant speed improvement, but it must be employed carefully. +;; All the basic outline functions that directly do string matches to +;; evaluate heading prefix location set the variables +;; `allout-recent-prefix-beginning' and `allout-recent-prefix-end' +;; when successful. Functions starting with `allout-recent-' all +;; use this state, providing the means to avoid redundant searches +;; for just-established data. This optimization can provide +;; significant speed improvement, but it must be employed carefully. ;;;_ = allout-recent-prefix-beginning (defvar allout-recent-prefix-beginning 0 "Buffer point of the start of the last topic prefix encountered.") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/arc-mode.el --- a/lisp/arc-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/arc-mode.el Thu May 13 15:13:52 2010 +0200 @@ -52,17 +52,17 @@ ;; ARCHIVE TYPES: Currently only the archives below are handled, but the ;; structure for handling just about anything is in place. ;; -;; Arc Lzh Zip Zoo Rar -;; ---------------------------------------- -;; View listing Intern Intern Intern Intern Y -;; Extract member Y Y Y Y Y -;; Save changed member Y Y Y Y N -;; Add new member N N N N N -;; Delete member Y Y Y Y N -;; Rename member Y Y N N N -;; Chmod - Y Y - N -;; Chown - Y - - N -;; Chgrp - Y - - N +;; Arc Lzh Zip Zoo Rar 7z +;; -------------------------------------------- +;; View listing Intern Intern Intern Intern Y Y +;; Extract member Y Y Y Y Y Y +;; Save changed member Y Y Y Y N N +;; Add new member N N N N N N +;; Delete member Y Y Y Y N N +;; Rename member Y Y N N N N +;; Chmod - Y Y - N N +;; Chown - Y - - N N +;; Chgrp - Y - - N N ;; ;; Special thanks to Bill Brodie for very useful tips ;; on the first released version of this package. @@ -217,17 +217,17 @@ ;; Zip archive configuration (defcustom archive-zip-extract - (if (and (not (executable-find "unzip")) - (executable-find "pkunzip")) - '("pkunzip" "-e" "-o-") - '("unzip" "-qq" "-c")) + (cond ((executable-find "unzip") '("unzip" "-qq" "-c")) + ((executable-find "7z") '("7z" "x" "-so")) + ((executable-find "pkunzip") '("pkunzip" "-e" "-o-")) + (t '("unzip" "-qq" "-c"))) "Program and its options to run in order to extract a zip file member. Extraction should happen to standard output. Archive and member name will be added." :type '(list (string :tag "Program") - (repeat :tag "Options" - :inline t - (string :format "%v"))) + (repeat :tag "Options" + :inline t + (string :format "%v"))) :group 'archive-zip) ;; For several reasons the latter behavior is not desirable in general. @@ -315,6 +315,20 @@ :inline t (string :format "%v"))) :group 'archive-zoo) +;; ------------------------------ +;; 7z archive configuration + +(defcustom archive-7z-extract + '("7z" "x" "-so") + "Program and its options to run in order to extract a 7z file member. +Extraction should happen to standard output. Archive and member name will +be added." + :type '(list (string :tag "Program") + (repeat :tag "Options" + :inline t + (string :format "%v"))) + :group 'archive-7z) + ;; ------------------------------------------------------------------------- ;;; Section: Variables @@ -732,6 +746,7 @@ ((and (looking-at "MZ") (re-search-forward "Rar!" (+ (point) 100000) t)) 'rar-exe) + ((looking-at "7z\274\257\047\034") '7z) (t (error "Buffer format not recognized"))))) ;; ------------------------------------------------------------------------- @@ -1047,8 +1062,8 @@ (archive-maybe-update t)) (or (not (buffer-name buffer)) (cond - (view-p (view-buffer - buffer (and just-created 'kill-buffer-if-not-modified))) + (view-p + (view-buffer buffer (and just-created 'kill-buffer-if-not-modified))) ((eq other-window-p 'display) (display-buffer buffer)) (other-window-p (switch-to-buffer-other-window buffer)) (t (switch-to-buffer buffer)))))) @@ -1081,11 +1096,11 @@ (archive-delete-local tmpfile) success)) -(defun archive-extract-by-stdout (archive name command) +(defun archive-extract-by-stdout (archive name command &optional stderr-file) (apply 'call-process (car command) nil - t + (if stderr-file (list t stderr-file) t) nil (append (cdr command) (list archive name)))) @@ -1787,16 +1802,22 @@ (apply 'vector (nreverse files)))) (defun archive-zip-extract (archive name) - (if (member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip")) - (archive-*-extract archive name archive-zip-extract) + (cond + ((member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip")) + (archive-*-extract archive name archive-zip-extract)) + ((equal (car archive-zip-extract) "7z") + (let ((archive-7z-extract archive-zip-extract)) + (archive-7z-extract archive name))) + (t (archive-extract-by-stdout archive ;; unzip expands wildcards in NAME, so we need to quote it. ;; FIXME: Does pkunzip need similar treatment? + ;; (7z doesn't need to quote wildcards) (if (equal (car archive-zip-extract) "unzip") (shell-quote-argument name) name) - archive-zip-extract))) + archive-zip-extract)))) (defun archive-zip-write-file-member (archive descr) (archive-*-write-file-member @@ -2004,7 +2025,65 @@ (if tmpbuf (kill-buffer tmpbuf)) (delete-file tmpfile)))) +;; ------------------------------------------------------------------------- +;;; Section: 7z Archives +(defun archive-7z-summarize () + (let ((maxname 10) + (maxsize 5) + (file buffer-file-name) + (files ())) + (with-temp-buffer + (call-process "7z" nil t nil "l" "-slt" file) + (goto-char (point-min)) + (re-search-forward "^-+\n") + (while (re-search-forward "^Path = \\(.*\\)\n" nil t) + (goto-char (match-end 0)) + (let ((name (match-string 1)) + (size (save-excursion + (and (re-search-forward "^Size = \\(.*\\)\n") + (match-string 1)))) + (time (save-excursion + (and (re-search-forward "^Modified = \\(.*\\)\n") + (match-string 1))))) + (if (> (length name) maxname) (setq maxname (length name))) + (if (> (length size) maxsize) (setq maxsize (length size))) + (push (vector name name nil nil time nil nil size) + files)))) + (setq files (nreverse files)) + (goto-char (point-min)) + (let* ((format (format " %%%ds %%s %%s" maxsize)) + (sep (format format (make-string maxsize ?-) "-------------------" "")) + (column (length sep))) + (insert (format format "Size " "Date Time " " Filename") "\n") + (insert sep (make-string maxname ?-) "\n") + (archive-summarize-files (mapcar (lambda (desc) + (let ((text + (format format + (aref desc 7) + (aref desc 4) + (aref desc 1)))) + (vector text + column + (length text)))) + files)) + (insert sep (make-string maxname ?-) "\n") + (apply 'vector files)))) + +(defun archive-7z-extract (archive name) + (let ((tmpfile (make-temp-file "7z-stderr"))) + ;; 7z doesn't provide a `quiet' option to suppress non-essential + ;; stderr messages. So redirect stderr to a temp file and display it + ;; in the echo area when it contains error messages. + (prog1 (archive-extract-by-stdout + archive name archive-7z-extract tmpfile) + (with-temp-buffer + (insert-file-contents tmpfile) + (unless (search-forward "Everything is Ok" nil t) + (message "%s" (buffer-string))) + (delete-file tmpfile))))) + +;; ------------------------------------------------------------------------- ;;; Section `ar' archives. ;; TODO: we currently only handle the basic format of ar archives, diff -r e56f669f17ce -r fe07c47cf7a7 lisp/bindings.el --- a/lisp/bindings.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/bindings.el Thu May 13 15:13:52 2010 +0200 @@ -62,24 +62,6 @@ (force-mode-line-update))) -(defun mode-line-abbrev-mode (event) - "Turn off `abbrev-mode' from the mode-line." - (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (abbrev-mode) - (force-mode-line-update))) - - -(defun mode-line-auto-fill-mode (event) - "Turn off `auto-fill-mode' from the mode-line." - (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (auto-fill-mode) - (force-mode-line-update))) - - (defvar mode-line-input-method-map (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-2] @@ -671,29 +653,6 @@ (define-key esc-map "\t" 'complete-symbol) -(defun complete-symbol (arg) - "Perform tags completion on the text around point. -If a tags table is loaded, call `complete-tag'. -Otherwise, if Semantic is active, call `semantic-ia-complete-symbol'. - -With a prefix argument, this command does completion within -the collection of symbols listed in the index of the manual for the -language you are using." - (interactive "P") - (cond (arg - (info-complete-symbol)) - ((or tags-table-list tags-file-name) - (complete-tag)) - ((and (fboundp 'semantic-ia-complete-symbol) - (fboundp 'semantic-active-p) - (semantic-active-p)) - (semantic-ia-complete-symbol)) - (t - (error "%s" - (substitute-command-keys - "No completions available; use \\[visit-tags-table] \ -or \\[semantic-mode]"))))) - ;; Reduce total amount of space we must allocate during this function ;; that we will not need to keep permanently. (garbage-collect) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/README --- a/lisp/calc/README Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/README Thu May 13 15:13:52 2010 +0200 @@ -72,6 +72,12 @@ Summary of changes to "Calc" ------- -- ------- -- ---- +Emacs 24.1 + +* Added "O" option prefix. + +* Used "O" prefix to "d r" (`calc-radix') to turn on twos-complement mode. + Emacs 23.2 * Added twos-complement display. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc-bin.el --- a/lisp/calc/calc-bin.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc-bin.el Thu May 13 15:13:52 2010 +0200 @@ -175,7 +175,7 @@ (progn (calc-change-mode (list 'calc-number-radix 'calc-twos-complement-mode) - (list n (and (or (= n 2) (= n 8) (= n 16)) arg)) t) + (list n (or arg (calc-is-option))) t) ;; also change global value so minibuffer sees it (setq-default calc-number-radix calc-number-radix)) (setq n calc-number-radix)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc-ext.el --- a/lisp/calc/calc-ext.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc-ext.el Thu May 13 15:13:52 2010 +0200 @@ -104,6 +104,7 @@ (define-key calc-mode-map "J" 'calc-conj) (define-key calc-mode-map "L" 'calc-ln) (define-key calc-mode-map "N" 'calc-eval-num) + (define-key calc-mode-map "O" 'calc-option) (define-key calc-mode-map "P" 'calc-pi) (define-key calc-mode-map "Q" 'calc-sqrt) (define-key calc-mode-map "R" 'calc-round) @@ -1045,7 +1046,7 @@ calc-d-prefix-help calc-describe-function calc-describe-key calc-describe-key-briefly calc-describe-variable calc-f-prefix-help calc-full-help calc-g-prefix-help calc-help-prefix -calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help +calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-option-prefix-help calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help) @@ -1408,9 +1409,18 @@ (with-current-buffer calc-main-buffer calc-hyperbolic-flag) calc-hyperbolic-flag)) - (msg (if hyp-flag - "Inverse Hyperbolic..." - "Inverse..."))) + (opt-flag (if (or + (eq major-mode 'calc-keypad-mode) + (eq major-mode 'calc-trail-mode)) + (with-current-buffer calc-main-buffer + calc-option-flag) + calc-option-flag)) + (msg + (cond + ((and opt-flag hyp-flag) "Option Inverse Hyperbolic...") + (hyp-flag "Inverse Hyperbolic...") + (opt-flag "Option Inverse...") + (t "Inverse...")))) (calc-fancy-prefix 'calc-inverse-flag msg n))) (defconst calc-fancy-prefix-map @@ -1489,9 +1499,18 @@ (with-current-buffer calc-main-buffer calc-inverse-flag) calc-inverse-flag)) - (msg (if inv-flag - "Inverse Hyperbolic..." - "Hyperbolic..."))) + (opt-flag (if (or + (eq major-mode 'calc-keypad-mode) + (eq major-mode 'calc-trail-mode)) + (with-current-buffer calc-main-buffer + calc-option-flag) + calc-option-flag)) + (msg + (cond + ((and opt-flag inv-flag) "Option Inverse Hyperbolic...") + (opt-flag "Option Hyperbolic...") + (inv-flag "Inverse Hyperbolic...") + (t "Hyperbolic...")))) (calc-fancy-prefix 'calc-hyperbolic-flag msg n))) (defun calc-hyperbolic-func () @@ -1504,6 +1523,31 @@ (defun calc-is-hyperbolic () calc-hyperbolic-flag) +(defun calc-option (&optional n) + (interactive "P") + (let* ((inv-flag (if (or + (eq major-mode 'calc-keypad-mode) + (eq major-mode 'calc-trail-mode)) + (with-current-buffer calc-main-buffer + calc-inverse-flag) + calc-inverse-flag)) + (hyp-flag (if (or + (eq major-mode 'calc-keypad-mode) + (eq major-mode 'calc-trail-mode)) + (with-current-buffer calc-main-buffer + calc-hyperbolic-flag) + calc-hyperbolic-flag)) + (msg + (cond + ((and hyp-flag inv-flag) "Option Inverse Hyperbolic...") + (hyp-flag "Option Hyperbolic...") + (inv-flag "Option Inverse...") + (t "Option...")))) + (calc-fancy-prefix 'calc-option-flag msg n))) + +(defun calc-is-option () + calc-option-flag) + (defun calc-keep-args (&optional n) (interactive "P") (calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc-graph.el --- a/lisp/calc/calc-graph.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc-graph.el Thu May 13 15:13:52 2010 +0200 @@ -345,7 +345,7 @@ "set xlabel\nset ylabel\nset title\n" "set noclip points\nset clip one\nset clip two\n" "set format \"%g\"\nset tics\nset xtics\nset ytics\n" - "set data style linespoints\n" + "set style data linespoints\n" "set nogrid\nset nokey\nset nopolar\n")) (if (>= ver 3) (insert "set surface\nset nocontour\n" diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc-help.el --- a/lisp/calc/calc-help.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc-help.el Thu May 13 15:13:52 2010 +0200 @@ -446,6 +446,7 @@ '(calc-inverse-prefix-help calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help + calc-option-prefix-help calc-a-prefix-help calc-b-prefix-help calc-c-prefix-help @@ -512,6 +513,11 @@ "I H + a S (general invert func); v h (rtail)") "inverse-hyperbolic" nil)) +(defun calc-option-prefix-help () + (interactive) + (calc-do-prefix-help + '("") + "option" nil)) (defun calc-f-prefix-help () (interactive) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc-misc.el --- a/lisp/calc/calc-misc.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc-misc.el Thu May 13 15:13:52 2010 +0200 @@ -35,6 +35,7 @@ (declare-function calc-inv-hyp-prefix-help "calc-help" ()) (declare-function calc-inverse-prefix-help "calc-help" ()) (declare-function calc-hyperbolic-prefix-help "calc-help" ()) +(declare-function calc-option-prefix-help "calc-help" ()) (declare-function calc-explain-why "calc-stuff" (why &optional more)) (declare-function calc-clear-command-flag "calc-ext" (f)) (declare-function calc-roll-down-with-selections "calc-sel" (n m)) @@ -219,7 +220,7 @@ (let ((msgs '("Press `h' for complete help; press `?' repeatedly for a summary" "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit" - "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic" + "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic, Option" "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB" "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi" "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro" @@ -245,20 +246,22 @@ (calc-inv-hyp-prefix-help) (calc-inverse-prefix-help)) (calc-hyperbolic-prefix-help)) - (setq calc-help-phase - (if (eq this-command last-command) - (% (1+ calc-help-phase) (1+ (length msgs))) - 0)) - (let ((msg (nth calc-help-phase msgs))) - (message "%s" (if msg - (concat msg ":" - (make-string (- (apply 'max - (mapcar 'length - msgs)) - (length msg)) 32) - " [?=MORE]") - ""))))))) - + (if calc-option-flag + (calc-option-prefix-help) + (setq calc-help-phase + (if (eq this-command last-command) + (% (1+ calc-help-phase) (1+ (length msgs))) + 0)) + (let ((msg (nth calc-help-phase msgs))) + (message "%s" (if msg + (concat msg ":" + (make-string (- (apply 'max + (mapcar 'length + msgs)) + (length msg)) 32) + " [?=MORE]") + "")))))))) + diff -r e56f669f17ce -r fe07c47cf7a7 lisp/calc/calc.el --- a/lisp/calc/calc.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/calc/calc.el Thu May 13 15:13:52 2010 +0200 @@ -797,6 +797,7 @@ calc-matrix-mode calc-inverse-flag calc-hyperbolic-flag + calc-option-flag calc-keep-args-flag calc-angle-mode calc-number-radix @@ -926,6 +927,8 @@ "If non-nil, next operation is Inverse.") (defvar calc-hyperbolic-flag nil "If non-nil, next operation is Hyperbolic.") +(defvar calc-option-flag nil + "If non-nil, next operation has Optional behavior.") (defvar calc-keep-args-flag nil "If non-nil, next operation should not remove its arguments from stack.") (defvar calc-function-open "(" @@ -1038,7 +1041,7 @@ (mapc (lambda (x) (define-key map (char-to-string x) 'undefined)) "lOW") (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key)) - (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz" + (concat "ABCDEFGHIJKLMNOPQRSTUVXZabcdfghjkmoprstuvwxyz" ":\\|!()[]<>{},;=~`\C-k\C-w\C-_")) (define-key map "\M-w" 'calc-missing-key) (define-key map "\M-k" 'calc-missing-key) @@ -1619,6 +1622,7 @@ (calc-select-buffer) (setq calc-inverse-flag nil calc-hyperbolic-flag nil + calc-option-flag nil calc-keep-args-flag nil))) (when (memq 'do-edit calc-command-flags) (switch-to-buffer (get-buffer-create "*Calc Edit*"))) @@ -1757,6 +1761,7 @@ (> (calc-stack-size) 0) (calc-top 1 'sel)) "Sel " "") (if calc-display-dirty "Dirty " "") + (if calc-option-flag "Opt " "") (if calc-inverse-flag "Inv " "") (if calc-hyperbolic-flag "Hyp " "") (if calc-keep-args-flag "Keep " "") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/ede/dired.el --- a/lisp/cedet/ede/dired.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/ede/dired.el Thu May 13 15:13:52 2010 +0200 @@ -27,57 +27,46 @@ ;; This provides a dired interface to EDE, allowing users to modify ;; their project file by adding files (or whatever) directly from a ;; dired buffer. - +(eval-when-compile (require 'cl)) (require 'easymenu) (require 'dired) (require 'ede) ;;; Code: -(defvar ede-dired-minor-mode nil - "Non-nil when in ede dired minor mode.") -(make-variable-buffer-local 'ede-dired-minor-mode) +(defvar ede-dired-keymap + (let ((map (make-sparse-keymap))) + (define-key map ".a" 'ede-dired-add-to-target) + (define-key map ".t" 'ede-new-target) + (define-key map ".s" 'ede-speedbar) + (define-key map ".C" 'ede-compile-project) + (define-key map ".d" 'ede-make-dist) -(defvar ede-dired-keymap nil + (easy-menu-define + ede-dired-menu map "EDE Dired Minor Mode Menu" + '("Project" + [ "Add files to target" ede-dired-add-to-target (ede-current-project) ] + ( "Build" :filter ede-build-forms-menu) + "-" + [ "Create Project" ede-new (not (ede-current-project)) ] + [ "Create Target" ede-new-target (ede-current-project) ] + "-" + ( "Customize Project" :filter ede-customize-forms-menu ) + [ "View Project Tree" ede-speedbar (ede-current-project) ] + )) + map) "Keymap used for ede dired minor mode.") -(if ede-dired-keymap - nil - (setq ede-dired-keymap (make-sparse-keymap)) - (define-key ede-dired-keymap ".a" 'ede-dired-add-to-target) - (define-key ede-dired-keymap ".t" 'ede-new-target) - (define-key ede-dired-keymap ".s" 'ede-speedbar) - (define-key ede-dired-keymap ".C" 'ede-compile-project) - (define-key ede-dired-keymap ".d" 'ede-make-dist) - - (easy-menu-define - ede-dired-menu ede-dired-keymap "EDE Dired Minor Mode Menu" - '("Project" - [ "Add files to target" ede-dired-add-to-target (ede-current-project) ] - ( "Build" :filter ede-build-forms-menu) - "-" - [ "Create Project" ede-new (not (ede-current-project)) ] - [ "Create Target" ede-new-target (ede-current-project) ] - "-" - ( "Customize Project" :filter ede-customize-forms-menu ) - [ "View Project Tree" ede-speedbar (ede-current-project) ] - )) - ) - -(defun ede-dired-minor-mode (&optional arg) +(define-minor-mode ede-dired-minor-mode "A minor mode that should only be activated in DIRED buffers. -If ARG is nil, toggle, if it is a positive number, force on, if +If ARG is nil or a positive number, force on, if negative, force off." - (interactive "P") - (if (not (or (eq major-mode 'dired-mode) - (eq major-mode 'vc-dired-mode))) - (error "Not in DIRED mode")) - (setq ede-dired-minor-mode - (not (or (and (null arg) ede-dired-minor-mode) - (<= (prefix-numeric-value arg) 0)))) - (if (and (not (ede-directory-project-p default-directory)) - (not (interactive-p))) - (setq ede-dired-minor-mode nil)) - ) + :lighter " EDE" :keymap ede-dired-keymap + (unless (derived-mode-p 'dired-mode) + (setq ede-dired-minor-mode nil) + (error "Not in DIRED mode")) + (unless (or (ede-directory-project-p default-directory) + (interactive-p)) + (setq ede-dired-minor-mode nil))) (defun ede-dired-add-to-target (target) "Add a file, or all marked files into a TARGET." @@ -85,24 +74,13 @@ (let ((ede-object (ede-current-project))) (ede-invoke-method 'project-interactive-select-target "Add files to Target: ")))) - (let ((files (dired-get-marked-files t))) - (while files - (project-add-file target (car files)) - ;; Find the buffer for this files, and set it's ede-object - (if (get-file-buffer (car files)) - (with-current-buffer (get-file-buffer (car files)) - (setq ede-object nil) - (setq ede-object (ede-buffer-object (current-buffer))))) - ;; Increment. - (setq files (cdr files))))) - -;; Minor mode management. -(add-to-list 'minor-mode-alist '(ede-dired-minor-mode " EDE")) -(let ((a (assoc 'ede-dired-minor-mode minor-mode-map-alist))) - (if a - (setcdr a ede-dired-keymap) - (add-to-list 'minor-mode-map-alist (cons 'ede-dired-minor-mode - ede-dired-keymap)))) + (dolist (file (dired-get-marked-files t)) + (project-add-file target file) + ;; Find the buffer for this files, and set it's ede-object + (if (get-file-buffer file) + (with-current-buffer (get-file-buffer file) + (setq ede-object nil) + (setq ede-object (ede-buffer-object (current-buffer))))))) (provide 'ede/dired) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/ede/pmake.el --- a/lisp/cedet/ede/pmake.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/ede/pmake.el Thu May 13 15:13:52 2010 +0200 @@ -425,10 +425,9 @@ (link (ede-proj-linkers this)) (name (ede-proj-makefile-target-name this)) (src (oref this source))) - (while comp - (ede-compiler-only-once (car comp) - (ede-proj-makefile-insert-variables (car comp))) - (setq comp (cdr comp))) + (dolist (obj comp) + (ede-compiler-only-once obj + (ede-proj-makefile-insert-variables obj))) (ede-proj-makefile-insert-object-variables (car comp) name src) (while link (ede-linker-only-once (car link) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic.el --- a/lisp/cedet/semantic.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic.el Thu May 13 15:13:52 2010 +0200 @@ -1080,6 +1080,11 @@ (require 'semantic/db-ebrowse) (semanticdb-load-ebrowse-caches))) (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) + ;; Add semantic-ia-complete-symbol to + ;; completion-at-point-functions, so that it is run from + ;; M-TAB. + (add-hook 'completion-at-point-functions + 'semantic-completion-at-point-function) (if global-ede-mode (define-key cedet-menu-map [cedet-menu-separator] '("--"))) (dolist (b (buffer-list)) @@ -1087,6 +1092,8 @@ (semantic-new-buffer-fcn)))) ;; Disable all Semantic features. (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) + (remove-hook 'completion-at-point-functions + 'semantic-completion-at-point-function) (define-key cedet-menu-map [cedet-menu-separator] nil) (define-key cedet-menu-map [semantic-options-separator] nil) ;; FIXME: handle semanticdb-load-ebrowse-caches @@ -1094,6 +1101,9 @@ (if (and (boundp mode) (eval mode)) (funcall mode -1))))) +(defun semantic-completion-at-point-function () + 'semantic-ia-complete-symbol) + ;;; Autoload some functions that are not in semantic/loaddefs (autoload 'global-semantic-idle-completions-mode "semantic/idle" diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic/decorate/mode.el --- a/lisp/cedet/semantic/decorate/mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic/decorate/mode.el Thu May 13 15:13:52 2010 +0200 @@ -224,46 +224,34 @@ ;; Generic mode for handling basic highlighting and decorations. ;; -(defcustom global-semantic-decoration-mode nil - "*If non-nil, enable global use of command `semantic-decoration-mode'. -When this mode is activated, decorations specified by -`semantic-decoration-styles'." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/decorate/mode - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-decoration-mode (if val 1 -1)))) - ;;;###autoload -(defun global-semantic-decoration-mode (&optional arg) +(define-minor-mode global-semantic-decoration-mode "Toggle global use of option `semantic-decoration-mode'. Decoration mode turns on all active decorations as specified -by `semantic-decoration-styles'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-decoration-mode - (semantic-toggle-minor-mode-globally - 'semantic-decoration-mode arg))) +by `semantic-decoration-styles'." + :global t :group 'semantic :group 'semantic-modes + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic/decorate/mode + (semantic-toggle-minor-mode-globally + 'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1))) (defcustom semantic-decoration-mode-hook nil "Hook run at the end of function `semantic-decoration-mode'." :group 'semantic :type 'hook) -;;;;###autoload -(defvar semantic-decoration-mode nil - "Non-nil if command `semantic-decoration-mode' is enabled. -Use the command `semantic-decoration-mode' to change this variable.") -(make-variable-buffer-local 'semantic-decoration-mode) - -(defun semantic-decoration-mode-setup () - "Setup the `semantic-decoration-mode' minor mode. -The minor mode can be turned on only if the semantic feature is available -and the current buffer was set up for parsing. Return non-nil if the +(define-minor-mode semantic-decoration-mode + "Minor mode for decorating tags. +Decorations are specified in `semantic-decoration-styles'. +You can define new decoration styles with +`define-semantic-decoration-style'. +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." +;; +;;\\{semantic-decoration-map}" + nil nil nil (if semantic-decoration-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn @@ -280,8 +268,7 @@ 'semantic-decorate-tags-after-full-reparse nil t) ;; Add decorations to available tags. The above hooks ensure ;; that new tags will be decorated when they become available. - (semantic-decorate-add-decorations (semantic-fetch-available-tags)) - ) + (semantic-decorate-add-decorations (semantic-fetch-available-tags))) ;; Remove decorations from available tags. (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) ;; Cleanup any leftover crap too. @@ -290,41 +277,10 @@ (remove-hook 'semantic-after-partial-cache-change-hook 'semantic-decorate-tags-after-partial-reparse t) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-decorate-tags-after-full-reparse t) - ) - semantic-decoration-mode) - -(defun semantic-decoration-mode (&optional arg) - "Minor mode for decorating tags. -Decorations are specified in `semantic-decoration-styles'. -You can define new decoration styles with -`define-semantic-decoration-style'. -With prefix argument ARG, turn on if positive, otherwise off. The -minor mode can be turned on only if semantic feature is available and -the current buffer was set up for parsing. Return non-nil if the -minor mode is enabled." -;; -;;\\{semantic-decoration-map}" - (interactive - (list (or current-prefix-arg - (if semantic-decoration-mode 0 1)))) - (setq semantic-decoration-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-decoration-mode))) - (semantic-decoration-mode-setup) - (run-hooks 'semantic-decoration-mode-hook) - (if (called-interactively-p 'interactive) - (message "decoration-mode minor mode %sabled" - (if semantic-decoration-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-decoration-mode) + 'semantic-decorate-tags-after-full-reparse t))) (semantic-add-minor-mode 'semantic-decoration-mode - "" - nil) + "") (defun semantic-decorate-tags-after-full-reparse (tag-list) "Add decorations after a complete reparse of the current buffer. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic/ia.el --- a/lisp/cedet/semantic/ia.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic/ia.el Thu May 13 15:13:52 2010 +0200 @@ -110,56 +110,52 @@ If POS is nil, default to point. Completion options are calculated with `semantic-analyze-possible-completions'." (interactive "d") - (or pos (setq pos (point))) - ;; Calculating completions is a two step process. - ;; - ;; The first analyzer the current context, which finds tags - ;; for all the stuff that may be references by the code around - ;; POS. - ;; - ;; The second step derives completions from that context. - (let* ((a (semantic-analyze-current-context pos)) - (syms (semantic-ia-get-completions a pos)) - (pre (car (reverse (oref a prefix)))) - ) - ;; If PRE was actually an already completed symbol, it doesn't - ;; come in as a string, but as a tag instead. - (if (semantic-tag-p pre) - ;; We will try completions on it anyway. - (setq pre (semantic-tag-name pre))) - ;; Complete this symbol. - (if (null syms) - (progn - ;(message "No smart completions found. Trying senator-complete-symbol.") + (when (semantic-active-p) + (or pos (setq pos (point))) + ;; Calculating completions is a two step process. + ;; + ;; The first analyzer the current context, which finds tags for + ;; all the stuff that may be references by the code around POS. + ;; + ;; The second step derives completions from that context. + (let* ((a (semantic-analyze-current-context pos)) + (syms (semantic-ia-get-completions a pos)) + (pre (car (reverse (oref a prefix))))) + ;; If PRE was actually an already completed symbol, it doesn't + ;; come in as a string, but as a tag instead. + (if (semantic-tag-p pre) + ;; We will try completions on it anyway. + (setq pre (semantic-tag-name pre))) + ;; Complete this symbol. + (if (null syms) (if (semantic-analyze-context-p a) ;; This is a clever hack. If we were unable to find any ;; smart completions, lets divert to how senator derives ;; completions. ;; - ;; This is a way of making this fcn more useful since the - ;; smart completion engine sometimes failes. - (semantic-complete-symbol))) - ;; Use try completion to seek a common substring. - (let ((tc (try-completion (or pre "") syms))) - (if (and (stringp tc) (not (string= tc (or pre "")))) - (let ((tok (semantic-find-first-tag-by-name - tc syms))) - ;; Delete what came before... - (when (and (car (oref a bounds)) (cdr (oref a bounds))) - (delete-region (car (oref a bounds)) - (cdr (oref a bounds))) - (goto-char (car (oref a bounds)))) - ;; We have some new text. Stick it in. - (if tok - (semantic-ia-insert-tag tok) - (insert tc))) - ;; We don't have new text. Show all completions. - (when (cdr (oref a bounds)) - (goto-char (cdr (oref a bounds)))) - (with-output-to-temp-buffer "*Completions*" - (display-completion-list - (mapcar semantic-ia-completion-format-tag-function syms)) - )))))) + ;; This is a way of making this fcn more useful since + ;; the smart completion engine sometimes failes. + (semantic-complete-symbol)) + ;; Use try completion to seek a common substring. + (let ((tc (try-completion (or pre "") syms))) + (if (and (stringp tc) (not (string= tc (or pre "")))) + (let ((tok (semantic-find-first-tag-by-name + tc syms))) + ;; Delete what came before... + (when (and (car (oref a bounds)) (cdr (oref a bounds))) + (delete-region (car (oref a bounds)) + (cdr (oref a bounds))) + (goto-char (car (oref a bounds)))) + ;; We have some new text. Stick it in. + (if tok + (semantic-ia-insert-tag tok) + (insert tc))) + ;; We don't have new text. Show all completions. + (when (cdr (oref a bounds)) + (goto-char (cdr (oref a bounds)))) + (with-output-to-temp-buffer "*Completions*" + (display-completion-list + (mapcar semantic-ia-completion-format-tag-function syms))))))))) (defcustom semantic-ia-completion-menu-format-tag-function 'semantic-uml-concise-prototype-nonterminal diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic/idle.el --- a/lisp/cedet/semantic/idle.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic/idle.el Thu May 13 15:13:52 2010 +0200 @@ -128,16 +128,6 @@ ;; The minor mode portion of this code just sets up the minor mode ;; which does the initial scheduling of the idle timers. ;; -;;;###autoload -(defcustom global-semantic-idle-scheduler-mode nil - "*If non-nil, enable global use of idle-scheduler mode." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/idle - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-idle-scheduler-mode (if val 1 -1)))) (defcustom semantic-idle-scheduler-mode-hook nil "Hook run at the end of the function `semantic-idle-scheduler-mode'." @@ -167,24 +157,8 @@ (or (<= semantic-idle-scheduler-max-buffer-size 0) (< (buffer-size) semantic-idle-scheduler-max-buffer-size)))) -(defun semantic-idle-scheduler-mode-setup () - "Setup option `semantic-idle-scheduler-mode'. -The minor mode can be turned on only if semantic feature is available -and the current buffer was set up for parsing. When minor mode is -enabled parse the current buffer if needed. Return non-nil if the -minor mode is enabled." - (if semantic-idle-scheduler-mode - (if (not (and (featurep 'semantic) (semantic-active-p))) - (progn - ;; Disable minor mode if semantic stuff not available - (setq semantic-idle-scheduler-mode nil) - (error "Buffer %s was not set up idle time scheduling" - (buffer-name))) - (semantic-idle-scheduler-setup-timers))) - semantic-idle-scheduler-mode) - ;;;###autoload -(defun semantic-idle-scheduler-mode (&optional arg) +(define-minor-mode semantic-idle-scheduler-mode "Minor mode to auto parse buffer following a change. When this mode is off, a buffer is only rescanned for tokens when some command requests the list of available tokens. When idle-scheduler @@ -195,26 +169,18 @@ minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-idle-scheduler-mode 0 1)))) - (setq semantic-idle-scheduler-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-idle-scheduler-mode))) - (semantic-idle-scheduler-mode-setup) - (run-hooks 'semantic-idle-scheduler-mode-hook) - (if (called-interactively-p 'interactive) - (message "idle-scheduler minor mode %sabled" - (if semantic-idle-scheduler-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-idle-scheduler-mode) + nil nil nil + (if semantic-idle-scheduler-mode + (if (not (and (featurep 'semantic) (semantic-active-p))) + (progn + ;; Disable minor mode if semantic stuff not available + (setq semantic-idle-scheduler-mode nil) + (error "Buffer %s was not set up idle time scheduling" + (buffer-name))) + (semantic-idle-scheduler-setup-timers)))) (semantic-add-minor-mode 'semantic-idle-scheduler-mode - "ARP" - nil) + "ARP") ;;; SERVICES services ;; @@ -582,31 +548,23 @@ (mode (intern (concat (symbol-name name) "-mode"))) (hook (intern (concat (symbol-name name) "-mode-hook"))) (map (intern (concat (symbol-name name) "-mode-map"))) - (setup (intern (concat (symbol-name name) "-mode-setup"))) (func (intern (concat (symbol-name name) "-idle-function")))) `(eval-and-compile - (defun ,global (&optional arg) + (define-minor-mode ,global ,(concat "Toggle " (symbol-name global) ". With ARG, turn the minor mode on if ARG is positive, off otherwise. When this minor mode is enabled, `" (symbol-name mode) "' is turned on in every Semantic-supported buffer.") - (interactive "P") - (setq ,global - (semantic-toggle-minor-mode-globally - ',mode arg))) - - (defcustom ,global nil - ,(concat "Non-nil if `" (symbol-name mode) "' is enabled.") + :global t :group 'semantic :group 'semantic-modes - :type 'boolean :require 'semantic/idle - :initialize 'custom-initialize-default - :set (lambda (sym val) - (,global (if val 1 -1)))) + (semantic-toggle-minor-mode-globally + ',mode (if ,global 1 -1))) + ;; FIXME: Get rid of this when define-minor-mode does it for us. (defcustom ,hook nil ,(concat "Hook run at the end of function `" (symbol-name mode) "'.") :group 'semantic @@ -617,14 +575,9 @@ km) ,(concat "Keymap for `" (symbol-name mode) "'.")) - (defvar ,mode nil - ,(concat "Non-nil if the minor mode `" (symbol-name mode) "' is enabled. -Use the command `" (symbol-name mode) "' to change this variable.")) - (make-variable-buffer-local ',mode) - - (defun ,setup () - ,(concat "Set up `" (symbol-name mode) "'. -Return non-nil if the minor mode is enabled.") + (define-minor-mode ,mode + ,doc + :keymap ,map (if ,mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn @@ -633,36 +586,12 @@ (error "Buffer %s was not set up for parsing" (buffer-name))) ;; Enable the mode mode - (semantic-idle-scheduler-add #',func) - ) + (semantic-idle-scheduler-add #',func)) ;; Disable the mode mode - (semantic-idle-scheduler-remove #',func) - ) - ,mode) - - (defun ,mode (&optional arg) - ,doc - (interactive - (list (or current-prefix-arg - (if ,mode 0 1)))) - (setq ,mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not ,mode))) - (,setup) - (run-hooks ,hook) - (if (called-interactively-p 'interactive) - (message "%s %sabled" - (symbol-name ',mode) - (if ,mode "en" "dis"))) - (semantic-mode-line-update) - ,mode) + (semantic-idle-scheduler-remove #',func))) (semantic-add-minor-mode ',mode - "" ; idle schedulers are quiet? - ,map) + "") ; idle schedulers are quiet? (defun ,func () ,(concat "Perform idle activity for the minor mode `" @@ -814,21 +743,6 @@ of the lexical token at point whenever Emacs is idle." :group 'semantic :group 'semantic-modes - (semantic-idle-summary-mode-setup) - (semantic-mode-line-update)) - -(defun semantic-idle-summary-refresh-echo-area () - (and semantic-idle-summary-mode - eldoc-last-message - (if (and (not executing-kbd-macro) - (not (and (boundp 'edebug-active) edebug-active)) - (not cursor-in-echo-area) - (not (eq (selected-window) (minibuffer-window)))) - (eldoc-message eldoc-last-message) - (setq eldoc-last-message nil)))) - -(defun semantic-idle-summary-mode-setup () - "Set up `semantic-idle-summary-mode'." (if semantic-idle-summary-mode ;; Enable the mode (progn @@ -842,8 +756,17 @@ (add-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)) ;; Disable the mode (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function) - (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)) - semantic-idle-summary-mode) + (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))) + +(defun semantic-idle-summary-refresh-echo-area () + (and semantic-idle-summary-mode + eldoc-last-message + (if (and (not executing-kbd-macro) + (not (and (boundp 'edebug-active) edebug-active)) + (not cursor-in-echo-area) + (not (eq (selected-window) (minibuffer-window)))) + (eldoc-message eldoc-last-message) + (setq eldoc-last-message nil)))) (semantic-add-minor-mode 'semantic-idle-summary-mode "") @@ -957,22 +880,22 @@ ;;;###autoload -(defun global-semantic-idle-scheduler-mode (&optional arg) +(define-minor-mode global-semantic-idle-scheduler-mode "Toggle global use of option `semantic-idle-scheduler-mode'. The idle scheduler will automatically reparse buffers in idle time, and then schedule other jobs setup with `semantic-idle-scheduler-add'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") +If ARG is positive or nil, enable, if it is negative, disable." + :global t + :group 'semantic + :group 'semantic-modes ;; When turning off, disable other idle modes. - (when (or (and (numberp arg) (< arg 0)) - (and (null arg) global-semantic-idle-scheduler-mode)) + (when (null global-semantic-idle-scheduler-mode) (global-semantic-idle-summary-mode -1) (global-semantic-idle-tag-highlight-mode -1) (global-semantic-idle-completions-mode -1)) - (setq global-semantic-idle-scheduler-mode - (semantic-toggle-minor-mode-globally - 'semantic-idle-scheduler-mode arg))) + (semantic-toggle-minor-mode-globally + 'semantic-idle-scheduler-mode + (if global-semantic-idle-scheduler-mode 1 -1))) ;;; Completion Popup Mode diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic/mru-bookmark.el --- a/lisp/cedet/semantic/mru-bookmark.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic/mru-bookmark.el Thu May 13 15:13:52 2010 +0200 @@ -239,27 +239,15 @@ ;; ;; Tracking minor mode. -(defcustom global-semantic-mru-bookmark-mode nil - "If non-nil, enable `semantic-mru-bookmark-mode' globally. -When this mode is enabled, Emacs keeps track of which tags have -been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic-util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-mru-bookmark-mode (if val 1 -1)))) - ;;;###autoload -(defun global-semantic-mru-bookmark-mode (&optional arg) +(define-minor-mode global-semantic-mru-bookmark-mode "Toggle global use of option `semantic-mru-bookmark-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-mru-bookmark-mode - (semantic-toggle-minor-mode-globally - 'semantic-mru-bookmark-mode arg))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic :group 'semantic-modes + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic-util-modes + (semantic-toggle-minor-mode-globally + 'semantic-mru-bookmark-mode (if global-semantic-mru-bookmark-mode 1 -1))) (defcustom semantic-mru-bookmark-mode-hook nil "*Hook run at the end of function `semantic-mru-bookmark-mode'." @@ -272,17 +260,18 @@ km) "Keymap for mru-bookmark minor mode.") -(defvar semantic-mru-bookmark-mode nil - "Non-nil if mru-bookmark minor mode is enabled. -Use the command `semantic-mru-bookmark-mode' to change this variable.") -(make-variable-buffer-local 'semantic-mru-bookmark-mode) +(define-minor-mode semantic-mru-bookmark-mode + "Minor mode for tracking tag-based bookmarks automatically. +When this mode is enabled, Emacs keeps track of which tags have +been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]. -(defun semantic-mru-bookmark-mode-setup () - "Setup option `semantic-mru-bookmark-mode'. -The minor mode can be turned on only if semantic feature is available -and the current buffer was set up for parsing. When minor mode is -enabled parse the current buffer if needed. Return non-nil if the +\\{semantic-mru-bookmark-mode-map} + +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." + :keymap semantic-mru-bookmark-mode-map (if semantic-mru-bookmark-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn @@ -294,47 +283,15 @@ (add-hook 'semantic-edits-new-change-hooks 'semantic-mru-bookmark-change-hook-fcn nil t) (add-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn nil t) - ) + 'semantic-mru-bookmark-change-hook-fcn nil t)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-hooks 'semantic-mru-bookmark-change-hook-fcn t) (remove-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn t) - ) - semantic-mru-bookmark-mode) - -(defun semantic-mru-bookmark-mode (&optional arg) - "Minor mode for tracking tag-based bookmarks automatically. -When this mode is enabled, Emacs keeps track of which tags have -been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]. - -\\{semantic-mru-bookmark-mode-map} - -With prefix argument ARG, turn on if positive, otherwise off. The -minor mode can be turned on only if semantic feature is available and -the current buffer was set up for parsing. Return non-nil if the -minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-mru-bookmark-mode 0 1)))) - (setq semantic-mru-bookmark-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-mru-bookmark-mode))) - (semantic-mru-bookmark-mode-setup) - (run-hooks 'semantic-mru-bookmark-mode-hook) - (if (called-interactively-p 'interactive) - (message "mru-bookmark minor mode %sabled" - (if semantic-mru-bookmark-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-mru-bookmark-mode) + 'semantic-mru-bookmark-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-mru-bookmark-mode - "k" - semantic-mru-bookmark-mode-map) + "k") ;;; COMPLETING READ ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/semantic/util-modes.el --- a/lisp/cedet/semantic/util-modes.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/semantic/util-modes.el Thu May 13 15:13:52 2010 +0200 @@ -28,6 +28,10 @@ ;; ;;; Code: + +;; FIXME: compiling util-modes.el seems to require loading util-modes.el, +;; so if the previous compilation generated a file that fails to load, +;; recompiling fails to fix the problem. (require 'semantic) ;;; Group for all semantic enhancing modes @@ -49,8 +53,7 @@ :set (lambda (sym val) (set-default sym val) ;; Update status of all Semantic enabled buffers - (semantic-map-buffers - #'semantic-mode-line-update))) + (semantic-mode-line-update))) (defcustom semantic-mode-line-prefix (propertize "S" 'face 'bold) @@ -60,59 +63,61 @@ :require 'semantic/util-modes :initialize 'custom-initialize-default) -(defvar semantic-minor-modes-status nil - "String showing Semantic minor modes which are locally enabled. +(defvar semantic-minor-modes-format nil + "Mode line format showing Semantic minor modes which are locally enabled. It is displayed in the mode line.") -(make-variable-buffer-local 'semantic-minor-modes-status) +(put 'semantic-minor-modes-format 'risky-local-variable t) (defvar semantic-minor-mode-alist nil "Alist saying how to show Semantic minor modes in the mode line. Like variable `minor-mode-alist'.") (defun semantic-mode-line-update () - "Update display of Semantic minor modes in the mode line. + "Update mode line format of Semantic minor modes. Only minor modes that are locally enabled are shown in the mode line." - (setq semantic-minor-modes-status nil) - (if semantic-update-mode-line - (let ((ml semantic-minor-mode-alist) - mm ms see) - (while ml - (setq mm (car ml) - ms (cadr mm) - mm (car mm) - ml (cdr ml)) - (when (and (symbol-value mm) - ;; Only show local minor mode status - (not (memq mm semantic-init-hook))) - (and ms - (symbolp ms) - (setq ms (symbol-value ms))) - (and (stringp ms) - (not (member ms see)) ;; Don't duplicate same status - (setq see (cons ms see) - ms (if (string-match "^[ ]*\\(.+\\)" ms) - (match-string 1 ms))) - (setq semantic-minor-modes-status - (if semantic-minor-modes-status - (concat semantic-minor-modes-status "/" ms) - ms))))) - (if semantic-minor-modes-status - (setq semantic-minor-modes-status - (concat - " " - (if (string-match "^[ ]*\\(.+\\)" - semantic-mode-line-prefix) - (match-string 1 semantic-mode-line-prefix) - "S") - "/" - semantic-minor-modes-status)))))) + (setq semantic-minor-modes-format nil) + (dolist (x semantic-minor-mode-alist) + (setq minor-mode-alist (delq (assq (car x) minor-mode-alist) + minor-mode-alist))) + (when semantic-update-mode-line + (let ((locals '())) + ;; Select the minor modes that aren't enabled globally and who + ;; have a non-empty "name". + (dolist (x semantic-minor-mode-alist) + (unless (or (memq (car x) semantic-init-hook) + (not (string-match "^[ ]*\\(.+\\)" (cadr x)))) + (push (list (car x) (concat "/" (match-string 1 (cadr x)))) locals))) + ;; Then build the format spec. + (when locals + (let ((prefix (if (string-match "^[ ]*\\(.+\\)" + semantic-mode-line-prefix) + (match-string 1 semantic-mode-line-prefix) + "S"))) + (setq semantic-minor-modes-format + `((:eval (if (or ,@(mapcar 'car locals)) + ,(concat " " prefix))))) + ;; It would be easier to just put `locals' inside + ;; semantic-minor-modes-format, but then things like + ;; mode-line-minor-mode-help can't find the right major mode + ;; any more. So instead, we carefully put the minor modes + ;; in minor-mode-alist. + (let* ((elem (or (assq 'semantic-minor-modes-format + minor-mode-alist) + ;; FIXME: This entry is meaningless for + ;; mode-line-minor-mode-help. + '(semantic-minor-modes-format + semantic-minor-modes-format))) + (tail (or (memq elem minor-mode-alist) + (setq minor-mode-alist + (cons elem minor-mode-alist))))) + (setcdr tail (nconc locals (cdr tail))))))))) (defun semantic-desktop-ignore-this-minor-mode (buffer) "Installed as a minor-mode initializer for Desktop mode. BUFFER is the buffer to not initialize a Semantic minor mode in." nil) -(defun semantic-add-minor-mode (toggle name &optional keymap) +(defun semantic-add-minor-mode (toggle name) "Register a new Semantic minor mode. TOGGLE is a symbol which is the name of a buffer-local variable that is toggled on or off to say whether the minor mode is active or not. @@ -120,98 +125,58 @@ NAME specifies what will appear in the mode line when the minor mode is active. NAME should be either a string starting with a space, or a -symbol whose value is such a string. - -Optional KEYMAP is the keymap for the minor mode that will be added to -`minor-mode-map-alist'." - ;; Add a dymmy semantic minor mode to display the status - (or (assq 'semantic-minor-modes-status minor-mode-alist) - (setq minor-mode-alist (cons (list 'semantic-minor-modes-status - 'semantic-minor-modes-status) - minor-mode-alist))) - (if (fboundp 'add-minor-mode) - ;; Emacs 21 & XEmacs - (add-minor-mode toggle "" keymap) - ;; Emacs 20 - (or (assq toggle minor-mode-alist) - (setq minor-mode-alist (cons (list toggle "") minor-mode-alist))) - (or (not keymap) - (assq toggle minor-mode-map-alist) - (setq minor-mode-map-alist (cons (cons toggle keymap) - minor-mode-map-alist)))) +symbol whose value is such a string." ;; Record how to display this minor mode in the mode line (let ((mm (assq toggle semantic-minor-mode-alist))) (if mm (setcdr mm (list name)) (setq semantic-minor-mode-alist (cons (list toggle name) semantic-minor-mode-alist)))) + (semantic-mode-line-update) ;; Semantic minor modes don't work w/ Desktop restore. ;; This line will disable this minor mode from being restored ;; by Desktop. (when (boundp 'desktop-minor-mode-handlers) (add-to-list 'desktop-minor-mode-handlers - (cons toggle 'semantic-desktop-ignore-this-minor-mode))) - ) + (cons toggle 'semantic-desktop-ignore-this-minor-mode)))) (defun semantic-toggle-minor-mode-globally (mode &optional arg) "Toggle minor mode MODE in every Semantic enabled buffer. Return non-nil if MODE is turned on in every Semantic enabled buffer. -If ARG is positive, enable, if it is negative, disable. If ARG is -nil, then toggle. Otherwise do nothing. MODE must be a valid minor -mode defined in `minor-mode-alist' and must be too an interactive -function used to toggle the mode." - (or (and (fboundp mode) (assq mode minor-mode-alist)) +If ARG is positive, enable, if it is negative, disable. +MODE must be a valid minor mode defined in `minor-mode-alist' and must be +too an interactive function used to toggle the mode." + ;; FIXME: All callers should pass a -1 or +1 argument. + (or (and (fboundp mode) (or (assq mode minor-mode-alist) ;Needed? + (assq mode semantic-minor-mode-alist))) (error "Semantic minor mode %s not found" mode)) - (if (not arg) - (if (memq mode semantic-init-hook) - (setq arg -1) - (setq arg 1))) - ;; Add or remove the MODE toggle function from - ;; `semantic-init-hook'. Then turn MODE on or off in every - ;; Semantic enabled buffer. + ;; Add or remove the MODE toggle function from `semantic-init-hook'. (cond ;; Turn off if ARG < 0 - ((< arg 0) - (remove-hook 'semantic-init-hook mode) - (semantic-map-buffers #'(lambda () (funcall mode -1))) - nil) + ((< arg 0) (remove-hook 'semantic-init-hook mode)) ;; Turn on if ARG > 0 - ((> arg 0) - (add-hook 'semantic-init-hook mode) - (semantic-map-buffers #'(lambda () (funcall mode 1))) - t) + ((> arg 0) (add-hook 'semantic-init-hook mode)) ;; Otherwise just check MODE state (t - (memq mode semantic-init-hook)) - )) + (error "semantic-toggle-minor-mode-globally: arg should be -1 or 1"))) + ;; Update the minor mode format. + (semantic-mode-line-update) + ;; Then turn MODE on or off in every Semantic enabled buffer. + (semantic-map-buffers #'(lambda () (funcall mode arg)))) ;;;; ;;;; Minor mode to highlight areas that a user edits. ;;;; ;;;###autoload -(defun global-semantic-highlight-edits-mode (&optional arg) +(define-minor-mode global-semantic-highlight-edits-mode "Toggle global use of option `semantic-highlight-edits-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-highlight-edits-mode - (semantic-toggle-minor-mode-globally - 'semantic-highlight-edits-mode arg))) - -;;;###autoload -(defcustom global-semantic-highlight-edits-mode nil - "If non-nil enable global use of variable `semantic-highlight-edits-mode'. -When this mode is enabled, changes made to a buffer are highlighted -until the buffer is reparsed." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-highlight-edits-mode (if val 1 -1)))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic :group 'semantic-modes + (semantic-toggle-minor-mode-globally + 'semantic-highlight-edits-mode + (if global-semantic-highlight-edits-mode 1 -1))) (defcustom semantic-highlight-edits-mode-hook nil "Hook run at the end of function `semantic-highlight-edits-mode'." @@ -238,36 +203,8 @@ km) "Keymap for highlight-edits minor mode.") -(defvar semantic-highlight-edits-mode nil - "Non-nil if highlight-edits minor mode is enabled. -Use the command `semantic-highlight-edits-mode' to change this variable.") -(make-variable-buffer-local 'semantic-highlight-edits-mode) - -(defun semantic-highlight-edits-mode-setup () - "Setup option `semantic-highlight-edits-mode'. -The minor mode can be turned on only if semantic feature is available -and the current buffer was set up for parsing. When minor mode is -enabled parse the current buffer if needed. Return non-nil if the -minor mode is enabled." - (if semantic-highlight-edits-mode - (if (not (and (featurep 'semantic) (semantic-active-p))) - (progn - ;; Disable minor mode if semantic stuff not available - (setq semantic-highlight-edits-mode nil) - (error "Buffer %s was not set up for parsing" - (buffer-name))) - (semantic-make-local-hook 'semantic-edits-new-change-hooks) - (add-hook 'semantic-edits-new-change-hooks - 'semantic-highlight-edits-new-change-hook-fcn nil t) - ) - ;; Remove hooks - (remove-hook 'semantic-edits-new-change-hooks - 'semantic-highlight-edits-new-change-hook-fcn t) - ) - semantic-highlight-edits-mode) - ;;;###autoload -(defun semantic-highlight-edits-mode (&optional arg) +(define-minor-mode semantic-highlight-edits-mode "Minor mode for highlighting changes made in a buffer. Changes are tracked by semantic so that the incremental parser can work properly. @@ -277,54 +214,38 @@ minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-highlight-edits-mode 0 1)))) - (setq semantic-highlight-edits-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-highlight-edits-mode))) - (semantic-highlight-edits-mode-setup) - (run-hooks 'semantic-highlight-edits-mode-hook) - (if (called-interactively-p 'interactive) - (message "highlight-edits minor mode %sabled" - (if semantic-highlight-edits-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-highlight-edits-mode) + :keymap semantic-highlight-edits-mode-map + (if semantic-highlight-edits-mode + (if (not (and (featurep 'semantic) (semantic-active-p))) + (progn + ;; Disable minor mode if semantic stuff not available + (setq semantic-highlight-edits-mode nil) + (error "Buffer %s was not set up for parsing" + (buffer-name))) + (semantic-make-local-hook 'semantic-edits-new-change-hooks) + (add-hook 'semantic-edits-new-change-hooks + 'semantic-highlight-edits-new-change-hook-fcn nil t)) + ;; Remove hooks + (remove-hook 'semantic-edits-new-change-hooks + 'semantic-highlight-edits-new-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-highlight-edits-mode - "e" - semantic-highlight-edits-mode-map) - + "e") ;;;; ;;;; Minor mode to show unmatched-syntax elements ;;;; ;;;###autoload -(defun global-semantic-show-unmatched-syntax-mode (&optional arg) +(define-minor-mode global-semantic-show-unmatched-syntax-mode "Toggle global use of option `semantic-show-unmatched-syntax-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-show-unmatched-syntax-mode - (semantic-toggle-minor-mode-globally - 'semantic-show-unmatched-syntax-mode arg))) - -;;;###autoload -(defcustom global-semantic-show-unmatched-syntax-mode nil - "If non-nil, enable global use of `semantic-show-unmatched-syntax-mode'. -When this mode is enabled, syntax in the current buffer which the -semantic parser cannot match is highlighted with a red underline." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-show-unmatched-syntax-mode (if val 1 -1)))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic :group 'semantic-modes + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic/util-modes + (semantic-toggle-minor-mode-globally + 'semantic-show-unmatched-syntax-mode + (if global-semantic-show-unmatched-syntax-mode 1 -1))) (defcustom semantic-show-unmatched-syntax-mode-hook nil "Hook run at the end of function `semantic-show-unmatched-syntax-mode'." @@ -432,18 +353,21 @@ km) "Keymap for command `semantic-show-unmatched-syntax-mode'.") -(defvar semantic-show-unmatched-syntax-mode nil - "Non-nil if show-unmatched-syntax minor mode is enabled. -Use the command `semantic-show-unmatched-syntax-mode' to change this -variable.") -(make-variable-buffer-local 'semantic-show-unmatched-syntax-mode) +;;;###autoload +(define-minor-mode semantic-show-unmatched-syntax-mode + "Minor mode to highlight unmatched lexical syntax tokens. +When a parser executes, some elements in the buffer may not match any +parser rules. These text characters are considered unmatched syntax. +Often time, the display of unmatched syntax can expose coding +problems before the compiler is run. -(defun semantic-show-unmatched-syntax-mode-setup () - "Setup the `semantic-show-unmatched-syntax' minor mode. -The minor mode can be turned on only if semantic feature is available -and the current buffer was set up for parsing. When minor mode is -enabled parse the current buffer if needed. Return non-nil if the -minor mode is enabled." +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the +minor mode is enabled. + +\\{semantic-show-unmatched-syntax-mode-map}" + :keymap semantic-show-unmatched-syntax-mode-map (if semantic-show-unmatched-syntax-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn @@ -468,43 +392,10 @@ (remove-hook 'semantic-pre-clean-token-hooks 'semantic-clean-token-of-unmatched-syntax t) ;; Cleanup unmatched-syntax highlighting - (semantic-clean-unmatched-syntax-in-buffer)) - semantic-show-unmatched-syntax-mode) - -;;;###autoload -(defun semantic-show-unmatched-syntax-mode (&optional arg) - "Minor mode to highlight unmatched lexical syntax tokens. -When a parser executes, some elements in the buffer may not match any -parser rules. These text characters are considered unmatched syntax. -Often time, the display of unmatched syntax can expose coding -problems before the compiler is run. - -With prefix argument ARG, turn on if positive, otherwise off. The -minor mode can be turned on only if semantic feature is available and -the current buffer was set up for parsing. Return non-nil if the -minor mode is enabled. - -\\{semantic-show-unmatched-syntax-mode-map}" - (interactive - (list (or current-prefix-arg - (if semantic-show-unmatched-syntax-mode 0 1)))) - (setq semantic-show-unmatched-syntax-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-show-unmatched-syntax-mode))) - (semantic-show-unmatched-syntax-mode-setup) - (run-hooks 'semantic-show-unmatched-syntax-mode-hook) - (if (called-interactively-p 'interactive) - (message "show-unmatched-syntax minor mode %sabled" - (if semantic-show-unmatched-syntax-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-show-unmatched-syntax-mode) + (semantic-clean-unmatched-syntax-in-buffer))) (semantic-add-minor-mode 'semantic-show-unmatched-syntax-mode - "u" - semantic-show-unmatched-syntax-mode-map) + "u") (defun semantic-show-unmatched-syntax-next () "Move forward to the next occurrence of unmatched syntax." @@ -519,27 +410,15 @@ ;;;; ;;;###autoload -(defcustom global-semantic-show-parser-state-mode nil - "If non-nil enable global use of `semantic-show-parser-state-mode'. -When enabled, the current parse state of the current buffer is displayed -in the mode line. See `semantic-show-parser-state-marker' for details -on what is displayed." - :group 'semantic - :type 'boolean - :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-show-parser-state-mode (if val 1 -1)))) - -;;;###autoload -(defun global-semantic-show-parser-state-mode (&optional arg) +(define-minor-mode global-semantic-show-parser-state-mode "Toggle global use of option `semantic-show-parser-state-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-show-parser-state-mode - (semantic-toggle-minor-mode-globally - 'semantic-show-parser-state-mode arg))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic/util-modes + (semantic-toggle-minor-mode-globally + 'semantic-show-parser-state-mode + (if global-semantic-show-parser-state-mode 1 -1))) (defcustom semantic-show-parser-state-mode-hook nil "Hook run at the end of function `semantic-show-parser-state-mode'." @@ -551,17 +430,22 @@ km) "Keymap for show-parser-state minor mode.") -(defvar semantic-show-parser-state-mode nil - "Non-nil if show-parser-state minor mode is enabled. -Use the command `semantic-show-parser-state-mode' to change this variable.") -(make-variable-buffer-local 'semantic-show-parser-state-mode) - -(defun semantic-show-parser-state-mode-setup () - "Setup option `semantic-show-parser-state-mode'. -The minor mode can be turned on only if semantic feature is available -and the current buffer was set up for parsing. When minor mode is -enabled parse the current buffer if needed. Return non-nil if the +;;;###autoload +(define-minor-mode semantic-show-parser-state-mode + "Minor mode for displaying parser cache state in the modeline. +The cache can be in one of three states. They are +Up to date, Partial reparse needed, and Full reparse needed. +The state is indicated in the modeline with the following characters: + `-' -> The cache is up to date. + `!' -> The cache requires a full update. + `~' -> The cache needs to be incrementally parsed. + `%' -> The cache is not currently parseable. + `@' -> Auto-parse in progress (not set here.) +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." + :keymap semantic-show-parser-state-mode-map (if semantic-show-parser-state-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn @@ -603,8 +487,7 @@ 'semantic-show-parser-state-auto-marker nil t) (semantic-make-local-hook 'semantic-after-idle-scheduler-reparse-hook) (add-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker nil t) - ) + 'semantic-show-parser-state-marker nil t)) ;; Remove parts of mode line (setq mode-line-modified (delq 'semantic-show-parser-state-string mode-line-modified)) @@ -626,45 +509,10 @@ (remove-hook 'semantic-before-idle-scheduler-reparse-hook 'semantic-show-parser-state-auto-marker t) (remove-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker t) - ) - semantic-show-parser-state-mode) - -;;;###autoload -(defun semantic-show-parser-state-mode (&optional arg) - "Minor mode for displaying parser cache state in the modeline. -The cache can be in one of three states. They are -Up to date, Partial reparse needed, and Full reparse needed. -The state is indicated in the modeline with the following characters: - `-' -> The cache is up to date. - `!' -> The cache requires a full update. - `~' -> The cache needs to be incrementally parsed. - `%' -> The cache is not currently parseable. - `@' -> Auto-parse in progress (not set here.) -With prefix argument ARG, turn on if positive, otherwise off. The -minor mode can be turned on only if semantic feature is available and -the current buffer was set up for parsing. Return non-nil if the -minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-show-parser-state-mode 0 1)))) - (setq semantic-show-parser-state-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-show-parser-state-mode))) - (semantic-show-parser-state-mode-setup) - (run-hooks 'semantic-show-parser-state-mode-hook) - (if (called-interactively-p 'interactive) - (message "show-parser-state minor mode %sabled" - (if semantic-show-parser-state-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-show-parser-state-mode) + 'semantic-show-parser-state-marker t))) (semantic-add-minor-mode 'semantic-show-parser-state-mode - "" - semantic-show-parser-state-mode-map) + "") (defvar semantic-show-parser-state-string nil "String showing the parser state for this buffer. @@ -691,7 +539,7 @@ (t "-"))) ;;(message "Setup mode line indicator to [%s]" semantic-show-parser-state-string) - (semantic-mode-line-update)) + ) (defun semantic-show-parser-state-auto-marker () "Hook function run before an autoparse. @@ -699,7 +547,6 @@ to indicate a parse in progress." (unless (semantic-parse-tree-up-to-date-p) (setq semantic-show-parser-state-string "@") - (semantic-mode-line-update) ;; For testing. ;;(sit-for 1) )) @@ -710,30 +557,14 @@ ;;;; ;;;###autoload -(defun global-semantic-stickyfunc-mode (&optional arg) +(define-minor-mode global-semantic-stickyfunc-mode "Toggle global use of option `semantic-stickyfunc-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-stickyfunc-mode - (semantic-toggle-minor-mode-globally - 'semantic-stickyfunc-mode arg))) - -;;;###autoload -(defcustom global-semantic-stickyfunc-mode nil - "If non-nil, enable global use of `semantic-stickyfunc-mode'. -This minor mode only works for Emacs 21 or later. -When enabled, the header line is enabled, and the first line -of the current function or method is displayed in it. -This makes it appear that the first line of that tag is -`sticky' to the top of the window." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-stickyfunc-mode (if val 1 -1)))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic :group 'semantic-modes + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic/util-modes + (semantic-toggle-minor-mode-globally + 'semantic-stickyfunc-mode (if global-semantic-stickyfunc-mode 1 -1))) (defcustom semantic-stickyfunc-mode-hook nil "Hook run at the end of function `semantic-stickyfunc-mode'." @@ -781,11 +612,6 @@ (describe-function 'semantic-stickyfunc-mode)) t]) ) -(defvar semantic-stickyfunc-mode nil - "Non-nil if stickyfunc minor mode is enabled. -Use the command `semantic-stickyfunc-mode' to change this variable.") -(make-variable-buffer-local 'semantic-stickyfunc-mode) - (defcustom semantic-stickyfunc-indent-string (if (and window-system (not (featurep 'xemacs))) (concat @@ -870,11 +696,21 @@ (t nil)) "The header line format used by stickyfunc mode.") -(defun semantic-stickyfunc-mode-setup () - "Setup option `semantic-stickyfunc-mode'. -For semantic enabled buffers, make the function declaration for the top most -function \"sticky\". This is accomplished by putting the first line of -text for that function in the header line." +;;;###autoload +(define-minor-mode semantic-stickyfunc-mode + "Minor mode to show the title of a tag in the header line. +Enables/disables making the header line of functions sticky. +A function (or other tag class specified by +`semantic-stickyfunc-sticky-classes') has a header line, meaning the +first line which describes the rest of the construct. This first +line is what is displayed in the header line. + +With prefix argument ARG, turn on if positive, otherwise off. The +minor mode can be turned on only if semantic feature is available and +the current buffer was set up for parsing. Return non-nil if the +minor mode is enabled." + ;; Don't need indicator. It's quite visible + :keymap semantic-stickyfunc-mode-map (if semantic-stickyfunc-mode (progn (unless (and (featurep 'semantic) (semantic-active-p)) @@ -892,8 +728,7 @@ semantic-stickyfunc-header-line-format))) (set (make-local-variable 'semantic-stickyfunc-old-hlf) header-line-format)) - (setq header-line-format semantic-stickyfunc-header-line-format) - ) + (setq header-line-format semantic-stickyfunc-header-line-format)) ;; Disable sticky func mode ;; Restore previous buffer local value of header line format if ;; the current one is the sticky func one. @@ -901,38 +736,7 @@ (kill-local-variable 'header-line-format) (when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer)) (setq header-line-format semantic-stickyfunc-old-hlf) - (kill-local-variable 'semantic-stickyfunc-old-hlf)))) - semantic-stickyfunc-mode) - -;;;###autoload -(defun semantic-stickyfunc-mode (&optional arg) - "Minor mode to show the title of a tag in the header line. -Enables/disables making the header line of functions sticky. -A function (or other tag class specified by -`semantic-stickyfunc-sticky-classes') has a header line, meaning the -first line which describes the rest of the construct. This first -line is what is displayed in the header line. - -With prefix argument ARG, turn on if positive, otherwise off. The -minor mode can be turned on only if semantic feature is available and -the current buffer was set up for parsing. Return non-nil if the -minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-stickyfunc-mode 0 1)))) - (setq semantic-stickyfunc-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-stickyfunc-mode))) - (semantic-stickyfunc-mode-setup) - (run-hooks 'semantic-stickyfunc-mode-hook) - (if (called-interactively-p 'interactive) - (message "Stickyfunc minor mode %sabled" - (if semantic-stickyfunc-mode "en" "dis"))) - (semantic-mode-line-update) - semantic-stickyfunc-mode) + (kill-local-variable 'semantic-stickyfunc-old-hlf))))) (defvar semantic-stickyfunc-sticky-classes '(function type) @@ -1012,8 +816,7 @@ (semantic-add-minor-mode 'semantic-stickyfunc-mode - "" ;; Don't need indicator. It's quite visible - semantic-stickyfunc-mode-map) + "") ;; Don't need indicator. It's quite visible @@ -1025,26 +828,15 @@ ;; from the tag going off the top of the screen. ;;;###autoload -(defun global-semantic-highlight-func-mode (&optional arg) +(define-minor-mode global-semantic-highlight-func-mode "Toggle global use of option `semantic-highlight-func-mode'. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-semantic-highlight-func-mode - (semantic-toggle-minor-mode-globally - 'semantic-highlight-func-mode arg))) - -;;;###autoload -(defcustom global-semantic-highlight-func-mode nil - "If non-nil, enable global use of `semantic-highlight-func-mode'. -When enabled, the first line of the current tag is highlighted." - :group 'semantic - :group 'semantic-modes - :type 'boolean - :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-semantic-highlight-func-mode (if val 1 -1)))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'semantic :group 'semantic-modes + ;; Not needed because it's autoloaded instead. + ;; :require 'semantic/util-modes + (semantic-toggle-minor-mode-globally + 'semantic-highlight-func-mode + (if global-semantic-highlight-func-mode 1 -1))) (defcustom semantic-highlight-func-mode-hook nil "Hook run at the end of function `semantic-highlight-func-mode'." @@ -1108,11 +900,6 @@ ) (select-window startwin))) -(defvar semantic-highlight-func-mode nil - "Non-nil if highlight-func minor mode is enabled. -Use the command `semantic-highlight-func-mode' to change this variable.") -(make-variable-buffer-local 'semantic-highlight-func-mode) - (defvar semantic-highlight-func-ct-overlay nil "Overlay used to highlight the tag the cursor is in.") (make-variable-buffer-local 'semantic-highlight-func-ct-overlay) @@ -1126,28 +913,8 @@ "Face used to show the top of current function." :group 'semantic-faces) - -(defun semantic-highlight-func-mode-setup () - "Setup option `semantic-highlight-func-mode'. -For Semantic enabled buffers, highlight the first line of the -current tag declaration." - (if semantic-highlight-func-mode - (progn - (unless (and (featurep 'semantic) (semantic-active-p)) - ;; Disable minor mode if semantic stuff not available - (setq semantic-highlight-func-mode nil) - (error "Buffer %s was not set up for parsing" (buffer-name))) - ;; Setup our hook - (add-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag nil t) - ) - ;; Disable highlight func mode - (remove-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag t) - (semantic-highlight-func-highlight-current-tag t) - ) - semantic-highlight-func-mode) - ;;;###autoload -(defun semantic-highlight-func-mode (&optional arg) +(define-minor-mode semantic-highlight-func-mode "Minor mode to highlight the first line of the current tag. Enables/disables making the current function's first line light up. A function (or other tag class specified by @@ -1162,21 +929,20 @@ minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." - (interactive - (list (or current-prefix-arg - (if semantic-highlight-func-mode 0 1)))) - (setq semantic-highlight-func-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not semantic-highlight-func-mode))) - (semantic-highlight-func-mode-setup) - (run-hooks 'semantic-highlight-func-mode-hook) - (if (called-interactively-p 'interactive) - (message "Highlight-Func minor mode %sabled" - (if semantic-highlight-func-mode "en" "dis"))) - semantic-highlight-func-mode) + :lighter nil ;; Don't need indicator. It's quite visible. + (if semantic-highlight-func-mode + (progn + (unless (and (featurep 'semantic) (semantic-active-p)) + ;; Disable minor mode if semantic stuff not available + (setq semantic-highlight-func-mode nil) + (error "Buffer %s was not set up for parsing" (buffer-name))) + ;; Setup our hook + (add-hook 'post-command-hook + 'semantic-highlight-func-highlight-current-tag nil t)) + ;; Disable highlight func mode + (remove-hook 'post-command-hook + 'semantic-highlight-func-highlight-current-tag t) + (semantic-highlight-func-highlight-current-tag t))) (defun semantic-highlight-func-highlight-current-tag (&optional disable) "Highlight the current tag under point. @@ -1223,8 +989,7 @@ nil) (semantic-add-minor-mode 'semantic-highlight-func-mode - "" ;; Don't need indicator. It's quite visible - nil) + "") ;; Don't need indicator. It's quite visible (provide 'semantic/util-modes) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cedet/srecode/mode.el --- a/lisp/cedet/srecode/mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cedet/srecode/mode.el Thu May 13 15:13:52 2010 +0200 @@ -37,19 +37,6 @@ ;;; Code: -(defcustom global-srecode-minor-mode nil - "Non-nil in buffers with Semantic Recoder macro keybindings." - :group 'srecode - :type 'boolean - :require 'srecode/mode - :initialize 'custom-initialize-default - :set (lambda (sym val) - (global-srecode-minor-mode (if val 1 -1)))) - -(defvar srecode-minor-mode nil - "Non-nil in buffers with Semantic Recoder macro keybindings.") -(make-variable-buffer-local 'srecode-minor-mode) - (defcustom srecode-minor-mode-hook nil "Hook run at the end of the function `srecode-minor-mode'." :group 'srecode @@ -150,7 +137,7 @@ "Keymap for srecode minor mode.") ;;;###autoload -(defun srecode-minor-mode (&optional arg) +(define-minor-mode srecode-minor-mode "Toggle srecode minor mode. With prefix argument ARG, turn on if positive, otherwise off. The minor mode can be turned on only if semantic feature is available and @@ -158,16 +145,7 @@ minor mode is enabled. \\{srecode-mode-map}" - (interactive - (list (or current-prefix-arg - (if srecode-minor-mode 0 1)))) - ;; Flip the bits. - (setq srecode-minor-mode - (if arg - (> - (prefix-numeric-value arg) - 0) - (not srecode-minor-mode))) + :keymap srecode-mode-map ;; If we are turning things on, make sure we have templates for ;; this mode first. (when srecode-minor-mode @@ -176,25 +154,20 @@ (mapcar (lambda (map) (srecode-map-entries-for-mode map major-mode)) (srecode-get-maps)))) - (setq srecode-minor-mode nil)) - ) - ;; Run hooks if we are turning this on. - (when srecode-minor-mode - (run-hooks 'srecode-minor-mode-hook)) - srecode-minor-mode) + (setq srecode-minor-mode nil)))) ;;;###autoload -(defun global-srecode-minor-mode (&optional arg) +(define-minor-mode global-srecode-minor-mode "Toggle global use of srecode minor mode. -If ARG is positive, enable, if it is negative, disable. -If ARG is nil, then toggle." - (interactive "P") - (setq global-srecode-minor-mode - (semantic-toggle-minor-mode-globally - 'srecode-minor-mode arg))) +If ARG is positive or nil, enable, if it is negative, disable." + :global t :group 'srecode + ;; Not needed because it's autoloaded instead. + ;; :require 'srecode/mode + (semantic-toggle-minor-mode-globally + 'srecode-minor-mode (if global-srecode-minor-mode 1 -1))) ;; Use the semantic minor mode magic stuff. -(semantic-add-minor-mode 'srecode-minor-mode "" srecode-mode-map) +(semantic-add-minor-mode 'srecode-minor-mode "") ;;; Menu Filters ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/composite.el --- a/lisp/composite.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/composite.el Thu May 13 15:13:52 2010 +0200 @@ -44,7 +44,7 @@ A glyph reference point symbol is to be used to specify a composition rule in COMPONENTS argument to such functions as `compose-region'. -Meanings of glyph reference point codes are as follows: +The meaning of glyph reference point codes is as follows: 0----1----2 <---- ascent 0:tl or top-left | | 1:tc or top-center @@ -212,7 +212,7 @@ this case, TAB element has a special meaning. If the first characer is TAB, the glyphs are displayed with left padding space so that no pixel overlaps with the previous column. If the last -character is TAB, the glyphs are displayed with rigth padding +character is TAB, the glyphs are displayed with right padding space so that no pixel overlaps with the following column. If it is a vector or list, it is a sequence of alternate characters and @@ -222,7 +222,7 @@ A composition rule is a cons of global and new glyph reference point symbols. See the documentation of `reference-point-alist' for more -detail. +details. Optional 4th argument MODIFICATION-FUNC is a function to call to adjust the composition when it gets invalid because of a change of @@ -299,16 +299,16 @@ (compose-string-internal str 0 (length str) components))) (defun find-composition (pos &optional limit string detail-p) - "Return information about a composition at or nearest to buffer position POS. + "Return information about a composition at or near buffer position POS. If the character at POS has `composition' property, the value is a list -of FROM, TO, and VALID-P. +\(FROM TO VALID-P). FROM and TO specify the range of text that has the same `composition' property, VALID-P is t if this composition is valid, and nil if not. If there's no composition at POS, and the optional 2nd argument LIMIT -is non-nil, search for a composition toward LIMIT. +is non-nil, search for a composition toward the position given by LIMIT. If no composition is found, return nil. @@ -316,8 +316,9 @@ composition in; nil means the current buffer. If a valid composition is found and the optional 4th argument DETAIL-P -is non-nil, the return value is a list of FROM, TO, COMPONENTS, -RELATIVE-P, MOD-FUNC, and WIDTH. +is non-nil, the return value is a list of the form + + (FROM TO COMPONENTS RELATIVE-P MOD-FUNC WIDTH) COMPONENTS is a vector of integers, the meaning depends on RELATIVE-P. @@ -331,12 +332,12 @@ WIDTH is a number of columns the composition occupies on the screen. -When Automatic Compostion mode is on, this function also finds a +When Automatic Composition mode is on, this function also finds a chunk of text that is automatically composed. If such a chunk is found closer to POS than the position that has `composition' -property, the value is a list of FROM, TO, and a glyph gstring -the specify how the chunk is composed. See the function -`composition-get-gstring' for the format of the glyph string." +property, the value is a list of FROM, TO, and a glyph-string +that specifies how the chunk is to be composed. See the function +`composition-get-gstring' for the format of the glyph-string." (let ((result (find-composition-internal pos limit string detail-p))) (if (and detail-p (> (length result) 3) (nth 2 result) (not (nth 3 result))) ;; This is a valid rule-base composition. @@ -744,14 +745,13 @@ (setq func 'compose-gstring-for-terminal)) (funcall func gstring)))) -(make-variable-buffer-local 'auto-composition-mode) (put 'auto-composition-mode 'permanent-local t) (make-variable-buffer-local 'auto-composition-function) (setq-default auto-composition-function 'auto-compose-chars) ;;;###autoload -(defun auto-composition-mode (&optional arg) +(define-minor-mode auto-composition-mode "Toggle Auto Composition mode. With ARG, turn Auto Composition mode off if and only if ARG is a non-positive number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto @@ -761,24 +761,16 @@ by functions registered in `composition-function-table' (which see). You can use `global-auto-composition-mode' to turn on -Auto Composition mode in all buffers (this is the default)." - (interactive "P") - (setq auto-composition-mode - (if arg - (or (not (integerp arg)) (> arg 0)) - (not auto-composition-mode)))) +Auto Composition mode in all buffers (this is the default).") ;;;###autoload -(defun global-auto-composition-mode (&optional arg) +(define-minor-mode global-auto-composition-mode "Toggle Auto-Composition mode in every possible buffer. With prefix arg, turn Global-Auto-Composition mode on if and only if arg is positive. See `auto-composition-mode' for more information on Auto-Composition mode." - (interactive "P") - (setq-default auto-composition-mode - (if arg - (or (not (integerp arg)) (> arg 0)) - (not (default-value 'auto-composition-mode))))) + :variable (default-value 'auto-composition-mode)) + (defalias 'toggle-auto-composition 'auto-composition-mode) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cus-edit.el --- a/lisp/cus-edit.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cus-edit.el Thu May 13 15:13:52 2010 +0200 @@ -739,25 +739,31 @@ (defvar custom-commands '(("Set for current session" Custom-set t "Apply all settings in this buffer to the current session" - "index") + "index" + "Apply") ("Save for future sessions" Custom-save (or custom-file user-init-file) "Apply all settings in this buffer and save them for future Emacs sessions." - "save") + "save" + "Save") ("Undo edits" Custom-reset-current t "Restore all settings in this buffer to reflect their current values." - "refresh") + "refresh" + "Undo") ("Reset to saved" Custom-reset-saved t "Restore all settings in this buffer to their saved values (if any)." - "undo") + "undo" + "Reset") ("Erase customizations" Custom-reset-standard (or custom-file user-init-file) "Un-customize all settings in this buffer and save them with standard values." - "delete") + "delete" + "Uncustomize") ("Help for Customize" Custom-help t "Get help for using Customize." - "help") - ("Exit" Custom-buffer-done t "Exit Customize." "exit"))) + "help" + "Help") + ("Exit" Custom-buffer-done t "Exit Customize." "exit" "Exit"))) (defun Custom-help () "Read the node on Easy Customization in the Emacs manual." @@ -1616,7 +1622,7 @@ (if custom-buffer-verbose-help (widget-insert " Operate on all settings in this buffer:\n")) - (let ((button (lambda (tag action active help icon) + (let ((button (lambda (tag action active help icon label) (widget-insert " ") (if (eval active) (widget-create 'push-button :tag tag @@ -4680,7 +4686,8 @@ (mapc (lambda (arg) (tool-bar-local-item-from-menu - (nth 1 arg) (nth 4 arg) map custom-mode-map)) + (nth 1 arg) (nth 4 arg) map custom-mode-map + :label (nth 5 arg))) custom-commands) (setq custom-tool-bar-map map)))) (make-local-variable 'custom-options) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cus-start.el --- a/lisp/cus-start.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cus-start.el Thu May 13 15:13:52 2010 +0200 @@ -339,6 +339,15 @@ (const :tag "Off (nil)" :value nil) (const :tag "Immediate" :value t) (number :tag "Delay by secs" :value 0.5)) "22.1") + (tool-bar-style + frames (choice + (const :tag "Images" :value image) + (const :tag "Text" :value text) + (const :tag "Both" :value both) + (const :tag "Both-horiz" :value both-horiz) + (const :tag "System default" :value nil)) "23.3") + (tool-bar-max-label-size frames integer "23.3") + ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c @@ -399,6 +408,10 @@ (fboundp 'define-fringe-bitmap)) ((equal "font-use-system-font" (symbol-name symbol)) (featurep 'system-font-setting)) + ;; Conditioned on x-create-frame, because that's + ;; the condition for loadup.el to preload tool-bar.el. + ((string-match "tool-bar-" (symbol-name symbol)) + (fboundp 'x-create-frame)) (t t)))) (if (not (boundp symbol)) ;; If variables are removed from C code, give an error here! diff -r e56f669f17ce -r fe07c47cf7a7 lisp/custom.el --- a/lisp/custom.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/custom.el Thu May 13 15:13:52 2010 +0200 @@ -304,7 +304,7 @@ See Info node `(elisp) Customization' in the Emacs Lisp manual for more information." - (declare (doc-string 3)) + (declare (doc-string 3) (debug (name body))) ;; It is better not to use backquote in this file, ;; because that makes a bootstrapping problem ;; if you need to recompile all the Lisp files using interpreted code. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/cvs-status.el --- a/lisp/cvs-status.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/cvs-status.el Thu May 13 15:13:52 2010 +0200 @@ -356,11 +356,11 @@ tags))) (defvar font-lock-mode) -(defun cvs-refontify (beg end) - (when (and (boundp 'font-lock-mode) - font-lock-mode - (fboundp 'font-lock-fontify-region)) - (font-lock-fontify-region (1- beg) (1+ end)))) +;; (defun cvs-refontify (beg end) +;; (when (and (boundp 'font-lock-mode) +;; font-lock-mode +;; (fboundp 'font-lock-fontify-region)) +;; (font-lock-fontify-region (1- beg) (1+ end)))) (defun cvs-status-trees () "Look for a lists of tags, and replace them with trees." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/desktop.el --- a/lisp/desktop.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/desktop.el Thu May 13 15:13:52 2010 +0200 @@ -620,7 +620,10 @@ (when (and desktop-save-mode (let ((exists (file-exists-p (desktop-full-file-name)))) (or (eq desktop-save t) - (and exists (memq desktop-save '(ask-if-new if-exists))) + (and exists (eq desktop-save 'if-exists)) + ;; If it exists, but we aren't using it, we are going + ;; to ask for a new directory below. + (and exists desktop-dirname (eq desktop-save 'ask-if-new)) (and (or (memq desktop-save '(ask ask-if-new)) (and exists (eq desktop-save 'ask-if-exists))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/diff.el --- a/lisp/diff.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/diff.el Thu May 13 15:13:52 2010 +0200 @@ -64,8 +64,8 @@ "Code run when the diff process exits. CODE is the exit code of the process. It should be 0 only if no diffs were found." - (if diff-old-temp-file (delete-file diff-old-temp-file)) - (if diff-new-temp-file (delete-file diff-new-temp-file)) + (if diff-old-temp-file (delete-file diff-old-temp-file t)) + (if diff-new-temp-file (delete-file diff-new-temp-file t)) (save-excursion (goto-char (point-max)) (let ((inhibit-read-only t)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/dirtrack.el --- a/lisp/dirtrack.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/dirtrack.el Thu May 13 15:13:52 2010 +0200 @@ -143,13 +143,6 @@ :group 'dirtrack :type 'string) -(defcustom dirtrackp t - "If non-nil, directory tracking via `dirtrack' is enabled." - :group 'dirtrack - :type 'boolean) - -(make-variable-buffer-local 'dirtrackp) - (defcustom dirtrack-directory-function (if (memq system-type (list 'ms-dos 'windows-nt 'cygwin)) 'dirtrack-windows-directory-function diff -r e56f669f17ce -r fe07c47cf7a7 lisp/dynamic-setting.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/dynamic-setting.el Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,105 @@ +;;; dynamic-setting.el --- Support dynamic changes + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Jan Djärv +;; Maintainer: FSF +;; Keywords: font, system-font, tool-bar-style + +;; 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This file provides the lisp part of the GConf and XSetting code in +;; xsetting.c. But it is nothing that prevents it from being used by +;; other configuration schemes. + +;;; Code: + +;;; Customizable variables + +(declare-function font-get-system-font "xsettings.c" ()) + +(defvar font-use-system-font) + +(defun font-setting-change-default-font (display-or-frame set-font) + "Change font and/or font settings for frames on display DISPLAY-OR-FRAME. +If DISPLAY-OR-FRAME is a frame, the display is the one for that frame. + +If SET-FONT is non-nil, change the font for frames. Otherwise re-apply the +current form for the frame (i.e. hinting or somesuch changed)." + + (let ((new-font (and (fboundp 'font-get-system-font) + (font-get-system-font)))) + (when new-font + ;; Be careful here: when set-face-attribute is called for the + ;; :font attribute, Emacs tries to guess the best matching font + ;; by examining the other face attributes (Bug#2476). + + (clear-font-cache) + ;; Set for current frames. Only change font for those that have + ;; the old font now. If they don't have the old font, the user + ;; probably changed it. + (dolist (f (frames-on-display-list display-or-frame)) + (if (display-graphic-p f) + (let* ((frame-font + (or (font-get (face-attribute 'default :font f + 'default) :user-spec) + (frame-parameter f 'font-parameter))) + (font-to-set + (if set-font new-font + ;; else set font again, hinting etc. may have changed. + frame-font))) + (if font-to-set + (progn + (message "setting %s" font-to-set) + (set-frame-parameter f 'font-parameter font-to-set) + (set-face-attribute 'default f + :width 'normal + :weight 'normal + :slant 'normal + :font font-to-set)))))) + + ;; Set for future frames. + (set-face-attribute 'default t :font new-font) + (let ((spec (list (list t (face-attr-construct 'default))))) + (progn + (put 'default 'customized-face spec) + (custom-push-theme 'theme-face 'default 'user 'set spec) + (put 'default 'face-modified nil)))))) + +(defun dynamic-setting-handle-config-changed-event (event) + "Handle config-changed-event on the display in EVENT. +Changes can be + The monospace font. If `font-use-system-font' is nil, the font + is not changed. + Xft parameters, like DPI and hinting. + The tool bar style." + (interactive "e") + (let ((type (nth 1 event)) + (display-name (nth 2 event))) + (cond ((and (eq type 'monospace-font-name) font-use-system-font) + (font-setting-change-default-font display-name t)) + + ((eq type 'font-render) + (font-setting-change-default-font display-name nil)) + + ((eq type 'tool-bar-style) (force-mode-line-update t))))) + +(define-key special-event-map [config-changed-event] + 'dynamic-setting-handle-config-changed-event) + +;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017 diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ebuff-menu.el --- a/lisp/ebuff-menu.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ebuff-menu.el Thu May 13 15:13:52 2010 +0200 @@ -95,7 +95,7 @@ (cons first last)))))) (set-buffer buffer) (Buffer-menu-mode) - (bury-buffer buffer) + (bury-buffer) ;Get rid of window, if dedicated. (message ""))) (if select (progn (set-buffer buffer) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/electric.el --- a/lisp/electric.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/electric.el Thu May 13 15:13:52 2010 +0200 @@ -58,12 +58,10 @@ (err nil) (prompt-string prompt)) (while t - (if (not (or (stringp prompt) (eq prompt nil) (eq prompt 'noprompt))) + (if (functionp prompt) (setq prompt-string (funcall prompt))) (if (not (stringp prompt-string)) - (if (eq prompt-string 'noprompt) - (setq prompt-string nil) - (setq prompt-string "->"))) + (setq prompt-string (unless (eq prompt-string 'noprompt) "->"))) (setq cmd (read-key-sequence prompt-string)) (setq last-command-event (aref cmd (1- (length cmd))) this-command (key-binding cmd t) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/authors.el --- a/lisp/emacs-lisp/authors.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/authors.el Thu May 13 15:13:52 2010 +0200 @@ -220,6 +220,9 @@ '("vc-\\*\\.el$" "spec.txt$" ".*loaddefs.el$" ; not obsolete, but auto-generated + "\\.\\(cvs\\|git\\)ignore$" ; obsolete or uninteresting + "\\.arch-inventory$" + "preferences\\.\\(nib\\|gorm\\)" "vc-\\(rcs\\|cvs\\|sccs\\)-hooks\\.el$") "List of regexps matching obsolete files. Changes to files matching one of the regexps in this list are not @@ -244,6 +247,14 @@ "Imakefile" "icons/sink.ico" "aixcc.lex" "nxml/char-name/unicode" "js2-mode.el" ; only installed very briefly, replaced by js.el + "cedet/tests/testtemplates.cpp" + "cedet/tests/testusing.cpp" + "cedet/tests/scopetest.cpp" + "cedet/tests/scopetest.java" + "cedet/tests/test.cpp" + "cedet/tests/test.py" + "cedet/tests/teststruct.cpp" + "*.el" ;; Autogen: "cus-load.el" "finder-inf.el" "ldefs-boot.el" ;; Never had any meaningful changes logged, now deleted: @@ -286,6 +297,42 @@ "List of files and directories to ignore. Changes to files in this list are not listed.") +;; List via: find . -name '*.el' | sed 's/.*\///g' | sort | uniq -d +;; FIXME It would be better to discover these dynamically. +;; Note that traditionally "Makefile.in" etc have not been in this list. +;; Ditto for "abbrev.texi" etc. +(defconst authors-ambiguous-files + '("chart.el" + "compile.el" + "complete.el" + "cpp.el" + "ctxt.el" + "debug.el" + "dired.el" + "el.el" + "files.el" + "find.el" + "format.el" + "grep.el" + "imenu.el" + "java.el" + "linux.el" + "locate.el" + "make.el" + "mode.el" + "python.el" + "semantic.el" + "shell.el" + "simple.el" + "sort.el" + "speedbar.el" + "srecode.el" + "table.el" + "texi.el" + "util.el" + "wisent.el") + "List of basenames occurring more than once in the source.") + ;; FIXME :cowrote entries here can be overwritten by :wrote entries ;; derived from a file's Author: header (eg mh-e). This really means ;; the Author: header is erroneous. @@ -464,11 +511,14 @@ "emacs16_mac.png" "emacs24_mac.png" "emacs256_mac.png" "emacs32_mac.png" "emacs48_mac.png" "emacs512_mac.png" + "revdiff" ; admin/ + "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/ + "mac-fix-env.m" ;; Deleted vms stuff: "temacs.opt" "descrip.mms" "compile.com" "link.com" ) - "File names which are valid, but no longer exist (or cannot be -found) in the repository.") + "File names which are valid, but no longer exist (or cannot be found) +in the repository.") (defconst authors-renamed-files-alist '(("nt.c" . "w32.c") ("nt.h" . "w32.h") @@ -505,6 +555,7 @@ ;; index and pick merged into search. ("mh-index.el" . "mh-search.el") ("mh-pick.el" . "mh-search.el") + ("font-setting.el" . "dynamic-setting.el") ;; INSTALL-CVS -> .CVS -> .BZR ("INSTALL-CVS" . "INSTALL.BZR") ("INSTALL.CVS" . "INSTALL.BZR") @@ -530,6 +581,7 @@ ("schema/docbook-dyntbl.rnc" . "schema/docbk-dyntbl.rnc") ("schema/docbook-soextbl.rnc" . "schema/docbk-soextbl.rn" ) ("texi/url.txi" . "url.texi") + ("edt-user.doc" . "edt.texi") ;; Moved to different directories. ("ctags.1" . "ctags.1") ("etags.1" . "etags.1") @@ -574,10 +626,25 @@ (defvar authors-checked-files-alist) (defvar authors-invalid-file-names) +(defun authors-disambiguate-file-name (fullname) + "Convert FULLNAME to an unambiguous relative-name." + (let ((relname (file-name-nondirectory fullname)) + parent) + (if (member relname authors-ambiguous-files) + ;; In case of ambiguity, just prepend the parent directory. + ;; FIXME obviously this is not a perfect solution. + (if (string-equal "lisp" + (setq parent (file-name-nondirectory + (directory-file-name + (file-name-directory fullname))))) + relname + (format "%s/%s" parent relname)) + relname))) + (defun authors-canonical-file-name (file log-file pos author) "Return canonical file name for FILE found in LOG-FILE. Checks whether FILE is a valid (existing) file name, has been renamed, -or is on the list of removed files. Returns the non-diretory part of +or is on the list of removed files. Returns the non-directory part of the file name. Only uses the LOG-FILE position POS and associated AUTHOR to print a message if FILE is not found." ;; FILE should be re-checked in every different directory associated @@ -594,7 +661,7 @@ (file-exists-p file) (file-exists-p relname) (file-exists-p (concat "etc/" relname))) - (setq valid relname) + (setq valid (authors-disambiguate-file-name fullname)) (setq valid (assoc file authors-renamed-files-alist)) (if valid (setq valid (cdr valid)) @@ -611,6 +678,7 @@ (cons (cons fullname valid) authors-checked-files-alist)) (unless (or valid (member file authors-ignored-files) + (authors-obsolete-file-p file) (string-match "[*]" file) (string-match "^[0-9.]+$" file)) (setq authors-invalid-file-names @@ -759,7 +827,7 @@ (enable-local-variables :safe) ; for find-file, hence let* (enable-local-eval nil) (buffer (find-file-noselect file))) - (setq file (file-name-nondirectory file)) + (setq file (authors-disambiguate-file-name (expand-file-name file))) (with-current-buffer buffer (save-restriction (widen) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/autoload.el --- a/lisp/emacs-lisp/autoload.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/autoload.el Thu May 13 15:13:52 2010 +0200 @@ -328,7 +328,29 @@ "File local variable to prevent scanning this file for autoload cookies.") (defun autoload-file-load-name (file) - (let ((name (file-name-nondirectory file))) + "Compute the name that will be used to load FILE." + ;; OUTFILE should be the name of the global loaddefs.el file, which + ;; is expected to be at the root directory of the files we're + ;; scanning for autoloads and will be in the `load-path'. + (let* ((outfile (default-value 'generated-autoload-file)) + (name (file-relative-name file (file-name-directory outfile))) + (names '()) + (dir (file-name-directory outfile))) + ;; If `name' has directory components, only keep the + ;; last few that are really needed. + (while name + (setq name (directory-file-name name)) + (push (file-name-nondirectory name) names) + (setq name (file-name-directory name))) + (while (not name) + (cond + ((null (cdr names)) (setq name (car names))) + ((file-exists-p (expand-file-name "subdirs.el" dir)) + ;; FIXME: here we only check the existence of subdirs.el, + ;; without checking its content. This makes it generate wrong load + ;; names for cases like lisp/term which is not added to load-path. + (setq dir (expand-file-name (pop names) dir))) + (t (setq name (mapconcat 'identity names "/"))))) (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name) (substring name 0 (match-beginning 0)) name))) @@ -343,6 +365,8 @@ (interactive "fGenerate autoloads for file: ") (autoload-generate-file-autoloads file (current-buffer))) +(defvar print-readably) + ;; When called from `generate-file-autoloads' we should ignore ;; `generated-autoload-file' altogether. When called from ;; `update-file-autoloads' we don't know `outbuf'. And when called from @@ -373,9 +397,8 @@ (visited (get-file-buffer file)) (otherbuf nil) (absfile (expand-file-name file)) - relfile ;; nil until we found a cookie. - output-start) + output-start ostart) (with-current-buffer (or visited ;; It is faster to avoid visiting the file. (autoload-find-file file)) @@ -385,7 +408,10 @@ (setq load-name (if (stringp generated-autoload-load-name) generated-autoload-load-name - (autoload-file-load-name file))) + (autoload-file-load-name absfile))) + (when (and outfile + (not (equal outfile (autoload-generated-file)))) + (setq otherbuf t)) (save-excursion (save-restriction (widen) @@ -396,26 +422,22 @@ ((looking-at (regexp-quote generate-autoload-cookie)) ;; If not done yet, figure out where to insert this text. (unless output-start - (when (and outfile - (not (equal outfile (autoload-generated-file)))) - ;; A file-local setting of autoload-generated-file says - ;; we should ignore OUTBUF. - (setq outbuf nil) - (setq otherbuf t)) - (unless outbuf - (setq outbuf (autoload-find-destination absfile)) - (unless outbuf - ;; The file has autoload cookies, but they're - ;; already up-to-date. If OUTFILE is nil, the - ;; entries are in the expected OUTBUF, otherwise - ;; they're elsewhere. - (throw 'done outfile))) - (with-current-buffer outbuf - (setq relfile (file-relative-name absfile)) - (setq output-start (point))) - ;; (message "file=%S, relfile=%S, dest=%S" - ;; file relfile (autoload-generated-file)) - ) + (let ((outbuf + (or (if otherbuf + ;; A file-local setting of + ;; autoload-generated-file says we + ;; should ignore OUTBUF. + nil + outbuf) + (autoload-find-destination absfile load-name) + ;; The file has autoload cookies, but they're + ;; already up-to-date. If OUTFILE is nil, the + ;; entries are in the expected OUTBUF, + ;; otherwise they're elsewhere. + (throw 'done otherbuf)))) + (with-current-buffer outbuf + (setq output-start (point-marker) + ostart (point))))) (search-forward generate-autoload-cookie) (skip-chars-forward " \t") (if (eolp) @@ -427,7 +449,8 @@ (if autoload (push (nth 1 form) autoloads-done) (setq autoload form)) - (let ((autoload-print-form-outbuf outbuf)) + (let ((autoload-print-form-outbuf + (marker-buffer output-start))) (autoload-print-form autoload))) (error (message "Error in %s: %S" file err))) @@ -442,7 +465,7 @@ (forward-char 1)) (point)) (progn (forward-line 1) (point))) - outbuf))) + (marker-buffer output-start)))) ((looking-at ";") ;; Don't read the comment. (forward-line 1)) @@ -454,40 +477,44 @@ (let ((secondary-autoloads-file-buf (if (local-variable-p 'generated-autoload-file) (current-buffer)))) - (with-current-buffer outbuf + (with-current-buffer (marker-buffer output-start) (save-excursion ;; Insert the section-header line which lists the file name ;; and which functions are in it, etc. + (assert (= ostart output-start)) (goto-char output-start) - (autoload-insert-section-header - outbuf autoloads-done load-name relfile - (if secondary-autoloads-file-buf - ;; MD5 checksums are much better because they do not - ;; change unless the file changes (so they'll be - ;; equal on two different systems and will change - ;; less often than time-stamps, thus leading to fewer - ;; unneeded changes causing spurious conflicts), but - ;; using time-stamps is a very useful optimization, - ;; so we use time-stamps for the main autoloads file - ;; (loaddefs.el) where we have special ways to - ;; circumvent the "random change problem", and MD5 - ;; checksum in secondary autoload files where we do - ;; not need the time-stamp optimization because it is - ;; already provided by the primary autoloads file. - (md5 secondary-autoloads-file-buf - ;; We'd really want to just use - ;; `emacs-internal' instead. - nil nil 'emacs-mule-unix) - (nth 5 (file-attributes relfile)))) - (insert ";;; Generated autoloads from " relfile "\n")) + (let ((relfile (file-relative-name absfile))) + (autoload-insert-section-header + (marker-buffer output-start) + autoloads-done load-name relfile + (if secondary-autoloads-file-buf + ;; MD5 checksums are much better because they do not + ;; change unless the file changes (so they'll be + ;; equal on two different systems and will change + ;; less often than time-stamps, thus leading to fewer + ;; unneeded changes causing spurious conflicts), but + ;; using time-stamps is a very useful optimization, + ;; so we use time-stamps for the main autoloads file + ;; (loaddefs.el) where we have special ways to + ;; circumvent the "random change problem", and MD5 + ;; checksum in secondary autoload files where we do + ;; not need the time-stamp optimization because it is + ;; already provided by the primary autoloads file. + (md5 secondary-autoloads-file-buf + ;; We'd really want to just use + ;; `emacs-internal' instead. + nil nil 'emacs-mule-unix) + (nth 5 (file-attributes relfile)))) + (insert ";;; Generated autoloads from " relfile "\n"))) (insert generate-autoload-section-trailer)))) (message "Generating autoloads for %s...done" file)) (or visited ;; We created this buffer, so we should kill it. (kill-buffer (current-buffer)))) - ;; If the entries were added to some other buffer, then the file - ;; doesn't add entries to OUTFILE. - (or (not output-start) otherbuf)))) + (or (not output-start) + ;; If the entries were added to some other buffer, then the file + ;; doesn't add entries to OUTFILE. + otherbuf)))) (defun autoload-save-buffers () (while autoload-modified-buffers @@ -511,15 +538,14 @@ (message "Autoload section for %s is up to date." file))) (if no-autoloads file))) -(defun autoload-find-destination (file) +(defun autoload-find-destination (file load-name) "Find the destination point of the current buffer's autoloads. FILE is the file name of the current buffer. Returns a buffer whose point is placed at the requested location. Returns nil if the file's autoloads are uptodate, otherwise removes any prior now out-of-date autoload entries." (catch 'up-to-date - (let* ((load-name (autoload-file-load-name file)) - (buf (current-buffer)) + (let* ((buf (current-buffer)) (existing-buffer (if buffer-file-name buf)) (found nil)) (with-current-buffer @@ -532,7 +558,7 @@ (unless (zerop (coding-system-eol-type buffer-file-coding-system)) (set-buffer-file-coding-system 'unix)) (or (> (buffer-size) 0) - (error "Autoloads file %s does not exist" buffer-file-name)) + (error "Autoloads file %s lacks boilerplate" buffer-file-name)) (or (file-writable-p buffer-file-name) (error "Autoloads file %s is not writable" buffer-file-name)) (widen) @@ -652,6 +678,7 @@ (t (autoload-remove-section (match-beginning 0)) (if (autoload-generate-file-autoloads + ;; Passing `current-buffer' makes it insert at point. file (current-buffer) buffer-file-name) (push file no-autoloads)))) (push file done) @@ -660,6 +687,9 @@ (dolist (file files) (cond ((member (expand-file-name file) autoload-excludes) nil) + ;; Passing nil as second argument forces + ;; autoload-generate-file-autoloads to look for the right + ;; spot where to insert each autoloads section. ((autoload-generate-file-autoloads file nil buffer-file-name) (push file no-autoloads)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/bytecomp.el --- a/lisp/emacs-lisp/bytecomp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/bytecomp.el Thu May 13 15:13:52 2010 +0200 @@ -3333,21 +3333,31 @@ (setq for-effect nil))) (defun byte-compile-setq-default (form) - (let ((bytecomp-args (cdr form)) - setters) - (while bytecomp-args - (let ((var (car bytecomp-args))) - (and (or (not (symbolp var)) - (byte-compile-const-symbol-p var t)) - (byte-compile-warning-enabled-p 'constants) - (byte-compile-warn - "variable assignment to %s `%s'" - (if (symbolp var) "constant" "nonvariable") - (prin1-to-string var))) - (push (list 'set-default (list 'quote var) (car (cdr bytecomp-args))) - setters)) - (setq bytecomp-args (cdr (cdr bytecomp-args)))) - (byte-compile-form (cons 'progn (nreverse setters))))) + (setq form (cdr form)) + (if (> (length form) 2) + (let ((setters ())) + (while (consp form) + (push `(setq-default ,(pop form) ,(pop form)) setters)) + (byte-compile-form (cons 'progn (nreverse setters)))) + (let ((var (car form))) + (and (or (not (symbolp var)) + (byte-compile-const-symbol-p var t)) + (byte-compile-warning-enabled-p 'constants) + (byte-compile-warn + "variable assignment to %s `%s'" + (if (symbolp var) "constant" "nonvariable") + (prin1-to-string var))) + (byte-compile-normal-call `(set-default ',var ,@(cdr form)))))) + +(byte-defop-compiler-1 set-default) +(defun byte-compile-set-default (form) + (let ((varexp (car-safe (cdr-safe form)))) + (if (eq (car-safe varexp) 'quote) + ;; If the varexp is constant, compile it as a setq-default + ;; so we get more warnings. + (byte-compile-setq-default `(setq-default ,(car-safe (cdr varexp)) + ,@(cddr form))) + (byte-compile-normal-call form)))) (defun byte-compile-quote (form) (byte-compile-constant (car (cdr form)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/cl-loaddefs.el --- a/lisp/emacs-lisp/cl-loaddefs.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/cl-loaddefs.el Thu May 13 15:13:52 2010 +0200 @@ -282,7 +282,7 @@ ;;;;;; flet progv psetq do-all-symbols do-symbols dotimes dolist ;;;;;; do* do loop return-from return block etypecase typecase ecase ;;;;;; case load-time-value eval-when destructuring-bind function* -;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "7fad7dd60f2f96ba90432f885015d61b") +;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "0faa39d8f21ae59f2cc1baa835e28a5f") ;;; Generated autoloads from cl-macs.el (autoload 'gensym "cl-macs" "\ @@ -1242,7 +1242,6 @@ ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: - -;; arch-tag: 08cc5aab-e992-47f6-992e-12a7428c1a0e ;;; cl-loaddefs.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/cl-macs.el --- a/lisp/emacs-lisp/cl-macs.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/cl-macs.el Thu May 13 15:13:52 2010 +0200 @@ -1769,6 +1769,7 @@ (defsetf frame-visible-p cl-set-frame-visible-p) (defsetf frame-width set-screen-width t) (defsetf frame-parameter set-frame-parameter t) +(defsetf terminal-parameter set-terminal-parameter) (defsetf getenv setenv t) (defsetf get-register set-register) (defsetf global-key-binding global-set-key) @@ -1821,10 +1822,26 @@ (defsetf x-get-secondary-selection x-own-secondary-selection t) (defsetf x-get-selection x-own-selection t) +;; This is a hack that allows (setf (eq a 7) B) to mean either +;; (setq a 7) or (setq a nil) depending on whether B is nil or not. +;; This is useful when you have control over the PLACE but not over +;; the VALUE, as is the case in define-minor-mode's :variable. +(define-setf-method eq (place val) + (let ((method (get-setf-method place cl-macro-environment)) + (val-temp (make-symbol "--eq-val--")) + (store-temp (make-symbol "--eq-store--"))) + (list (append (nth 0 method) (list val-temp)) + (append (nth 1 method) (list val)) + (list store-temp) + `(let ((,(car (nth 2 method)) + (if ,store-temp ,val-temp (not ,val-temp)))) + ,(nth 3 method) ,store-temp) + `(eq ,(nth 4 method) ,val-temp)))) + ;;; More complex setf-methods. -;;; These should take &environment arguments, but since full arglists aren't -;;; available while compiling cl-macs, we fake it by referring to the global -;;; variable cl-macro-environment directly. +;; These should take &environment arguments, but since full arglists aren't +;; available while compiling cl-macs, we fake it by referring to the global +;; variable cl-macro-environment directly. (define-setf-method apply (func arg1 &rest rest) (or (and (memq (car-safe func) '(quote function function*)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/derived.el --- a/lisp/emacs-lisp/derived.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/derived.el Thu May 13 15:13:52 2010 +0200 @@ -230,7 +230,7 @@ ; Run the parent. (delay-mode-hooks - (,(or parent 'kill-all-local-variables)) + (,(or parent 'fundamental-mode)) ; Identify the child mode. (setq major-mode (quote ,child)) (setq mode-name ,name) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/easy-mmode.el --- a/lisp/emacs-lisp/easy-mmode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/easy-mmode.el Thu May 13 15:13:52 2010 +0200 @@ -116,6 +116,11 @@ :lighter SPEC Same as the LIGHTER argument. :keymap MAP Same as the KEYMAP argument. :require SYM Same as in `defcustom'. +:variable PLACE The location (as can be used with `setf') to use instead + of the variable MODE to store the state of the mode. PLACE + can also be of the form (GET . SET) where GET is an expression + that returns the current state and SET is a function that takes + a new state and sets it. For example, you could write (define-minor-mode foo-mode \"If enabled, foo on you!\" @@ -147,6 +152,9 @@ (type nil) (extra-args nil) (extra-keywords nil) + (variable nil) ;The PLACE where the state is stored. + (setter nil) ;The function (if any) to set the mode var. + (modefun mode) ;The minor mode function name we're defining. (require t) (hook (intern (concat mode-name "-hook"))) (hook-on (intern (concat mode-name "-on-hook"))) @@ -167,6 +175,12 @@ (:type (setq type (list :type (pop body)))) (:require (setq require (pop body))) (:keymap (setq keymap (pop body))) + (:variable (setq variable (pop body)) + (if (not (functionp (cdr-safe variable))) + ;; PLACE is not of the form (GET . SET). + (setq mode variable) + (setq mode (car variable)) + (setq setter (cdr variable)))) (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) (setq keymap-sym (if (and keymap (symbolp keymap)) keymap @@ -187,12 +201,16 @@ `(progn ;; Define the variable to enable or disable the mode. - ,(if (not globalp) - `(progn - (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled. + ,(cond + ;; If :variable is specified, then the var will be + ;; declared elsewhere. + (variable nil) + ((not globalp) + `(progn + (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled. Use the command `%s' to change this variable." pretty-name mode)) - (make-variable-buffer-local ',mode)) - + (make-variable-buffer-local ',mode))) + (t (let ((base-doc-string (concat "Non-nil if %s is enabled. See the command `%s' for a description of this minor mode." @@ -207,10 +225,10 @@ ,@group ,@type ,@(unless (eq require t) `(:require ,require)) - ,@(nreverse extra-keywords)))) + ,@(nreverse extra-keywords))))) ;; The actual function. - (defun ,mode (&optional arg ,@extra-args) + (defun ,modefun (&optional arg ,@extra-args) ,(or doc (format (concat "Toggle %s on or off. Interactively, with no prefix argument, toggle the mode. @@ -221,17 +239,19 @@ ;; repeat-command still does the toggling correctly. (interactive (list (or current-prefix-arg 'toggle))) (let ((,last-message (current-message))) - (setq ,mode - (if (eq arg 'toggle) - (not ,mode) - ;; A nil argument also means ON now. - (> (prefix-numeric-value arg) 0))) + (,@(if setter (list setter) + (list (if (symbolp mode) 'setq 'setf) mode)) + (if (eq arg 'toggle) + (not ,mode) + ;; A nil argument also means ON now. + (> (prefix-numeric-value arg) 0))) ,@body ;; The on/off hooks are here for backward compatibility only. (run-hooks ',hook (if ,mode ',hook-on ',hook-off)) (if (called-interactively-p 'any) (progn - ,(if globalp `(customize-mark-as-set ',mode)) + ,(if (and globalp (symbolp mode)) + `(customize-mark-as-set ',mode)) ;; Avoid overwriting a message shown by the body, ;; but do overwrite previous messages. (unless (and (current-message) @@ -256,9 +276,15 @@ (t (error "Invalid keymap %S" ,keymap)))) ,(format "Keymap for `%s'." mode-name))) - (add-minor-mode ',mode ',lighter - ,(if keymap keymap-sym - `(if (boundp ',keymap-sym) ,keymap-sym)))))) + ,(if (not (symbolp mode)) + (if (or lighter keymap) + (error ":lighter and :keymap unsupported with mode expression %s" mode)) + `(with-no-warnings + (add-minor-mode ',mode ',lighter + ,(if keymap keymap-sym + `(if (boundp ',keymap-sym) ,keymap-sym)) + nil + ,(unless (eq mode modefun) 'modefun))))))) ;;; ;;; make global minor mode @@ -338,9 +364,11 @@ (progn (add-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (add-hook 'fundamental-mode-hook ',MODE-enable-in-buffers) (add-hook 'find-file-hook ',MODE-check-buffers) (add-hook 'change-major-mode-hook ',MODE-cmhh)) (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (remove-hook 'fundamental-mode-hook ',MODE-enable-in-buffers) (remove-hook 'find-file-hook ',MODE-check-buffers) (remove-hook 'change-major-mode-hook ',MODE-cmhh)) @@ -361,13 +389,14 @@ (dolist (buf ,MODE-buffers) (when (buffer-live-p buf) (with-current-buffer buf - (if ,mode - (unless (eq ,MODE-major-mode major-mode) - (,mode -1) - (,turn-on) - (setq ,MODE-major-mode major-mode)) - (,turn-on) - (setq ,MODE-major-mode major-mode)))))) + (unless (eq ,MODE-major-mode major-mode) + (if ,mode + (progn + (,mode -1) + (,turn-on) + (setq ,MODE-major-mode major-mode)) + (,turn-on) + (setq ,MODE-major-mode major-mode))))))) (put ',MODE-enable-in-buffers 'definition-name ',global-mode) (defun ,MODE-check-buffers () diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/lisp-mode.el --- a/lisp/emacs-lisp/lisp-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/lisp-mode.el Thu May 13 15:13:52 2010 +0200 @@ -466,7 +466,7 @@ "Keymap for ordinary Lisp mode. All commands in `lisp-mode-shared-map' are inherited by this map.") -(defun lisp-mode () +(define-derived-mode lisp-mode nil "Lisp" "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. Commands: Delete converts tabs to spaces as it moves back. @@ -478,19 +478,12 @@ Entry to this mode calls the value of `lisp-mode-hook' if that value is non-nil." - (interactive) - (kill-all-local-variables) - (use-local-map lisp-mode-map) - (setq major-mode 'lisp-mode) - (setq mode-name "Lisp") (lisp-mode-variables nil t) + (set (make-local-variable 'find-tag-default-function) 'lisp-find-tag-default) (make-local-variable 'comment-start-skip) (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") - (setq imenu-case-fold-search t) - (set-syntax-table lisp-mode-syntax-table) - (run-mode-hooks 'lisp-mode-hook)) -(put 'lisp-mode 'find-tag-default-function 'lisp-find-tag-default) + (setq imenu-case-fold-search t)) (defun lisp-find-tag-default () (let ((default (find-tag-default))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emacs-lisp/lisp.el --- a/lisp/emacs-lisp/lisp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emacs-lisp/lisp.el Thu May 13 15:13:52 2010 +0200 @@ -624,20 +624,25 @@ (interactive) (let* ((data (lisp-completion-at-point predicate)) (plist (nthcdr 3 data))) - (let ((completion-annotate-function (plist-get plist :annotate-function))) + (if (null data) + (minibuffer-message "Nothing to complete") + (let ((completion-annotate-function + (plist-get plist :annotate-function))) (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data) - (plist-get plist :predicate))))) - + (plist-get plist :predicate)))))) + (defun lisp-completion-at-point (&optional predicate) + "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." ;; FIXME: the `end' could be after point? - (let* ((end (point)) + (let* ((pos (point)) (beg (with-syntax-table emacs-lisp-mode-syntax-table - (save-excursion - (backward-sexp 1) - (while (= (char-syntax (following-char)) ?\') - (forward-char 1)) - (point)))) + (condition-case nil + (save-excursion + (backward-sexp 1) + (skip-syntax-forward "'") + (point)) + (scan-error pos)))) (predicate (or predicate (save-excursion @@ -656,12 +661,23 @@ ;; Maybe a `let' varlist or something. nil ;; Else, we assume that a function name is expected. - 'fboundp)))))) - (list beg end obarray - :predicate predicate - :annotate-function + 'fboundp))))) + (end + (unless (or (eq beg (point-max)) + (member (char-syntax (char-after beg)) '(?\" ?\( ?\)))) + (condition-case nil + (save-excursion + (goto-char beg) + (forward-sexp 1) + (when (>= (point) pos) + (point))) + (scan-error pos))))) + (when end + (list beg end obarray + :predicate predicate + :annotate-function (unless (eq predicate 'fboundp) - (lambda (str) (if (fboundp (intern-soft str)) " ")))))) + (lambda (str) (if (fboundp (intern-soft str)) " "))))))) ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e ;;; lisp.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emulation/cua-base.el --- a/lisp/emulation/cua-base.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emulation/cua-base.el Thu May 13 15:13:52 2010 +0200 @@ -780,6 +780,10 @@ (setq mark-active nil) (run-hooks 'deactivate-mark-hook))) +(defun cua--filter-buffer-noprops (start end) + (let ((str (filter-buffer-substring start end))) + (set-text-properties 0 (length str) nil str) + str)) ;; The current register prefix (defvar cua--register nil) @@ -1039,8 +1043,7 @@ (setq s (car u)) (setq s (car u) e (cdr u))))))) (cond ((and s e (<= s e) (= s (mark t))) - (setq cua--repeat-replace-text - (filter-buffer-substring s e nil t))) + (setq cua--repeat-replace-text (cua--filter-buffer-noprops s e))) ((and (null s) (eq u elt)) ;; nothing inserted (setq cua--repeat-replace-text "")) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emulation/cua-gmrk.el --- a/lisp/emulation/cua-gmrk.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emulation/cua-gmrk.el Thu May 13 15:13:52 2010 +0200 @@ -137,7 +137,7 @@ (let ((src-buf (current-buffer))) (save-excursion (if (equal (marker-buffer cua--global-mark-marker) src-buf) - (let ((text (filter-buffer-substring start end nil t))) + (let ((text (cua--filter-buffer-noprops start end))) (goto-char (marker-position cua--global-mark-marker)) (insert text)) (set-buffer (marker-buffer cua--global-mark-marker)) @@ -161,7 +161,7 @@ (if (and (< start (marker-position cua--global-mark-marker)) (< (marker-position cua--global-mark-marker) end)) (message "Can't move region into itself") - (let ((text (filter-buffer-substring start end nil t)) + (let ((text (cua--filter-buffer-noprops start end)) (p1 (copy-marker start)) (p2 (copy-marker end))) (goto-char (marker-position cua--global-mark-marker)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emulation/cua-rect.el --- a/lisp/emulation/cua-rect.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emulation/cua-rect.el Thu May 13 15:13:52 2010 +0200 @@ -625,7 +625,7 @@ (if (not (cua--rectangle-virtual-edges)) (cua--rectangle-operation nil nil nil nil nil ; do not tabify '(lambda (s e l r) - (setq rect (cons (filter-buffer-substring s e nil t) rect)))) + (setq rect (cons (cua--filter-buffer-noprops s e) rect)))) (cua--rectangle-operation nil 1 nil nil nil ; do not tabify '(lambda (s e l r v) (let ((copy t) (bs 0) (as 0) row) @@ -643,7 +643,7 @@ (setq as (- r (max (current-column) l)) e (point))) (setq row (if (and copy (> e s)) - (filter-buffer-substring s e nil t) + (cua--filter-buffer-noprops s e) "")) (when (> bs 0) (setq row (concat (make-string bs ?\s) row))) @@ -1124,12 +1124,12 @@ '(lambda (s e l r) (cond ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t) - (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t)) + (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1))) (n (string-to-number txt 16)) (fmt (format "0x%%0%dx" (length txt)))) (replace-match (format fmt (+ n increment))))) ((re-search-forward "\\( *-?[0-9]+\\)" e t) - (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t)) + (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1))) (prefix (if (= (aref txt 0) ?0) "0" "")) (n (string-to-number txt 10)) (fmt (format "%%%s%dd" prefix (length txt)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/emulation/edt.el --- a/lisp/emulation/edt.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/emulation/edt.el Thu May 13 15:13:52 2010 +0200 @@ -858,8 +858,7 @@ In select mode, selected text is highlighted." (if arg (progn - (make-local-variable 'edt-select-mode) - (setq edt-select-mode 'edt-select-mode-current) + (set (make-local-variable 'edt-select-mode) 'edt-select-mode-current) (setq rect-start-point (window-point))) (progn (kill-local-variable 'edt-select-mode))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/epg.el --- a/lisp/epg.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/epg.el Thu May 13 15:13:52 2010 +0200 @@ -137,7 +137,8 @@ '((?e . encrypt) (?s . sign) (?c . certify) - (?a . authentication))) + (?a . authentication) + (?D . disabled))) (defvar epg-new-signature-type-alist '((?D . detached) @@ -1898,7 +1899,7 @@ ;; Cleanup the tempfile. (and tempfile (file-exists-p tempfile) - (delete-file tempfile)) + (delete-file tempfile t)) ;; Cleanup the tempdir. (and tempdir (file-directory-p tempdir) @@ -1998,7 +1999,7 @@ (epg-read-output context)) (epg-delete-output-file context) (if (file-exists-p input-file) - (delete-file input-file)) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-verify (context signature &optional signed-text) @@ -2202,7 +2203,7 @@ (epg-read-output context)) (epg-delete-output-file context) (if input-file - (delete-file input-file)) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-encrypt (context plain recipients @@ -2322,7 +2323,7 @@ (epg-read-output context)) (epg-delete-output-file context) (if input-file - (delete-file input-file)) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-export-keys (context keys) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/erc/ChangeLog --- a/lisp/erc/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/erc/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,7 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-03-10 Chong Yidong * Branch for 23.2. @@ -12,8 +16,8 @@ (erc-server-reconnect): Use it to reconnect via old connector (Bug#4958). - * erc.el (erc-determine-parameters): Save - erc-server-connect-function to erc-session-connector. + * erc.el (erc-determine-parameters): + Save erc-server-connect-function to erc-session-connector. 2009-11-03 Stefan Monnier diff -r e56f669f17ce -r fe07c47cf7a7 lisp/erc/ChangeLog.03 --- a/lisp/erc/ChangeLog.03 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/erc/ChangeLog.03 Thu May 13 15:13:52 2010 +0200 @@ -145,7 +145,7 @@ to delete-if-not. * erc.el 1.580 (erc-update-current-channel-member): - Use erc-downcase when comparing + Use erc-downcase when comparing nick entries. Cleanup indentation. 2003-11-01 Lawrence Mitchell @@ -171,7 +171,7 @@ 2003-10-24 Mario Lang * erc-dcc.el 1.80: From Stephan Stahl : - * (erc-dcc-send-block): Kill buffer if transfer completed correctly. + (erc-dcc-send-block): Kill buffer if transfer completed correctly. 2003-10-22 Mario Lang diff -r e56f669f17ce -r fe07c47cf7a7 lisp/erc/ChangeLog.04 --- a/lisp/erc/ChangeLog.04 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/erc/ChangeLog.04 Thu May 13 15:13:52 2010 +0200 @@ -72,7 +72,7 @@ 2004-12-24 Jorgen Schaefer * erc-goodies.el, erc.el: The Small Extraction of Stuff[tm] commit. - Moved some functions from erc.el to erc-goodies.el, and + Moved some functions from erc.el to erc-goodies.el, and transformed them to erc modules in the process. - imenu autoload stuff moved. I don't know why it is here at all. - Moved: scroll-to-bottom, make-read-only, distinguish-noncommands, diff -r e56f669f17ce -r fe07c47cf7a7 lisp/filecache.el --- a/lisp/filecache.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/filecache.el Thu May 13 15:13:52 2010 +0200 @@ -296,8 +296,8 @@ (defun file-cache-add-directory-list (directory-list &optional regexp) "Add DIRECTORY-LIST (a list of directory names) to the file cache. If the optional REGEXP argument is non-nil, only files which match it -will be added to the cache. Note that the REGEXP is applied to the files -in each directory, not to the directory list itself." +will be added to the cache. Note that the REGEXP is applied to the +files in each directory, not to the directory list itself." (interactive "XAdd files from directory list: ") (mapcar (lambda (dir) (file-cache-add-directory dir regexp)) @@ -370,10 +370,10 @@ ;;;###autoload (defun file-cache-add-directory-recursively (dir &optional regexp) "Adds DIR and any subdirectories to the file-cache. -This function does not use any external programs +This function does not use any external programs. If the optional REGEXP argument is non-nil, only files which match it -will be added to the cache. Note that the REGEXP is applied to the files -in each directory, not to the directory list itself." +will be added to the cache. Note that the REGEXP is applied to the +files in each directory, not to the directory list itself." (interactive "DAdd directory: ") (require 'find-lisp) (mapcar diff -r e56f669f17ce -r fe07c47cf7a7 lisp/files.el --- a/lisp/files.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/files.el Thu May 13 15:13:52 2010 +0200 @@ -2252,15 +2252,14 @@ ;; The list of archive file extensions should be in sync with ;; `auto-coding-alist' with `no-conversion' coding system. ("\\.\\(\ -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\ -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode) +arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\ +ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode) ("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'" . archive-mode) ;OpenOffice.org ("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode) ; Debian/Opkg packages. ;; Mailer puts message to be edited in ;; /tmp/Re.... or Message ("\\`/tmp/Re" . text-mode) ("/Message[0-9]*\\'" . text-mode) - ("\\.zone\\'" . zone-mode) ;; some news reader is reported to use this ("\\`/tmp/fol/" . text-mode) ("\\.oak\\'" . scheme-mode) @@ -2294,7 +2293,6 @@ ("#\\*mail\\*" . mail-mode) ("\\.g\\'" . antlr-mode) ("\\.ses\\'" . ses-mode) - ("\\.\\(soa\\|zone\\)\\'" . dns-mode) ("\\.docbook\\'" . sgml-mode) ("\\.com\\'" . dcl-mode) ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode) @@ -3625,10 +3623,13 @@ no longer accessible under its old name. The value is non-nil after a backup was made by renaming. -It has the form (MODES . BACKUPNAME). +It has the form (MODES SELINUXCONTEXT BACKUPNAME). MODES is the result of `file-modes' on the original file; this means that the caller, after saving the buffer, should change the modes of the new file to agree with the old modes. +SELINUXCONTEXT is the result of `file-selinux-context' on the original +file; this means that the caller, after saving the buffer, should change +the SELinux context of the new file to agree with the old context. BACKUPNAME is the backup file name, which is the old file renamed." (if (and make-backup-files (not backup-inhibited) (not buffer-backed-up) @@ -3656,7 +3657,8 @@ (or delete-old-versions (y-or-n-p (format "Delete excess backup versions of %s? " real-file-name))))) - (modes (file-modes buffer-file-name))) + (modes (file-modes buffer-file-name)) + (context (file-selinux-context buffer-file-name))) ;; Actually write the back up file. (condition-case () (if (or file-precious-flag @@ -3676,10 +3678,10 @@ (<= (nth 2 attr) backup-by-copying-when-privileged-mismatch))) (or (nth 9 attr) (not (file-ownership-preserved-p real-file-name))))))) - (backup-buffer-copy real-file-name backupname modes) + (backup-buffer-copy real-file-name backupname modes context) ;; rename-file should delete old backup. (rename-file real-file-name backupname t) - (setq setmodes (cons modes backupname))) + (setq setmodes (list modes context backupname))) (file-error ;; If trouble writing the backup, write it in ~. (setq backupname (expand-file-name @@ -3688,7 +3690,7 @@ (message "Cannot write backup file; backing up in %s" backupname) (sleep-for 1) - (backup-buffer-copy real-file-name backupname modes))) + (backup-buffer-copy real-file-name backupname modes context))) (setq buffer-backed-up t) ;; Now delete the old versions, if desired. (if delete-old-versions @@ -3700,7 +3702,7 @@ setmodes) (file-error nil)))))) -(defun backup-buffer-copy (from-name to-name modes) +(defun backup-buffer-copy (from-name to-name modes context) (let ((umask (default-file-modes))) (unwind-protect (progn @@ -3727,7 +3729,9 @@ ;; Reset the umask. (set-default-file-modes umask))) (and modes - (set-file-modes to-name (logand modes #o1777)))) + (set-file-modes to-name (logand modes #o1777))) + (and context + (set-file-selinux-context to-name context))) (defun file-name-sans-versions (name &optional keep-backup-version) "Return file NAME sans backup versions or strings. @@ -4257,7 +4261,9 @@ (nthcdr 10 (file-attributes buffer-file-name))) (if setmodes (condition-case () - (set-file-modes buffer-file-name (car setmodes)) + (progn + (set-file-modes buffer-file-name (car setmodes)) + (set-file-selinux-context buffer-file-name (nth 1 setmodes))) (error nil)))) ;; If the auto-save file was recent before this command, ;; delete it now. @@ -4270,7 +4276,7 @@ ;; This does the "real job" of writing a buffer into its visited file ;; and making a backup file. This is what is normally done ;; but inhibited if one of write-file-functions returns non-nil. -;; It returns a value (MODES . BACKUPNAME), like backup-buffer. +;; It returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer. (defun basic-save-buffer-1 () (prog1 (if save-buffer-coding-system @@ -4282,7 +4288,7 @@ (setq buffer-file-coding-system-explicit (cons last-coding-system-used nil))))) -;; This returns a value (MODES . BACKUPNAME), like backup-buffer. +;; This returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer. (defun basic-save-buffer-2 () (let (tempsetmodes setmodes) (if (not (file-writable-p buffer-file-name)) @@ -4353,8 +4359,9 @@ ;; Since we have created an entirely new file, ;; make sure it gets the right permission bits set. (setq setmodes (or setmodes - (cons (or (file-modes buffer-file-name) + (list (or (file-modes buffer-file-name) (logand ?\666 umask)) + (file-selinux-context buffer-file-name) buffer-file-name))) ;; We succeeded in writing the temp file, ;; so rename it. @@ -4365,8 +4372,11 @@ ;; (setmodes is set) because that says we're superseding. (cond ((and tempsetmodes (not setmodes)) ;; Change the mode back, after writing. - (setq setmodes (cons (file-modes buffer-file-name) buffer-file-name)) - (set-file-modes buffer-file-name (logior (car setmodes) 128)))) + (setq setmodes (list (file-modes buffer-file-name) + (file-selinux-context buffer-file-name) + buffer-file-name)) + (set-file-modes buffer-file-name (logior (car setmodes) 128)) + (set-file-selinux-context buffer-file-name (nth 1 setmodes))))) (let (success) (unwind-protect (progn @@ -4380,8 +4390,8 @@ ;; the backup by renaming, undo the backing-up. (and setmodes (not success) (progn - (rename-file (cdr setmodes) buffer-file-name t) - (setq buffer-backed-up nil))))))) + (rename-file (nth 2 setmodes) buffer-file-name t) + (setq buffer-backed-up nil)))))) setmodes)) (defun diff-buffer-with-file (&optional buffer) @@ -4743,10 +4753,14 @@ (mapc (lambda (file) (let ((target (expand-file-name - (file-name-nondirectory file) newname))) - (if (file-directory-p file) - (copy-directory file target keep-time parents) - (copy-file file target t keep-time)))) + (file-name-nondirectory file) newname)) + (attrs (file-attributes file))) + (cond ((file-directory-p file) + (copy-directory file target keep-time parents)) + ((stringp (car attrs)) ; Symbolic link + (make-symbolic-link (car attrs) target t)) + (t + (copy-file file target t keep-time))))) ;; We do not want to copy "." and "..". (directory-files directory 'full directory-files-no-dot-files-regexp)) @@ -5138,30 +5152,6 @@ (kill-buffer-ask buffer))))) -(defun auto-save-mode (arg) - "Toggle auto-saving of contents of current buffer. -With prefix argument ARG, turn auto-saving on if positive, else off." - (interactive "P") - (setq buffer-auto-save-file-name - (and (if (null arg) - (or (not buffer-auto-save-file-name) - ;; If auto-save is off because buffer has shrunk, - ;; then toggling should turn it on. - (< buffer-saved-size 0)) - (or (eq arg t) (listp arg) (and (integerp arg) (> arg 0)))) - (if (and buffer-file-name auto-save-visited-file-name - (not buffer-read-only)) - buffer-file-name - (make-auto-save-file-name)))) - ;; If -1 was stored here, to temporarily turn off saving, - ;; turn it back on. - (and (< buffer-saved-size 0) - (setq buffer-saved-size 0)) - (if (called-interactively-p 'interactive) - (message "Auto-save %s (in this buffer)" - (if buffer-auto-save-file-name "on" "off"))) - buffer-auto-save-file-name) - (defun rename-auto-save-file () "Adjust current buffer's auto save file name for current conditions. Also rename any existing auto save file, if it was made in this session." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/font-setting.el --- a/lisp/font-setting.el Wed May 12 14:32:06 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -;;; font-setting.el --- Support dynamic font changes - -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. - -;; Author: Jan Djärv -;; Maintainer: FSF -;; Keywords: font, system-font - -;; 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 GNU Emacs. If not, see . - -;;; Commentary: - -;; This file provides the lisp part of the GConf and XSetting code in -;; xsetting.c. But it is nothing that prevents it from being used by -;; other configuration schemes. - -;;; Code: - -;;; Customizable variables - -(declare-function font-get-system-font "xsettings.c" ()) - -(defvar font-use-system-font) - -(defun font-setting-change-default-font (display-or-frame set-font) - "Change font and/or font settings for frames on display DISPLAY-OR-FRAME. -If DISPLAY-OR-FRAME is a frame, the display is the one for that frame. - -If SET-FONT is non-nil, change the font for frames. Otherwise re-apply the -current form for the frame (i.e. hinting or somesuch changed)." - - (let ((new-font (and (fboundp 'font-get-system-font) - (font-get-system-font)))) - (when new-font - ;; Be careful here: when set-face-attribute is called for the - ;; :font attribute, Emacs tries to guess the best matching font - ;; by examining the other face attributes (Bug#2476). - - (clear-font-cache) - ;; Set for current frames. Only change font for those that have - ;; the old font now. If they don't have the old font, the user - ;; probably changed it. - (dolist (f (frames-on-display-list display-or-frame)) - (if (display-graphic-p f) - (let* ((frame-font - (or (font-get (face-attribute 'default :font f - 'default) :user-spec) - (frame-parameter f 'font-parameter))) - (font-to-set - (if set-font new-font - ;; else set font again, hinting etc. may have changed. - frame-font))) - (if font-to-set - (progn - (message "setting %s" font-to-set) - (set-frame-parameter f 'font-parameter font-to-set) - (set-face-attribute 'default f - :width 'normal - :weight 'normal - :slant 'normal - :font font-to-set)))))) - - ;; Set for future frames. - (set-face-attribute 'default t :font new-font) - (let ((spec (list (list t (face-attr-construct 'default))))) - (progn - (put 'default 'customized-face spec) - (custom-push-theme 'theme-face 'default 'user 'set spec) - (put 'default 'face-modified nil)))))) - -(defun font-setting-handle-config-changed-event (event) - "Handle config-changed-event to change fonts on the display in EVENT. -If `font-use-system-font' is nil, the font is not changed." - (interactive "e") - (let ((type (nth 1 event)) ;; font-name or font-render - (display-name (nth 2 event))) - (if (or (not (eq type 'font-name)) - font-use-system-font) - (font-setting-change-default-font display-name - (eq type 'font-name))))) - -(if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) - (define-key special-event-map [config-changed-event] - 'font-setting-handle-config-changed-event)) - -(provide 'font-setting) - -;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017 diff -r e56f669f17ce -r fe07c47cf7a7 lisp/frame.el --- a/lisp/frame.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/frame.el Thu May 13 15:13:52 2010 +0200 @@ -24,6 +24,7 @@ ;;; Commentary: ;;; Code: +(eval-when-compile (require 'cl)) (defvar frame-creation-function-alist (list (cons nil @@ -1132,37 +1133,26 @@ (modify-frame-parameters (selected-frame) (list (cons 'border-color color-name)))) -(defun auto-raise-mode (arg) +(define-minor-mode auto-raise-mode "Toggle whether or not the selected frame should auto-raise. With ARG, turn auto-raise mode on if and only if ARG is positive. Note that this controls Emacs's own auto-raise feature. Some window managers allow you to enable auto-raise for certain windows. You can use that for Emacs windows if you wish, but if you do, that is beyond the control of Emacs and this command has no effect on it." - (interactive "P") - (if (null arg) - (setq arg - (if (cdr (assq 'auto-raise (frame-parameters (selected-frame)))) - -1 1))) - (if (> arg 0) - (raise-frame (selected-frame))) - (modify-frame-parameters (selected-frame) - (list (cons 'auto-raise (> arg 0))))) + :variable (frame-parameter nil 'auto-raise) + (if (frame-parameter nil 'auto-raise) + (raise-frame))) -(defun auto-lower-mode (arg) +(define-minor-mode auto-lower-mode "Toggle whether or not the selected frame should auto-lower. With ARG, turn auto-lower mode on if and only if ARG is positive. Note that this controls Emacs's own auto-lower feature. Some window managers allow you to enable auto-lower for certain windows. You can use that for Emacs windows if you wish, but if you do, that is beyond the control of Emacs and this command has no effect on it." - (interactive "P") - (if (null arg) - (setq arg - (if (cdr (assq 'auto-lower (frame-parameters (selected-frame)))) - -1 1))) - (modify-frame-parameters (selected-frame) - (list (cons 'auto-lower (> arg 0))))) + :variable (frame-parameter nil 'auto-lower)) + (defun set-frame-name (name) "Set the name of the selected frame to NAME. When called interactively, prompt for the name of the frame. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,164 @@ +2010-05-12 Katsumi Yamaoka + + * message.el (message-forward-make-body-plain) + (message-forward-make-body-mml): Use mm-multibyte-string-p instead of + multibyte-string-p. + +2010-05-12 Katsumi Yamaoka + + * message.el (message-forward-make-body-mml): Assume original message + is multibyte string; error on unibyte. + (message-forward-make-body-plain): Ditto; don't add excessive newline + in body end. + +2010-05-11 Andreas Seltenreich + + * gnus-sum.el (gnus-summary-kill-thread): Use gnus-summary-mark-article + instead of g-s-m-a-as-unread to set the expirable mark. (Bug#5284) + +2010-05-11 Katsumi Yamaoka + + * mm-extern.el (mm-extern-url): Don't use + mm-with-unibyte-current-buffer. + (mm-extern-cache-contents): Use with-current-buffer instead of + save-excursion + set-buffer. + +2010-05-10 Katsumi Yamaoka + + * mm-util.el (mm-emacs-mule): Remove. + +2010-05-10 Andreas Seltenreich + + * gnus-sum.el (gnus-summary-mode): Don't make minor-mode-alist + buffer-local as it's incompatible with Stefan Monnier's 2010-05-03 + change. + +2010-05-10 Katsumi Yamaoka + + * mm-util.el (mm-with-unibyte-current-buffer): Redefine it so as not to + bind the default value of enable-multibyte-characters to nil. + +2010-05-10 Katsumi Yamaoka + + * message.el (message-forward-make-body-plain) + (message-forward-make-body-mml): + Don't use mm-with-unibyte-current-buffer. + +2010-05-07 Christian von Roques (tiny change) + + * mml2015.el (mml2015-epg-find-usable-key): Skip disabled key + (Bug#5592). + +2010-05-07 Julien Danjou + + * gnus-art.el (gnus-mime-pipe-part): Add optional argument `cmd'; pass + it to mm-pipe-part. + + * mm-decode.el (mm-pipe-part): Add optional argument `cmd'; use it if + it is given. + +2010-05-07 Katsumi Yamaoka + + * nnweb.el (nnweb-gmane-search) + * yenc.el (yenc-decode-region): Don't run set-buffer-multibyte for + XEmacs. + + * gnus-art.el (gnus-article-browse-html-parts) + * gnus-group.el (gnus-read-ephemeral-gmane-group) + (gnus-read-ephemeral-bug-grou): Use mm-make-temp-file instead of + make-temp-file. + + * gnus-dired.el (gnus-dired-mode): Bind gnus-dired-mode-hook, + gnus-dired-mode-on-hook and gnus-dired-mode-off-hook for XEmacs when + compiling. + + * gnus-ml.el (gnus-mailing-list-mode): Bind gnus-mailing-list-mode-hook, + gnus-mailing-list-mode-on-hook and gnus-mailing-list-mode-off-hook for + XEmacs when compiling. + + * gnus-salt.el (gnus-pick-mode): Bind gnus-pick-mode-on-hook and + gnus-pick-mode-off-hook for XEmacs when compiling. + (gnus-binary-mode): Bind gnus-binary-mode-on-hook and + gnus-binary-mode-off-hook for XEmacs when compiling. + + * gnus-sum.el (gnus-summary-limit-strange-charsets-predicate): Return + nil if char-charset is not available. + + * sieve-manage.el (sieve-manage-disable-multibyte): Redefine it as a + macro. + + * mm-url.el (mm-url-form-encode-xwfu): Use mm-encode-coding-string + instead of encode-coding-string. + + * mm-util.el (mm-enable-multibyte, mm-disable-multibyte): Use (featurep + 'xemacs) instead of mm-emacs-mule to switch function definitions. + (mm-with-unibyte-current-buffer): Make it a progn macro for XEmacs. + +2010-05-06 Tommi Vainikainen (tiny change) + + * mml-sec.el (mml-secure-message-sign): Fix cut and paste error. + +2010-05-06 Katsumi Yamaoka + + * gnus-dired.el, gnus-draft.el, gnus-ml.el, gnus-salt.el, gnus-sum.el, + gnus-undo.el, mml.el: Require easy-mmode for XEmacs when compiling. + +2010-05-03 Juanma Barranquero + + * mm-util.el (mm-decompress-buffer): Use `delete-file'; + alias `jka-compr-delete-temp-file' no longer exists. + +2010-05-03 Stefan Monnier + + Use define-minor-mode in Gnus where applicable. + * mml.el (mml-mode): Use define-minor-mode. + * gnus-undo.el (gnus-undo-mode-map): Initialize in declaration. + (gnus-undo-mode): Use define-minor-mode. + * gnus-sum.el (gnus-dead-summary-mode-map): Initialize in declaration. + (gnus-dead-summary-mode): Use define-minor-mode. + * gnus-salt.el (gnus-pick-mode-map, gnus-binary-mode-map): + Initialize in declaration. + (gnus-pick-mode, gnus-binary-mode): Use define-minor-mode. + * gnus-ml.el (gnus-mailing-list-mode-map): Initialize in declaration. + (gnus-mailing-list-mode): Use define-minor-mode. + * gnus-draft.el (gnus-draft-mode-map): Initialize in declaration. + (gnus-draft-mode): Use define-minor-mode. + * gnus-dired.el (gnus-dired-mode-map): Initialize in declaration. + (gnus-dired-mode): Use define-minor-mode. + +2010-05-01 Andreas Seltenreich + + * mml.el (mml-generate-mime-1,mml-compute-boundary-1): Update 'mml + handles on recursive mml-to-mime translation and check them for + boundary delimiter collisions. Reported by: Greg Troxel. + +2010-04-27 Katsumi Yamaoka + + * gnus-util.el: Don't load tm and apel XEmacs packages when compiling. + +2010-04-23 Stefan Monnier + + * mm-util.el (mm-find-buffer-file-coding-system): + * yenc.el (yenc-decode-region): Don't let-bind a read-only variable. + +2010-04-22 Andreas Seltenreich + + * message.el (message-generate-headers): Record insertion of optional + headers as well. Otherwise the check to prevent repeated insertion of + optional headers is a no-op. + +2010-04-17 Teodor Zlatanov + + * smime.el: Don't mention CVS. + + * nnrss.el (nnrss-fetch): Don't mention CVS. + + * nnir.el: Don't mention CVS. + 2010-04-14 Stefan Monnier - * gnus-sum.el (gnus-summary-bookmark-make-record): Add `location' field. + * gnus-sum.el (gnus-summary-bookmark-make-record): + Add `location' field. 2010-04-12 Stefan Monnier diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/ChangeLog.1 --- a/lisp/gnus/ChangeLog.1 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/ChangeLog.1 Thu May 13 15:13:52 2010 +0200 @@ -28,10 +28,10 @@ * gnus-start.el (gnus-slave-save-newsrc): * gnus-uu.el (gnus-uu-tmp-dir, gnus-uu-decode-binhex) - (gnus-uu-decode-binhex-view, gnus-uu-digest-mail-forward) - (gnus-uu-initialize): + (gnus-uu-decode-binhex-view, gnus-uu-digest-mail-forward) + (gnus-uu-initialize): * nnmail.el (nnmail-make-complex-temp-name, nnmail-get-new-mail): - Use make-temp-file. + Use make-temp-file. 1999-09-07 Eli Zaretskii diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/ChangeLog.2 --- a/lisp/gnus/ChangeLog.2 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/ChangeLog.2 Thu May 13 15:13:52 2010 +0200 @@ -4905,8 +4905,8 @@ 2003-02-08 Michael Welsh Duggan * nnmail.el (nnmail-split-it): If a message ends up matching the - same mailbox more than once, it will cause duplicates to appear - in the mailbox. + same mailbox more than once, it will cause duplicates to appear + in the mailbox. 2003-02-08 Simon Josefsson @@ -5553,8 +5553,8 @@ 2003-01-13 Jhair Tocancipa Triana * gnus-audio.el (gnus-audio-au-player, gnus-audio-wav-player): Use - /usr/bin/play as default player. - (gnus-audio-play): Added ARG-DESCRIPTOR to prompt for a file to play. + /usr/bin/play as default player. + (gnus-audio-play): Added ARG-DESCRIPTOR to prompt for a file to play. 2003-01-14 Katsumi Yamaoka @@ -9034,7 +9034,7 @@ boolean not a string * gnus-group.el (gnus-group-line-format): Add description of %C * gnus-group.el (gnus-group-line-format-alist): Add gnus-tmp-comment - as %C + as %C * gnus-group.el (gnus-group-insert-group-line): Add gnus-tmp-comment. 2002-04-22 Paul Jarc @@ -11326,7 +11326,7 @@ 2002-01-02 ShengHuo ZHU * gnus-picon.el (gnus-picon-transform-newsgroups): Fix for the case - "Newsgroups: rec.music.beatles.moderated, rec.music.beatles". + "Newsgroups: rec.music.beatles.moderated, rec.music.beatles". 2002-01-03 Steve Youngs @@ -12256,7 +12256,7 @@ (imap-stream-alist): Backslash. * gnus-sum.el (gnus-summary-limit-to-author): Missing arguments. - Thanks to david.goldberg6@verizon.net (David S. Goldberg). + Thanks to david.goldberg6@verizon.net (David S. Goldberg). 2001-11-27 14:00:00 ShengHuo ZHU @@ -12755,7 +12755,7 @@ 2001-10-30 13:00:00 ShengHuo ZHU * gnus-spec.el (gnus-parse-simple-format): Use - buffer-substring-no-properties. + buffer-substring-no-properties. 2001-10-30 Katsumi Yamaoka diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-art.el --- a/lisp/gnus/gnus-art.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-art.el Thu May 13 15:13:52 2010 +0200 @@ -2897,7 +2897,7 @@ ]+[\t\n ]+\\)*src=\"\\(cid:\\([^\"]+\\)\\)\"" nil t) (unless cid-dir - (setq cid-dir (make-temp-file "cid" t)) + (setq cid-dir (mm-make-temp-file "cid" t)) (add-to-list 'gnus-article-browse-html-temp-list cid-dir)) (setq file nil content nil) @@ -5041,13 +5041,14 @@ (when data (mm-save-part data)))) -(defun gnus-mime-pipe-part () - "Pipe the MIME part under point to a process." +(defun gnus-mime-pipe-part (&optional cmd) + "Pipe the MIME part under point to a process. +Use CMD as the process." (interactive) (gnus-article-check-buffer) (let ((data (get-text-property (point) 'gnus-data))) (when data - (mm-pipe-part data)))) + (mm-pipe-part data cmd)))) (defun gnus-mime-view-part () "Interactively choose a viewing method for the MIME part under point." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-dired.el --- a/lisp/gnus/gnus-dired.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-dired.el Thu May 13 15:13:52 2010 +0200 @@ -39,6 +39,9 @@ ;;; Code: +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' (require 'dired) (autoload 'mml-attach-file "mml") (autoload 'mm-default-file-encoding "mm-decode");; Shift this to `mailcap.el'? @@ -55,17 +58,12 @@ (autoload 'message-buffers "message") (autoload 'gnus-print-buffer "gnus-sum") -(defvar gnus-dired-mode nil - "Minor mode for intersections of MIME mail composition and dired.") - -(defvar gnus-dired-mode-map nil) - -(unless gnus-dired-mode-map - (setq gnus-dired-mode-map (make-sparse-keymap)) - - (define-key gnus-dired-mode-map "\C-c\C-m\C-a" 'gnus-dired-attach) - (define-key gnus-dired-mode-map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap) - (define-key gnus-dired-mode-map "\C-c\C-m\C-p" 'gnus-dired-print)) +(defvar gnus-dired-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c\C-m\C-a" 'gnus-dired-attach) + (define-key map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap) + (define-key map "\C-c\C-m\C-p" 'gnus-dired-print) + map)) ;; FIXME: Make it customizable, change the default to `mail-user-agent' when ;; this file is renamed (e.g. to `dired-mime.el'). @@ -89,19 +87,19 @@ gnus-user-agent) (function :tag "Other"))) -(defun gnus-dired-mode (&optional arg) +(eval-when-compile + (when (featurep 'xemacs) + (defvar gnus-dired-mode-hook) + (defvar gnus-dired-mode-on-hook) + (defvar gnus-dired-mode-off-hook))) + +(define-minor-mode gnus-dired-mode "Minor mode for intersections of gnus and dired. \\{gnus-dired-mode-map}" - (interactive "P") - (when (eq major-mode 'dired-mode) - (set (make-local-variable 'gnus-dired-mode) - (if (null arg) (not gnus-dired-mode) - (> (prefix-numeric-value arg) 0))) - (when gnus-dired-mode - (add-minor-mode 'gnus-dired-mode "" gnus-dired-mode-map) - (save-current-buffer - (run-hooks 'gnus-dired-mode-hook))))) + :keymap gnus-dired-mode-map + (unless (derived-mode-p 'dired-mode) + (setq gnus-dired-mode nil))) ;;;###autoload (defun turn-on-gnus-dired-mode () diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-draft.el --- a/lisp/gnus/gnus-draft.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-draft.el Thu May 13 15:13:52 2010 +0200 @@ -32,23 +32,21 @@ (require 'nndraft) (require 'gnus-agent) (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' ;;; Draft minor mode -(defvar gnus-draft-mode nil - "Minor mode for providing a draft summary buffers.") - -(defvar gnus-draft-mode-map nil) - -(unless gnus-draft-mode-map - (setq gnus-draft-mode-map (make-sparse-keymap)) - - (gnus-define-keys gnus-draft-mode-map - "Dt" gnus-draft-toggle-sending - "e" gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article' - "De" gnus-draft-edit-message - "Ds" gnus-draft-send-message - "DS" gnus-draft-send-all-messages)) +(defvar gnus-draft-mode-map + (let ((map (make-sparse-keymap))) + (gnus-define-keys map + "Dt" gnus-draft-toggle-sending + "e" gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article' + "De" gnus-draft-edit-message + "Ds" gnus-draft-send-message + "DS" gnus-draft-send-all-messages) + map)) (defun gnus-draft-make-menu-bar () (unless (boundp 'gnus-draft-menu) @@ -61,20 +59,17 @@ ["Send all messages" gnus-draft-send-all-messages t] ["Delete draft" gnus-summary-delete-article t])))) -(defun gnus-draft-mode (&optional arg) +(define-minor-mode gnus-draft-mode "Minor mode for providing a draft summary buffers. \\{gnus-draft-mode-map}" - (interactive "P") - (when (eq major-mode 'gnus-summary-mode) - (when (set (make-local-variable 'gnus-draft-mode) - (if (null arg) (not gnus-draft-mode) - (> (prefix-numeric-value arg) 0))) - ;; Set up the menu. - (when (gnus-visual-p 'draft-menu 'menu) - (gnus-draft-make-menu-bar)) - (add-minor-mode 'gnus-draft-mode " Draft" gnus-draft-mode-map) - (gnus-run-hooks 'gnus-draft-mode-hook)))) + :lighter " Draft" :keymap gnus-draft-mode-map + (cond + ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-draft-mode nil)) + (gnus-draft-mode + ;; Set up the menu. + (when (gnus-visual-p 'draft-menu 'menu) + (gnus-draft-make-menu-bar))))) ;;; Commands diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-group.el --- a/lisp/gnus/gnus-group.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-group.el Thu May 13 15:13:52 2010 +0200 @@ -2364,7 +2364,7 @@ (unless range (setq range 500)) (when (< range 1) (error "Invalid range: %s" range)) - (let ((tmpfile (make-temp-file + (let ((tmpfile (mm-make-temp-file (format "%s.start-%s.range-%s." group start range))) (gnus-thread-sort-functions '(gnus-thread-sort-by-number))) (with-temp-file tmpfile @@ -2445,7 +2445,7 @@ (cdr (assoc 'emacs gnus-bug-group-download-format-alist)))) (when (stringp number) (setq number (string-to-number number))) - (let ((tmpfile (make-temp-file "gnus-temp-group-"))) + (let ((tmpfile (mm-make-temp-file "gnus-temp-group-"))) (with-temp-file tmpfile (url-insert-file-contents (format mbox-url number)) (write-region (point-min) (point-max) tmpfile) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-ml.el --- a/lisp/gnus/gnus-ml.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-ml.el Thu May 13 15:13:52 2010 +0200 @@ -30,27 +30,25 @@ (require 'gnus) (require 'gnus-msg) (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' ;;; Mailing list minor mode -(defvar gnus-mailing-list-mode nil - "Minor mode for providing mailing-list commands.") - -(defvar gnus-mailing-list-mode-map nil) +(defvar gnus-mailing-list-mode-map + (let ((map (make-sparse-keymap))) + (gnus-define-keys map + "\C-c\C-nh" gnus-mailing-list-help + "\C-c\C-ns" gnus-mailing-list-subscribe + "\C-c\C-nu" gnus-mailing-list-unsubscribe + "\C-c\C-np" gnus-mailing-list-post + "\C-c\C-no" gnus-mailing-list-owner + "\C-c\C-na" gnus-mailing-list-archive) + map)) (defvar gnus-mailing-list-menu) -(unless gnus-mailing-list-mode-map - (setq gnus-mailing-list-mode-map (make-sparse-keymap)) - - (gnus-define-keys gnus-mailing-list-mode-map - "\C-c\C-nh" gnus-mailing-list-help - "\C-c\C-ns" gnus-mailing-list-subscribe - "\C-c\C-nu" gnus-mailing-list-unsubscribe - "\C-c\C-np" gnus-mailing-list-post - "\C-c\C-no" gnus-mailing-list-owner - "\C-c\C-na" gnus-mailing-list-archive)) - (defun gnus-mailing-list-make-menu-bar () (unless (boundp 'gnus-mailing-list-menu) (easy-menu-define @@ -87,22 +85,26 @@ (gnus-mailing-list-mode 1)) (gnus-message 1 "no list-post in this message.")))) +(eval-when-compile + (when (featurep 'xemacs) + (defvar gnus-mailing-list-mode-hook) + (defvar gnus-mailing-list-mode-on-hook) + (defvar gnus-mailing-list-mode-off-hook))) + ;;;###autoload -(defun gnus-mailing-list-mode (&optional arg) +(define-minor-mode gnus-mailing-list-mode "Minor mode for providing mailing-list commands. \\{gnus-mailing-list-mode-map}" - (interactive "P") - (when (eq major-mode 'gnus-summary-mode) - (when (set (make-local-variable 'gnus-mailing-list-mode) - (if (null arg) (not gnus-mailing-list-mode) - (> (prefix-numeric-value arg) 0))) - ;; Set up the menu. - (when (gnus-visual-p 'mailing-list-menu 'menu) - (gnus-mailing-list-make-menu-bar)) - (add-minor-mode 'gnus-mailing-list-mode " Mailing-List" - gnus-mailing-list-mode-map) - (gnus-run-hooks 'gnus-mailing-list-mode-hook)))) + :lighter " Mailing-List" + :keymap gnus-mailing-list-mode-map + (cond + ((not (derived-mode-p 'gnus-summary-mode)) + (setq gnus-mailing-list-mode nil)) + (gnus-mailing-list-mode + ;; Set up the menu. + (when (gnus-visual-p 'mailing-list-menu 'menu) + (gnus-mailing-list-make-menu-bar))))) ;;; Commands diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-salt.el --- a/lisp/gnus/gnus-salt.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-salt.el Thu May 13 15:13:52 2010 +0200 @@ -26,6 +26,9 @@ ;;; Code: (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' (require 'gnus) (require 'gnus-sum) @@ -35,10 +38,6 @@ ;;; gnus-pick-mode ;;; -(defvar gnus-pick-mode nil - "Minor mode for providing a pick-and-read interface in Gnus -summary buffers.") - (defcustom gnus-pick-display-summary nil "*Display summary while reading." :type 'boolean @@ -72,17 +71,15 @@ ;;; Internal variables. -(defvar gnus-pick-mode-map nil) - -(unless gnus-pick-mode-map - (setq gnus-pick-mode-map (make-sparse-keymap)) - - (gnus-define-keys gnus-pick-mode-map - " " gnus-pick-next-page - "u" gnus-pick-unmark-article-or-thread - "." gnus-pick-article-or-thread - gnus-down-mouse-2 gnus-pick-mouse-pick-region - "\r" gnus-pick-start-reading)) +(defvar gnus-pick-mode-map + (let ((map (make-sparse-keymap))) + (gnus-define-keys map + " " gnus-pick-next-page + "u" gnus-pick-unmark-article-or-thread + "." gnus-pick-article-or-thread + gnus-down-mouse-2 gnus-pick-mouse-pick-region + "\r" gnus-pick-start-reading) + map)) (defun gnus-pick-make-menu-bar () (unless (boundp 'gnus-pick-menu) @@ -104,30 +101,35 @@ ["Start reading" gnus-pick-start-reading t] ["Switch pick mode off" gnus-pick-mode gnus-pick-mode])))) -(defun gnus-pick-mode (&optional arg) +(eval-when-compile + (when (featurep 'xemacs) + (defvar gnus-pick-mode-on-hook) + (defvar gnus-pick-mode-off-hook))) + +(define-minor-mode gnus-pick-mode "Minor mode for providing a pick-and-read interface in Gnus summary buffers. \\{gnus-pick-mode-map}" - (interactive "P") - (when (eq major-mode 'gnus-summary-mode) - (if (not (set (make-local-variable 'gnus-pick-mode) - (if (null arg) (not gnus-pick-mode) - (> (prefix-numeric-value arg) 0)))) - (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) - ;; Make sure that we don't select any articles upon group entry. - (set (make-local-variable 'gnus-auto-select-first) nil) - ;; Change line format. - (setq gnus-summary-line-format gnus-summary-pick-line-format) - (setq gnus-summary-line-format-spec nil) - (gnus-update-format-specifications nil 'summary) - (gnus-update-summary-mark-positions) - (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) - (set (make-local-variable 'gnus-summary-goto-unread) 'never) - ;; Set up the menu. - (when (gnus-visual-p 'pick-menu 'menu) - (gnus-pick-make-menu-bar)) - (add-minor-mode 'gnus-pick-mode " Pick" gnus-pick-mode-map) - (gnus-run-hooks 'gnus-pick-mode-hook)))) + :lighter " Pick" :keymap gnus-pick-mode-map + (cond + ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-pick-mode nil)) + ((not gnus-pick-mode) + ;; FIXME: a buffer-local minor mode removing globally from a hook?? + (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message)) + (t + ;; Make sure that we don't select any articles upon group entry. + (set (make-local-variable 'gnus-auto-select-first) nil) + ;; Change line format. + (setq gnus-summary-line-format gnus-summary-pick-line-format) + (setq gnus-summary-line-format-spec nil) + (gnus-update-format-specifications nil 'summary) + (gnus-update-summary-mark-positions) + ;; FIXME: a buffer-local minor mode adding globally to a hook?? + (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) + (set (make-local-variable 'gnus-summary-goto-unread) 'never) + ;; Set up the menu. + (when (gnus-visual-p 'pick-menu 'menu) + (gnus-pick-make-menu-bar))))) (defun gnus-pick-setup-message () "Make Message do the right thing on exit." @@ -319,20 +321,14 @@ ;;; gnus-binary-mode ;;; -(defvar gnus-binary-mode nil - "Minor mode for providing a binary group interface in Gnus summary buffers.") - (defvar gnus-binary-mode-hook nil "Hook run in summary binary mode buffers.") -(defvar gnus-binary-mode-map nil) - -(unless gnus-binary-mode-map - (setq gnus-binary-mode-map (make-sparse-keymap)) - - (gnus-define-keys - gnus-binary-mode-map - "g" gnus-binary-show-article)) +(defvar gnus-binary-mode-map + (let ((map (make-sparse-keymap))) + (gnus-define-keys map + "g" gnus-binary-show-article) + map)) (defun gnus-binary-make-menu-bar () (unless (boundp 'gnus-binary-menu) @@ -341,25 +337,25 @@ '("Pick" ["Switch binary mode off" gnus-binary-mode t])))) -(defun gnus-binary-mode (&optional arg) +(eval-when-compile + (when (featurep 'xemacs) + (defvar gnus-binary-mode-on-hook) + (defvar gnus-binary-mode-off-hook))) + +(define-minor-mode gnus-binary-mode "Minor mode for providing a binary group interface in Gnus summary buffers." - (interactive "P") - (when (eq major-mode 'gnus-summary-mode) - (make-local-variable 'gnus-binary-mode) - (setq gnus-binary-mode - (if (null arg) (not gnus-binary-mode) - (> (prefix-numeric-value arg) 0))) - (when gnus-binary-mode - ;; Make sure that we don't select any articles upon group entry. - (make-local-variable 'gnus-auto-select-first) - (setq gnus-auto-select-first nil) - (make-local-variable 'gnus-summary-display-article-function) - (setq gnus-summary-display-article-function 'gnus-binary-display-article) - ;; Set up the menu. - (when (gnus-visual-p 'binary-menu 'menu) - (gnus-binary-make-menu-bar)) - (add-minor-mode 'gnus-binary-mode " Binary" gnus-binary-mode-map) - (gnus-run-hooks 'gnus-binary-mode-hook)))) + :lighter " Binary" :keymap gnus-binary-mode-map + (cond + ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-binary-mode nil)) + (gnus-binary-mode + ;; Make sure that we don't select any articles upon group entry. + (make-local-variable 'gnus-auto-select-first) + (setq gnus-auto-select-first nil) + (make-local-variable 'gnus-summary-display-article-function) + (setq gnus-summary-display-article-function 'gnus-binary-display-article) + ;; Set up the menu. + (when (gnus-visual-p 'binary-menu 'menu) + (gnus-binary-make-menu-bar))))) (defun gnus-binary-display-article (article &optional all-header) "Run ARTICLE through the binary decode functions." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-start.el --- a/lisp/gnus/gnus-start.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-start.el Thu May 13 15:13:52 2010 +0200 @@ -2960,6 +2960,8 @@ (defun gnus-slave-mode () "Minor mode for slave Gnusae." + ;; FIXME: gnus-slave-mode appears to never be set (i.e. it'll always be nil): + ;; Remove, or fix and use define-minor-mode. (add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap)) (gnus-run-hooks 'gnus-slave-mode-hook)) @@ -3058,6 +3060,7 @@ nil) (t (save-excursion + ;; FIXME: Shouldn't save-restriction be done after set-buffer? (save-restriction (set-buffer nntp-server-buffer) (goto-char (point-min)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-sum.el --- a/lisp/gnus/gnus-sum.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-sum.el Thu May 13 15:13:52 2010 +0200 @@ -30,6 +30,9 @@ (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' (defvar tool-bar-mode) (defvar gnus-tmp-header) @@ -3053,7 +3056,6 @@ (gnus-simplify-mode-line) (setq major-mode 'gnus-summary-mode) (setq mode-name "Summary") - (make-local-variable 'minor-mode-alist) (use-local-map gnus-summary-mode-map) (buffer-disable-undo) (setq buffer-read-only t ;Disable modification @@ -7237,33 +7239,21 @@ ;;; Dead summaries. -(defvar gnus-dead-summary-mode-map nil) - -(unless gnus-dead-summary-mode-map - (setq gnus-dead-summary-mode-map (make-keymap)) - (suppress-keymap gnus-dead-summary-mode-map) - (substitute-key-definition - 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map) - (dolist (key '("\C-d" "\r" "\177" [delete])) - (define-key gnus-dead-summary-mode-map - key 'gnus-summary-wake-up-the-dead)) - (dolist (key '("q" "Q")) - (define-key gnus-dead-summary-mode-map key 'bury-buffer))) - -(defvar gnus-dead-summary-mode nil - "Minor mode for Gnus summary buffers.") - -(defun gnus-dead-summary-mode (&optional arg) +(defvar gnus-dead-summary-mode-map + (let ((map (make-keymap))) + (suppress-keymap map) + (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map) + (dolist (key '("\C-d" "\r" "\177" [delete])) + (define-key map key 'gnus-summary-wake-up-the-dead)) + (dolist (key '("q" "Q")) + (define-key map key 'bury-buffer)) + map)) + +(define-minor-mode gnus-dead-summary-mode "Minor mode for Gnus summary buffers." - (interactive "P") - (when (eq major-mode 'gnus-summary-mode) - (make-local-variable 'gnus-dead-summary-mode) - (setq gnus-dead-summary-mode - (if (null arg) (not gnus-dead-summary-mode) - (> (prefix-numeric-value arg) 0))) - (when gnus-dead-summary-mode - (add-minor-mode - 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map)))) + :lighter " Dead" :keymap gnus-dead-summary-mode-map + (unless (derived-mode-p 'gnus-summary-mode) + (setq gnus-dead-summary-mode nil))) (defun gnus-deaden-summary () "Make the current summary buffer into a dead summary buffer." @@ -8194,14 +8184,15 @@ (gnus-summary-position-point)))) (defun gnus-summary-limit-strange-charsets-predicate (header) - (let ((string (concat (mail-header-subject header) - (mail-header-from header))) - charset found) - (dotimes (i (1- (length string))) - (setq charset (format "%s" (char-charset (aref string (1+ i))))) - (when (string-match "unicode\\|big\\|japanese" charset) - (setq found t))) - found)) + (when (fboundp 'char-charset) + (let ((string (concat (mail-header-subject header) + (mail-header-from header))) + charset found) + (dotimes (i (1- (length string))) + (setq charset (format "%s" (char-charset (aref string (1+ i))))) + (when (string-match "unicode\\|big\\|japanese" charset) + (setq found t))) + found))) (defun gnus-summary-limit-to-predicate (predicate) "Limit to articles where PREDICATE returns non-nil. @@ -11517,7 +11508,7 @@ ((> unmark 0) (gnus-summary-mark-article-as-unread gnus-unread-mark)) ((= unmark 0) - (gnus-summary-mark-article-as-unread gnus-expirable-mark)) + (gnus-summary-mark-article nil gnus-expirable-mark)) (t (gnus-summary-mark-article-as-unread gnus-ticked-mark))) (setq articles (cdr articles)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-topic.el --- a/lisp/gnus/gnus-topic.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-topic.el Thu May 13 15:13:52 2010 +0200 @@ -1140,6 +1140,7 @@ (defun gnus-topic-mode (&optional arg redisplay) "Minor mode for topicsifying Gnus group buffers." + ;; FIXME: Use define-minor-mode. (interactive (list current-prefix-arg t)) (when (eq major-mode 'gnus-group-mode) (make-local-variable 'gnus-topic-mode) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-undo.el --- a/lisp/gnus/gnus-undo.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-undo.el Thu May 13 15:13:52 2010 +0200 @@ -45,6 +45,9 @@ ;;; Code: (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' (require 'gnus-util) (require 'gnus) @@ -59,6 +62,10 @@ :group 'gnus-undo) (defcustom gnus-undo-mode nil + ;; FIXME: This is a buffer-local minor mode which requires running + ;; code upon activation/deactivation, so defining it as a defcustom + ;; doesn't seem very useful: setting it to non-nil via Customize + ;; probably won't do the right thing. "Minor mode for undoing in Gnus buffers." :type 'boolean :group 'gnus-undo) @@ -77,17 +84,15 @@ ;;; Minor mode definition. -(defvar gnus-undo-mode-map nil) - -(unless gnus-undo-mode-map - (setq gnus-undo-mode-map (make-sparse-keymap)) - - (gnus-define-keys gnus-undo-mode-map - "\M-\C-_" gnus-undo - "\C-_" gnus-undo - "\C-xu" gnus-undo - ;; many people are used to type `C-/' on X terminals and get `C-_'. - [(control /)] gnus-undo)) +(defvar gnus-undo-mode-map + (let ((map (make-sparse-keymap))) + (gnus-define-keys map + "\M-\C-_" gnus-undo + "\C-_" gnus-undo + "\C-xu" gnus-undo + ;; many people are used to type `C-/' on X terminals and get `C-_'. + [(control /)] gnus-undo) + map)) (defun gnus-undo-make-menu-bar () ;; This is disabled for the time being. @@ -96,24 +101,19 @@ (cons "Undo" 'gnus-undo-actions) [menu-bar file whatever]))) -(defun gnus-undo-mode (&optional arg) +(define-minor-mode gnus-undo-mode "Minor mode for providing `undo' in Gnus buffers. \\{gnus-undo-mode-map}" - (interactive "P") - (set (make-local-variable 'gnus-undo-mode) - (if (null arg) (not gnus-undo-mode) - (> (prefix-numeric-value arg) 0))) + :keymap gnus-undo-mode-map (set (make-local-variable 'gnus-undo-actions) nil) (set (make-local-variable 'gnus-undo-boundary) t) (when gnus-undo-mode ;; Set up the menu. (when (gnus-visual-p 'undo-menu 'menu) (gnus-undo-make-menu-bar)) - (add-minor-mode 'gnus-undo-mode "" gnus-undo-mode-map) (gnus-make-local-hook 'post-command-hook) - (add-hook 'post-command-hook 'gnus-undo-boundary nil t) - (gnus-run-hooks 'gnus-undo-mode-hook))) + (add-hook 'post-command-hook 'gnus-undo-boundary nil t))) ;;; Interface functions. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/gnus-util.el --- a/lisp/gnus/gnus-util.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/gnus-util.el Thu May 13 15:13:52 2010 +0200 @@ -1070,23 +1070,15 @@ ;;; Functions for saving to babyl/mail files. (eval-when-compile - (condition-case nil - (progn - (require 'rmail) - (autoload 'rmail-update-summary "rmailsum")) - (error - (define-compiler-macro rmail-select-summary (&rest body) - ;; Rmail of the XEmacs version is supplied by the package, and - ;; requires tm and apel packages. However, there may be those - ;; who haven't installed those packages. This macro helps such - ;; people even if they install those packages later. - `(eval '(rmail-select-summary ,@body))) - ;; If there's rmail but there's no tm (or there's apel of the - ;; mainstream, not the XEmacs version), loading rmail of the XEmacs - ;; version fails halfway, however it provides the rmail-select-summary - ;; macro which uses the following functions: - (autoload 'rmail-summary-displayed "rmail") - (autoload 'rmail-maybe-display-summary "rmail")))) + (if (featurep 'xemacs) + ;; Don't load tm and apel XEmacs packages that provide some + ;; Emacs emulating functions and variables. + (let ((features features)) + (provide 'tm-view) + (unless (fboundp 'set-alist) (defalias 'set-alist 'ignore)) + (require 'rmail)) ;; It requires tm-view that loads apel. + (require 'rmail)) + (autoload 'rmail-update-summary "rmailsum")) (defvar mm-text-coding-system) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/message.el --- a/lisp/gnus/message.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/message.el Thu May 13 15:13:52 2010 +0200 @@ -5905,6 +5905,7 @@ (if formatter (funcall formatter header value) (insert header-string ": " value)) + (push header-string message-inserted-headers) (goto-char (message-fill-field)) ;; We check whether the value was ended by a ;; newline. If not, we insert one. @@ -7160,22 +7161,28 @@ (defun message-forward-make-body-plain (forward-buffer) (insert "\n-------------------- Start of forwarded message --------------------\n") - (let ((b (point)) e) - (insert - (with-temp-buffer - (mm-disable-multibyte) - (insert - (with-current-buffer forward-buffer - (mm-with-unibyte-current-buffer (buffer-string)))) - (mm-enable-multibyte) - (mime-to-mml) - (goto-char (point-min)) - (when (looking-at "From ") - (replace-match "X-From-Line: ")) - (buffer-string))) + (let ((b (point)) + (contents (with-current-buffer forward-buffer (buffer-string))) + e) + (unless (featurep 'xemacs) + (unless (mm-multibyte-string-p contents) + (error "Attempt to insert unibyte string from the buffer \"%s\"\ + to the multibyte buffer \"%s\"" + (if (bufferp forward-buffer) + (buffer-name forward-buffer) + forward-buffer) + (buffer-name)))) + (insert (mm-with-multibyte-buffer + (insert contents) + (mime-to-mml) + (goto-char (point-min)) + (when (looking-at "From ") + (replace-match "X-From-Line: ")) + (buffer-string))) + (unless (bolp) (insert "\n")) (setq e (point)) (insert - "\n-------------------- End of forwarded message --------------------\n") + "-------------------- End of forwarded message --------------------\n") (message-remove-ignored-headers b e))) (defun message-remove-ignored-headers (b e) @@ -7211,18 +7218,22 @@ (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n") (let ((b (point)) e) (if (not message-forward-decoded-p) - (insert - (with-temp-buffer - (mm-disable-multibyte) - (insert - (with-current-buffer forward-buffer - (mm-with-unibyte-current-buffer (buffer-string)))) - (mm-enable-multibyte) - (mime-to-mml) - (goto-char (point-min)) - (when (looking-at "From ") - (replace-match "X-From-Line: ")) - (buffer-string))) + (let ((contents (with-current-buffer forward-buffer (buffer-string)))) + (unless (featurep 'xemacs) + (unless (mm-multibyte-string-p contents) + (error "Attempt to insert unibyte string from the buffer \"%s\"\ + to the multibyte buffer \"%s\"" + (if (bufferp forward-buffer) + (buffer-name forward-buffer) + forward-buffer) + (buffer-name)))) + (insert (mm-with-multibyte-buffer + (insert contents) + (mime-to-mml) + (goto-char (point-min)) + (when (looking-at "From ") + (replace-match "X-From-Line: ")) + (buffer-string)))) (save-restriction (narrow-to-region (point) (point)) (mml-insert-buffer forward-buffer) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mm-decode.el --- a/lisp/gnus/mm-decode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mm-decode.el Thu May 13 15:13:52 2010 +0200 @@ -1301,12 +1301,13 @@ (mm-write-region (point-min) (point-max) file nil nil nil 'binary t) (set-default-file-modes current-file-modes))))) -(defun mm-pipe-part (handle) - "Pipe HANDLE to a process." - (let* ((name (mail-content-type-get (mm-handle-type handle) 'name)) - (command - (gnus-read-shell-command - "Shell command on MIME part: " mm-last-shell-command))) +(defun mm-pipe-part (handle &optional cmd) + "Pipe HANDLE to a process. +Use CMD as the process." + (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) + (command (or cmd + (gnus-read-shell-command + "Shell command on MIME part: " mm-last-shell-command)))) (mm-with-unibyte-buffer (mm-insert-part handle) (mm-add-meta-html-tag handle) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mm-extern.el --- a/lisp/gnus/mm-extern.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mm-extern.el Thu May 13 15:13:52 2010 +0200 @@ -67,9 +67,8 @@ (coding-system-for-read mm-binary-coding-system)) (unless url (error "URL is not specified")) - (mm-with-unibyte-current-buffer - (mm-url-insert-file-contents url)) (mm-disable-multibyte) + (mm-url-insert-file-contents url) (setq buffer-file-name name))) (defun mm-extern-anon-ftp (handle) @@ -125,7 +124,7 @@ (or access-type (error "Couldn't find access type")))) mm-extern-function-alist))) - buf handles) + handles) (unless func (error "Access type (%s) is not supported" access-type)) (mm-with-part handle @@ -136,8 +135,7 @@ (unless (bufferp (car handles)) (mm-destroy-parts handles) (error "Multipart external body is not supported")) - (save-excursion - (set-buffer (setq buf (mm-handle-buffer handles))) + (with-current-buffer (mm-handle-buffer handles) (let (good) (unwind-protect (progn diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mm-url.el --- a/lisp/gnus/mm-url.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mm-url.el Thu May 13 15:13:52 2010 +0200 @@ -404,14 +404,10 @@ ((= char ? ) "+") ((memq char mm-url-unreserved-chars) (char-to-string char)) (t (upcase (format "%%%02x" char))))) - ;; Fixme: Should this actually be accepting multibyte? Is there a - ;; better way in XEmacs? - (if (featurep 'mule) - (encode-coding-string chunk - (if (fboundp 'find-coding-systems-string) - (car (find-coding-systems-string chunk)) - buffer-file-coding-system)) - chunk) + (mm-encode-coding-string chunk + (if (fboundp 'find-coding-systems-string) + (car (find-coding-systems-string chunk)) + buffer-file-coding-system)) "")) (defun mm-url-encode-www-form-urlencoded (pairs) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mm-util.el --- a/lisp/gnus/mm-util.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mm-util.el Thu May 13 15:13:52 2010 +0200 @@ -902,26 +902,20 @@ out))) (eval-and-compile - (defvar mm-emacs-mule (and (not (featurep 'xemacs)) - (boundp 'enable-multibyte-characters) - (default-value 'enable-multibyte-characters) - (fboundp 'set-buffer-multibyte)) - "True in Emacs with Mule.") - - (if mm-emacs-mule - (defun mm-enable-multibyte () - "Set the multibyte flag of the current buffer. + (if (featurep 'xemacs) + (defalias 'mm-enable-multibyte 'ignore) + (defun mm-enable-multibyte () + "Set the multibyte flag of the current buffer. Only do this if the default value of `enable-multibyte-characters' is non-nil. This is a no-op in XEmacs." - (set-buffer-multibyte 'to)) - (defalias 'mm-enable-multibyte 'ignore)) + (set-buffer-multibyte t))) - (if mm-emacs-mule - (defun mm-disable-multibyte () - "Unset the multibyte flag of in the current buffer. + (if (featurep 'xemacs) + (defalias 'mm-disable-multibyte 'ignore) + (defun mm-disable-multibyte () + "Unset the multibyte flag of in the current buffer. This is a no-op in XEmacs." - (set-buffer-multibyte nil)) - (defalias 'mm-disable-multibyte 'ignore))) + (set-buffer-multibyte nil)))) (defun mm-preferred-coding-system (charset) ;; A typo in some Emacs versions. @@ -1230,28 +1224,23 @@ (defmacro mm-with-unibyte-current-buffer (&rest forms) "Evaluate FORMS with current buffer temporarily made unibyte. -Also bind the default-value of `enable-multibyte-characters' to nil. -Equivalent to `progn' in XEmacs +Equivalent to `progn' in XEmacs. -NOTE: Use this macro with caution in multibyte buffers (it is not -worth using this macro in unibyte buffers of course). Use of -`(set-buffer-multibyte t)', which is run finally, is generally -harmful since it is likely to modify existing data in the buffer. -For instance, it converts \"\\300\\255\" into \"\\255\" in -Emacs 23 (unicode)." - (let ((multibyte (make-symbol "multibyte")) - (buffer (make-symbol "buffer"))) - `(if mm-emacs-mule - (let ((,multibyte enable-multibyte-characters) - (,buffer (current-buffer))) - (unwind-protect - (letf (((default-value 'enable-multibyte-characters) nil)) - (set-buffer-multibyte nil) - ,@forms) - (set-buffer ,buffer) - (set-buffer-multibyte ,multibyte))) - (letf (((default-value 'enable-multibyte-characters) nil)) - ,@forms)))) +Note: We recommend not using this macro any more; there should be +better ways to do a similar thing. The previous version of this macro +bound the default value of `enable-multibyte-characters' to nil while +evaluating FORMS but it is no longer done. So, some programs assuming +it if any may malfunction." + (if (featurep 'xemacs) + `(progn ,@forms) + (let ((multibyte (make-symbol "multibyte"))) + `(let ((,multibyte enable-multibyte-characters)) + (when ,multibyte + (set-buffer-multibyte nil)) + (prog1 + (progn ,@forms) + (when ,multibyte + (set-buffer-multibyte t))))))) (put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0) (put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body)) @@ -1560,7 +1549,7 @@ (error (setq err-msg (error-message-string err))))) (when (file-exists-p err-file) - (ignore-errors (jka-compr-delete-temp-file err-file))) + (ignore-errors (delete-file err-file))) (when inplace (unless err-msg (delete-region (point-min) (point-max)) @@ -1593,8 +1582,8 @@ filename)) (mm-decompress-buffer filename nil t)))) (when decomp - (set-buffer (letf (((default-value 'enable-multibyte-characters) nil)) - (generate-new-buffer " *temp*"))) + (set-buffer (generate-new-buffer " *temp*")) + (mm-disable-multibyte) (insert decomp) (setq filename (file-name-sans-extension filename))) (goto-char (point-min)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mml-sec.el --- a/lisp/gnus/mml-sec.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mml-sec.el Thu May 13 15:13:52 2010 +0200 @@ -308,11 +308,11 @@ (defun mml-secure-message-sign (&optional method) - "Add MML tags to sign this MML part. + "Add MML tags to sign the entire message. Use METHOD if given. Else use `mml-secure-method' or `mml-default-sign-method'." (interactive) - (mml-secure-part + (mml-secure-message (or method mml-secure-method mml-default-sign-method) 'sign)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mml.el --- a/lisp/gnus/mml.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mml.el Thu May 13 15:13:52 2010 +0200 @@ -33,6 +33,9 @@ (require 'mm-decode) (require 'mml-sec) (eval-when-compile (require 'cl)) +(eval-when-compile + (when (featurep 'xemacs) + (require 'easy-mmode))) ; for `define-minor-mode' (autoload 'message-make-message-id "message") (declare-function gnus-setup-posting-charset "gnus-msg" (group)) @@ -520,7 +523,10 @@ ;; `m-g-d-t' will be bound to "message/rfc822" ;; when encoding an article to be forwarded. (mml-generate-default-type "text/plain")) - (mml-to-mime)) + (mml-to-mime) + ;; Update handle so mml-compute-boundary can + ;; detect collisions with the nested parts. + (setcdr (assoc 'contents cont) (buffer-string))) (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) ;; ignore 0x1b, it is part of iso-2022-jp (setq encoding (mm-body-7-or-8)))) @@ -699,7 +705,7 @@ (defun mml-compute-boundary-1 (cont) (let (filename) (cond - ((eq (car cont) 'part) + ((member (car cont) '(part mml)) (with-temp-buffer (cond ((cdr (assq 'buffer cont)) @@ -898,8 +904,7 @@ ;; Determine type and stuff. (unless (stringp (car handle)) (unless (setq textp (equal (mm-handle-media-supertype handle) "text")) - (save-excursion - (set-buffer (setq buffer (mml-generate-new-buffer " *mml*"))) + (with-current-buffer (setq buffer (mml-generate-new-buffer " *mml*")) (if (eq (mail-content-type-get (mm-handle-type handle) 'charset) 'gnus-decoded) ;; A part that mm-uu dissected from a non-MIME message @@ -1126,25 +1131,18 @@ ,@(if (featurep 'xemacs) '(t) '(:help "Display the EasyPG manual"))])) -(defvar mml-mode nil - "Minor mode for editing MML.") - -(defun mml-mode (&optional arg) +(define-minor-mode mml-mode "Minor mode for editing MML. MML is the MIME Meta Language, a minor mode for composing MIME articles. See Info node `(emacs-mime)Composing'. \\{mml-mode-map}" - (interactive "P") - (when (set (make-local-variable 'mml-mode) - (if (null arg) (not mml-mode) - (> (prefix-numeric-value arg) 0))) - (add-minor-mode 'mml-mode " MML" mml-mode-map) + :lighter " MML" :keymap mml-mode-map + (when mml-mode (easy-menu-add mml-menu mml-mode-map) (when (boundp 'dnd-protocol-alist) (set (make-local-variable 'dnd-protocol-alist) - (append mml-dnd-protocol-alist dnd-protocol-alist))) - (run-hooks 'mml-mode-hook))) + (append mml-dnd-protocol-alist dnd-protocol-alist))))) ;;; ;;; Helper functions for reading MIME stuff from the minibuffer and diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/mml2015.el --- a/lisp/gnus/mml2015.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/mml2015.el Thu May 13 15:13:52 2010 +0200 @@ -1021,6 +1021,7 @@ (let ((pointer (epg-key-sub-key-list (car keys)))) (while pointer (if (and (memq usage (epg-sub-key-capability (car pointer))) + (not (memq 'disabled (epg-sub-key-capability (car pointer)))) (not (memq (epg-sub-key-validity (car pointer)) '(revoked expired)))) (throw 'found (car keys))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/nnir.el --- a/lisp/gnus/nnir.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/nnir.el Thu May 13 15:13:52 2010 +0200 @@ -52,7 +52,7 @@ ;; The most recent version of this can always be fetched from the Gnus -;; CVS repository. See http://www.gnus.org/ for more information. +;; repository. See http://www.gnus.org/ for more information. ;; This code is still in the development stage but I'd like other ;; people to have a look at it. Please do not hesitate to contact me diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/nnrss.el --- a/lisp/gnus/nnrss.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/nnrss.el Thu May 13 15:13:52 2010 +0200 @@ -427,7 +427,7 @@ (defun nnrss-fetch (url &optional local) "Fetch URL and put it in a the expected Lisp structure." (mm-with-unibyte-buffer - ;;some CVS versions of url.el need this to close the connection quickly + ;;some versions of url.el need this to close the connection quickly (let (cs xmlform htmlform) ;; bit o' work necessary for w3 pre-cvs and post-cvs (if local diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/nnweb.el --- a/lisp/gnus/nnweb.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/nnweb.el Thu May 13 15:13:52 2010 +0200 @@ -525,7 +525,7 @@ ;;("TOPDOC" . "1000") )))) (setq buffer-file-name nil) - (set-buffer-multibyte t) + (unless (featurep 'xemacs) (set-buffer-multibyte t)) (mm-decode-coding-region (point-min) (point-max) 'utf-8) t) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/sieve-manage.el --- a/lisp/gnus/sieve-manage.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/sieve-manage.el Thu May 13 15:13:52 2010 +0200 @@ -191,10 +191,10 @@ ;; Internal utility functions -(defsubst sieve-manage-disable-multibyte () +(defmacro sieve-manage-disable-multibyte () "Enable multibyte in the current buffer." - (when (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte nil))) + (unless (featurep 'xemacs) + '(set-buffer-multibyte nil))) (declare-function password-read "password-cache" (prompt &optional key)) (declare-function password-cache-add "password-cache" (key password)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/smime.el --- a/lisp/gnus/smime.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/smime.el Thu May 13 15:13:52 2010 +0200 @@ -42,7 +42,7 @@ ;; done on messages encoded in these formats. The terminology chosen ;; reflect this. ;; -;; The home of this file is in Gnus CVS, but also available from +;; The home of this file is in Gnus, but also available from ;; http://josefsson.org/smime.html. ;;; Quick introduction: diff -r e56f669f17ce -r fe07c47cf7a7 lisp/gnus/yenc.el --- a/lisp/gnus/yenc.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/gnus/yenc.el Thu May 13 15:13:52 2010 +0200 @@ -89,8 +89,9 @@ (when (re-search-forward "^=yend.*$" end t) (setq last (match-beginning 0)) (setq footer-alist (yenc-parse-line (match-string 0))) - (letf (((default-value 'enable-multibyte-characters) nil)) - (setq work-buffer (generate-new-buffer " *yenc-work*"))) + (setq work-buffer (generate-new-buffer " *yenc-work*")) + (unless (featurep 'xemacs) + (with-current-buffer work-buffer (set-buffer-multibyte nil))) (while (< first last) (setq char (char-after first)) (cond ((or (eq char ?\r) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/help.el --- a/lisp/help.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/help.el Thu May 13 15:13:52 2010 +0200 @@ -1048,10 +1048,9 @@ Select WINDOW according to the value of `help-window-select'. Display message telling how to scroll and eventually quit WINDOW. -Optional argument REUSE non-nil means WINDOW has been reused \(by -`display-buffer'\) for displaying help. Optional argument -KEEP-FRAME non-nil means that quitting must no delete the frame -of WINDOW." +Optional argument REUSE non-nil means WINDOW has been reused by +`display-buffer'. Optional argument KEEP-FRAME non-nil means +that quitting should not delete WINDOW's frame." (let ((number-of-windows (length (window-list (window-frame window) 'no-mini window)))) (cond diff -r e56f669f17ce -r fe07c47cf7a7 lisp/hfy-cmap.el --- a/lisp/hfy-cmap.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/hfy-cmap.el Thu May 13 15:13:52 2010 +0200 @@ -803,6 +803,7 @@ (defconst hfy-rgb-regex "^\\s-*\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\(.+\\)\\s-*$") +;;;###autoload (defun htmlfontify-load-rgb-file (&optional file) "Load an X11 style rgb.txt FILE. Search `hfy-rgb-load-path' if FILE is not specified. @@ -832,14 +833,21 @@ (kill-buffer rgb-buffer))))) (defun htmlfontify-unload-rgb-file () + "Unload the current color name -> rgb translation map." (interactive) (setq hfy-rgb-txt-colour-map nil)) +;;;###autoload (defun hfy-fallback-colour-values (colour-string) + "Use a fallback method for obtaining the rgb values for a color." (cdr (assoc-string colour-string (or hfy-rgb-txt-colour-map hfy-fallback-colour-map))) ) (provide 'hfy-cmap) -;;; hfy-cmap.el ends here + +;; Local Variables: +;; generated-autoload-file: "htmlfontify.el" +;; End: ;; arch-tag: dff7feea-add4-48ba-937c-e79ac40cec9b +;;; hfy-cmap.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/htmlfontify.el --- a/lisp/htmlfontify.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/htmlfontify.el Thu May 13 15:13:52 2010 +0200 @@ -90,39 +90,6 @@ ;; (`font-lock-fontify-region') (require 'cus-edit) -(eval-and-compile - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; I want these - can't be bothered requiring all of cl though. - (if (not (fboundp 'caddr)) - (defun caddr (list) - "Return the `car' of the `cddr' of LIST." - (car (cddr list)))) - - (if (not (fboundp 'cadddr)) - (defun cadddr (list) - "Return the `cadr' of the `cddr' of LIST." - (cadr (cddr list)))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - (autoload - 'htmlfontify-load-rgb-file - "hfy-cmap" - "Load an rgb.txt file for color name -> rgb translation purposes." - 'interactive) - - (autoload - 'htmlfontify-unload-rgb-file - "hfy-cmap" - "Unload the current color name -> rgb translation map." - 'interactive) - - (autoload - 'hfy-fallback-colour-values - "hfy-cmap" - "Use a fallback method for obtaining the rgb values for a color." - 'interactive) - ) - (defconst htmlfontify-version 0.21) (defconst hfy-meta-tags @@ -1790,6 +1757,7 @@ (when font-lock-defaults (font-lock-fontify-buffer)) )) +;;;###autoload (defun htmlfontify-buffer (&optional srcdir file) "Create a new buffer, named for the current buffer + a .html extension, containing an inline CSS-stylesheet and formatted CSS-markup HTML @@ -2276,6 +2244,7 @@ (save-buffer) (kill-buffer B))) +;;;###autoload (defun htmlfontify-copy-and-link-dir (srcdir dstdir &optional f-ext l-ext) "Trawl SRCDIR and write fontified-and-hyperlinked output in DSTDIR. F-EXT and L-EXT specify values for `hfy-extn' and `hfy-link-extn'.\n @@ -2366,7 +2335,28 @@ (let ((file (hfy-initfile))) (load file 'NOERROR nil nil) )) + +;;;### (autoloads (hfy-fallback-colour-values htmlfontify-load-rgb-file) +;;;;;; "hfy-cmap" "hfy-cmap.el" "3de2db2d213813bb3afe170ffd66cdde") +;;; Generated autoloads from hfy-cmap.el + +(autoload 'htmlfontify-load-rgb-file "hfy-cmap" "\ +Load an X11 style rgb.txt FILE. +Search `hfy-rgb-load-path' if FILE is not specified. +Loads the variable `hfy-rgb-txt-colour-map', which is used by +`hfy-fallback-colour-values'. + +\(fn &optional FILE)" t nil) + +(autoload 'hfy-fallback-colour-values "hfy-cmap" "\ +Use a fallback method for obtaining the rgb values for a color. + +\(fn COLOUR-STRING)" nil nil) + +;;;*** + + (provide 'htmlfontify) -;;; htmlfontify.el ends here ;; arch-tag: 944e5e63-c81d-4baa-a82a-0275f9c30e61 +;;; htmlfontify.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ibuf-ext.el --- a/lisp/ibuf-ext.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ibuf-ext.el Thu May 13 15:13:52 2010 +0200 @@ -91,11 +91,6 @@ (defvar ibuffer-tmp-show-regexps nil "A list of regexps which should match buffer names to always show.") -(defvar ibuffer-auto-mode nil - "If non-nil, Ibuffer auto-mode should be enabled for this buffer. -Do not set this variable directly! Use the function -`ibuffer-auto-mode' instead.") - (defvar ibuffer-auto-buffers-changed nil) (defcustom ibuffer-saved-filters '(("gnus" @@ -220,6 +215,16 @@ (ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers) (ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates))))) +;;;###autoload +(define-minor-mode ibuffer-auto-mode + "Toggle use of Ibuffer's auto-update facility. +With numeric ARG, enable auto-update if and only if ARG is positive." + nil nil nil + (unless (derived-mode-p 'ibuffer-mode) + (error "This buffer is not in Ibuffer mode")) + (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector + (add-hook 'post-command-hook 'ibuffer-auto-update-changed)) + (defun ibuffer-auto-update-changed () (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) (dolist (buf (buffer-list)) @@ -230,20 +235,6 @@ (ibuffer-update nil t))))))) ;;;###autoload -(defun ibuffer-auto-mode (&optional arg) - "Toggle use of Ibuffer's auto-update facility. -With numeric ARG, enable auto-update if and only if ARG is positive." - (interactive) - (unless (derived-mode-p 'ibuffer-mode) - (error "This buffer is not in Ibuffer mode")) - (set (make-local-variable 'ibuffer-auto-mode) - (if arg - (plusp arg) - (not ibuffer-auto-mode))) - (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector - (add-hook 'post-command-hook 'ibuffer-auto-update-changed)) - -;;;###autoload (defun ibuffer-mouse-filter-by-mode (event) "Enable or disable filtering by the major mode chosen via mouse." (interactive "e") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ibuffer.el --- a/lisp/ibuffer.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ibuffer.el Thu May 13 15:13:52 2010 +0200 @@ -2641,7 +2641,7 @@ ;;;;;; ibuffer-backward-filter-group ibuffer-forward-filter-group ;;;;;; ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group ;;;;;; ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode -;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "4fb4f1a32cf4ecf4669a133a866f4a14") +;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "e1272bfdc7c3b6e926b2a68155217303") ;;; Generated autoloads from ibuf-ext.el (autoload 'ibuffer-auto-mode "ibuf-ext" "\ diff -r e56f669f17ce -r fe07c47cf7a7 lisp/icomplete.el --- a/lisp/icomplete.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/icomplete.el Thu May 13 15:13:52 2010 +0200 @@ -283,7 +283,8 @@ matches exist. \(Keybindings for uniquely matched commands are exhibited within the square braces.)" - (let* ((comps (completion-all-sorted-completions)) + (let* ((non-essential t) + (comps (completion-all-sorted-completions)) (last (if (consp comps) (last comps))) (base-size (cdr last)) (open-bracket (if require-match "(" "[")) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/ido.el --- a/lisp/ido.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/ido.el Thu May 13 15:13:52 2010 +0200 @@ -322,7 +322,6 @@ ;;; Code: -(defvar cua-inhibit-cua-keys) (defvar recentf-list) ;;; User Variables @@ -1624,7 +1623,6 @@ (define-key map "\C-o" 'ido-copy-current-word) (define-key map "\C-w" 'ido-copy-current-file-name) (define-key map [(meta ?l)] 'ido-toggle-literal) - (define-key map "\C-v" 'ido-toggle-vc) (set-keymap-parent map ido-file-dir-completion-map) (setq ido-file-completion-map map)) @@ -1633,6 +1631,7 @@ (define-key map "\C-x\C-f" 'ido-enter-find-file) (define-key map "\C-x\C-b" 'ido-fallback-command) (define-key map "\C-k" 'ido-kill-buffer-at-head) + (define-key map "\C-o" 'ido-toggle-virtual-buffers) (set-keymap-parent map ido-common-completion-map) (setq ido-buffer-completion-map map))) @@ -2182,6 +2181,9 @@ (ido-current-directory nil) (ido-directory-nonreadable nil) (ido-directory-too-big nil) + (ido-use-virtual-buffers (if (eq method 'kill) + nil ;; Don't consider virtual buffers for killing + ido-use-virtual-buffers)) (require-match (confirm-nonexistent-file-or-buffer)) (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default require-match initial)) @@ -2312,7 +2314,8 @@ (or ido-use-url-at-point ido-use-filename-at-point)) (let (fn d) (require 'ffap) - ;; Duplicate code from ffap-guesser as we want different behavior for files and URLs. + ;; Duplicate code from ffap-guesser as we want different + ;; behavior for files and URLs. (cond ((with-no-warnings (and ido-use-url-at-point @@ -2328,7 +2331,10 @@ (ffap-guesser) (ffap-string-at-point)))) (not (string-match "^http:/" fn)) - (setq d (file-name-directory (expand-file-name fn))) + (let ((absolute-fn (expand-file-name fn))) + (setq d (if (file-directory-p absolute-fn) + (file-name-as-directory absolute-fn) + (file-name-directory absolute-fn)))) (file-directory-p d)) (setq ido-current-directory d) (setq initial (file-name-nondirectory fn)))))) @@ -2701,6 +2707,16 @@ (setq ido-exit 'keep) (exit-minibuffer)))) +(defun ido-toggle-virtual-buffers () + "Toggle the use of virtual buffers. +See `ido-use-virtual-buffers' for explanation of virtual buffer." + (interactive) + (when (and ido-mode (eq ido-cur-item 'buffer)) + (setq ido-use-virtual-buffers (not ido-use-virtual-buffers)) + (setq ido-text-init ido-text) + (setq ido-exit 'refresh) + (exit-minibuffer))) + (defun ido-reread-directory () "Read current directory again. May be useful if cached version is no longer valid, but directory @@ -4591,7 +4607,6 @@ (when (ido-active) (add-hook 'pre-command-hook 'ido-tidy nil t) (add-hook 'post-command-hook 'ido-exhibit nil t) - (setq cua-inhibit-cua-keys t) (when (featurep 'xemacs) (ido-exhibit) (goto-char (point-min))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/iimage.el --- a/lisp/iimage.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/iimage.el Thu May 13 15:13:52 2010 +0200 @@ -55,19 +55,17 @@ :group 'image) (defconst iimage-version "1.1") -(defvar iimage-mode nil) -(defvar iimage-mode-map nil) -;; Set up key map. -(unless iimage-mode-map - (setq iimage-mode-map (make-sparse-keymap)) - (define-key iimage-mode-map "\C-l" 'iimage-recenter)) +(defvar iimage-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-l" 'iimage-recenter) + map)) (defun iimage-recenter (&optional arg) -"Re-draw images and recenter." + "Re-draw images and recenter." (interactive "P") - (iimage-mode-buffer 0) - (iimage-mode-buffer 1) + (iimage-mode-buffer nil) + (iimage-mode-buffer t) (recenter arg)) (defvar iimage-mode-image-filename-regex @@ -81,7 +79,7 @@ `((,(concat "\\(`?file://\\|\\[\\[\\|<\\|`\\)?" "\\(" iimage-mode-image-filename-regex "\\)" "\\(\\]\\]\\|>\\|'\\)?") . 2)) -"*Alist of filename REGEXP vs NUM. + "*Alist of filename REGEXP vs NUM. Each element looks like (REGEXP . NUM). NUM specifies which parenthesized expression in the regexp. @@ -90,54 +88,43 @@ `file://foo.png' \\[\\[foo.gif]] - foo.JPG -") + foo.JPG") (defvar iimage-mode-image-search-path nil -"*List of directories to search for image files for iimage-mode.") + "*List of directories to search for image files for `iimage-mode'.") ;;;###autoload -(defun turn-on-iimage-mode () -"Unconditionally turn on iimage mode." - (interactive) - (iimage-mode 1)) +(define-obsolete-function-alias 'turn-on-iimage-mode 'iimage-mode "24.1") (defun turn-off-iimage-mode () -"Unconditionally turn off iimage mode." + "Unconditionally turn off iimage mode." (interactive) (iimage-mode 0)) -(defalias 'iimage-locate-file 'locate-file) - (defun iimage-mode-buffer (arg) -"Display/undisplay images. -With numeric ARG, display the images if and only if ARG is positive." - (interactive) - (let ((ing (if (numberp arg) - (> arg 0) - iimage-mode)) - (modp (buffer-modified-p (current-buffer))) - file buffer-read-only) - (save-excursion - (goto-char (point-min)) - (dolist (pair iimage-mode-image-regex-alist) - (while (re-search-forward (car pair) nil t) - (if (and (setq file (match-string (cdr pair))) - (setq file (iimage-locate-file file - (cons default-directory - iimage-mode-image-search-path)))) - (if ing - (add-text-properties (match-beginning 0) (match-end 0) - (list 'display (create-image file))) - (remove-text-properties (match-beginning 0) (match-end 0) - '(display))))))) - (set-buffer-modified-p modp))) + "Display images if ARG is non-nil, undisplay them otherwise." + (let ((image-path (cons default-directory iimage-mode-image-search-path)) + file) + (with-silent-modifications + (save-excursion + (goto-char (point-min)) + (dolist (pair iimage-mode-image-regex-alist) + (while (re-search-forward (car pair) nil t) + (if (and (setq file (match-string (cdr pair))) + (setq file (locate-file file image-path))) + ;; FIXME: we don't mark our images, so we can't reliably + ;; remove them either (we may leave some of ours, and we + ;; may remove other packages's display properties). + (if arg + (add-text-properties (match-beginning 0) (match-end 0) + (list 'display (create-image file))) + (remove-text-properties (match-beginning 0) (match-end 0) + '(display)))))))))) ;;;###autoload (define-minor-mode iimage-mode "Toggle inline image minor mode." :group 'iimage :lighter " iImg" :keymap iimage-mode-map - (run-hooks 'iimage-mode-hook) (iimage-mode-buffer iimage-mode)) (provide 'iimage) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/image-mode.el --- a/lisp/image-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/image-mode.el Thu May 13 15:13:52 2010 +0200 @@ -392,7 +392,7 @@ to display an image file as the actual image. You can use `image-mode-as-text' in `auto-mode-alist' when you want -to display an image file as text inititally. +to display an image file as text initially. See commands `image-mode' and `image-minor-mode' for more information on these modes." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/image.el --- a/lisp/image.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/image.el Thu May 13 15:13:52 2010 +0200 @@ -692,10 +692,10 @@ (defconst imagemagick-types-inhibit '(C HTML HTM TXT) - "Types the imagemagic loader should not try to handle.") + "Types the imagemagick loader should not try to handle.") ;;;###autoload -(defun imagemagic-register-types () +(defun imagemagick-register-types () "Register file types that imagemagick is able to handle." (let ((im-types (imagemagick-types)) (im-inhibit imagemagick-types-inhibit)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/info.el --- a/lisp/info.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/info.el Thu May 13 15:13:52 2010 +0200 @@ -266,6 +266,8 @@ :group 'info) (defvar Info-isearch-initial-node nil) +(defvar Info-isearch-initial-history nil) +(defvar Info-isearch-initial-history-list nil) (defcustom Info-mode-hook ;; Try to obey obsolete Info-fontify settings. @@ -1053,8 +1055,8 @@ (Info-select-node) (goto-char (point-min)) (forward-line 1) ; skip header line - (when (> Info-breadcrumbs-depth 0) ; skip breadcrumbs line - (forward-line 1)) + ;; (when (> Info-breadcrumbs-depth 0) ; skip breadcrumbs line + ;; (forward-line 1)) (cond (anchorpos (let ((new-history (list Info-current-file @@ -1914,7 +1916,27 @@ (setq Info-isearch-initial-node ;; Don't stop at initial node for nonincremental search. ;; Otherwise this variable is set after first search failure. - (and isearch-nonincremental Info-current-node))) + (and isearch-nonincremental Info-current-node)) + (setq Info-isearch-initial-history Info-history + Info-isearch-initial-history-list Info-history-list) + (add-hook 'isearch-mode-end-hook 'Info-isearch-end nil t)) + +(defun Info-isearch-end () + ;; Remove intermediate nodes (visited while searching) + ;; from the history. Add only the last node (where Isearch ended). + (if (> (length Info-history) + (length Info-isearch-initial-history)) + (setq Info-history + (nthcdr (- (length Info-history) + (length Info-isearch-initial-history) + 1) + Info-history))) + (if (> (length Info-history-list) + (length Info-isearch-initial-history-list)) + (setq Info-history-list + (cons (car Info-history-list) + Info-isearch-initial-history-list))) + (remove-hook 'isearch-mode-end-hook 'Info-isearch-end t)) (defun Info-isearch-filter (beg-found found) "Test whether the current search hit is a visible useful text. @@ -3104,6 +3126,7 @@ (add-to-list 'Info-virtual-nodes '("\\`\\*Index.*\\*\\'" (find-node . Info-virtual-index-find-node) + (slow . t) )) (defvar Info-virtual-index-nodes nil @@ -3193,6 +3216,7 @@ (toc-nodes . Info-apropos-toc-nodes) (find-file . Info-apropos-find-file) (find-node . Info-apropos-find-node) + (slow . t) )) (defvar Info-apropos-file "*Apropos*" @@ -3348,6 +3372,7 @@ (defun Info-finder-find-node (filename nodename &optional no-going-back) "Finder-specific implementation of Info-find-node-2." + (require 'finder) (cond ((equal nodename "Top") ;; Display Top menu with descriptions of the keywords @@ -3602,6 +3627,19 @@ ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)")) (Info-goto-node node fork))) node)) + +(defun Info-mouse-follow-link (click) + "Follow a link where you click." + (interactive "e") + (let* ((position (event-start click)) + (posn-string (and position (posn-string position))) + (string (car-safe posn-string)) + (string-pos (cdr-safe posn-string)) + (link-args (and string string-pos + (get-text-property string-pos 'link-args string)))) + (when link-args + (Info-goto-node link-args)))) + (defvar Info-mode-map (let ((map (make-keymap))) @@ -3723,9 +3761,11 @@ (defvar info-tool-bar-map (let ((map (make-sparse-keymap))) (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map - :rtl "right-arrow") + :rtl "right-arrow" + :label "Back") (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map - :rtl "left-arrow") + :rtl "left-arrow" + :label "Forward") (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map :rtl "next-node") (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map @@ -3733,7 +3773,8 @@ (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map) (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map) (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map) - (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map) + (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map + :label "Index Search") (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map) (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map) map)) @@ -4183,11 +4224,22 @@ keymap) "Keymap to put on the Up link in the text or the header line.") -(defun Info-insert-breadcrumbs () +(defvar Info-link-keymap + (let ((keymap (make-sparse-keymap))) + (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link) + (define-key keymap [header-line mouse-2] 'Info-mouse-follow-link) + (define-key keymap [header-line down-mouse-1] 'ignore) + (define-key keymap [mouse-2] 'Info-mouse-follow-link) + (define-key keymap [follow-link] 'mouse-face) + keymap) + "Keymap to put on the link in the text or the header line.") + +(defun Info-breadcrumbs () (let ((nodes (Info-toc-nodes Info-current-file)) (node Info-current-node) (crumbs ()) - (depth Info-breadcrumbs-depth)) + (depth Info-breadcrumbs-depth) + line) ;; Get ancestors from the cached parent-children node info (while (and (not (equal "Top" node)) (> depth 0)) @@ -4214,15 +4266,25 @@ (file-name-nondirectory Info-current-file) ;; Some legacy code can still use a symbol. Info-current-file))))) - (insert (if (bolp) "" " > ") - (cond - ((null node) "...") - ((equal node Info-current-node) - ;; No point linking to ourselves. - (propertize text 'font-lock-face 'info-header-node)) - (t - (concat "*Note " text "::")))))) - (insert "\n")))) + (setq line (concat + line + (if (null line) "" " > ") + (cond + ((null node) "...") + ((equal node Info-current-node) + ;; No point linking to ourselves. + (propertize text 'font-lock-face 'info-header-node)) + (t + (propertize text + 'mouse-face 'highlight + 'font-lock-face 'info-header-xref + 'help-echo "mouse-2: Go to node" + 'keymap Info-link-keymap + 'link-args text))))))) + (setq line (concat line "\n"))) + ;; (font-lock-append-text-property 0 (length line) + ;; 'font-lock-face 'header-line line) + line)) (defun Info-fontify-node () "Fontify the node." @@ -4269,8 +4331,8 @@ ((string-equal (downcase tag) "next") Info-next-link-keymap) ((string-equal (downcase tag) "up" ) Info-up-link-keymap)))))) - (when (> Info-breadcrumbs-depth 0) - (Info-insert-breadcrumbs)) + ;; (when (> Info-breadcrumbs-depth 0) + ;; (insert (Info-breadcrumbs))) ;; Treat header line. (when Info-use-header-line @@ -4302,7 +4364,9 @@ ;; that is in the header, if it is just part. (cond ((> Info-breadcrumbs-depth 0) - (put-text-property (point-min) (1+ header-end) 'invisible t)) + (let ((ov (make-overlay (point-min) (1+ header-end)))) + (overlay-put ov 'display (Info-breadcrumbs)) + (overlay-put ov 'evaporate t))) ((not (bobp)) ;; Hide the punctuation at the end, too. (skip-chars-backward " \t,") @@ -4796,21 +4860,35 @@ (defun Info-desktop-buffer-misc-data (desktop-dirname) "Auxiliary information to be saved in desktop file." - (unless (Info-virtual-file-p Info-current-file) - (list Info-current-file Info-current-node))) + (list Info-current-file + Info-current-node + ;; Additional data as an association list. + (delq nil (list + (and Info-history + (cons 'history Info-history)) + (and (Info-virtual-fun + 'slow Info-current-file Info-current-node) + (cons 'slow t)))))) (defun Info-restore-desktop-buffer (desktop-buffer-file-name desktop-buffer-name desktop-buffer-misc) "Restore an Info buffer specified in a desktop file." - (let ((first (nth 0 desktop-buffer-misc)) - (second (nth 1 desktop-buffer-misc))) - (when (and first second) - (when desktop-buffer-name - (set-buffer (get-buffer-create desktop-buffer-name)) - (Info-mode)) - (Info-find-node first second) - (current-buffer)))) + (let* ((file (nth 0 desktop-buffer-misc)) + (node (nth 1 desktop-buffer-misc)) + (data (nth 2 desktop-buffer-misc)) + (hist (assq 'history data)) + (slow (assq 'slow data))) + ;; Don't restore nodes slow to regenerate. + (unless slow + (when (and file node) + (when desktop-buffer-name + (set-buffer (get-buffer-create desktop-buffer-name)) + (Info-mode)) + (Info-find-node file node) + (when hist + (setq Info-history (cdr hist))) + (current-buffer))))) (add-to-list 'desktop-buffer-mode-handlers '(Info-mode . Info-restore-desktop-buffer)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/international/iso-ascii.el --- a/lisp/international/iso-ascii.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/international/iso-ascii.el Thu May 13 15:13:52 2010 +0200 @@ -33,6 +33,7 @@ ;;; Code: (require 'disp-table) +(eval-when-compile (require 'cl)) (defgroup iso-ascii nil "Set up char tables for ISO 8859/1 on ASCII terminals." @@ -162,15 +163,11 @@ (iso-ascii-display 254 "th") ; small thorn, Icelandic (iso-ascii-display 255 "\"y") ; small y with diaeresis or umlaut mark -(defun iso-ascii-mode (arg) +(define-minor-mode iso-ascii-mode "Toggle ISO-ASCII mode." - (interactive "P") - (unless arg - (setq arg (eq standard-display-table iso-ascii-standard-display-table))) - (setq standard-display-table - (if arg - iso-ascii-display-table - iso-ascii-standard-display-table))) + :variable (eq standard-display-table iso-ascii-display-table) + (unless standard-display-table + (setq standard-display-table iso-ascii-standard-display-table))) (provide 'iso-ascii) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/international/mule-cmds.el --- a/lisp/international/mule-cmds.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/international/mule-cmds.el Thu May 13 15:13:52 2010 +0200 @@ -286,8 +286,7 @@ "Display the HELLO file, which lists many languages and characters." (interactive) ;; We have to decode the file in any environment. - (letf (((default-value 'enable-multibyte-characters) t) - (coding-system-for-read 'iso-2022-7bit)) + (letf ((coding-system-for-read 'iso-2022-7bit)) (view-file (expand-file-name "HELLO" data-directory)))) (defun universal-coding-system-argument (coding-system) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/international/mule.el --- a/lisp/international/mule.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/international/mule.el Thu May 13 15:13:52 2010 +0200 @@ -1165,6 +1165,64 @@ (make-variable-buffer-local 'buffer-file-coding-system-explicit) (put 'buffer-file-coding-system-explicit 'permanent-local t) +(defun read-buffer-file-coding-system () + (let* ((bcss (find-coding-systems-region (point-min) (point-max))) + (css-table + (unless (equal bcss '(undecided)) + (append '("dos" "unix" "mac") + (delq nil (mapcar (lambda (cs) + (if (memq (coding-system-base cs) bcss) + (symbol-name cs))) + coding-system-list))))) + (combined-table + (if css-table + (completion-table-in-turn css-table coding-system-alist) + coding-system-alist)) + (auto-cs + (unless find-file-literally + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (funcall set-auto-coding-function + (or buffer-file-name "") (buffer-size)))))) + (preferred + (let ((bfcs (default-value 'buffer-file-coding-system))) + (cons (and (or (equal bcss '(undecided)) + (memq (coding-system-base bfcs) bcss)) + bfcs) + (mapcar (lambda (cs) + (and (coding-system-p cs) + (coding-system-get cs :mime-charset) + (or (equal bcss '(undecided)) + (memq (coding-system-base cs) bcss)) + cs)) + (coding-system-priority-list))))) + (default + (let ((current (coding-system-base buffer-file-coding-system))) + ;; Generally use as a default the first preferred coding-system + ;; different from the current coding-system, except for + ;; the case of auto-cs since choosing anything else is asking + ;; for trouble (would lead to using a different coding + ;; system than specified in the coding tag). + (or auto-cs + (car (delq nil + (mapcar (lambda (cs) + (if (eq current (coding-system-base cs)) + nil + cs)) + preferred)))))) + (completion-ignore-case t) + (completion-pcm--delim-wild-regex ; Let "u8" complete to "utf-8". + (concat completion-pcm--delim-wild-regex + "\\|\\([[:alpha:]]\\)[[:digit:]]")) + (cs (completing-read + (format "Coding system for saving file (default %s): " default) + combined-table + nil t nil 'coding-system-history + (if default (symbol-name default))))) + (unless (zerop (length cs)) (intern cs)))) + (defun set-buffer-file-coding-system (coding-system &optional force nomodify) "Set the file coding-system of the current buffer to CODING-SYSTEM. This means that when you save the buffer, it will be converted @@ -1182,19 +1240,26 @@ don't want to mark the buffer modified, specify t for NOMODIFY. If you know exactly what coding system you want to use, just set the variable `buffer-file-coding-system' directly." - (interactive "zCoding system for saving file (default nil): \nP") + (interactive + (list (read-buffer-file-coding-system) + current-prefix-arg)) (check-coding-system coding-system) (if (and coding-system buffer-file-coding-system (null force)) (setq coding-system (merge-coding-systems coding-system buffer-file-coding-system))) + (when (called-interactively-p 'interactive) + ;; Check whether save would succeed, and jump to the offending char(s) + ;; if not. + (let ((css (find-coding-systems-region (point-min) (point-max)))) + (unless (or (eq (car css) 'undecided) + (memq (coding-system-base coding-system) css)) + (setq coding-system (select-safe-coding-system-interactively + (point-min) (point-max) css + (list coding-system)))))) (setq buffer-file-coding-system coding-system) (if buffer-file-coding-system-explicit (setcdr buffer-file-coding-system-explicit coding-system) (setq buffer-file-coding-system-explicit (cons nil coding-system))) - ;; This is in case of an explicit call. Normally, `normal-mode' and - ;; `set-buffer-major-mode-hook' take care of setting the table. - (if (fboundp 'ucs-set-table-for-input) ; don't lose when building - (ucs-set-table-for-input)) (unless nomodify (set-buffer-modified-p t)) (force-mode-line-update)) @@ -1625,9 +1690,10 @@ (defcustom auto-coding-alist ;; .exe and .EXE are added to support archive-mode looking at DOS ;; self-extracting exe archives. - (purecopy '(("\\.\\(\ -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\ -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" + (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg))) + '(("\\.\\(\ +arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\ +ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . no-conversion-multibyte) ("\\.\\(exe\\|EXE\\)\\'" . no-conversion) ("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/isearch.el --- a/lisp/isearch.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/isearch.el Thu May 13 15:13:52 2010 +0200 @@ -1708,9 +1708,10 @@ ;; attempts this, we scroll the text back again. ;; ;; We implement this feature with a property called `isearch-scroll'. -;; If a command's symbol has the value t for this property it is a -;; scrolling command. The feature needs to be enabled by setting the -;; customizable variable `isearch-allow-scroll' to a non-nil value. +;; If a command's symbol has the value t for this property or for the +;; `scroll-command' property, it is a scrolling command. The feature +;; needs to be enabled by setting the customizable variable +;; `isearch-allow-scroll' to a non-nil value. ;; ;; The universal argument commands (e.g. C-u) in simple.el are marked ;; as scrolling commands, and isearch.el has been amended to allow @@ -1727,12 +1728,11 @@ (if (fboundp 'w32-handle-scroll-bar-event) (put 'w32-handle-scroll-bar-event 'isearch-scroll t)) -;; Commands which scroll the window: +;; Commands which scroll the window (some scroll commands +;; already have the `scroll-command' property on them): (put 'recenter 'isearch-scroll t) (put 'recenter-top-bottom 'isearch-scroll t) (put 'reposition-window 'isearch-scroll t) -(put 'scroll-up 'isearch-scroll t) -(put 'scroll-down 'isearch-scroll t) ;; Commands which act on the other window (put 'list-buffers 'isearch-scroll t) @@ -1757,7 +1757,7 @@ "Whether scrolling is allowed during incremental search. If non-nil, scrolling commands can be used in Isearch mode. However, the current match will never scroll offscreen. -If nil, scolling commands will first cancel Isearch mode." +If nil, scrolling commands will first cancel Isearch mode." :type 'boolean :group 'isearch) @@ -1821,7 +1821,8 @@ (let* ((overriding-terminal-local-map nil) (binding (key-binding key-seq))) (and binding (symbolp binding) (commandp binding) - (eq (get binding 'isearch-scroll) t) + (or (eq (get binding 'isearch-scroll) t) + (eq (get binding 'scroll-command) t)) binding))) (defalias 'isearch-other-control-char 'isearch-other-meta-char) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/jka-compr.el --- a/lisp/jka-compr.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/jka-compr.el Thu May 13 15:13:52 2010 +0200 @@ -181,7 +181,8 @@ null-device)) jka-compr-acceptable-retval-list) (jka-compr-error prog args infile message err-file)) - (jka-compr-delete-temp-file err-file))) + (delete-file err-file t))) + ;; Run the uncompression program directly. ;; We get the whole file and must delete what we don't want. (jka-compr-call-process prog message infile t nil args)) @@ -222,7 +223,7 @@ ""))) jka-compr-acceptable-retval-list) (jka-compr-error prog args infile message err-file)) - (jka-compr-delete-temp-file err-file))) + (delete-file err-file t))) (or (eq 0 (apply 'call-process prog infile (if (stringp output) temp output) @@ -248,9 +249,6 @@ "This routine will return the name of a new file." (make-temp-file jka-compr-temp-name-template)) -(defalias 'jka-compr-delete-temp-file 'delete-file) - - (defun jka-compr-write-region (start end file &optional append visit) (let* ((filename (expand-file-name file)) (visit-file (if (stringp visit) (expand-file-name visit) filename)) @@ -337,7 +335,7 @@ (and append can-append) 'dont)) (erase-buffer)) ) - (jka-compr-delete-temp-file temp-file) + (delete-file temp-file t) (and compress-message @@ -603,7 +601,7 @@ (setq file (file-name-sans-extension file))) (setcar l file))) - (jka-compr-delete-temp-file local-copy)) + (delete-file local-copy)) t)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/language/indian.el --- a/lisp/language/indian.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/language/indian.el Thu May 13 15:13:52 2010 +0200 @@ -198,15 +198,14 @@ (defconst gurmukhi-composable-pattern (let ((table - '(("a" . "[\u0A01-\u0A02]") ; SIGN ADAK BINDI .. BINDI - ("A" . "\u0A03]") ; SIGN VISARGA + '(("a" . "[\u0A01-\u0A02\u0A70]") ; SIGN ADAK BINDI .. BINDI, TIPPI + ("A" . "\u0A03") ; SIGN VISARGA ("V" . "[\u0A05-\u0A14]") ; independent vowel ("C" . "[\u0A15-\u0A39\u0A59-\u0A5E]") ; consonant - ("Y" . "[\u0A2F\u0A30\u0A35\u0A39]") ; YA, RA, VA, HA + ("Y" . "[\u0A2F-u0A30\u0A35\u0A39]") ; YA, RA, VA, HA ("n" . "\u0A3C") ; NUKTA ("v" . "[\u0A3E-\u0A4C]") ; vowel sign ("H" . "\u0A4D") ; VIRAMA - ("a" . "\u0A70") ; TIPPI ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ ("X" . "[\u0A00-\u0A7F]")))) ; all coverage @@ -226,7 +225,7 @@ (defconst gujarati-composable-pattern (let ((table '(("a" . "[\u0A81-\u0A82]") ; SIGN CANDRABINDU .. ANUSVARA - ("A" . "\u0A83]") ; SIGN VISARGA + ("A" . "\u0A83") ; SIGN VISARGA ("V" . "[\u0A85-\u0A94\u0AE0-\u0AE1]") ; independent vowel ("C" . "[\u0A95-\u0AB9]") ; consonant ("R" . "\u0AB0") ; RA @@ -241,7 +240,7 @@ ;; syllables with an independent vowel, or "\\(?:RH\\)?Vn?\\(?:J?HR\\)?v*n?a?A?\\|" ;; consonant-based syllables, or - "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?|v*n?a?A?\\)\\|" + "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?\\|v*n?a?A?\\)\\|" ;; special consonant form, or "JHR\\|" ;; any other singleton characters @@ -256,8 +255,9 @@ ("V" . "[\u0B05-\u0B14\u0B60-\u0B61]") ; independent vowel ("C" . "[\u0B15-\u0B39\u0B5C-\u0B5D\u0B71]") ; consonant ("B" . "[\u0B15-\u0B17\u0B1B-\u0B1D\u0B1F-\u0B21\u0B23-\u0B24\u0B27-\u0B30\u0B32-\u0B35\u0B38-\u0B39]") ; consonant with below form + ("R" . "\u0B30") ; RA ("n" . "\u0B3C") ; NUKTA - ("v" . "[\u0B3E-\u0B44\u0B56-\u0B57\u0B62-\u0B63]") ; vowel sign + ("v" . "[\u0B3E-\u0B4C\u0B56-\u0B57\u0B62-\u0B63]") ; vowel sign ("H" . "\u0B4D") ; VIRAMA ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ @@ -267,7 +267,7 @@ ;; syllables with an independent vowel, or "\\(?:RH\\)?Vn?\\(?:J?HB\\)?v*n?a?A?\\|" ;; consonant-based syllables, or - "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?|v*n?a?A?\\)\\|" + "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?\\|v*n?a?A?\\)\\|" ;; special consonant form, or "JHB\\|" ;; any other singleton characters @@ -280,7 +280,7 @@ '(("a" . "\u0B82") ; SIGN ANUSVARA ("V" . "[\u0B85-\u0B94]") ; independent vowel ("C" . "[\u0B95-\u0BB9]") ; consonant - ("v" . "[\u0BBE-\u0BC8\u0BD7]") ; vowel sign + ("v" . "[\u0BBE-\u0BCC\u0BD7]") ; vowel sign ("H" . "\u0BCD") ; VIRAMA ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ @@ -288,7 +288,7 @@ (indian-compose-regexp (concat ;; consonant-based syllables, or - "C\\(?:J?HJ?C\\)*\\(?:H[NJ]?|v*a?\\)\\|" + "C\\(?:J?HJ?C\\)*\\(?:H[NJ]?\\|v*a?\\)\\|" ;; syllables with an independent vowel, or "Vv*a?\\|" ;; any other singleton characters @@ -302,14 +302,14 @@ ("V" . "[\u0C05-\u0C14\u0C60-\u0C61]") ; independent vowel ("C" . "[\u0C15-\u0C39\u0C58-\u0C59]") ; consonant ("v" . "[\u0C3E-\u0C4C\u0C55-\u0C56\u0C62-\u0C63]") ; vowel sign - ("H" . "\u0BCD") ; VIRAMA + ("H" . "\u0C4D") ; VIRAMA ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ ("X" . "[\u0C00-\u0C7F]")))) ; all coverage (indian-compose-regexp (concat ;; consonant-based syllables, or - "C\\(?:J?HJ?C\\)*\\(?:H[NJ]?|v*a?\\)\\|" + "C\\(?:J?HJ?C\\)*\\(?:H[NJ]?\\|v*a?\\)\\|" ;; syllables with an independent vowel, or "V\\(?:J?HC\\)?v*a?\\|" ;; special consonant form, or @@ -324,7 +324,7 @@ '(("A" . "[\u0C82-\u0C83]") ; SIGN ANUSVARA .. VISARGA ("V" . "[\u0C85-\u0C94\u0CE0-\u0CE1]") ; independent vowel ("C" . "[\u0C95-\u0CB9\u0CDE]") ; consonant - ("B" . "\u0CB0") ; RA + ("R" . "\u0CB0") ; RA ("n" . "\u0CBC") ; NUKTA ("v" . "[\u0CBE-\u0CCC\u0CD5-\u0CD6\u0CE2-\u0CE3]") ; vowel sign ("H" . "\u0CCD") ; VIRAMA @@ -336,9 +336,9 @@ ;; syllables with an independent vowel, or "\\(?:RH\\)?Vn?\\(?:J?HC\\)?v?A?\\|" ;; consonant-based syllables, or - "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?|v*n?A?\\)\\|" + "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?\\|v*n?A?\\)\\|" ;; special consonant form, or - "JHB\\|" + "JHC\\|" ;; any other singleton characters "X") table)) @@ -350,14 +350,15 @@ ("V" . "[\u0D05-\u0D14\u0D60-\u0D61]") ; independent vowel ("C" . "[\u0D15-\u0D39]") ; consonant ("Y" . "[\u0D2F-\u0D30\u0D32\u0D35]") ; YA, RA, LA, VA - ("v" . "[\u0D3E-\u0D48\u0D57\u0D62-\u0D63]") ; postbase matra + ("v" . "[\u0D3E-\u0D4C\u0D57\u0D62-\u0D63]") ; postbase matra + ("H" . "\u0D4D") ; SIGN VIRAMA ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ ("X" . "[\u0D00-\u0D7F]")))) ; all coverage (indian-compose-regexp (concat ;; consonant-based syllables, or - "\\(?:CJ?HJ?C\\)*\\(?:H[NJ]?\\|v?A?\\)\\|" + "C\\(?:J?HJ?C\\)*\\(?:H[NJ]?\\|v?A?\\)\\|" ;; syllables with an independent vowel, or "V\\(?:J?HY\\)?v*?A?\\|" ;; special consonant form, or diff -r e56f669f17ce -r fe07c47cf7a7 lisp/loadup.el --- a/lisp/loadup.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/loadup.el Thu May 13 15:13:52 2010 +0200 @@ -64,6 +64,10 @@ (expand-file-name "international" dir) (expand-file-name "textmodes" dir))))) +(if (eq t purify-flag) + ;; Hash consing saved around 11% of pure space in my tests. + (setq purify-flag (make-hash-table :test 'equal))) + (message "Using load-path %s" load-path) (if (or (member (nth 3 command-line-args) '("dump" "bootstrap")) @@ -199,8 +203,8 @@ (load "dnd") (load "tool-bar"))) -(if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) - (load "font-setting")) +(if (featurep 'dynamic-setting) + (load "dynamic-setting")) (if (featurep 'x) (progn @@ -345,6 +349,10 @@ ;; At this point, we're ready to resume undo recording for scratch. (buffer-enable-undo "*scratch*") +;; Avoid error if user loads some more libraries now and make sure the +;; hash-consing hash table is GC'd. +(setq purify-flag nil) + (if (null (garbage-collect)) (setq pure-space-overflow t)) @@ -378,9 +386,6 @@ (add-name-to-file "emacs" name t))) (kill-emacs))) -;; Avoid error if user loads some more libraries now. -(setq purify-flag nil) - ;; For machines with CANNOT_DUMP defined in config.h, ;; this file must be loaded each time Emacs is run. ;; So run the startup code now. First, remove `-l loadup' from args. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/log-edit.el --- a/lisp/log-edit.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/log-edit.el Thu May 13 15:13:52 2010 +0200 @@ -125,6 +125,7 @@ :type 'boolean) (defcustom log-edit-hook '(log-edit-insert-cvs-template + log-edit-show-files log-edit-insert-changelog) "Hook run at the end of `log-edit'." :group 'log-edit @@ -188,22 +189,6 @@ (defvar log-edit-callback nil) (defvar log-edit-diff-function nil) (defvar log-edit-listfun nil) -(defvar log-edit-extra-flags nil - "List of extra flags to pass to the check in command.") -(defvar log-edit-before-checkin-process nil - "Alist with instructions for processing the commit message before check in. -The format is: (REGEXP . INSTRUCTIONS). -All lines matching REGEXP are removed. For example: - -\(\"^#.*\" . nil) - -means: just remove all lines starting with #. This can be used -to insert lines in the commit buffer that contain, for example, the -list of files to be committed. - -\(\"Author: \\\\(.*\\\\)\" . (list \"--author\" (match-string 1))) - -means: append (list \"--author\" (match-string 1)) to `log-edit-extra-flags'.") (defvar log-edit-parent-buffer nil) @@ -329,10 +314,53 @@ ;;; Actual code ;;; +(defface log-edit-summary '((t :inherit font-lock-function-name-face)) + "Face for the summary in `log-edit-mode' buffers.") + +(defface log-edit-header '((t :inherit font-lock-keyword-face)) + "Face for the headers in `log-edit-mode' buffers.") + +(defface log-edit-unknown-header '((t :inherit font-lock-comment-face)) + "Face for unknown headers in `log-edit-mode' buffers.") + +(defvar log-edit-headers-alist '(("Summary" . log-edit-summary) + ("Fixes") ("Author")) + "AList of known headers and the face to use to highlight them.") + +(defconst log-edit-header-contents-regexp + "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?") + +(defun log-edit-match-to-eoh (limit) + ;; FIXME: copied from message-match-to-eoh. + (let ((start (point))) + (rfc822-goto-eoh) + ;; Typical situation: some temporary change causes the header to be + ;; incorrect, so EOH comes earlier than intended: the last lines of the + ;; intended headers are now not considered part of the header any more, + ;; so they don't have the multiline property set. When the change is + ;; completed and the header has its correct shape again, the lack of the + ;; multiline property means we won't rehighlight the last lines of + ;; the header. + (if (< (point) start) + nil ;No header within start..limit. + ;; Here we disregard LIMIT so that we may extend the area again. + (set-match-data (list start (point))) + (point)))) + (defvar log-edit-font-lock-keywords - '(("\\`\\(Summary:\\)\\(.*\\)" - (1 font-lock-keyword-face) - (2 font-lock-function-name-face)))) + ;; Copied/inspired by message-font-lock-keywords. + `((log-edit-match-to-eoh + (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp + "\\|\\(.*\\)") + (progn (goto-char (match-beginning 0)) (match-end 0)) nil + (1 (if (assoc (match-string 2) log-edit-headers-alist) + 'log-edit-header + 'log-edit-unknown-header) + nil lax) + (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) + 'log-edit-header) + nil lax) + (4 font-lock-warning-face))))) ;;;###autoload (defun log-edit (callback &optional setup params buffer mode &rest ignore) @@ -358,7 +386,10 @@ (if buffer (pop-to-buffer buffer)) (when (and log-edit-setup-invert (not (eq setup 'force))) (setq setup (not setup))) - (when setup (erase-buffer)) + (when setup + (erase-buffer) + (insert "Summary: ") + (save-excursion (insert "\n\n"))) (if mode (funcall mode) (log-edit-mode)) @@ -387,7 +418,7 @@ \\{log-edit-mode-map}" (set (make-local-variable 'font-lock-defaults) - '(log-edit-font-lock-keywords t)) + '(log-edit-font-lock-keywords t t)) (make-local-variable 'log-edit-comment-ring-index) (hack-dir-local-variables-non-file-buffer)) @@ -401,6 +432,17 @@ "Finish editing the log message and commit the files. If you want to abort the commit, simply delete the buffer." (interactive) + ;; Clean up empty headers. + (goto-char (point-min)) + (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp)) + (let ((beg (match-beginning 0))) + (goto-char (match-end 0)) + (if (string-match "\\`[ \n\t]*\\'" (match-string 1)) + (delete-region beg (point))))) + ;; Get rid of leading empty lines. + (goto-char (point-min)) + (when (looking-at "\\([ \t]*\n\\)+") + (delete-region (match-beginning 0) (match-end 0))) ;; Get rid of trailing empty lines (goto-char (point-max)) (skip-syntax-backward " ") @@ -458,12 +500,13 @@ "(Un)Indent the current buffer rigidly to `log-edit-common-indent'." (save-excursion (let ((common (point-max))) - (goto-char (point-min)) + (rfc822-goto-eoh) (while (< (point) (point-max)) (if (not (looking-at "^[ \t]*$")) (setq common (min common (current-indentation)))) (forward-line 1)) - (indent-rigidly (point-min) (point-max) + (rfc822-goto-eoh) + (indent-rigidly (point) (point-max) (- log-edit-common-indent common))))) (defun log-edit-show-diff () @@ -546,6 +589,10 @@ or if the command is repeated a second time in a row, use the first log entry regardless of user name or time." (interactive "P") + (let ((eoh (save-excursion (rfc822-goto-eoh) (point)))) + (when (<= (point) eoh) + (goto-char eoh) + (if (looking-at "\n") (forward-char 1)))) (let ((log-edit-changelog-use-first (or use-first (eq last-command 'log-edit-insert-changelog)))) (log-edit-insert-changelog-entries (log-edit-files))) @@ -731,16 +778,39 @@ (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry)) (when (cdr buffer-entry) (newline))))) -(defun log-view-process-buffer () - (when log-edit-before-checkin-process - (dolist (crt log-edit-before-checkin-process) - ;; Remove all lines matching (car crt) - ;; Append to `log-edit-extra-flags' the results of (cdr crt). +(defun log-edit-extract-headers (headers comment) + "Extract headers from COMMENT to form command line arguments. +HEADERS should be an alist with elements of the form (HEADER . CMDARG) +associating header names to the corresponding cmdline option name and the +result is then a list of the form (MSG CMDARG1 HDRTEXT1 CMDARG2 HDRTEXT2...). +where MSG is the remaining text from STRING. +If \"Summary\" is not in HEADERS, then the \"Summary\" header is extracted +anyway and put back as the first line of MSG." + (with-temp-buffer + (insert comment) + (rfc822-goto-eoh) + (narrow-to-region (point-min) (point)) + (let ((case-fold-search t) + (summary ()) + (res ())) + (dolist (header (if (assoc "Summary" headers) headers + (cons '("Summary" . t) headers))) + (goto-char (point-min)) + (while (re-search-forward (concat "^" (car header) + ":" log-edit-header-contents-regexp) + nil t) + (if (eq t (cdr header)) + (setq summary (match-string 1)) + (push (match-string 1) res) + (push (or (cdr header) (car header)) res)) + (replace-match "" t t))) + ;; Remove header separator if the header is empty. + (widen) (goto-char (point-min)) - (while (re-search-forward (car crt) nil t) - (when (cdr crt) - (setq log-edit-extra-flags (append log-edit-extra-flags (eval (cdr crt))))) - (replace-match "" nil t))))) + (when (looking-at "\\([ \t]*\n\\)+") + (delete-region (match-beginning 0) (match-end 0))) + (if summary (insert summary "\n")) + (cons (buffer-string) res)))) (provide 'log-edit) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mail/binhex.el --- a/lisp/mail/binhex.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mail/binhex.el Thu May 13 15:13:52 2010 +0200 @@ -221,7 +221,8 @@ (goto-char start) (when (re-search-forward binhex-begin-line end t) (setq work-buffer (generate-new-buffer " *binhex-work*")) - (with-current-buffer work-buffer (set-buffer-multibyte nil)) + (unless (featurep 'xemacs) + (with-current-buffer work-buffer (set-buffer-multibyte nil))) (beginning-of-line) (setq bits 0 counter 0) (while tmp diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mail/supercite.el --- a/lisp/mail/supercite.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mail/supercite.el Thu May 13 15:13:52 2010 +0200 @@ -1619,21 +1619,20 @@ (cadr err) sc-eref-style) (beep)))))) -(defun sc-electric-mode (&optional arg) - " -Mode for viewing Supercite reference headers. Commands are: +(defun sc-electric-mode (&optional style) + "Mode for viewing Supercite reference headers. Commands are: \n\\{sc-electric-mode-map} `sc-electric-mode' is not intended to be run interactively, but rather accessed through Supercite's electric reference feature. See -`sc-insert-reference' for more details. Optional ARG is the initial +`sc-insert-reference' for more details. Optional STYLE is the initial header style to use, unless not supplied or invalid, in which case `sc-preferred-header-style' is used." (let ((info sc-mail-info)) (setq sc-eref-style - (or (sc-valid-index-p arg) + (or (sc-valid-index-p style) (sc-valid-index-p sc-preferred-header-style) 0)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mail/uudecode.el --- a/lisp/mail/uudecode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mail/uudecode.el Thu May 13 15:13:52 2010 +0200 @@ -216,7 +216,7 @@ (skip-chars-forward non-data-chars end)) (if file-name (with-temp-file file-name - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (insert (apply 'concat (nreverse result)))) (or (markerp end) (setq end (set-marker (make-marker) end))) (goto-char start) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mh-e/ChangeLog --- a/lisp/mh-e/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mh-e/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,12 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-03 Stefan Monnier + + * mh-show.el (mh-showing-mode): Move function to mh-e.el. + * mh-e.el (mh-showing-mode): Use define-minor-mode. + 2010-03-24 Juanma Barranquero * mh-scan.el (mh-scan-cmd-note-width): Doc fix. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mh-e/ChangeLog.1 --- a/lisp/mh-e/ChangeLog.1 Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mh-e/ChangeLog.1 Thu May 13 15:13:52 2010 +0200 @@ -195,11 +195,11 @@ 2005-05-28 Bill Wohler - Released MH-E version 7.84. - - * MH-E-NEWS, README: Updated for release 7.84. - - * mh-e.el (Version, mh-version): Updated for release 7.84. + Released MH-E version 7.84. + + * MH-E-NEWS, README: Updated for release 7.84. + + * mh-e.el (Version, mh-version): Updated for release 7.84. 2005-05-28 Bill Wohler @@ -4396,7 +4396,6 @@ mh-xemacs-toolbar.el: Removed RCS keywords per Emacs conventions (closes SF #680731). - 2003-03-26 Satyaki Das * mh-index.el: Fix commentary to mention that mairix is supported @@ -7556,10 +7555,10 @@ the MH pick command to give the user more information when choosing between mh-search-folder and mh-index-folder. - * mh-index.el (mh-index-search): Edited the docstring. Direct the - user to mh-index-program if necessary. - (mh-index-program): Edited this docstring too. Viewing the help - in a *Help* buffer really exposes grammatical flaws. + * mh-index.el (mh-index-search): Edited the docstring. Direct the + user to mh-index-program if necessary. + (mh-index-program): Edited this docstring too. Viewing the help + in a *Help* buffer really exposes grammatical flaws. 2002-11-05 Peter S Galbraith @@ -7839,7 +7838,6 @@ (.PHONY): Added emacs, xemacs, autoloads, custom-loads. Broke up target and moved pieces into their own sections. - 2002-10-30 Peter S Galbraith * mh-utils.el (mh-show-font-lock-keywords): Wrap an @@ -8494,11 +8492,10 @@ 2002-10-22 Mark D. Baushke * mh-mime.el (mh-graphical-smileys-flag): Renamed from - mh-graphical-smileys-p. - (mh-display-smileys): Use it. - (mh-graphical-emphasis-flag): Renamed from - mh-graphical-emphasis-p. - (mh-display-emphasis): Use it. This addresses part of SF #627015. + mh-graphical-smileys-p. + (mh-display-smileys): Use it. + (mh-graphical-emphasis-flag): Renamed from mh-graphical-emphasis-p. + (mh-display-emphasis): Use it. This addresses part of SF #627015. 2002-10-22 Satyaki Das @@ -9301,7 +9298,7 @@ * mh-mime.el (mh-store-mime-parts-directory): New defcustom. Default directory to use for mh-store-mime-parts. (mh-store-mime-parts): New Command. Store the MIME parts of the - current message. + current message. (mh-store-mime-parts-directory-default): New internal working variable. Default to use for mh-store-mime-parts-directory, set from last use. @@ -9309,7 +9306,6 @@ * mh-e.el (mh-folder-seq-tool-bar-map): Add mh-store-mime-parts to toolbar. - 2002-08-22 Satyaki Das * mh-seq.el (mh-thread-generate-scan-lines): In threaded view, @@ -10487,7 +10483,6 @@ (clean): New target that blows away MH-E-OBJ. (dist): Added $(MH-E-OBJ) to tarball. - Attempt to quiet compilation errors to a dull roar. * mh-e.el: Require easymenu, added autoload of info. @@ -10506,7 +10501,6 @@ * mh-comp.el: Require mh-e and easymenu, moved autoloads to top of file. - * Makefile: (EMACS): New constant to hold emacs calling sequence. (install): Renamed to install-emacs. (compile): New target to compile all files. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mh-e/mh-e.el --- a/lisp/mh-e/mh-e.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mh-e/mh-e.el Thu May 13 15:13:52 2010 +0200 @@ -287,8 +287,10 @@ (defvar mh-show-buffer nil "Buffer that displays message for this folder.") -(defvar mh-showing-mode nil - "If non-nil, show the message in a separate window.") +(define-minor-mode mh-showing-mode + "Minor mode to show the message in a separate window." + ;; FIXME: maybe this should be moved to mh-show.el. + :lighter " Show") (defvar mh-view-ops nil "Stack of operations that change the folder view. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mh-e/mh-show.el --- a/lisp/mh-e/mh-show.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mh-e/mh-show.el Thu May 13 15:13:52 2010 +0200 @@ -170,16 +170,6 @@ (run-hooks 'mh-show-hook))) ;;;###mh-autoload -(defun mh-showing-mode (&optional arg) - "Change whether messages should be displayed. - -With ARG, display messages if ARG is positive, otherwise don't display them." - (setq mh-showing-mode - (if (null arg) - (not mh-showing-mode) - (> (prefix-numeric-value arg) 0)))) - -;;;###mh-autoload (defun mh-start-of-uncleaned-message () "Position uninteresting headers off the top of the window." (let ((case-fold-search t)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/minibuffer.el --- a/lisp/minibuffer.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/minibuffer.el Thu May 13 15:13:52 2010 +0200 @@ -76,6 +76,9 @@ ;; the provided string (as is the case in filecache.el), in which ;; case partial-completion (for example) doesn't make any sense ;; and neither does the completions-first-difference highlight. +;; - indicate how to display the completions in *Completions* (turn +;; \n into something else, add special boundaries between +;; completions). E.g. when completing from the kill-ring. ;; - make partial-completion-mode obsolete: ;; - (?) style completion for file names. @@ -381,21 +384,38 @@ (defconst completion-styles-alist '((emacs21 completion-emacs21-try-completion completion-emacs21-all-completions - "Simple prefix-based completion.") + "Simple prefix-based completion. +I.e. when completing \"foo_bar\" (where _ is the position of point), +it will consider all completions candidates matching the glob +pattern \"foobar*\".") (emacs22 completion-emacs22-try-completion completion-emacs22-all-completions - "Prefix completion that only operates on the text before point.") + "Prefix completion that only operates on the text before point. +I.e. when completing \"foo_bar\" (where _ is the position of point), +it will consider all completions candidates matching the glob +pattern \"foo*\" and will add back \"bar\" to the end of it.") (basic completion-basic-try-completion completion-basic-all-completions - "Completion of the prefix before point and the suffix after point.") + "Completion of the prefix before point and the suffix after point. +I.e. when completing \"foo_bar\" (where _ is the position of point), +it will consider all completions candidates matching the glob +pattern \"foo*bar*\".") (partial-completion completion-pcm-try-completion completion-pcm-all-completions "Completion of multiple words, each one taken as a prefix. -E.g. M-x l-c-h can complete to list-command-history -and C-x C-f /u/m/s to /usr/monnier/src.") +I.e. when completing \"l-co_h\" (where _ is the position of point), +it will consider all completions candidates matching the glob +pattern \"l*-co*h*\". +Furthermore, for completions that are done step by step in subfields, +the method is applied to all the preceding fields that do not yet match. +E.g. C-x C-f /u/mo/s TAB could complete to /usr/monnier/src. +Additionally the user can use the char \"*\" as a glob pattern.") (substring completion-substring-try-completion completion-substring-all-completions - "Completion of the string taken as a substring.") + "Completion of the string taken as a substring. +I.e. when completing \"foo_bar\" (where _ is the position of point), +it will consider all completions candidates matching the glob +pattern \"*foo*bar*\".") (initials completion-initials-try-completion completion-initials-all-completions "Completion of acronyms and initialisms. @@ -410,7 +430,19 @@ follow the calling convention of `completion-all-completions'), and DOC describes the way this style of completion works.") -(defcustom completion-styles '(basic partial-completion emacs22) +(defcustom completion-styles + ;; First, use `basic' because prefix completion has been the standard + ;; for "ever" and works well in most cases, so using it first + ;; ensures that we obey previous behavior in most cases. + '(basic + ;; Then use `partial-completion' because it has proven to + ;; be a very convenient extension. + partial-completion + ;; Finally use `emacs22' so as to maintain (in many/most cases) + ;; the previous behavior that when completing "foobar" with point + ;; between "foo" and "bar" the completion try to complete "foo" + ;; and simply add "bar" to the end of the result. + emacs22) "List of completion styles to use. The available styles are listed in `completion-styles-alist'." :type `(repeat (choice ,@(mapcar (lambda (x) (list 'const (car x))) @@ -460,6 +492,18 @@ (insert newtext) (delete-region (point) (+ (point) (- end beg)))) +(defcustom completion-cycle-threshold nil + "Number of completion candidates below which cycling is used. +Depending on this setting `minibuffer-complete' may use cycling, +like `minibuffer-force-complete'. +If nil, cycling is never used. +If t, cycling is always used. +If an integer, cycling is used as soon as there are fewer completion +candidates than this number." + :type '(choice (const :tag "No cycling" nil) + (const :tag "Always cycle" t) + (integer :tag "Threshold"))) + (defun completion--do-completion (&optional try-completion-function) "Do the completion and return a summary of what happened. M = completion was performed, the text was Modified. @@ -519,14 +563,43 @@ ;; It did find a match. Do we match some possibility exactly now? (let ((exact (test-completion completion minibuffer-completion-table - minibuffer-completion-predicate))) - (if completed + minibuffer-completion-predicate)) + (comps + ;; Check to see if we want to do cycling. We do it + ;; here, after having performed the normal completion, + ;; so as to take advantage of the difference between + ;; try-completion and all-completions, for things + ;; like completion-ignored-extensions. + (when (and completion-cycle-threshold + ;; Check that the completion didn't make + ;; us jump to a different boundary. + (or (not completed) + (< (car (completion-boundaries + (substring completion 0 comp-pos) + minibuffer-completion-table + minibuffer-completion-predicate + "")) + comp-pos))) + (completion-all-sorted-completions)))) + (setq completion-all-sorted-completions nil) + (cond + ((and (not (ignore-errors + ;; This signal an (intended) error if comps is too + ;; short or if completion-cycle-threshold is t. + (consp (nthcdr completion-cycle-threshold comps)))) + ;; More than 1, so there's something to cycle. + (consp (cdr comps))) + ;; Fewer than completion-cycle-threshold remaining + ;; completions: let's cycle. + (setq completed t exact t) + (setq completion-all-sorted-completions comps) + (minibuffer-force-complete)) + (completed ;; We could also decide to refresh the completions, ;; if they're displayed (and assuming there are ;; completions left). - (minibuffer-hide-completions) + (minibuffer-hide-completions)) ;; Show the completion table, if requested. - (cond ((not exact) (if (case completion-auto-help (lazy (eq this-command last-command)) @@ -537,7 +610,7 @@ ;; means we've already given a "Next char not unique" message ;; and the user's hit TAB again, so now we give him help. ((eq this-command last-command) - (if completion-auto-help (minibuffer-completion-help))))) + (if completion-auto-help (minibuffer-completion-help)))) (minibuffer--bitset completed t exact)))))))) @@ -551,21 +624,26 @@ ;; If the previous command was not this, ;; mark the completion buffer obsolete. (unless (eq this-command last-command) + (setq completion-all-sorted-completions nil) (setq minibuffer-scroll-window nil)) - (let ((window minibuffer-scroll-window)) + (cond ;; If there's a fresh completion window with a live buffer, ;; and this command is repeated, scroll that window. - (if (window-live-p window) + ((window-live-p minibuffer-scroll-window) + (let ((window minibuffer-scroll-window)) (with-current-buffer (window-buffer window) (if (pos-visible-in-window-p (point-max) window) ;; If end is in view, scroll up to the beginning. (set-window-start window (point-min) nil) ;; Else scroll down one screen. (scroll-other-window)) - nil) - - (case (completion--do-completion) + nil))) + ;; If we're cycling, keep on cycling. + (completion-all-sorted-completions + (minibuffer-force-complete) + t) + (t (case (completion--do-completion) (#b000 nil) (#b001 (minibuffer-message "Sole completion") t) @@ -1128,7 +1206,7 @@ (call-interactively 'minibuffer-complete) (delete-overlay ol))))) -(defvar completion-at-point-functions nil +(defvar completion-at-point-functions '(tags-completion-at-point-function) "Special hook to find the completion table for the thing at point. It is called without any argument and should return either nil, or a function of no argument to perform completion (discouraged), @@ -1140,22 +1218,31 @@ `:predicate' a predicate that completion candidates need to satisfy. `:annotation-function' the value to use for `completion-annotate-function'.") -(defun completion-at-point () - "Complete the thing at point according to local mode." - (interactive) - (let ((res (run-hook-with-args-until-success - 'completion-at-point-functions))) - (cond - ((functionp res) (funcall res)) - (res - (let* ((plist (nthcdr 3 res)) - (start (nth 0 res)) - (end (nth 1 res)) - (completion-annotate-function - (or (plist-get plist :annotation-function) - completion-annotate-function))) - (completion-in-region start end (nth 2 res) - (plist-get plist :predicate))))))) +(defun completion-at-point (&optional arg) + "Perform completion on the text around point. +The completion method is determined by `completion-at-point-functions'. + +With a prefix argument, this command does completion within +the collection of symbols listed in the index of the manual for the +language you are using." + (interactive "P") + (if arg + (info-complete-symbol) + (let ((res (run-hook-with-args-until-success + 'completion-at-point-functions))) + (cond + ((functionp res) (funcall res)) + (res + (let* ((plist (nthcdr 3 res)) + (start (nth 0 res)) + (end (nth 1 res)) + (completion-annotate-function + (or (plist-get plist :annotation-function) + completion-annotate-function))) + (completion-in-region start end (nth 2 res) + (plist-get plist :predicate)))))))) + +(define-obsolete-function-alias 'complete-symbol 'completion-at-point "24.1") ;;; Key bindings. @@ -1332,7 +1419,9 @@ (substitute-in-file-name string) (error string))) (comp (completion-file-name-table - str (or pred read-file-name-predicate) action))) + str + (with-no-warnings (or pred read-file-name-predicate)) + action))) (cond ((stringp comp) @@ -1729,6 +1818,14 @@ :group 'minibuffer :type 'string) +(defcustom completion-pcm-complete-word-inserts-delimiters nil + "Treat the SPC or - inserted by `minibuffer-complete-word' as delimiters. +Those chars are treated as delimiters iff this variable is non-nil. +I.e. if non-nil, M-x SPC will just insert a \"-\" in the minibuffer, whereas +if nil, it will list all possible commands in *Completions* because none of +the commands start with a \"-\" or a SPC." + :type 'boolean) + (defun completion-pcm--pattern-trivial-p (pattern) (and (stringp (car pattern)) ;; It can be followed by `point' and "" and still be trivial. @@ -1741,7 +1838,7 @@ (defun completion-pcm--string->pattern (string &optional point) "Split STRING into a pattern. A pattern is a list where each element is either a string -or a symbol chosen among `any', `star', `point'." +or a symbol chosen among `any', `star', `point', `prefix'." (if (and point (< point (length string))) (let ((prefix (substring string 0 point)) (suffix (substring string point))) @@ -1754,11 +1851,12 @@ (while (and (setq p (string-match completion-pcm--delim-wild-regex string p)) - ;; If the char was added by minibuffer-complete-word, then - ;; don't treat it as a delimiter, otherwise "M-x SPC" - ;; ends up inserting a "-" rather than listing - ;; all completions. - (not (get-text-property p 'completion-try-word string))) + (or completion-pcm-complete-word-inserts-delimiters + ;; If the char was added by minibuffer-complete-word, + ;; then don't treat it as a delimiter, otherwise + ;; "M-x SPC" ends up inserting a "-" rather than listing + ;; all completions. + (not (get-text-property p 'completion-try-word string)))) ;; Usually, completion-pcm--delim-wild-regex matches a delimiter, ;; meaning that something can be added *before* it, but it can also ;; match a prefix and postfix, in which case something can be added @@ -1784,11 +1882,10 @@ (concat "\\`" (mapconcat (lambda (x) - (case x - ((star any point) - (if (if (consp group) (memq x group) group) - "\\(.*?\\)" ".*?")) - (t (regexp-quote x)))) + (cond + ((stringp x) (regexp-quote x)) + ((if (consp group) (memq x group) group) "\\(.*?\\)") + (t ".*?"))) pattern "")))) ;; Avoid pathological backtracking. @@ -1943,6 +2040,17 @@ (nconc (completion-pcm--hilit-commonality pattern all) (length prefix))))) +(defun completion--sreverse (str) + "Like `reverse' but for a string STR rather than a list." + (apply 'string (nreverse (mapcar 'identity str)))) + +(defun completion--common-suffix (strs) + "Return the common suffix of the strings STRS." + (completion--sreverse + (try-completion + "" + (mapcar 'completion--sreverse strs)))) + (defun completion-pcm--merge-completions (strs pattern) "Extract the commonality in STRS, with the help of PATTERN." ;; When completing while ignoring case, we want to try and avoid @@ -2004,7 +2112,17 @@ ;; `any' into a `star' because the surrounding context has ;; changed such that string->pattern wouldn't add an `any' ;; here any more. - (unless unique (push elem res)) + (unless unique + (push elem res) + (when (memq elem '(star point prefix)) + ;; Extract common suffix additionally to common prefix. + ;; Only do it for `point', `star', and `prefix' since for + ;; `any' it could lead to a merged completion that + ;; doesn't itself match the candidates. + (let ((suffix (completion--common-suffix comps))) + (assert (stringp suffix)) + (unless (equal suffix "") + (push suffix res))))) (setq fixed ""))))) ;; We return it in reverse order. res))))) @@ -2013,8 +2131,7 @@ (mapconcat (lambda (x) (cond ((stringp x) x) ((eq x 'star) "*") - ((eq x 'any) "") - ((eq x 'point) ""))) + (t ""))) ;any, point, prefix. pattern "")) @@ -2056,6 +2173,7 @@ (pointpat (or (memq 'point mergedpat) (memq 'any mergedpat) (memq 'star mergedpat) + ;; Not `prefix'. mergedpat)) ;; New pos from the start. (newpos (length (completion-pcm--pattern->string pointpat))) @@ -2086,7 +2204,7 @@ beforepoint afterpoint bounds)) (pattern (if (not (stringp (car basic-pattern))) basic-pattern - (cons 'any basic-pattern))) + (cons 'prefix basic-pattern))) (all (completion-pcm--all-completions prefix pattern table pred))) (list all pattern prefix suffix (car bounds)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/mwheel.el --- a/lisp/mwheel.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/mwheel.el Thu May 13 15:13:52 2010 +0200 @@ -246,7 +246,7 @@ (run-with-timer mouse-wheel-inhibit-click-time nil 'mwheel-inhibit-click-timeout)))) -(add-to-list 'scroll-preserve-screen-position-commands 'mwheel-scroll) +(put 'mwheel-scroll 'scroll-command t) (defvar mwheel-installed-bindings nil) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/ange-ftp.el --- a/lisp/net/ange-ftp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/ange-ftp.el Thu May 13 15:13:52 2010 +0200 @@ -1734,7 +1734,10 @@ ange-ftp-gateway-tmp-name-template ange-ftp-tmp-name-template))) -(defalias 'ange-ftp-del-tmp-name 'delete-file) +(defun ange-ftp-del-tmp-name (filename) + "Force to delete temporary file." + (delete-file filename 'force)) + ;;;; ------------------------------------------------------------ ;;;; Interactive gateway program support. @@ -3504,7 +3507,7 @@ (file-exists-p file) (ange-ftp-real-file-executable-p file)))) -(defun ange-ftp-delete-file (file) +(defun ange-ftp-delete-file (file &optional force) (interactive "fDelete file: ") (setq file (expand-file-name file)) (let ((parsed (ange-ftp-ftp-name file))) @@ -3523,7 +3526,7 @@ (format "FTP Error: \"%s\"" (cdr result)) file))) (ange-ftp-delete-file-entry file)) - (ange-ftp-real-delete-file file)))) + (ange-ftp-real-delete-file file force)))) (defun ange-ftp-file-modtime (file) "Return the modification time of remote file FILE. @@ -3827,7 +3830,8 @@ (ange-ftp-call-cont cont result line))) (defun ange-ftp-copy-file (filename newname &optional ok-if-already-exists - keep-date preserve-uid-gid) + keep-date preserve-uid-gid + preserve-selinux-context) (interactive "fCopy file: \nFCopy %s to file: \np") (ange-ftp-copy-file-internal filename newname @@ -3893,7 +3897,7 @@ (ange-ftp-add-file-entry newname) (ange-ftp-delete-file-entry filename)) (ange-ftp-copy-file-internal filename newname t nil) - (delete-file filename)))) + (delete-file filename 'force)))) (defun ange-ftp-rename-local-to-remote (filename newname) "Rename local file FILENAME to remote file NEWNAME." @@ -3902,7 +3906,7 @@ (msg (format "Renaming %s to %s" fabbr nabbr))) (ange-ftp-copy-file-internal filename newname t nil msg) (let (ange-ftp-process-verbose) - (delete-file filename)))) + (delete-file filename 'force)))) (defun ange-ftp-rename-remote-to-local (filename newname) "Rename remote file FILENAME to local file NEWNAME." @@ -3911,7 +3915,7 @@ (msg (format "Renaming %s to %s" fabbr nabbr))) (ange-ftp-copy-file-internal filename newname t nil msg) (let (ange-ftp-process-verbose) - (delete-file filename)))) + (delete-file filename 'force)))) (defun ange-ftp-rename-file (filename newname &optional ok-if-already-exists) (interactive "fRename file: \nFRename %s to file: \np") @@ -4192,7 +4196,7 @@ (if copy (unwind-protect (funcall 'load copy noerror nomessage nosuffix) - (delete-file copy)) + (delete-file copy 'force)) (or noerror (signal 'file-error (list "Cannot open load file" file))) nil)) @@ -4263,7 +4267,7 @@ (if (zerop (buffer-size)) (progn (let (ange-ftp-process-verbose) - (delete-file file)) + (delete-file file 'force)) (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) (ange-ftp-del-tmp-name tmp1) (ange-ftp-del-tmp-name tmp2)))) @@ -4299,7 +4303,7 @@ (if (zerop (buffer-size)) (progn (let (ange-ftp-process-verbose) - (delete-file file)) + (delete-file file 'force)) (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) (ange-ftp-del-tmp-name tmp1) (ange-ftp-del-tmp-name tmp2)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/browse-url.el --- a/lisp/net/browse-url.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/browse-url.el Thu May 13 15:13:52 2010 +0200 @@ -313,8 +313,11 @@ :type '(repeat (string :tag "Argument")) :group 'browse-url) -;;;###autoload -(defcustom browse-url-firefox-program (purecopy "firefox") +(defcustom browse-url-firefox-program + (let ((candidates '("firefox" "iceweasel"))) + (while (and candidates (not (executable-find (car candidates)))) + (setq candidates (cdr candidates))) + (or (car candidates) "firefox")) "The name by which to invoke Firefox." :type 'string :group 'browse-url) @@ -331,8 +334,7 @@ :type '(repeat (string :tag "Argument")) :group 'browse-url) -;;;###autoload -(defcustom browse-url-galeon-program (purecopy "galeon") +(defcustom browse-url-galeon-program "galeon" "The name by which to invoke Galeon." :type 'string :group 'browse-url) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/dns.el --- a/lisp/net/dns.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/dns.el Thu May 13 15:13:52 2010 +0200 @@ -101,7 +101,7 @@ (defun dns-read-string-name (string buffer) (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (insert string) (goto-char (point-min)) (dns-read-name buffer))) @@ -135,7 +135,7 @@ "Write a DNS packet according to SPEC. If TCP-P, the first two bytes of the package with be the length field." (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (dns-write-bytes (dns-get 'id spec) 2) (dns-write-bytes (logior @@ -186,7 +186,7 @@ (defun dns-read (packet) (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (let ((spec nil) queries answers authorities additionals) (insert packet) @@ -263,7 +263,7 @@ (point (point))) (prog1 (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (insert string) (goto-char (point-min)) (cond @@ -391,7 +391,7 @@ (if (not dns-servers) (message "No DNS server configuration found") (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (let ((process (condition-case () (dns-make-network-process (car dns-servers)) (error diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/imap.el --- a/lisp/net/imap.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/imap.el Thu May 13 15:13:52 2010 +0200 @@ -475,10 +475,10 @@ (setcdr alist (imap-remassoc key (cdr alist))) alist))) -(defsubst imap-disable-multibyte () +(defmacro imap-disable-multibyte () "Enable multibyte in the current buffer." - (when (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte nil))) + (unless (featurep 'xemacs) + '(set-buffer-multibyte nil))) (defsubst imap-utf7-encode (string) (if imap-use-utf7 diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/rlogin.el --- a/lisp/net/rlogin.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/rlogin.el Thu May 13 15:13:52 2010 +0200 @@ -249,7 +249,7 @@ ``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'', then do directory tracking but assume the remote filesystem is the same as the local system. This only works in general if the remote machine and the -local one share the same directories (through NFS)." +local one share the same directories (e.g. through NFS)." (interactive "P") (cond ((or (null prefix) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-cmds.el --- a/lisp/net/tramp-cmds.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-cmds.el Thu May 13 15:13:52 2010 +0200 @@ -106,8 +106,7 @@ (setq tramp-locked nil) ;; Flush password cache. - (when (functionp 'password-reset) - (funcall (symbol-function 'password-reset))) + (tramp-compat-funcall 'password-reset) ;; Flush file and connection cache. (clrhash tramp-cache-data) @@ -254,7 +253,7 @@ (base64-encode-string val)))))) ;; Dump variable. - (funcall (symbol-function 'reporter-dump-variable) varsym mailbuf) + (tramp-compat-funcall 'reporter-dump-variable varsym mailbuf) (unless (hash-table-p val) ;; Remove string quotation. @@ -283,10 +282,8 @@ (load "mml" 'noerror)) (require 'message nil 'noerror) (require 'mml nil 'noerror)) - (when (functionp 'message-mode) - (funcall (symbol-function 'message-mode))) - (when (functionp 'mml-mode) - (funcall (symbol-function 'mml-mode) t))) + (tramp-compat-funcall 'message-mode) + (tramp-compat-funcall 'mml-mode t)) (defun tramp-append-tramp-buffers () "Append Tramp buffers and buffer local variables into the bug report." @@ -308,15 +305,14 @@ (erase-buffer) (insert "\n(setq\n") (lisp-indent-line) - (funcall (symbol-function 'reporter-dump-variable) - 'buffer-name (current-buffer)) + (tramp-compat-funcall + 'reporter-dump-variable 'buffer-name (current-buffer)) (dolist (varsym-or-cons-cell (buffer-local-variables buffer)) (let ((varsym (or (car-safe varsym-or-cons-cell) varsym-or-cons-cell))) (when (string-match "tramp" (symbol-name varsym)) - (funcall - (symbol-function 'reporter-dump-variable) - varsym (current-buffer))))) + (tramp-compat-funcall + 'reporter-dump-variable varsym (current-buffer))))) (lisp-indent-line) (insert ")\n")) (insert-buffer-substring elbuf))) @@ -328,7 +324,7 @@ (symbol-value 'mml-mode)) (let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/") - (buffer-list (funcall (symbol-function 'tramp-list-tramp-buffers))) + (buffer-list (tramp-compat-funcall 'tramp-list-tramp-buffers)) (curbuf (current-buffer))) ;; There is at least one Tramp buffer. @@ -376,10 +372,10 @@ use another mail agent (by copying the contents of this buffer) please ensure that the buffers are attached to your email.\n\n") (dolist (buffer buffer-list) - (funcall (symbol-function 'mml-insert-empty-tag) - 'part 'type "text/plain" 'encoding "base64" - 'disposition "attachment" 'buffer buffer - 'description buffer)) + (tramp-compat-funcall + 'mml-insert-empty-tag 'part 'type "text/plain" + 'encoding "base64" 'disposition "attachment" 'buffer buffer + 'description buffer)) (set-buffer-modified-p nil)) ;; Don't send. Delete the message buffer. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-compat.el --- a/lisp/net/tramp-compat.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-compat.el Thu May 13 15:13:52 2010 +0200 @@ -89,14 +89,25 @@ (unless (boundp 'byte-compile-not-obsolete-var) (defvar byte-compile-not-obsolete-var nil)) (setq byte-compile-not-obsolete-var 'directory-sep-char) - (if (boundp 'byte-compile-not-obsolete-vars) ; Emacs 23.2 - (setq byte-compile-not-obsolete-vars '(directory-sep-char))) + ;; Emacs 23.2. + (unless (boundp 'byte-compile-not-obsolete-vars) + (defvar byte-compile-not-obsolete-vars nil)) + (setq byte-compile-not-obsolete-vars '(directory-sep-char)) ;; `with-temp-message' does not exists in XEmacs. (condition-case nil (with-temp-message (current-message) nil) (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))) + ;; For not existing functions, or functions with a changed argument + ;; list, there are compiler warnings. We want to avoid them in + ;; cases we know what we do. + (defmacro tramp-compat-funcall (function &rest arguments) + (if (featurep 'xemacs) + `(funcall (symbol-function ,function) ,@arguments) + `(when (or (subrp ,function) (functionp ,function)) + (with-no-warnings (funcall ,function ,@arguments))))) + ;; `set-buffer-multibyte' comes from Emacs Leim. (unless (fboundp 'set-buffer-multibyte) (defalias 'set-buffer-multibyte 'ignore)) @@ -182,8 +193,8 @@ own implementation." (cond ((fboundp 'line-beginning-position) - (funcall (symbol-function 'line-beginning-position))) - ((fboundp 'point-at-bol) (funcall (symbol-function 'point-at-bol))) + (tramp-compat-funcall 'line-beginning-position)) + ((fboundp 'point-at-bol) (tramp-compat-funcall 'point-at-bol)) (t (save-excursion (beginning-of-line) (point))))) (defsubst tramp-compat-line-end-position () @@ -191,8 +202,8 @@ Calls `line-end-position' or `point-at-eol' if defined, else own implementation." (cond - ((fboundp 'line-end-position) (funcall (symbol-function 'line-end-position))) - ((fboundp 'point-at-eol) (funcall (symbol-function 'point-at-eol))) + ((fboundp 'line-end-position) (tramp-compat-funcall 'line-end-position)) + ((fboundp 'point-at-eol) (tramp-compat-funcall 'point-at-eol)) (t (save-excursion (end-of-line) (point))))) (defsubst tramp-compat-temporary-file-directory () @@ -201,7 +212,7 @@ this is the function `temp-directory'." (cond ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory)) - ((fboundp 'temp-directory) (funcall (symbol-function 'temp-directory))) + ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory)) ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) (file-name-as-directory (getenv "TEMP"))) ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) @@ -227,8 +238,7 @@ result) (if (fboundp 'make-temp-file) (setq result - (funcall - (symbol-function 'make-temp-file) prefix dir-flag extension)) + (tramp-compat-funcall 'make-temp-file prefix dir-flag extension)) ;; We use our own implementation, taken from files.el. (while (condition-case () @@ -261,19 +271,27 @@ ((tramp-tramp-file-p filename) (tramp-file-name-handler 'file-attributes filename id-format)) (t (condition-case nil - (funcall (symbol-function 'file-attributes) filename id-format) - (error (file-attributes filename)))))) + (tramp-compat-funcall 'file-attributes filename id-format) + (wrong-number-of-arguments (file-attributes filename)))))) ;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not ;; hurt to ignore it for other (X)Emacs versions. +;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24. (defun tramp-compat-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files (compat function)." - (if preserve-uid-gid - (funcall - (symbol-function 'copy-file) - filename newname ok-if-already-exists keep-date preserve-uid-gid) - (copy-file filename newname ok-if-already-exists keep-date))) + (cond + (preserve-selinux-context + (tramp-compat-funcall + 'copy-file filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context)) + (preserve-uid-gid + (tramp-compat-funcall + 'copy-file filename newname ok-if-already-exists keep-date + preserve-uid-gid)) + (t + (copy-file filename newname ok-if-already-exists keep-date)))) ;; `copy-directory' is a new function in Emacs 23.2. Implementation ;; is taken from there. @@ -281,8 +299,7 @@ (directory newname &optional keep-time parents) "Make a copy of DIRECTORY (compat function)." (if (fboundp 'copy-directory) - (funcall - (symbol-function 'copy-directory) directory newname keep-time parents) + (tramp-compat-funcall 'copy-directory directory newname keep-time parents) ;; If `default-directory' is a remote directory, make sure we find ;; its `copy-directory' handler. @@ -317,16 +334,34 @@ (if keep-time (set-file-times newname (nth 5 (file-attributes directory)))))))) +;; FORCE has been introduced with Emacs 24.1. +(defun tramp-compat-delete-file (filename &optional force) + "Like `delete-file' for Tramp files (compat function)." + (if (null force) + (delete-file filename) + (condition-case nil + (tramp-compat-funcall 'delete-file filename force) + ;; This Emacs version does not support the FORCE flag. Setting + ;; `delete-by-moving-to-trash' shall give us the same effect. + (wrong-number-of-arguments + (let ((delete-by-moving-to-trash + (cond + ((null force) t) + ((boundp 'delete-by-moving-to-trash) + (symbol-value 'delete-by-moving-to-trash)) + (t nil)))) + (delete-file filename)))))) + ;; RECURSIVE has been introduced with Emacs 23.2. (defun tramp-compat-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files (compat function)." (if (null recursive) (delete-directory directory) (condition-case nil - (funcall (symbol-function 'delete-directory) directory recursive) + (tramp-compat-funcall 'delete-directory directory recursive) ;; This Emacs version does not support the RECURSIVE flag. We ;; use the implementation from Emacs 23.2. - (error + (wrong-number-of-arguments (setq directory (directory-file-name (expand-file-name directory))) (if (not (file-symlink-p directory)) (mapc (lambda (file) @@ -342,7 +377,7 @@ (defun tramp-compat-number-sequence (from &optional to inc) "Return a sequence of numbers from FROM to TO as a list (compat function)." (if (or (subrp 'number-sequence) (symbol-file 'number-sequence)) - (funcall (symbol-function 'number-sequence) from to inc) + (tramp-compat-funcall 'number-sequence from to inc) (if (or (not to) (= from to)) (list from) (or inc (setq inc 1)) @@ -372,15 +407,13 @@ (cond ;; GNU Emacs 22 on w32. ((fboundp 'w32-window-exists-p) - (funcall (symbol-function 'w32-window-exists-p) - process-name process-name)) + (tramp-compat-funcall 'w32-window-exists-p process-name process-name)) ;; GNU Emacs 23. ((and (fboundp 'list-system-processes) (fboundp 'process-attributes)) (let (result) - (dolist (pid (funcall (symbol-function 'list-system-processes)) result) - (let ((attributes - (funcall (symbol-function 'process-attributes) pid))) + (dolist (pid (tramp-compat-funcall 'list-system-processes) result) + (let ((attributes (tramp-compat-funcall 'process-attributes pid))) (when (and (string-equal (cdr (assoc 'user attributes)) (user-login-name)) (let ((comm (cdr (assoc 'comm attributes)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-fish.el --- a/lisp/net/tramp-fish.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-fish.el Thu May 13 15:13:52 2010 +0200 @@ -217,7 +217,6 @@ (file-executable-p . tramp-fish-handle-file-executable-p) (file-exists-p . tramp-fish-handle-file-exists-p) (file-local-copy . tramp-fish-handle-file-local-copy) - (file-remote-p . tramp-handle-file-remote-p) (file-modes . tramp-handle-file-modes) (file-name-all-completions . tramp-fish-handle-file-name-all-completions) (file-name-as-directory . tramp-handle-file-name-as-directory) @@ -229,6 +228,8 @@ (file-ownership-preserved-p . ignore) (file-readable-p . tramp-fish-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) + (file-remote-p . tramp-handle-file-remote-p) + ;; `file-selinux-context' performed by default handler. (file-symlink-p . tramp-handle-file-symlink-p) ;; `file-truename' performed by default handler (file-writable-p . tramp-fish-handle-file-writable-p) @@ -243,6 +244,7 @@ (make-symbolic-link . tramp-fish-handle-make-symbolic-link) (rename-file . tramp-fish-handle-rename-file) (set-file-modes . tramp-fish-handle-set-file-modes) + ;; `set-file-selinux-context' performed by default handler. (set-file-times . tramp-fish-handle-set-file-times) (set-visited-file-modtime . ignore) (shell-command . tramp-handle-shell-command) @@ -307,7 +309,8 @@ v1 'file-error "Error with add-name-to-file %s" newname))))) (defun tramp-fish-handle-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files." (tramp-fish-do-copy-or-rename-file 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid)) @@ -329,7 +332,7 @@ (tramp-flush-directory-property v localname) (tramp-fish-send-command-and-check v (format "#RMD %s" localname))))) -(defun tramp-fish-handle-delete-file (filename) +(defun tramp-fish-handle-delete-file (filename &optional force) "Like `delete-file' for Tramp files." (when (file-exists-p filename) (with-parsed-tramp-file-name (expand-file-name filename) nil @@ -655,7 +658,7 @@ localname))))) (tramp-error v 'file-already-exists "File %s already exists" localname) - (delete-file linkname))) + (tramp-compat-delete-file linkname 'force))) ;; If FILENAME is a Tramp name, use just the localname component. (when (tramp-tramp-file-p filename) @@ -834,8 +837,8 @@ ;; Provide error file. (when tmpstderr (rename-file tmpstderr (cadr destination) t)) ;; Cleanup. - (when tmpinput (delete-file tmpinput)) - (when tmpoutput (delete-file tmpoutput)) + (when tmpinput (tramp-compat-delete-file tmpinput 'force)) + (when tmpoutput (tramp-compat-delete-file tmpoutput 'force)) ;; Return exit status. ret))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-ftp.el --- a/lisp/net/tramp-ftp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-ftp.el Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,7 @@ ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, -;; 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Michael Albinus ;; Keywords: comm, processes @@ -182,7 +182,7 @@ (unwind-protect (rename-file tmpfile newname (car args)) ;; Cleanup. - (ignore-errors (delete-file tmpfile))))) + (ignore-errors (tramp-compat-delete-file tmpfile 'force))))) ;; Normally, the handlers must be discarded. ;; `inhibit-file-name-handlers' isn't sufficient, because the diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-gvfs.el --- a/lisp/net/tramp-gvfs.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-gvfs.el Thu May 13 15:13:52 2010 +0200 @@ -386,7 +386,6 @@ (file-executable-p . tramp-gvfs-handle-file-executable-p) (file-exists-p . tramp-gvfs-handle-file-exists-p) (file-local-copy . tramp-gvfs-handle-file-local-copy) - (file-remote-p . tramp-handle-file-remote-p) ;; `file-modes' performed by default handler. (file-name-all-completions . tramp-gvfs-handle-file-name-all-completions) (file-name-as-directory . tramp-handle-file-name-as-directory) @@ -398,6 +397,8 @@ (file-ownership-preserved-p . ignore) (file-readable-p . tramp-gvfs-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) + (file-remote-p . tramp-handle-file-remote-p) + (file-selinux-context . tramp-gvfs-handle-file-selinux-context) (file-symlink-p . tramp-handle-file-symlink-p) ;; `file-truename' performed by default handler. (file-writable-p . tramp-gvfs-handle-file-writable-p) @@ -413,6 +414,7 @@ (process-file . tramp-gvfs-handle-process-file) (rename-file . tramp-gvfs-handle-rename-file) (set-file-modes . tramp-gvfs-handle-set-file-modes) + (set-file-selinux-context . tramp-gvfs-handle-set-file-selinux-context) (set-visited-file-modtime . tramp-gvfs-handle-set-visited-file-modtime) (shell-command . tramp-gvfs-handle-shell-command) (start-file-process . tramp-gvfs-handle-start-file-process) @@ -510,25 +512,30 @@ ;; File name primitives. (defun tramp-gvfs-handle-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files." - (copy-file - (if (tramp-gvfs-file-name-p filename) - (tramp-gvfs-fuse-file-name filename) - filename) - (if (tramp-gvfs-file-name-p newname) - (tramp-gvfs-fuse-file-name newname) - newname) - ok-if-already-exists keep-date preserve-uid-gid)) + (let ((args + (list + (if (tramp-gvfs-file-name-p filename) + (tramp-gvfs-fuse-file-name filename) + filename) + (if (tramp-gvfs-file-name-p newname) + (tramp-gvfs-fuse-file-name newname) + newname) + ok-if-already-exists keep-date preserve-uid-gid))) + (when preserve-selinux-context + (setq args (append args (list preserve-selinux-context)))) + (apply 'copy-file args))) (defun tramp-gvfs-handle-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files." (tramp-compat-delete-directory (tramp-gvfs-fuse-file-name directory) recursive)) -(defun tramp-gvfs-handle-delete-file (filename) +(defun tramp-gvfs-handle-delete-file (filename &optional force) "Like `delete-file' for Tramp files." - (delete-file (tramp-gvfs-fuse-file-name filename))) + (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) force)) (defun tramp-gvfs-handle-directory-files (directory &optional full match nosort) @@ -620,6 +627,11 @@ "Like `file-readable-p' for Tramp files." (file-readable-p (tramp-gvfs-fuse-file-name filename))) +(defun tramp-gvfs-handle-file-selinux-context (filename) + "Like `file-selinux-context' for Tramp files." + (tramp-compat-funcall + 'file-selinux-context (tramp-gvfs-fuse-file-name filename))) + (defun tramp-gvfs-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." (file-writable-p (tramp-gvfs-fuse-file-name filename))) @@ -682,6 +694,11 @@ (with-tramp-gvfs-error-message filename 'set-file-modes (tramp-gvfs-fuse-file-name filename) mode)) +(defun tramp-gvfs-handle-set-file-selinux-context (filename context) + "Like `set-file-selinux-context' for Tramp files." + (with-tramp-gvfs-error-message filename 'set-file-selinux-context + (tramp-gvfs-fuse-file-name filename) context)) + (defun tramp-gvfs-handle-set-visited-file-modtime (&optional time-list) "Like `set-visited-file-modtime' for Tramp files." (let ((buffer-file-name (tramp-gvfs-fuse-file-name (buffer-file-name)))) @@ -725,7 +742,7 @@ "gvfs-save" tmpfile (tramp-get-buffer v) nil (tramp-gvfs-url-file-name filename))) (signal (car err) (cdr err))) - (delete-file tmpfile))))) + (tramp-compat-delete-file tmpfile 'force))))) ;; Set file modification time. (when (or (eq visit t) (stringp visit)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-imap.el --- a/lisp/net/tramp-imap.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-imap.el Thu May 13 15:13:52 2010 +0200 @@ -63,6 +63,7 @@ (autoload 'epg-context-set-progress-callback "epg") (autoload 'epg-decrypt-string "epg") (autoload 'epg-encrypt-string "epg") +(autoload 'epg-make-context "epg") (autoload 'imap-hash-get "imap-hash") (autoload 'imap-hash-make "imap-hash") (autoload 'imap-hash-map "imap-hash") @@ -124,7 +125,6 @@ (file-executable-p . tramp-imap-handle-file-executable-p) (file-exists-p . tramp-imap-handle-file-exists-p) (file-local-copy . tramp-imap-handle-file-local-copy) - (file-remote-p . tramp-handle-file-remote-p) (file-modes . tramp-handle-file-modes) (file-name-all-completions . tramp-imap-handle-file-name-all-completions) (file-name-as-directory . tramp-handle-file-name-as-directory) @@ -136,6 +136,8 @@ (file-ownership-preserved-p . ignore) (file-readable-p . tramp-imap-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) + (file-remote-p . tramp-handle-file-remote-p) + ;; `file-selinux-context' performed by default handler. (file-symlink-p . tramp-handle-file-symlink-p) ;; `file-truename' performed by default handler (file-writable-p . tramp-imap-handle-file-writable-p) @@ -150,6 +152,7 @@ (make-symbolic-link . ignore) (rename-file . tramp-imap-handle-rename-file) (set-file-modes . ignore) + ;; `set-file-selinux-context' performed by default handler. (set-file-times . ignore) ;; tramp-imap-handle-set-file-times) (set-visited-file-modtime . ignore) (shell-command . ignore) @@ -200,7 +203,8 @@ (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler)) (defun tramp-imap-handle-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files." (tramp-imap-do-copy-or-rename-file 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid)) @@ -265,7 +269,7 @@ (tramp-message v 0 "Transferring %s to %s...done" filename newname)) (when (eq op 'rename) - (delete-file filename)))) + (tramp-compat-delete-file filename 'force)))) ;; TODO: revise this much (defun tramp-imap-handle-expand-file-name (name &optional dir) @@ -550,7 +554,7 @@ ;; (file-exists-p (file-name-directory filename))) (file-directory-p (file-name-directory filename))) -(defun tramp-imap-handle-delete-file (filename) +(defun tramp-imap-handle-delete-file (filename &optional force) "Like `delete-file' for Tramp files." (cond ((not (file-exists-p filename)) nil) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp-smb.el --- a/lisp/net/tramp-smb.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp-smb.el Thu May 13 15:13:52 2010 +0200 @@ -164,7 +164,6 @@ (file-executable-p . tramp-smb-handle-file-exists-p) (file-exists-p . tramp-smb-handle-file-exists-p) (file-local-copy . tramp-smb-handle-file-local-copy) - (file-remote-p . tramp-handle-file-remote-p) (file-modes . tramp-handle-file-modes) (file-name-all-completions . tramp-smb-handle-file-name-all-completions) (file-name-as-directory . tramp-handle-file-name-as-directory) @@ -176,6 +175,8 @@ (file-ownership-preserved-p . ignore) (file-readable-p . tramp-smb-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) + (file-remote-p . tramp-handle-file-remote-p) + ;; `file-selinux-context' performed by default handler. (file-symlink-p . tramp-handle-file-symlink-p) ;; `file-truename' performed by default handler. (file-writable-p . tramp-smb-handle-file-writable-p) @@ -190,6 +191,7 @@ (make-symbolic-link . tramp-smb-handle-make-symbolic-link) (rename-file . tramp-smb-handle-rename-file) (set-file-modes . tramp-smb-handle-set-file-modes) + ;; `set-file-selinux-context' performed by default handler. (set-file-times . ignore) (set-visited-file-modtime . ignore) (shell-command . ignore) @@ -325,7 +327,8 @@ 'copy-directory (list dirname newname keep-date parents))))))) (defun tramp-smb-handle-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files. KEEP-DATE is not handled in case NEWNAME resides on an SMB server. PRESERVE-UID-GID is completely ignored." @@ -339,7 +342,7 @@ (condition-case err (rename-file tmpfile newname ok-if-already-exists) ((error quit) - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (signal (car err) (cdr err)))) ;; Remote newname. @@ -401,7 +404,7 @@ (tramp-error v 'file-error "%s `%s'" (match-string 0) directory)))))) -(defun tramp-smb-handle-delete-file (filename) +(defun tramp-smb-handle-delete-file (filename &optional force) "Like `delete-file' for Tramp files." (setq filename (expand-file-name filename)) (when (file-exists-p filename) @@ -608,7 +611,7 @@ (tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile) ;; Oops, an error. We shall cleanup. - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (tramp-error v 'file-error "Cannot make local copy of file `%s'" filename)) tmpfile))) @@ -855,7 +858,7 @@ (condition-case err (rename-file tmpfile newname ok-if-already-exists) ((error quit) - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (signal (car err) (cdr err)))) ;; Remote newname. @@ -878,7 +881,7 @@ v 0 "Copying file %s to file %s...done" filename newname) (tramp-error v 'file-error "Cannot rename `%s'" filename))))) - (delete-file filename)) + (tramp-compat-delete-file filename 'force)) (defun tramp-smb-handle-set-file-modes (filename mode) "Like `set-file-modes' for Tramp files." @@ -942,7 +945,7 @@ (tramp-message v 5 "Writing tmp file %s to file %s...done" tmpfile filename) (tramp-error v 'file-error "Cannot write `%s'" filename)) - (delete-file tmpfile)) + (tramp-compat-delete-file tmpfile 'force)) (unless (equal curbuf (current-buffer)) (tramp-error diff -r e56f669f17ce -r fe07c47cf7a7 lisp/net/tramp.el --- a/lisp/net/tramp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/net/tramp.el Thu May 13 15:13:52 2010 +0200 @@ -145,7 +145,7 @@ ;; this would load dbus.el. (when (and (featurep 'dbusbind) (condition-case nil - (funcall 'dbus-get-unique-name :session) + (tramp-compat-funcall 'dbus-get-unique-name :session) (error nil)) (tramp-compat-process-running-p "gvfs-fuse-daemon")) 'tramp-gvfs) @@ -285,10 +285,19 @@ :group 'tramp :type 'string) +(defcustom tramp-inline-compress-start-size 4096 + "*The minimum size of compressing where inline transfer. +When inline transfer, compress transfered data of file +whose size is this value or above (up to `tramp-copy-size-limit'). +If it is nil, no compression at all will be applied." + :group 'tramp + :type '(choice (const nil) integer)) + (defcustom tramp-copy-size-limit 10240 - "*The maximum file size where inline copying is preferred over an out-of-the-band copy." + "*The maximum file size where inline copying is preferred over an out-of-the-band copy. +If it is nil, inline out-of-the-band copy will be used without a check." :group 'tramp - :type 'integer) + :type '(choice (const nil) integer)) (defcustom tramp-terminal-type "dumb" "*Value of TERM environment variable for logging in to remote host. @@ -323,7 +332,7 @@ (tramp-copy-recursive t) (tramp-password-end-of-line nil)) ("scp" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -338,7 +347,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scp1" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-1" "-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -353,7 +362,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scp2" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-2" "-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -438,7 +447,7 @@ (tramp-copy-keep-date nil) (tramp-password-end-of-line nil)) ("ssh" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -451,7 +460,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("ssh1" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-1" "-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -464,7 +473,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("ssh2" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-2" "-e" "none"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -526,7 +535,7 @@ (tramp-copy-keep-date nil) (tramp-password-end-of-line nil)) ("scpc" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-o" "ControlPath=%t.%%r@%%h:%%p") ("-o" "ControlMaster=yes") ("-e" "none"))) @@ -543,7 +552,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scpx" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-e" "none" "-t" "-t" "/bin/sh"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -556,7 +565,7 @@ ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("sshx" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") + (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-e" "none" "-t" "-t" "/bin/sh"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -723,6 +732,16 @@ `localhost' or the name of the local host. Another host name is useful only in combination with `tramp-default-proxies-alist'.") +(defun tramp-detect-ssh-controlmaster () + "Call ssh to detect whether it supports the ControlMaster argument. +This function may return nil when the argument is supported, but +shouldn't return t when it isn't." + (ignore-errors + (with-temp-buffer + (call-process "ssh" nil t nil "-o" "ControlMaster") + (goto-char (point-min)) + (search-forward-regexp "Missing ControlMaster argument" nil t)))) + (defcustom tramp-default-method ;; An external copy method seems to be preferred, because it is much ;; more performant for large files, and it hasn't too serious delays @@ -730,9 +749,8 @@ ;; permanent password queries. Either a password agent like ;; "ssh-agent" or "Pageant" shall run, or the optional ;; password-cache.el or auth-sources.el packages shall be active for - ;; password caching. "scpc" would be another good choice because of - ;; the "ControlMaster" option, but this is a more modern alternative - ;; in OpenSSH 4, which cannot be taken as default. + ;; password caching. "scpc" is chosen if we detect that the user is + ;; running OpenSSH 4.0 or newer. (cond ;; PuTTY is installed. ((executable-find "pscp") @@ -744,13 +762,15 @@ "plink")) ;; There is an ssh installation. ((executable-find "scp") - (if (or (fboundp 'password-read) - (fboundp 'auth-source-user-or-password) - ;; ssh-agent is running. - (getenv "SSH_AUTH_SOCK") - (getenv "SSH_AGENT_PID")) - "scp" - "ssh")) + (cond + ((tramp-detect-ssh-controlmaster) "scpc") + ((or (fboundp 'password-read) + (fboundp 'auth-source-user-or-password) + ;; ssh-agent is running. + (getenv "SSH_AUTH_SOCK") + (getenv "SSH_AGENT_PID")) + "scp") + (t "ssh"))) ;; Fallback. (t "ftp")) "*Default method to use for transferring files. @@ -2025,6 +2045,8 @@ (dired-uncache . tramp-handle-dired-uncache) (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime) + (file-selinux-context . tramp-handle-file-selinux-context) + (set-file-selinux-context . tramp-handle-set-file-selinux-context) (vc-registered . tramp-handle-vc-registered)) "Alist of handler functions. Operations not mentioned here will be handled by the normal Emacs functions.") @@ -2170,7 +2192,9 @@ (save-window-excursion (unwind-protect (apply 'tramp-error vec-or-proc signal fmt-string args) - (when (and vec-or-proc (not (zerop tramp-verbose))) + (when (and vec-or-proc + (not (zerop tramp-verbose)) + (not (tramp-completion-mode-p))) (let ((enable-recursive-minibuffers t)) (pop-to-buffer (or (and (bufferp buffer) buffer) @@ -2227,7 +2251,7 @@ (font-lock-add-keywords 'emacs-lisp-mode '("\\")) (defmacro with-connection-property (key property &rest body) - "Checks in Tramp for property PROPERTY, otherwise executes BODY and set." + "Check in Tramp for property PROPERTY, otherwise executes BODY and set." `(let ((value (tramp-get-connection-property ,key ,property 'undef))) (when (eq value 'undef) ;; We cannot pass ,@body as parameter to @@ -2241,7 +2265,29 @@ (put 'with-connection-property 'edebug-form-spec t) (font-lock-add-keywords 'emacs-lisp-mode '("\\")) -(eval-and-compile ; silence compiler +(defmacro with-progress-reporter (vec level message &rest body) + "Executes BODY, spinning a progress reporter with MESSAGE." + `(let (pr tm) + (tramp-message ,vec ,level "%s..." ,message) + ;; We start a pulsing progress reporter after 3 seconds. Feature + ;; introduced in Emacs 24.1. + (when (<= ,level tramp-verbose) + (condition-case nil + (setq pr (tramp-compat-funcall 'make-progress-reporter ,message) + tm (if pr (run-at-time 3 0.1 'progress-reporter-update pr))) + (error nil))) + (unwind-protect + ;; Execute the body. + (progn ,@body) + ;; Stop progress reporter. + (if tm (tramp-compat-funcall 'cancel-timer tm)) + (tramp-message ,vec ,level "%s...done" ,message)))) + +(put 'with-progress-reporter 'lisp-indent-function 3) +(put 'with-progress-reporter 'edebug-form-spec t) +(font-lock-add-keywords 'emacs-lisp-mode '("\\")) + +(eval-and-compile ;; Silence compiler. (if (memq system-type '(cygwin windows-nt)) (defun tramp-drop-volume-letter (name) "Cut off unnecessary drive letter from file NAME. @@ -2351,15 +2397,16 @@ special handling of `substitute-in-file-name'." (when (symbol-value 'minibuffer-completing-file-name) (setq tramp-rfn-eshadow-overlay - (funcall (symbol-function 'make-overlay) - (funcall (symbol-function 'minibuffer-prompt-end)) - (funcall (symbol-function 'minibuffer-prompt-end)))) + (tramp-compat-funcall + 'make-overlay + (tramp-compat-funcall 'minibuffer-prompt-end) + (tramp-compat-funcall 'minibuffer-prompt-end))) ;; Copy rfn-eshadow-overlay properties. - (let ((props (funcall (symbol-function 'overlay-properties) - (symbol-value 'rfn-eshadow-overlay)))) + (let ((props (tramp-compat-funcall + 'overlay-properties (symbol-value 'rfn-eshadow-overlay)))) (while props - (funcall (symbol-function 'overlay-put) - tramp-rfn-eshadow-overlay (pop props) (pop props)))))) + (tramp-compat-funcall + 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props)))))) (when (boundp 'rfn-eshadow-setup-minibuffer-hook) (add-hook 'rfn-eshadow-setup-minibuffer-hook @@ -2378,10 +2425,12 @@ `file-name-shadow-mode'; the minibuffer should have already been set up by `rfn-eshadow-setup-minibuffer'." ;; In remote files name, there is a shadowing just for the local part. - (let ((end (or (funcall (symbol-function 'overlay-end) - (symbol-value 'rfn-eshadow-overlay)) - (funcall (symbol-function 'minibuffer-prompt-end))))) - (when (file-remote-p (buffer-substring-no-properties end (point-max))) + (let ((end (or (tramp-compat-funcall + 'overlay-end (symbol-value 'rfn-eshadow-overlay)) + (tramp-compat-funcall 'minibuffer-prompt-end)))) + (when + (file-remote-p + (tramp-compat-funcall 'buffer-substring-no-properties end (point-max))) (save-excursion (save-restriction (narrow-to-region @@ -2391,8 +2440,9 @@ (point-max)) (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) (rfn-eshadow-update-overlay-hook nil)) - (move-overlay rfn-eshadow-overlay (point-max) (point-max)) - (funcall (symbol-function 'rfn-eshadow-update-overlay)))))))) + (tramp-compat-funcall + 'move-overlay rfn-eshadow-overlay (point-max) (point-max)) + (tramp-compat-funcall 'rfn-eshadow-update-overlay))))))) (when (boundp 'rfn-eshadow-update-overlay-hook) (add-hook 'rfn-eshadow-update-overlay-hook @@ -2465,7 +2515,7 @@ l-localname))))) (tramp-error l 'file-already-exists "File %s already exists" l-localname) - (delete-file linkname))) + (tramp-compat-delete-file linkname 'force))) ;; If FILENAME is a Tramp name, use just the localname component. (when (tramp-tramp-file-p filename) @@ -2513,7 +2563,7 @@ ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. (unwind-protect (load local-copy noerror t t) - (delete-file local-copy))) + (tramp-compat-delete-file local-copy 'force))) (unless nomessage (tramp-message v 0 "Loading %s...done" file)) t))) @@ -2817,7 +2867,9 @@ (tramp-send-command-and-read vec (format - "((%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' %s || echo nil)" + ;; On Opsware, pdksh (which is the true name of ksh there) doesn't + ;; parse correctly the sequence "((". Therefore, we add a space. + "( (%s %s || %s -h %s) && %s -c '( (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' %s || echo nil)" (tramp-get-file-exists-command vec) (tramp-shell-quote-argument localname) (tramp-get-test-command vec) @@ -2870,12 +2922,14 @@ function directly, unless those two cases are already taken care of." (with-current-buffer buf - ;; There is no file visiting the buffer, or the buffer has no - ;; recorded last modification time. - (if (or (not (buffer-file-name)) - (eq (visited-file-modtime) 0)) - t - (let ((f (buffer-file-name))) + (let ((f (buffer-file-name))) + ;; There is no file visiting the buffer, or the buffer has no + ;; recorded last modification time, or there is no established + ;; connection. + (if (or (not f) + (eq (visited-file-modtime) 0) + (not (tramp-file-name-handler 'file-remote-p f nil 'connected))) + t (with-parsed-tramp-file-name f nil (tramp-flush-file-property v localname) (let* ((attr (file-attributes f)) @@ -2934,17 +2988,11 @@ (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time)) - (utc - ;; With GNU Emacs, `format-time-string' has an - ;; optional parameter UNIVERSAL. This is preferred, - ;; because we could handle the case when the remote - ;; host is located in a different time zone as the - ;; local host. - (and (functionp 'subr-arity) - (subrp (symbol-function 'format-time-string)) - (= 3 (cdr (funcall (symbol-function 'subr-arity) - (symbol-function - 'format-time-string))))))) + ;; With GNU Emacs, `format-time-string' has an optional + ;; parameter UNIVERSAL. This is preferred, because we + ;; could handle the case when the remote host is + ;; located in a different time zone as the local host. + (utc (not (featurep 'xemacs)))) (tramp-send-command-and-check v (format "%s touch -t %s %s" (if utc "TZ=UTC; export TZ;" "") @@ -2993,6 +3041,59 @@ "chown" nil nil nil (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) +(defun tramp-remote-selinux-p (vec) + "Check, whether SELINUX is enabled on the remote host." + (with-connection-property (tramp-get-connection-process vec) "selinux-p" + (let ((result (tramp-find-executable + vec "getenforce" (tramp-get-remote-path vec) t t))) + (and result + (string-equal + (tramp-send-command-and-read + vec (format "echo \\\"`%S`\\\"" result)) + "Enforcing"))))) + +(defun tramp-handle-file-selinux-context (filename) + "Like `file-selinux-context' for Tramp files." + (with-parsed-tramp-file-name filename nil + (with-file-property v localname "file-selinux-context" + (let ((context '(nil nil nil nil)) + (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):" + "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))) + (when (and (tramp-remote-selinux-p v) + (zerop (tramp-send-command-and-check + v (format + "%s -d -Z %s" + (tramp-get-ls-command v) + (tramp-shell-quote-argument localname))))) + (with-current-buffer (tramp-get-connection-buffer v) + (goto-char (point-min)) + (when (re-search-forward regexp (tramp-compat-line-end-position) t) + (setq context (list (match-string 1) (match-string 2) + (match-string 3) (match-string 4)))))) + ;; Return the context. + context)))) + +(defun tramp-handle-set-file-selinux-context (filename context) + "Like `set-file-selinux-context' for Tramp files." + (with-parsed-tramp-file-name filename nil + (if (and (consp context) + (tramp-remote-selinux-p v) + (zerop (tramp-send-command-and-check + v (format "chcon %s %s %s %s %s" + (if (stringp (nth 0 context)) + (format "--user=%s" (nth 0 context)) "") + (if (stringp (nth 1 context)) + (format "--role=%s" (nth 1 context)) "") + (if (stringp (nth 2 context)) + (format "--type=%s" (nth 2 context)) "") + (if (stringp (nth 3 context)) + (format "--range=%s" (nth 3 context)) "") + (tramp-shell-quote-argument localname))))) + (tramp-set-file-property v localname "file-selinux-context" context) + (tramp-set-file-property v localname "file-selinux-context" 'undef))) + ;; We always return nil. + nil) + ;; Simple functions using the `test' command. (defun tramp-handle-file-executable-p (filename) @@ -3435,10 +3536,9 @@ (buffer-name)))))) (defun tramp-handle-copy-file - (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files." - ;; Check if both files are local -- invoke normal copy-file. - ;; Otherwise, use Tramp from local system. (setq filename (expand-file-name filename)) (setq newname (expand-file-name newname)) (cond @@ -3446,8 +3546,14 @@ ((or (tramp-tramp-file-p filename) (tramp-tramp-file-p newname)) (tramp-do-copy-or-rename-file - 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid)) + 'copy filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context)) ;; Compat section. + (preserve-selinux-context + (tramp-run-real-handler + 'copy-file + (list filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context))) (preserve-uid-gid (tramp-run-real-handler 'copy-file @@ -3508,7 +3614,8 @@ 'rename-file (list filename newname ok-if-already-exists)))) (defun tramp-do-copy-or-rename-file - (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) + (op filename newname &optional ok-if-already-exists keep-date + preserve-uid-gid preserve-selinux-context) "Copy or rename a remote file. OP must be `copy' or `rename' and indicates the operation to perform. FILENAME specifies the file to copy or rename, NEWNAME is the name of @@ -3517,6 +3624,7 @@ KEEP-DATE means to make sure that NEWNAME has the same timestamp as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep the uid and gid if both files are on the same host. +PRESERVE-SELINUX-CONTEXT activates selinux commands. This function is invoked by `tramp-handle-copy-file' and `tramp-handle-rename-file'. It is an error if OP is neither of `copy' @@ -3525,6 +3633,8 @@ (error "Unknown operation `%s', must be `copy' or `rename'" op)) (let ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname)) + (context (and preserve-selinux-context + (apply 'file-selinux-context (list filename)))) pr tm) (when (and (not ok-if-already-exists) (file-exists-p newname)) @@ -3533,91 +3643,79 @@ v 'file-already-exists "File %s already exists" newname))) (with-parsed-tramp-file-name (if t1 filename newname) nil - (tramp-message v 0 "Transferring %s to %s..." filename newname)) - - ;; We start a pulsing progress reporter. Introduced in Emacs 24.1. - (when (> (nth 7 (file-attributes filename)) tramp-copy-size-limit) - (condition-case nil - (setq pr (funcall - 'make-progress-reporter - (format "Transferring %s to %s..." filename newname)) - tm (run-at-time 0 0.1 'progress-reporter-update pr)) - (error nil))) - - (unwind-protect - (cond - ;; Both are Tramp files. - ((and t1 t2) - (with-parsed-tramp-file-name filename v1 - (with-parsed-tramp-file-name newname v2 - (cond - ;; Shortcut: if method, host, user are the same for both - ;; files, we invoke `cp' or `mv' on the remote host - ;; directly. - ((tramp-equal-remote filename newname) - (tramp-do-copy-or-rename-file-directly - op filename newname - ok-if-already-exists keep-date preserve-uid-gid)) - - ;; Try out-of-band operation. - ((tramp-method-out-of-band-p - v1 (nth 7 (file-attributes filename))) - (tramp-do-copy-or-rename-file-out-of-band - op filename newname keep-date)) - - ;; No shortcut was possible. So we copy the - ;; file first. If the operation was `rename', we go - ;; back and delete the original file (if the copy was - ;; successful). The approach is simple-minded: we - ;; create a new buffer, insert the contents of the - ;; source file into it, then write out the buffer to - ;; the target file. The advantage is that it doesn't - ;; matter which filename handlers are used for the - ;; source and target file. - (t - (tramp-do-copy-or-rename-file-via-buffer - op filename newname keep-date)))))) - - ;; One file is a Tramp file, the other one is local. - ((or t1 t2) - (with-parsed-tramp-file-name (if t1 filename newname) nil - (cond - ;; Fast track on local machine. - ((tramp-local-host-p v) - (tramp-do-copy-or-rename-file-directly - op filename newname - ok-if-already-exists keep-date preserve-uid-gid)) - - ;; If the Tramp file has an out-of-band method, the corresponding - ;; copy-program can be invoked. - ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename))) - (tramp-do-copy-or-rename-file-out-of-band - op filename newname keep-date)) - - ;; Use the inline method via a Tramp buffer. - (t (tramp-do-copy-or-rename-file-via-buffer - op filename newname keep-date))))) - - (t - ;; One of them must be a Tramp file. - (error "Tramp implementation says this cannot happen"))) - - ;; In case of `rename', we must flush the cache of the source file. - (when (and t1 (eq op 'rename)) - (with-parsed-tramp-file-name filename nil - (tramp-flush-file-property v (file-name-directory localname)) - (tramp-flush-file-property v localname))) - - ;; When newname did exist, we have wrong cached values. - (when t2 - (with-parsed-tramp-file-name newname nil - (tramp-flush-file-property v (file-name-directory localname)) - (tramp-flush-file-property v localname))) - - ;; Stop progress reporter. - (if tm (cancel-timer tm)) - (with-parsed-tramp-file-name (if t1 filename newname) nil - (tramp-message v 0 "Transferring %s to %s...done" filename newname))))) + (with-progress-reporter + v 0 (format "Transferring %s to %s" filename newname) + + (cond + ;; Both are Tramp files. + ((and t1 t2) + (with-parsed-tramp-file-name filename v1 + (with-parsed-tramp-file-name newname v2 + (cond + ;; Shortcut: if method, host, user are the same for both + ;; files, we invoke `cp' or `mv' on the remote host + ;; directly. + ((tramp-equal-remote filename newname) + (tramp-do-copy-or-rename-file-directly + op filename newname + ok-if-already-exists keep-date preserve-uid-gid)) + + ;; Try out-of-band operation. + ((tramp-method-out-of-band-p + v1 (nth 7 (file-attributes filename))) + (tramp-do-copy-or-rename-file-out-of-band + op filename newname keep-date)) + + ;; No shortcut was possible. So we copy the + ;; file first. If the operation was `rename', we go + ;; back and delete the original file (if the copy was + ;; successful). The approach is simple-minded: we + ;; create a new buffer, insert the contents of the + ;; source file into it, then write out the buffer to + ;; the target file. The advantage is that it doesn't + ;; matter which filename handlers are used for the + ;; source and target file. + (t + (tramp-do-copy-or-rename-file-via-buffer + op filename newname keep-date)))))) + + ;; One file is a Tramp file, the other one is local. + ((or t1 t2) + (cond + ;; Fast track on local machine. + ((tramp-local-host-p v) + (tramp-do-copy-or-rename-file-directly + op filename newname + ok-if-already-exists keep-date preserve-uid-gid)) + + ;; If the Tramp file has an out-of-band method, the corresponding + ;; copy-program can be invoked. + ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename))) + (tramp-do-copy-or-rename-file-out-of-band + op filename newname keep-date)) + + ;; Use the inline method via a Tramp buffer. + (t (tramp-do-copy-or-rename-file-via-buffer + op filename newname keep-date)))) + + (t + ;; One of them must be a Tramp file. + (error "Tramp implementation says this cannot happen"))) + + ;; Handle `preserve-selinux-context'. + (when context (apply 'set-file-selinux-context (list newname context))) + + ;; In case of `rename', we must flush the cache of the source file. + (when (and t1 (eq op 'rename)) + (with-parsed-tramp-file-name filename v1 + (tramp-flush-file-property v1 (file-name-directory localname)) + (tramp-flush-file-property v1 localname))) + + ;; When newname did exist, we have wrong cached values. + (when t2 + (with-parsed-tramp-file-name newname v2 + (tramp-flush-file-property v2 (file-name-directory localname)) + (tramp-flush-file-property v2 localname))))))) (defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date) "Use an Emacs buffer to copy or rename a file. @@ -3641,7 +3739,7 @@ ;; Set the mode. (set-file-modes newname (tramp-default-file-modes filename)) ;; If the operation was `rename', delete the original file. - (unless (eq op 'copy) (delete-file filename))) + (unless (eq op 'copy) (tramp-compat-delete-file filename 'force))) (defun tramp-do-copy-or-rename-file-directly (op filename newname ok-if-already-exists keep-date preserve-uid-gid) @@ -3796,7 +3894,7 @@ ;; Save exit. (condition-case nil - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (error))))))))) ;; Set the time and mode. Mask possible errors. @@ -3836,7 +3934,7 @@ (if dir-flag (tramp-compat-delete-directory (expand-file-name ".." tmpfile) 'recursive) - (delete-file tmpfile)) + (tramp-compat-delete-file tmpfile 'force)) (error)))) ;; Expand hops. Might be necessary for gateway methods. @@ -3954,7 +4052,7 @@ ;; If the operation was `rename', delete the original file. (unless (eq op 'copy) (if (file-regular-p filename) - (delete-file filename) + (tramp-compat-delete-file filename 'force) (tramp-compat-delete-directory filename 'recursive)))))) (defun tramp-handle-make-directory (dir &optional parents) @@ -3984,7 +4082,7 @@ (tramp-shell-quote-argument localname)))) (tramp-error v 'file-error "Couldn't delete %s" directory)))) -(defun tramp-handle-delete-file (filename) +(defun tramp-handle-delete-file (filename &optional force) "Like `delete-file' for Tramp files." (setq filename (expand-file-name filename)) (with-parsed-tramp-file-name filename nil @@ -4055,30 +4153,30 @@ nil) ((and suffix (nth 2 suffix)) ;; We found an uncompression rule. - (tramp-message v 0 "Uncompressing %s..." file) - (when (zerop (tramp-send-command-and-check - v (concat (nth 2 suffix) " " - (tramp-shell-quote-argument localname)))) - (tramp-message v 0 "Uncompressing %s...done" file) - ;; `dired-remove-file' is not defined in XEmacs - (funcall (symbol-function 'dired-remove-file) file) - (string-match (car suffix) file) - (concat (substring file 0 (match-beginning 0))))) + (with-progress-reporter v 0 (format "Uncompressing %s..." file) + (when (zerop + (tramp-send-command-and-check + v (concat (nth 2 suffix) " " + (tramp-shell-quote-argument localname)))) + ;; `dired-remove-file' is not defined in XEmacs. + (tramp-compat-funcall 'dired-remove-file file) + (string-match (car suffix) file) + (concat (substring file 0 (match-beginning 0)))))) (t ;; We don't recognize the file as compressed, so compress it. ;; Try gzip. - (tramp-message v 0 "Compressing %s..." file) - (when (zerop (tramp-send-command-and-check - v (concat "gzip -f " - (tramp-shell-quote-argument localname)))) - (tramp-message v 0 "Compressing %s...done" file) - ;; `dired-remove-file' is not defined in XEmacs - (funcall (symbol-function 'dired-remove-file) file) - (cond ((file-exists-p (concat file ".gz")) - (concat file ".gz")) - ((file-exists-p (concat file ".z")) - (concat file ".z")) - (t nil))))))))) + (with-progress-reporter v 0 (format "Compressing %s..." file) + (when (zerop + (tramp-send-command-and-check + v (concat "gzip -f " + (tramp-shell-quote-argument localname)))) + ;; `dired-remove-file' is not defined in XEmacs. + (tramp-compat-funcall 'dired-remove-file file) + (cond ((file-exists-p (concat file ".gz")) + (concat file ".gz")) + ((file-exists-p (concat file ".z")) + (concat file ".z")) + (t nil)))))))))) (defun tramp-handle-dired-uncache (dir &optional dir-p) "Like `dired-uncache' for Tramp files." @@ -4223,7 +4321,7 @@ (unless (file-name-absolute-p name) (setq name (concat (file-name-as-directory dir) name))) ;; If NAME is not a Tramp file, run the real handler. - (if (not (tramp-tramp-file-p name)) + (if (not (tramp-connectable-p name)) (tramp-run-real-handler 'expand-file-name (list name nil)) ;; Dissect NAME. (with-parsed-tramp-file-name name nil @@ -4503,7 +4601,7 @@ ;; Cleanup. We remove all file cache values for the connection, ;; because the remote process could have changed them. - (when tmpinput (delete-file tmpinput)) + (when tmpinput (tramp-compat-delete-file tmpinput 'force)) ;; `process-file-side-effects' has been introduced with GNU ;; Emacs 23.2. If set to `nil', no remote file will be changed @@ -4540,7 +4638,7 @@ (when delete (delete-region start end)) (unwind-protect (apply 'call-process program tmpfile buffer display args) - (delete-file tmpfile)))) + (tramp-compat-delete-file tmpfile 'force)))) (defun tramp-handle-shell-command (command &optional output-buffer error-buffer) @@ -4605,7 +4703,7 @@ (when (listp buffer) (with-current-buffer error-buffer (insert-file-contents (cadr buffer))) - (delete-file (cadr buffer))) + (tramp-compat-delete-file (cadr buffer) 'force)) (if current-buffer-p ;; This is like exchange-point-and-mark, but doesn't ;; activate the mark. It is cleaner to avoid activation, @@ -4617,8 +4715,7 @@ ;; There's some output, display it. (when (with-current-buffer output-buffer (> (point-max) (point-min))) (if (functionp 'display-message-or-buffer) - (funcall (symbol-function 'display-message-or-buffer) - output-buffer) + (tramp-compat-funcall 'display-message-or-buffer output-buffer) (pop-to-buffer output-buffer)))))))) ;; File Editing. @@ -4635,16 +4732,16 @@ v 'file-error "Cannot make local copy of non-existing file `%s'" filename)) - (let ((rem-enc (tramp-get-remote-coding v "remote-encoding")) - (loc-dec (tramp-get-local-coding v "local-decoding")) - (tmpfile (tramp-compat-make-temp-file filename))) + (let* ((size (nth 7 (file-attributes filename))) + (rem-enc (tramp-get-inline-coding v "remote-encoding" size)) + (loc-dec (tramp-get-inline-coding v "local-decoding" size)) + (tmpfile (tramp-compat-make-temp-file filename))) (condition-case err (cond ;; `copy-file' handles direct copy and out-of-band methods. ((or (tramp-local-host-p v) - (tramp-method-out-of-band-p - v (nth 7 (file-attributes filename)))) + (tramp-method-out-of-band-p v size)) (copy-file filename tmpfile t t)) ;; Use inline encoding for file transfer. @@ -4652,12 +4749,11 @@ (save-excursion (tramp-message v 5 "Encoding remote file %s..." filename) (tramp-barf-unless-okay - v - (format "%s < %s" rem-enc (tramp-shell-quote-argument localname)) + v (format rem-enc (tramp-shell-quote-argument localname)) "Encoding remote file failed") (tramp-message v 5 "Encoding remote file %s...done" filename) - (if (and (symbolp loc-dec) (fboundp loc-dec)) + (if (functionp loc-dec) ;; If local decoding is a function, we call it. We ;; must disable multibyte, because ;; `uudecode-decode-region' doesn't handle it @@ -4688,7 +4784,7 @@ filename loc-dec) (unwind-protect (tramp-call-local-coding-command loc-dec tmpfile2 tmpfile) - (delete-file tmpfile2)))) + (tramp-compat-delete-file tmpfile2 'force)))) (tramp-message v 5 "Decoding remote file %s...done" filename) ;; Set proper permissions. @@ -4702,7 +4798,7 @@ ;; Error handling. ((error quit) - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (signal (car err) (cdr err)))) (run-hooks 'tramp-handle-file-local-copy-hook) @@ -4848,10 +4944,11 @@ (set-buffer-modified-p nil)) (when (and (stringp local-copy) (or remote-copy (null tramp-temp-buffer-file-name))) - (delete-file local-copy)) + (tramp-compat-delete-file local-copy 'force)) (when (stringp remote-copy) - (delete-file - (tramp-make-tramp-file-name method user host remote-copy)))))) + (tramp-compat-delete-file + (tramp-make-tramp-file-name method user host remote-copy) + 'force))))) ;; Result. (list (expand-file-name filename) @@ -5006,12 +5103,10 @@ 'write-region (list start end localname append 'no-message lockname confirm)) - (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) - (loc-enc (tramp-get-local-coding v "local-encoding")) - (modes (save-excursion (tramp-default-file-modes filename))) + (let ((modes (save-excursion (tramp-default-file-modes filename))) ;; We use this to save the value of - ;; `last-coding-system-used' after writing the tmp file. - ;; At the end of the function, we set + ;; `last-coding-system-used' after writing the tmp + ;; file. At the end of the function, we set ;; `last-coding-system-used' to this saved value. This ;; way, any intermediary coding systems used while ;; talking to the remote shell or suchlike won't hose @@ -5034,7 +5129,8 @@ ;; file. We call `set-visited-file-modtime' ourselves later ;; on. We must ensure that `file-coding-system-alist' ;; matches `tmpfile'. - (let ((file-coding-system-alist + (let (file-name-handler-alist + (file-coding-system-alist (tramp-find-file-name-coding-system-alist filename tmpfile))) (condition-case err (tramp-run-real-handler @@ -5042,7 +5138,7 @@ (list start end tmpfile append 'no-message lockname confirm)) ((error quit) (setq tramp-temp-buffer-file-name nil) - (delete-file tmpfile) + (tramp-compat-delete-file tmpfile 'force) (signal (car err) (cdr err)))) ;; Now, `last-coding-system-used' has the right value. Remember it. @@ -5066,124 +5162,125 @@ ;; specified. However, if the method _also_ specifies an ;; encoding function, then that is used for encoding the ;; contents of the tmp file. - (cond - ;; `copy-file' handles direct copy and out-of-band methods. - ((or (tramp-local-host-p v) - (tramp-method-out-of-band-p - v (nth 7 (file-attributes tmpfile)))) - (if (and (not (stringp start)) - (= (or end (point-max)) (point-max)) - (= (or start (point-min)) (point-min)) - (tramp-get-method-parameter - method 'tramp-copy-keep-tmpfile)) - (progn - (setq tramp-temp-buffer-file-name tmpfile) - (condition-case err - ;; We keep the local file for performance - ;; reasons, useful for "rsync". - (copy-file tmpfile filename t) - ((error quit) - (setq tramp-temp-buffer-file-name nil) - (delete-file tmpfile) - (signal (car err) (cdr err))))) - (setq tramp-temp-buffer-file-name nil) - ;; Don't rename, in order to keep context in SELinux. + (let* ((size (nth 7 (file-attributes tmpfile))) + (rem-dec (tramp-get-inline-coding v "remote-decoding" size)) + (loc-enc (tramp-get-inline-coding v "local-encoding" size))) + (cond + ;; `copy-file' handles direct copy and out-of-band methods. + ((or (tramp-local-host-p v) + (tramp-method-out-of-band-p v size)) + (if (and (not (stringp start)) + (= (or end (point-max)) (point-max)) + (= (or start (point-min)) (point-min)) + (tramp-get-method-parameter + method 'tramp-copy-keep-tmpfile)) + (progn + (setq tramp-temp-buffer-file-name tmpfile) + (condition-case err + ;; We keep the local file for performance + ;; reasons, useful for "rsync". + (copy-file tmpfile filename t) + ((error quit) + (setq tramp-temp-buffer-file-name nil) + (tramp-compat-delete-file tmpfile 'force) + (signal (car err) (cdr err))))) + (setq tramp-temp-buffer-file-name nil) + ;; Don't rename, in order to keep context in SELinux. + (unwind-protect + (copy-file tmpfile filename t) + (tramp-compat-delete-file tmpfile 'force)))) + + ;; Use inline file transfer. + (rem-dec + ;; Encode tmpfile. + (tramp-message v 5 "Encoding region...") (unwind-protect - (copy-file tmpfile filename t) - (delete-file tmpfile)))) - - ;; Use inline file transfer. - (rem-dec - ;; Encode tmpfile. - (tramp-message v 5 "Encoding region...") - (unwind-protect - (with-temp-buffer - ;; Use encoding function or command. - (if (and (symbolp loc-enc) (fboundp loc-enc)) - (progn - (tramp-message - v 5 "Encoding region using function `%s'..." - (symbol-name loc-enc)) - (let ((coding-system-for-read 'binary)) - (insert-file-contents-literally tmpfile)) - ;; The following `let' is a workaround for the - ;; base64.el that comes with pgnus-0.84. If - ;; both of the following conditions are - ;; satisfied, it tries to write to a local - ;; file in default-directory, but at this - ;; point, default-directory is remote. - ;; (`call-process-region' can't write to - ;; remote files, it seems.) The file in - ;; question is a tmp file anyway. - (let ((default-directory - (tramp-compat-temporary-file-directory))) - (funcall loc-enc (point-min) (point-max)))) - - (tramp-message - v 5 "Encoding region using command `%s'..." loc-enc) - (unless (equal 0 (tramp-call-local-coding-command + (with-temp-buffer + (set-buffer-multibyte nil) + ;; Use encoding function or command. + (if (functionp loc-enc) + (progn + (tramp-message + v 5 "Encoding region using function `%s'..." loc-enc) + (let ((coding-system-for-read 'binary)) + (insert-file-contents-literally tmpfile)) + ;; The following `let' is a workaround for the + ;; base64.el that comes with pgnus-0.84. If + ;; both of the following conditions are + ;; satisfied, it tries to write to a local + ;; file in default-directory, but at this + ;; point, default-directory is remote. + ;; (`call-process-region' can't write to + ;; remote files, it seems.) The file in + ;; question is a tmp file anyway. + (let ((default-directory + (tramp-compat-temporary-file-directory))) + (funcall loc-enc (point-min) (point-max)))) + + (tramp-message + v 5 "Encoding region using command `%s'..." loc-enc) + (unless (zerop (tramp-call-local-coding-command loc-enc tmpfile t)) - (tramp-error - v 'file-error - "Cannot write to `%s', local encoding command `%s' failed" - filename loc-enc))) - - ;; Send buffer into remote decoding command which - ;; writes to remote file. Because this happens on - ;; the remote host, we cannot use the function. - (goto-char (point-max)) - (unless (bolp) (newline)) - (tramp-message - v 5 "Decoding region into remote file %s..." filename) - (tramp-send-command - v - (format - "%s >%s <<'EOF'\n%sEOF" - rem-dec - (tramp-shell-quote-argument localname) - (buffer-string))) - (tramp-barf-unless-okay - v nil - "Couldn't write region to `%s', decode using `%s' failed" - filename rem-dec) - ;; When `file-precious-flag' is set, the region is - ;; written to a temporary file. Check that the - ;; checksum is equal to that from the local tmpfile. - (when file-precious-flag - (erase-buffer) - (and - ;; cksum runs locally, if possible. - (zerop (tramp-local-call-process "cksum" tmpfile t)) - ;; cksum runs remotely. - (zerop - (tramp-send-command-and-check - v - (format - "cksum <%s" (tramp-shell-quote-argument localname)))) - ;; ... they are different. - (not - (string-equal - (buffer-string) - (with-current-buffer (tramp-get-buffer v) - (buffer-string)))) - (tramp-error - v 'file-error - (concat "Couldn't write region to `%s'," - " decode using `%s' failed") - filename rem-dec))) - (tramp-message - v 5 "Decoding region into remote file %s...done" filename)) - - ;; Save exit. - (delete-file tmpfile))) - - ;; That's not expected. - (t - (tramp-error - v 'file-error - (concat "Method `%s' should specify both encoding and " - "decoding command or an rcp program") - method))) + (tramp-error + v 'file-error + "Cannot write to `%s', local encoding command `%s' failed" + filename loc-enc))) + + ;; Send buffer into remote decoding command which + ;; writes to remote file. Because this happens on + ;; the remote host, we cannot use the function. + (goto-char (point-max)) + (unless (bolp) (newline)) + (tramp-message + v 5 "Decoding region into remote file %s..." filename) + (tramp-send-command + v + (format + (concat rem-dec " <<'EOF'\n%sEOF") + (tramp-shell-quote-argument localname) + (buffer-string))) + (tramp-barf-unless-okay + v nil + "Couldn't write region to `%s', decode using `%s' failed" + filename rem-dec) + ;; When `file-precious-flag' is set, the region is + ;; written to a temporary file. Check that the + ;; checksum is equal to that from the local tmpfile. + (when file-precious-flag + (erase-buffer) + (and + ;; cksum runs locally, if possible. + (zerop (tramp-local-call-process "cksum" tmpfile t)) + ;; cksum runs remotely. + (zerop + (tramp-send-command-and-check + v + (format + "cksum <%s" (tramp-shell-quote-argument localname)))) + ;; ... they are different. + (not + (string-equal + (buffer-string) + (with-current-buffer (tramp-get-buffer v) + (buffer-string)))) + (tramp-error + v 'file-error + (concat "Couldn't write region to `%s'," + " decode using `%s' failed") + filename rem-dec))) + (tramp-message + v 5 "Decoding region into remote file %s...done" filename)) + + ;; Save exit. + (tramp-compat-delete-file tmpfile 'force))) + + ;; That's not expected. + (t + (tramp-error + v 'file-error + (concat "Method `%s' should specify both encoding and " + "decoding command or an rcp program") + method)))) ;; Make `last-coding-system-used' have the right value. (when coding-system-used @@ -5336,6 +5433,8 @@ 'unhandled-file-name-directory 'vc-registered ;; Emacs 22+ only. 'set-file-times + ;; Emacs 24+ only. + 'file-selinux-context 'set-file-selinux-context ;; XEmacs only. 'abbreviate-file-name 'create-file-buffer 'dired-file-modtime 'dired-make-compressed-filename @@ -5425,19 +5524,28 @@ (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil - (cond - ;; When we are in completion mode, some operations - ;; shouldn't be handled by backend. - ((and completion (zerop (length localname)) - (memq operation '(file-exists-p file-directory-p))) - t) - ((and completion (zerop (length localname)) - (memq operation '(file-name-as-directory))) - filename) - ;; Call the backend function. - (foreign (apply foreign operation args)) - ;; Nothing to do for us. - (t (tramp-run-real-handler operation args)))))) + ;; Call the backend function. + (if foreign + (condition-case err + (apply foreign operation args) + (error + (cond + ;; When we are in completion mode, some failed + ;; operations shall return at least a default + ;; value in order to give the user a chance to + ;; correct the file name in the minibuffer. + ((and completion (zerop (length localname)) + (memq operation '(file-exists-p file-directory-p))) + t) + ((and completion (zerop (length localname)) + (memq operation + '(expand-file-name file-name-as-directory))) + filename) + ;; Propagate the error. + (t (signal (car err) (cdr err)))))) + ;; Nothing to do for us. + (tramp-run-real-handler operation args))))) + ;; When `tramp-mode' is not enabled, we don't do anything. (tramp-run-real-handler operation args))) @@ -5527,10 +5635,11 @@ ;; disable this part of the completion, unless the user implicitly ;; indicated his interest in using a fancier completion system. (or (eq tramp-syntax 'sep) - (featurep 'tramp) ;; If it's loaded, we may as well use - ;; it. `partial-completion-mode' does not exist in - ;; XEmacs. It is obsoleted with Emacs 24.1. - (and (boundp 'partial-completion-mode) partial-completion-mode) + (featurep 'tramp) ;; If it's loaded, we may as well use it. + ;; `partial-completion-mode' does not exist in XEmacs. + ;; It is obsoleted with Emacs 24.1. + (and (boundp 'partial-completion-mode) + (symbol-value 'partial-completion-mode)) ;; FIXME: These may have been loaded even if the user never ;; intended to use them. (featurep 'ido) @@ -5603,7 +5712,7 @@ ;; overwriting this check in such cases. Or we change Tramp file name ;; syntax in order to avoid ambiguities, like in XEmacs ... (defun tramp-completion-mode-p () - "Checks whether method / user name / host name completion is active." + "Check, whether method / user name / host name completion is active." (or ;; Signal from outside. `non-essential' has been introduced in Emacs 24. (and (boundp 'non-essential) (symbol-value 'non-essential)) @@ -5622,19 +5731,27 @@ ;; `last-input-event' might be nil. (not (null last-input-event)) ;; `last-input-event' may have no character approximation. - (funcall (symbol-function 'event-to-character) last-input-event) + (tramp-compat-funcall 'event-to-character last-input-event) (or ;; ?\t has event-modifier 'control. (equal - (funcall (symbol-function 'event-to-character) - last-input-event) ?\t) + (tramp-compat-funcall 'event-to-character last-input-event) ?\t) (and (not (event-modifiers last-input-event)) (or (equal - (funcall (symbol-function 'event-to-character) - last-input-event) ?\?) + (tramp-compat-funcall 'event-to-character last-input-event) + ?\?) (equal - (funcall (symbol-function 'event-to-character) - last-input-event) ?\ ))))))) + (tramp-compat-funcall 'event-to-character last-input-event) + ?\ ))))))) + +(defun tramp-connectable-p (filename) + "Check, whether it is possible to connect the remote host w/o side-effects. +This is true, if either the remote host is already connected, or if we are +not in completion mode." + (and (tramp-tramp-file-p filename) + (with-parsed-tramp-file-name filename nil + (or (get-buffer (tramp-buffer-name v)) + (not (tramp-completion-mode-p)))))) ;; Method, host name and user name completion. ;; `tramp-completion-dissect-file-name' returns a list of @@ -5699,8 +5816,10 @@ (append result1 (condition-case nil - (tramp-completion-run-real-handler - 'file-name-all-completions (list filename directory)) + (apply (if (tramp-connectable-p fullname) + 'tramp-completion-run-real-handler + 'tramp-run-real-handler) + 'file-name-all-completions (list (list filename directory))) (error nil))))) ;; Method, host name and user name completion for a file. @@ -5711,7 +5830,8 @@ (try-completion filename (mapcar 'list (file-name-all-completions filename directory)) - (when predicate + (when (and predicate + (tramp-connectable-p (expand-file-name filename directory))) (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) ;; I misuse a little bit the tramp-file-name structure in order to handle @@ -6232,7 +6352,7 @@ "Remove temporary files related to current buffer." (when (stringp tramp-temp-buffer-file-name) (condition-case nil - (delete-file tramp-temp-buffer-file-name) + (tramp-compat-delete-file tramp-temp-buffer-file-name 'force) (error nil)))) (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) @@ -6550,12 +6670,12 @@ (tramp-send-string vec tramp-terminal-type)) (defun tramp-action-process-alive (proc vec) - "Check whether a process has finished." + "Check, whether a process has finished." (unless (memq (process-status proc) '(run open)) (throw 'tramp-action 'process-died))) (defun tramp-action-out-of-band (proc vec) - "Check whether an out-of-band copy has finished." + "Check, whether an out-of-band copy has finished." (cond ((and (memq (process-status proc) '(stop exit)) (zerop (process-exit-status proc))) (tramp-message vec 3 "Process has finished.") @@ -6637,7 +6757,7 @@ (tramp-message proc 10 "\n%s" (buffer-string)))) (defun tramp-check-for-regexp (proc regexp) - "Check whether REGEXP is contained in process buffer of PROC. + "Check, whether REGEXP is contained in process buffer of PROC. Erase echoed commands if exists." (with-current-buffer (process-buffer proc) (goto-char (point-min)) @@ -6657,10 +6777,11 @@ (when (or (not (tramp-get-connection-property proc "check-remote-echo" nil)) ;; Sometimes, the echo string is suppressed on the remote side. (not (string-equal - (substring-no-properties - tramp-echo-mark-marker + (tramp-compat-funcall + 'substring-no-properties tramp-echo-mark-marker 0 (min tramp-echo-mark-marker-length (1- (point-max)))) - (buffer-substring-no-properties + (tramp-compat-funcall + 'buffer-substring-no-properties 1 (min (1+ tramp-echo-mark-marker-length) (point-max)))))) ;; No echo to be handled, now we can look for the regexp. (goto-char (point-min)) @@ -6787,7 +6908,7 @@ (if (featurep 'mule) ;; Use MULE to select the right EOL convention for communicating ;; with the process. - (let* ((cs (or (funcall (symbol-function 'process-coding-system) proc) + (let* ((cs (or (tramp-compat-funcall 'process-coding-system proc) (cons 'undecided 'undecided))) cs-decode cs-encode) (when (symbolp cs) (setq cs (cons cs cs))) @@ -6800,8 +6921,8 @@ (when (search-forward "\r" nil t) (setq cs-decode (tramp-coding-system-change-eol-conversion cs-decode 'dos))) - (funcall (symbol-function 'set-buffer-process-coding-system) - cs-decode cs-encode) + (tramp-compat-funcall + 'set-buffer-process-coding-system cs-decode cs-encode) (tramp-message vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) ;; Look for ^M and do something useful if found. @@ -6827,10 +6948,10 @@ (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) (with-current-buffer (tramp-get-debug-buffer vec) - ;; Keep the debug buffer + ;; Keep the debug buffer. (rename-buffer (generate-new-buffer-name tramp-temp-buffer-name) 'unique) - (funcall (symbol-function 'tramp-cleanup-connection) vec) + (tramp-compat-funcall 'tramp-cleanup-connection vec) (if (= (point-min) (point-max)) (kill-buffer nil) (rename-buffer (tramp-debug-buffer-name vec) 'unique)) @@ -7090,6 +7211,64 @@ (if (string-match "%s" cmd) (format cmd input) cmd) (if (stringp output) (concat "> " output) "")))) +(defconst tramp-inline-compress-commands + '(("gzip" "gzip -d") + ("bzip2" "bzip2 -d") + ("compress" "compress -d")) + "List of compress and decompress commands for inline transfer. +Each item is a list that looks like this: + +\(COMPRESS DECOMPRESS\) + +COMPRESS or DECOMPRESS are strings with the respective commands.") + +(defun tramp-find-inline-compress (vec) + "Find an inline transfer compress command that works. +Goes through the list `tramp-inline-compress-commands'." + (save-excursion + (let ((commands tramp-inline-compress-commands) + (magic "xyzzy") + item compress decompress + found) + (while (and commands (not found)) + (catch 'next + (setq item (pop commands) + compress (nth 0 item) + decompress (nth 1 item)) + (tramp-message + vec 5 + "Checking local compress command `%s', `%s' for sanity" + compress decompress) + (unless (zerop (tramp-call-local-coding-command + (format "echo %s | %s | %s" + magic compress decompress) nil nil)) + (throw 'next nil)) + (tramp-message + vec 5 + "Checking remote compress command `%s', `%s' for sanity" + compress decompress) + (unless (zerop (tramp-send-command-and-check + vec (format "echo %s | %s | %s" + magic compress decompress) t)) + (throw 'next nil)) + (setq found t))) + + ;; Did we find something? + (if found + (progn + ;; Set connection properties. + (tramp-message + vec 5 "Using inline transfer compress command `%s'" compress) + (tramp-set-connection-property vec "inline-compress" compress) + (tramp-message + vec 5 "Using inline transfer decompress command `%s'" decompress) + (tramp-set-connection-property vec "inline-decompress" decompress)) + + (tramp-set-connection-property vec "inline-compress" nil) + (tramp-set-connection-property vec "inline-decompress" nil) + (tramp-message + vec 2 "Couldn't find an inline transfer compress command"))))) + (defun tramp-compute-multi-hops (vec) "Expands VEC according to `tramp-default-proxies-alist'. Gateway hops are already opened." @@ -7155,7 +7334,7 @@ 'target-alist (vector (tramp-file-name-method hop) (tramp-file-name-user hop) - (funcall (symbol-function 'tramp-gw-open-connection) vec gw hop) nil)) + (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil)) ;; For the password prompt, we need the correct values. ;; Therefore, we must remember the gateway vector. But we ;; cannot do it as connection property, because it shouldn't @@ -7278,9 +7457,9 @@ ;; Check whether process is alive. (tramp-set-process-query-on-exit-flag p nil) - (tramp-message vec 3 "Waiting 60s for local shell to come up...") - (tramp-barf-if-no-shell-prompt - p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell) + (with-progress-reporter vec 3 "Waiting 60s for local shell to come up" + (tramp-barf-if-no-shell-prompt + p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell)) ;; Now do all the connections as specified. (while target-alist @@ -7773,7 +7952,7 @@ ;; data structure. (defun tramp-file-name-p (vec) - "Check whether VEC is a Tramp object." + "Check, whether VEC is a Tramp object." (and (vectorp vec) (= 4 (length vec)))) (defun tramp-file-name-method (vec) @@ -7904,7 +8083,7 @@ localname)))))) (defun tramp-equal-remote (file1 file2) - "Checks, whether the remote parts of FILE1 and FILE2 are identical. + "Check, whether the remote parts of FILE1 and FILE2 are identical. The check depends on method, user and host name of the files. If one of the components is missing, the default values are used. The local file name parts of FILE1 and FILE2 are not taken into @@ -7969,8 +8148,9 @@ (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program) ;; Either the file size is large enough, or (in rare cases) there ;; does not exist a remote encoding. - (or (> size tramp-copy-size-limit) - (null (tramp-get-remote-coding vec "remote-encoding"))))) + (or (null tramp-copy-size-limit) + (> size tramp-copy-size-limit) + (null (tramp-get-inline-coding vec "remote-encoding" size))))) (defun tramp-local-host-p (vec) "Return t if this points to the local host, nil otherwise." @@ -8251,38 +8431,89 @@ (nth 3 (tramp-compat-file-attributes "~/" id-format))) ;; Some predefined connection properties. -(defun tramp-get-remote-coding (vec prop) - ;; Local coding handles properties like remote coding. So we could - ;; call it without pain. - (let ((ret (tramp-get-local-coding vec prop))) +(defun tramp-get-inline-compress (vec prop size) + "Return the compress command related to PROP. +PROP is either `inline-compress' or `inline-decompress'. SIZE is +the length of the file to be compressed. + +If no corresponding command is found, nil is returned." + (when (and (integerp tramp-inline-compress-start-size) + (> size tramp-inline-compress-start-size)) + (with-connection-property vec prop + (tramp-find-inline-compress vec) + (tramp-get-connection-property vec prop nil)))) + +(defun tramp-get-inline-coding (vec prop size) + "Return the coding command related to PROP. +PROP is either `remote-encoding', `remode-decoding', +`local-encoding' or `local-decoding'. + +SIZE is the length of the file to be coded. Depending on SIZE, +compression might be applied. + +If no corresponding command is found, nil is returned. +Otherwise, either a string is returned which contains a `%s' mark +to be used for the respective input or output file; or a Lisp +function cell is returned to be applied on a buffer." + (let ((coding + (with-connection-property vec prop + (tramp-find-inline-encoding vec) + (tramp-get-connection-property vec prop nil))) + (prop1 (if (string-match "encoding" prop) + "inline-compress" "inline-decompress")) + compress) ;; The connection property might have been cached. So we must send - ;; the script - maybe. - (when (and ret (symbolp ret)) - (let ((name (symbol-name ret))) + ;; the script to the remote side - maybe. + (when (and coding (symbolp coding) (string-match "remote" prop)) + (let ((name (symbol-name coding))) (while (string-match (regexp-quote "-") name) (setq name (replace-match "_" nil t name))) - (tramp-maybe-send-script vec (symbol-value ret) name) - (setq ret name))) - ;; Return the value. - ret)) - -(defun tramp-get-local-coding (vec prop) - (or - (tramp-get-connection-property vec prop nil) - (progn - (tramp-find-inline-encoding vec) - (tramp-get-connection-property vec prop nil)))) + (tramp-maybe-send-script vec (symbol-value coding) name) + (setq coding name))) + (when coding + ;; Check for the `compress' command. + (setq compress (tramp-get-inline-compress vec prop1 size)) + ;; Return the value. + (cond + ((and compress (symbolp coding)) + (if (string-match "decompress" prop1) + `(lambda (beg end) + (,coding beg end) + (let ((coding-system-for-write 'binary) + (coding-system-for-read 'binary)) + (apply + 'call-process-region (point-min) (point-max) + (car (split-string ,compress)) t t nil + (cdr (split-string ,compress))))) + `(lambda (beg end) + (let ((coding-system-for-write 'binary) + (coding-system-for-read 'binary)) + (apply + 'call-process-region beg end + (car (split-string ,compress)) t t nil + (cdr (split-string ,compress)))) + (,coding (point-min) (point-max))))) + ((symbolp coding) + coding) + ((and compress (string-match "decoding" prop)) + (format "(%s | %s >%%s)" coding compress)) + (compress + (format "(%s <%%s | %s)" compress coding)) + ((string-match "decoding" prop) + (format "%s >%%s" coding)) + (t + (format "%s <%%s" coding)))))) (defun tramp-get-method-parameter (method param) "Return the method parameter PARAM. -If the `tramp-methods' entry does not exist, return NIL." +If the `tramp-methods' entry does not exist, return nil." (let ((entry (assoc param (assoc method tramp-methods)))) (when entry (cadr entry)))) ;; Auto saving to a special directory. (defun tramp-exists-file-name-handler (operation &rest args) - "Checks whether OPERATION runs a file name handler." + "Check, whether OPERATION runs a file name handler." ;; The file name handler is determined on base of either an ;; argument, `buffer-file-name', or `default-directory'. (condition-case nil @@ -8382,16 +8613,17 @@ (and (boundp 'auth-sources) (tramp-get-connection-property v "first-password-request" nil) ;; Try with Tramp's current method. - (funcall (symbol-function 'auth-source-user-or-password) - "password" tramp-current-host tramp-current-method)) + (tramp-compat-funcall + 'auth-source-user-or-password + "password" tramp-current-host tramp-current-method)) ;; Try the password cache. (when (functionp 'password-read) (unless (tramp-get-connection-property v "first-password-request" nil) - (funcall (symbol-function 'password-cache-remove) key)) + (tramp-compat-funcall 'password-cache-remove key)) (let ((password - (funcall (symbol-function 'password-read) pw-prompt key))) - (funcall (symbol-function 'password-cache-add) key password) + (tramp-compat-funcall 'password-read pw-prompt key))) + (tramp-compat-funcall 'password-cache-add key password) password)) ;; Else, get the password interactively. (read-passwd pw-prompt)) @@ -8399,14 +8631,13 @@ (defun tramp-clear-passwd (vec) "Clear password cache for connection related to VEC." - (when (functionp 'password-cache-remove) - (funcall - (symbol-function 'password-cache-remove) - (tramp-make-tramp-file-name - (tramp-file-name-method vec) - (tramp-file-name-user vec) - (tramp-file-name-host vec) - "")))) + (tramp-compat-funcall + 'password-cache-remove + (tramp-make-tramp-file-name + (tramp-file-name-method vec) + (tramp-file-name-user vec) + (tramp-file-name-host vec) + ""))) ;; Snarfed code from time-date.el and parse-time.el @@ -8443,16 +8674,17 @@ ;; Pacify byte-compiler with `symbol-function'. (cond ((and (fboundp 'subtract-time) (fboundp 'float-time)) - (funcall (symbol-function 'float-time) - (funcall (symbol-function 'subtract-time) t1 t2))) + (tramp-compat-funcall + 'float-time (tramp-compat-funcall 'subtract-time t1 t2))) ((and (fboundp 'subtract-time) (fboundp 'time-to-seconds)) - (funcall (symbol-function 'time-to-seconds) - (funcall (symbol-function 'subtract-time) t1 t2))) + (tramp-compat-funcall + 'time-to-seconds (tramp-compat-funcall 'subtract-time t1 t2))) ((fboundp 'itimer-time-difference) - (funcall (symbol-function 'itimer-time-difference) - (if (< (length t1) 3) (append t1 '(0)) t1) - (if (< (length t2) 3) (append t2 '(0)) t2))) + (tramp-compat-funcall + 'itimer-time-difference + (if (< (length t1) 3) (append t1 '(0)) t1) + (if (< (length t2) 3) (append t2 '(0)) t2))) (t (let ((time (tramp-time-subtract t1 t2))) (+ (* (car time) 65536.0) @@ -8463,18 +8695,18 @@ "Return a coding system like CODING-SYSTEM but with given EOL-TYPE. EOL-TYPE can be one of `dos', `unix', or `mac'." (cond ((fboundp 'coding-system-change-eol-conversion) - (funcall (symbol-function 'coding-system-change-eol-conversion) - coding-system eol-type)) + (tramp-compat-funcall + 'coding-system-change-eol-conversion coding-system eol-type)) ((fboundp 'subsidiary-coding-system) - (funcall (symbol-function 'subsidiary-coding-system) - coding-system - (cond ((eq eol-type 'dos) 'crlf) - ((eq eol-type 'unix) 'lf) - ((eq eol-type 'mac) 'cr) - (t - (error "Unknown EOL-TYPE `%s', must be %s" - eol-type - "`dos', `unix', or `mac'"))))) + (tramp-compat-funcall + 'subsidiary-coding-system coding-system + (cond ((eq eol-type 'dos) 'crlf) + ((eq eol-type 'unix) 'lf) + ((eq eol-type 'mac) 'cr) + (t + (error "Unknown EOL-TYPE `%s', must be %s" + eol-type + "`dos', `unix', or `mac'"))))) (t (error "Can't change EOL conversion -- is MULE missing?")))) (defun tramp-set-process-query-on-exit-flag (process flag) @@ -8482,8 +8714,8 @@ If the second argument flag is non-nil, Emacs will query the user before exiting if process is running." (if (fboundp 'set-process-query-on-exit-flag) - (funcall (symbol-function 'set-process-query-on-exit-flag) process flag) - (funcall (symbol-function 'process-kill-without-query) process flag))) + (tramp-compat-funcall 'set-process-query-on-exit-flag process flag) + (tramp-compat-funcall 'process-kill-without-query) process flag)) ;; ------------------------------------------------------------ @@ -8543,8 +8775,7 @@ ;; When Tramp is not loaded yet, its autoloads are still active. (tramp-unload-file-name-handlers) ;; ange-ftp settings must be enabled. - (when (functionp 'tramp-ftp-enable-ange-ftp) - (funcall (symbol-function 'tramp-ftp-enable-ange-ftp))) + (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp) ;; Maybe its not loaded yet. (condition-case nil (unload-feature 'tramp 'force) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/ChangeLog --- a/lisp/org/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,1344 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-05 Stefan Monnier + + * org-table.el (orgtbl-setup): + * org-agenda.el (org-agenda-entry-text-mode): Simplify. + +2010-05-03 Stefan Monnier + + * org-table.el (orgtbl-mode): Use define-minor-mode. + +2010-04-10 Carsten Dominik + + * org.el (org-insert-link): Find the link buffer on visible frames. + (org-export-latex-default-packages-alist): Hyperref must be loaded + late. + (org-open-file): More care with the new matching for file links. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-preprocess): Do not yet protect + defined entities - these will be taken care of later. + (org-export-latex-special-chars): Post-process entity replacement. + (org-export-latex-fontify-headline): Do not yet protect defined + entities - these will be taken care of later. + (org-export-latex-tables, org-export-latex-links): Format the + caption properly. + + * org-entities.el (org-entities-user): Fix typo. + + * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords + + * org-entities.el (org-entities-user): Improve docstring. + +2010-04-10 Carsten Dominik + + * org-entities.el (org-macs): Require org-macs, to be sure that we + have `declare-function' defined. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Update docstring. + + * org.el (org-format-latex-header): Add cookies to the header. + (org-splice-latex-header): Implement placement according to cookies. + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-aux-preprocess): Control case + sensitivity. + +2010-04-10 Bastien Guerry + + * org.el (org-splice-latex-header): Fix typo. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): + Use `org-splice-latex-header' to build the header. + (org-export-latex-classes): Update docstring. + + * org.el (org-splice-latex-header): New function. + (org-create-formula-image): Use `org-splice-latex-header' to build + the header. + + * org-gnus.el (org-gnus-follow-link): Handle nndoc backend. + +2010-04-10 Carsten Dominik + + * org.el (org-export-latex-packages-alist) + (org-export-latex-default-packages-alist): Fix docstring to + reflect the expected structure. + + * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. + (org-export-docbook-finalize-table): Make use of label for tables. + +2010-04-10 Carsten Dominik + + * org-attach.el (org-attach-commit): Split on newlines. + + * org.el (org-export-latex-default-packages-alist): Use list + instead of cons for the entries. + +2010-04-10 Carsten Dominik + + * org-entities.el (org-entity-get-representation): Catch the case + that there is not entry in the list. + + * org-mobile.el (org-mobile-use-encryption) + (org-mobile-encryption-tempfile, org-mobile-encryption-password): + New options. + (org-mobile-check-setup): CHeck the encryption setup. + (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command) + (org-mobile-create-sumo-agenda): Use encryption code. + (org-mobile-encrypt-and-move): New function. + (org-mobile-encrypt-file, org-mobile-decrypt-file): New + functions. + (org-mobile-move-capture): Decrypt the capture file. + + * org.el (org-entities): Require the new file. + (org-export-latex-default-packages-alist): New variable. + (org-complete): Use new entity code for completion. + (org-create-formula-image): Use the new packages variable. + + * org-latex.el (org-export-latex-classes): Remove the standard + packages from the class headers. + (org-export-latex-make-header): Use the new package variable. + (org-export-latex-special-chars): Better regexp for entities, to + support entity name that contain numbers. + (org-export-latex-treat-backslash-char): Use the new entity code. + + * org-html.el (org-html-do-expand): Use the new entity code. + + * org-exp.el (org-export): Add the new export commands. + (org-html-entities): Constant removed. + (org-export-visible): Add the new export commands. + + * org-docbook.el (org-docbook-do-expand): Use new entity code. + + * org-ascii.el (org-export-ascii-entities): New variable. + (org-export-as-latin1, org-export-as-latin1-to-buffer) + (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands. + (org-export-as-encoding): New function. + (org-export-ascii-preprocess): Call `org-ascii-replace-entities'. + (org-ascii-replace-entities): New function. + +2010-04-10 Carsten Dominik + Ulf Stegemann + + * org-entities.el: New file. + +2010-04-10 Carsten Dominik + + * org-html.el (org-html-level-start): Catch the case that target + might be nil. + +2010-04-10 Dan Davison + + * org.el (org-appearance): Change Customize group variable name + from org-font-lock to org-appearance, and change tag from "Org + Font Lock" to "Org Appearance" + (org-odd-levels-only): Change Customize group variable name + (org-level-color-stars-only): Change Customize group variable name + (org-hide-leading-stars): Change Customize group variable name + (org-hidden-keywords): Change Customize group variable name + (org-fontify-done-headline): Change Customize group variable name + (org-fontify-emphasized-text): Change Customize group variable name + (org-fontify-whole-heading-line): Change Customize group variable name + (org-highlight-latex-fragments-and-specials): Change Customize + group variable name + (org-hide-emphasis-markers): Change Customize group variable name + (org-emphasis-alist): Change Customize group variable name + (org-emphasis-regexp-components): Change Customize group variable + name + (org-modules): Remove mention of org-R + + * org-faces.el (org-faces): Change Customize group variable name + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-last-run-time): New variable. + (org-diary): prepare agenda buffers only if last call was some + time ago. + + * org-html.el (org-export-html-preprocess): Replace \ref macros + with a link. + (org-format-org-table-html): Add the label as an anchor. + + * org-docbook.el (org-export-docbook-format-image): Do some + formatting on captions. + + * org-latex.el (org-export-latex-tables, org-export-latex-links): + Do some formatting on captions. + + * org-html.el (org-export-html-format-image) + (org-format-org-table-html): Do some formatting on captions. + +2010-04-10 Dan Davison + + * org.el (org-hidden-keywords): New customizable variable. This is + a list of symbols specifying which of the special keywords #+DATE, + #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. + (org-fontify-meta-lines-and-blocks): Changes to font-lock code + implementing new faces and hiding behaviour. + + * org-faces.el (org-document-title): New face for #+TITLE lines + (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines + (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-sanitize-plist): New function to + rename "index" properties to "sitemap". Do this renaming + globally. + (org-publish-with-aux-preprocess-maybe): New macro. + (org-publish-org-to-pdf, org-publish-org-to-html): Use the new + macro. + (org-publish-aux-preprocess) + (org-publish-index-generate-theindex.inc): New function. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-align): Interpret at fixed width, + not as maximum width. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-author-info, org-export-email-info): Fix + docstrings. + + * org-beamer.el (org-beamer-select-environment): Renamed from + `org-beamer-set-environment-tag'. Improve docstring. + + * org-freemind.el (org-freemind-write-mm-buffer): Fix another + problem with odd levels. + + * org-ascii.el (org-export-as-ascii): Export email only if the + author wants it. + + * org-docbook.el (org-export-as-docbook): Export email only if the + author wants it. + + * org-html.el (org-export-as-html): Export email only if the + author wants it. + + * org-exp.el (org-export-email-info): New option. + (org-export-plist-vars): Add entry for `org-export-email'. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-goto-line): Fix typo. + +2010-04-10 Mikael Fornius + + * org.el (org-agenda-files): Typo. + (org-read-agenda-file-list): Add optional argument to help + `org-store-new-agenda-file-list' to remember un-expanded file + names. Expand file names relative to `org-directory'. + (org-store-new-agenda-file-list): Keep un-expanded file names when + saving, if available. + (org-agenda-files): Update documentation. + +2010-04-10 Carsten Dominik + + * org-ascii.el (org-export-as-ascii): Catch the case of exporting + a buffer with no file name attached. + + * org.el (org-log-refile): New option. + (org-log-note-headings): Add a heading for refiling. + (org-startup-options): Add keywords for logging of the refile + action. + (org-refile): Add logging action. + (org-add-log-note): Allow for refiling action. + + * org-agenda.el (org-agenda-bulk-action): Make sure + `org-log-refile' is not `note' during a bulk action. + +2010-04-10 Carsten Dominik + + * org.el (org-map-dblocks): Use save-excursion to remember the + position. + + * org-attach.el (org-attach-commit): Remove dependence on xargs. + (org-attach-delete-one): Commit after deleting a file. + + * org-latex.el (org-export-latex-fontify): Do not mistake table.el + borders for strike-through emphasis. + + * org-freemind.el (org-freemind-write-mm-buffer): Simplify the + handling of odd levels. + + * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past' + and `future' values. + (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): + Handle `past' and `future' values. + + * org.el (org-read-agenda-file-list): Interpret file names + relative to org-directory and allow environment variables and + "~". + + * org-latex.el (org-export-latex-special-chars): Allow a + parenthesis before an exponent or subscript. + +2010-04-10 Dan Davison + + * org-src.el (org-edit-src-exit): When returning from code edit + buffer, if code block is hidden, leave point at start of + #+begin_src line + +2010-04-10 Carsten Dominik + + * org.el (org-insert-heading): Do not remove all spaces if the + headline is empty. + + * org-indent.el (org-indent): Fix group name. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-goto-column): Fix forcing a non-existing + column. + (org-table-get, org-table-put, org-table-goto-line) + (org-table-current-line): New functions. + +2010-04-10 Jan Böcker + + * org.el (org-open-file): Allow regular expressions in + org-file-apps to capture link parameters using groups. In a + command string to be executed, the parameters can be referenced + using %1, %2, etc. Lisp forms can access them using + (match-string n link). + (org-apps-regexp-alist): Adopt the created regexp, as this is now + matched against a file: link instead of the file name. + +2010-04-10 Carsten Dominik + + * org-crypt.el (org-reveal-start-hook): Add a decryption function + to this hook. + (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add + docstrings. + + * org.el (org-point-at-end-of-empty-headline) + (org-level-increment, org-get-previous-line-level): New function. + (org-cycle-level): Rewritten to be independent of when this + function is called. + (org-in-regexps-block-p): New function. + (org-reveal-start-hook): New hook. + (org-reveal): Run new hook. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-keywords): Start a new paragraph + after time keywords, do not add "\newline". + + * org-html.el (org-export-as-html): Avoid double # in href. + + * org.el (org-refile-get-location): Catch an invalid target + specification. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): + Make sure the behavior regarding to extracting time is + consistent. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-agenda-insert-diary-extract-time): New + variable. + (org-agenda-add-entry-to-org-agenda-diary-file): Use this new + variable rather than `org-agenda-search-headline-for-time'. + +2010-04-10 Carsten Dominik + + * org-list.el (org-fix-bullet-type): Improve cursor positioning. + +2010-04-10 Carsten Dominik + + * org.el (org-adaptive-fill-regexp-backup): New variable. + (org-set-autofill-regexps): Store a backup of + `adaptive-fill-regexp'. + (org-adaptive-fill-function): Fix filling of comments and ordered + lists. If there is no other match, till try adaptive fill. + +2010-04-10 John Wiegley + + * org-agenda.el (org-agenda-include-deadlines): Added new + customization variable to determine whether unscheduled tasks + should appear in the agenda solely because of their deadline. + Default to true, which was the previous behavior (it just wasn't + configurable). + (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in + the agenda to show/hide deadline tasks. + (org-agenda-menu): Added menu option for show/hide deadlines. + (org-agenda-list): Make the agenda list sensitive to the value of + `org-agenda-include-deadlines'. + (org-agenda-toggle-deadlines): New function to toggle the value of + `org-agenda-include-deadlines' and repaint the modeline + indicators. + (org-agenda-set-mode-name): Show "Deadlines" in the agenda + modeline if deadline tasks are being displayed. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-eval-formula): Replace $# and @# by + current column and row number. + +2010-04-10 Carsten Dominik + + * org.el (org-set-property, org-delete-property): Go back to + prompting for the property. + + * org-latex.el (org-export-latex-make-header): Fully process + author line. + (org-export-latex-fontify-headline): Allow several arguments, not + just one. + (org-export-latex-fix-inputenc): Catch the error when + `latexenc-coding-system-to-inputenc' is not defined. + + * org-agenda.el (org-agenda-skip-if-todo): New function. + (org-agenda-skip-if): Add conditions for TODO keywords. + (org-agenda-skip-if): Document the new todo conditions. + +2010-04-10 Mikael Fornius + + * org.el (org-at-property-p): Check if we are inside a property + drawer not just any drawer. + (org-set-property, org-delete-property): When cursor is on a + property key value pair do not prompt for property name instead + use name at cursor. + (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is + on the first line of a property drawer. + (org-property-end-re): Spell check. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-attach-captions-and-attributes): Add the + properties to the entire table, in case the first line is + removed. + + * org-archive.el (org-archive-reversed-order): New option. + (org-archive-subtree, org-archive-to-archive-sibling): Use the new + option `org-archive-reversed-order'. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-entry-types): New variable. + (org-agenda-list): Use `org-agenda-entry-types'. + (org-agenda-custom-commands-local-options): Support for setting + `org-agenda-entry-types' as an option. + (org-diary): Shift some documentation from here to the variable + `org-agenda-entry-types'. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): Apply macros in + author field. + + * org-clock.el (org-clocking-buffer, org-clocking-p): New function. + (org-clock-select-task, org-clock-notify-once-if-expired) + (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto) + (org-clock-out-if-current, org-clock-save): Use the new functions. + +2010-04-10 Carsten Dominik + + * org-docbook.el (org-export-as-docbook): Remove unnecessary + newline. + (org-export-as-docbook): Remove unnecessary newline. + (org-export-as-docbook): Fix problem with double footnote + reference in one place. + + * org-exp.el (org-export-format-source-code-or-example): Remove + unnecessary newline. + + * org.el (org-deadline, org-schedule): Allow rescheduling entries + with repeaters. + + * org-table.el (org-table-convert-refs-to-rc): Better way to catch + function calls that look like references. + + * org.el (org-open-at-point): Get link abbreviations from + reference buffer. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2 + as a reference. + +2010-04-10 Carsten Dominik + + * org.el (org-link-unescape): Solve issue with lower-case escapes. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Add + \usepackage{latexsym} to all classes. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html): Do not allow protected lines + into the table of contents. + + * org-latex.el (org-export-latex-special-chars): Find subsequent + occurrences of special characters. + (org-export-latex-tables): Do not convert table-like stuff that is + protected. + +2010-04-10 Carsten Dominik + + * org-list.el (org-toggle-checkbox): No errors when updating + checkbox count fails because there is no heading. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-report-include-clocking-task): New + option. + (org-clock-sum): Add the current clocking task. + +2010-04-10 Carsten Dominik + + * org.el (org-cycle): Print a message when in a table.el table. + (org-edit-special): Recognize the table.el context. + (org-ctrl-c-ctrl-c): Print a message when in a table.el table. + + * org-src.el (org-at-table.el-p): Declare. + (org-edit-src-code): Handle a special case for table.el editing. + (org-edit-src-find-region-and-lang): Recognize the table.el + context. + + * org-latex.el (org-export-latex-tables): Convert table.el + tables. + (org-export-latex-convert-table.el-table): New function. + + * org-html.el (org-html-expand): Fix table.el export. + + * org-latex.el (org-export-latex-preprocess): Protect footnotes in + headings. + + * org-id.el (org-id-find-id-file): Fix bug when there is no hash + table for the id locations. + + * org.el (org-read-date-analyze): Match American-style dates, like + 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he + current year when reading ISO and American dates. + +2010-04-10 Carsten Dominik + + * org.el (org-face-from-face-or-color): New function. + (org-get-todo-face, org-font-lock-add-priority-faces) + (org-get-tag-face): Use `org-face-from-face-or-color'. + + * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow + simple colors as values. + (org-faces-easy-properties): New option. + + * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is + restricted, as an agenda mode. + (org-agenda-fontify-priorities): Allow simple colors as values. + +2010-04-10 Bastien Guerry + + * org-timer.el (org-timer-current-timer): Renamed from + `org-timer-last-timer'. + (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. + (org-timer-cancel-timer, org-timer-show-remaining-time) + (org-timer-set-timer): Update to use only one timer. + + * org.el (org-set-property): Remove useless space in the prompt. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-html-style-default): Add a default style + for textareas. + + * org-exp.el (org-export-format-source-code-or-example): Fix + textarea tag. + +2010-04-10 Bastien Guerry + + * org-clock.el (org-clock-current-task): New variable to store + last clocked in task. + (org-clock-set-current, org-clock-delete-current): New functions. + +2010-04-10 Carsten Dominik + + * org-remember.el (org-remember-apply-template): Extend comment. + (org-remember-handler): Implement clock sibling filing. + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-all, org-publish-current-file) + (org-publish-current-project): When called with prefix argument + FORCE, also rebuild the validation file list. + + * org-latex.el (org-export-latex-preprocess): Protect footnotes in + section headings. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html-and-open): Kill product buffer + if the user wants that. + + * org-latex.el (org-export-as-pdf-and-open): Kill product buffer + if the user wants that. + + * org-exp.el (org-export-kill-product-buffer-when-displayed): New + option. + + * org-agenda.el (org-batch-agenda-csv): Use the time property + instead of the `time-of-day' property. + +2010-04-10 Carsten Dominik + + * org-timer.el (org-timer-start-hook, org-timer-stop-hook) + (org-timer-pause-hook, org-timer-set-hook) + (org-timer-cancel-hook): New hooks. + (org-timer-start): Run `org-timer-start-hook'. + (org-timer-pause-or-continue): Run `org-timer-pause-hook'. + (org-timer-stop): Run `org-timer-stop-hook'. + (org-timer-cancel-timers): Run `org-timer-cancel-hook'. + +2010-04-10 Carsten Dominik + + * org.el (org-reveal): Double prefix arg shows the subtree of the + parent. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-search-view): Fix bug with searching full + words in headlines in search view. + (org-agenda-skip-deadline-prewarning-if-scheduled): New option. + (org-agenda-get-deadlines): Suppress pre-warning if the entry is + scheduled (if the user configures it so. + +2010-04-10 Carsten Dominik + + * org.el (org-hide-archived-subtrees): Don't jump to end of + subtree if the match was not in a headline. + (org-inside-latex-macro-p): Allow more complex arguments. + (org-emphasize): Protect against use at end of buffer. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-align-tags): Avoid side effects on + text properties. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed + values. + (org-agenda-todo-ignore-scheduled) + (org-agenda-todo-ignore-deadlines): More control with different + allowed values. + (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): + Honor the new option settings. + +2010-04-10 Carsten Dominik + + * org.el (org-get-location): Make sure the selection buffer is + shown in the current frame. + + * org-ascii.el (org-export-ascii-table-widen-columns): New + option. + (org-export-ascii-preprocess): Realign tables to remove narrowing + if `org-export-ascii-table-widen-columns' is set. + + * org-table.el (org-table-do-narrow): New variable. + (org-table-align): Narrow only if `org-table-do-narrow' is t. + + * org.el (org-deadline, org-schedule): Allow updating if the + relevant time stamp does not have a repeater, i.e. do not require + that no time stamp has a repeater. + + * org-agenda.el (org-agenda-align-tags): Don't add a face to the + new white space before the tags. + + * org-latex.el (org-export-as-latex): Do nit require the buffer to + be visiting a file when only exporting to a buffer or string. + (org-export-latex-fix-inputenc): Only save the buffer is there is + a file name attached to it. + +2010-04-10 Dan Davison + + * org-src.el (org-edit-src-exit): Widen before exiting edit buffers + +2010-04-10 Carsten Dominik + + * org.el (org-fontify-meta-lines-and-blocks): Honor + `org-fontify-quote-and-verse-blocks'. + + * org-faces.el (org-fontify-quote-and-verse-blocks): New option. + +2010-04-10 Carsten Dominik + + * org.el (org-open-at-point): Also check for text property + org-linked-text before offering collected links. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): + Optionally extract time specification from text and add to the + timestamp. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Fix typo. + + * org-latex.el (org-export-latex-make-header): Use \providecommand + to make sure the \alert macro is defined. + + * org.el (org-format-latex-signal-error) + (org-create-formula-image): Use `org-format-latex-signal-error'. + +2010-04-10 Stephen Eglen + + * org.el (org-store-link): For dired buffers, use + default-directory as link name if dired-get-filename returns + nil. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-concatenate-multiline-links): The for + protectedness at beginning of match. + + * org-latex.el (org-export-latex-fix-inputenc): Never leave the + AUTO as a coding system, instead default to utf8. + +2010-04-10 Carsten Dominik + + * org.el (org-block-todo-from-children-or-siblings-or-parent) + (org-block-todo-from-checkboxes): Respect the local variable + value when deciding if blocking should be active. + + * org-latex.el (org-export-latex-make-header): Define the align + macro if it is not yet defined. + + * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call + `org-insert-heading' with the INVISIBLE-OK argument. + + * org-mac-message.el (org-mac-message-insert-flagged): Call + `org-insert-heading' with the INVISIBLE-OK argument. + + * org.el (org-insert-heading): New argument INVISIBLE-OK. + + * org-agenda.el (org-agenda-view-mode-dispatch): Improve the + prompt message. + + * org-html.el (org-html-level-start): Use the + `html-container-class' text property to set an additional class + for an outline container. + + * org-exp.el (org-export-remember-html-container-classes): New + function. + (org-export-preprocess-string): Call + `org-export-remember-html-container-classes'. + + * org.el (org-cycle): Mention level cycling in the docstring. + (org-default-properties): Add new property HTML_CONTAINER_CLASS. + + * org-remember.el (org-remember-apply-template): Do file insertion + first. + +2010-04-10 Carsten Dominik + + * org-habit.el (org-habit-insert-consistency-graphs): Fix a + problem with mis-aligned graphs when showing habits. + +2010-04-10 Mikael Fornius + + * org.el (org-assign-fast-keys): Prefer keys used in keyword name + when assigning. Begin using numerical characters when all in name + is used up. This is to spare alphanumeric characters for better + match with other keywords. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-preprocess-hook): Improve documentation. + + * org-latex.el (org-export-latex-preprocess): More consistent + conversion and protection of the words LaTeX and TeX. + (org-export-latex-fontify-headline, org-export-latex-preprocess): + Allow angle brackets in commands, for beamer. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-in): Improve the look of the clock line + by formatting links. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Use AUTO as the place + holder string for the coding system. And improve the + documentation. + (org-export-latex-fix-inputenc): Only modify the coding system if + it is given by the placeholder AUTO. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-task-overrun-text): New option. + (org-task-overrun, org-clock-update-period): New variables. + (org-clock-get-clock-string, org-clock-update-mode-line): Mark + overrun clock. + (org-clock-notify-once-if-expired): Check if clock is overrun. + + * org-faces.el: New face `org-mode-line-clock-overrun'. + +2010-04-10 Jan Böcker + + * org.el (org-narrow-to-subtree): Position the end of the narrowed + region before the line with the next heading, to prevent the user + from prepending text to the next headline. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-get-time-of-day): Use + org-agenda-time-leading-zero to allow leading zero (rather than + space) for times. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure + org-datetree.el is loaded. + + * org-datetree.el: autoload `org-datetree-find-day-create' + + * org-latex.el (org-export-latex-hyperref-format): New option. + (org-export-latex-links): Use `org-export-latex-hyperref-format'. + +2010-04-10 Carsten Dominik + + * org-ctags.el (org-ctags-enable): Change order of functions. + (org-ctags-create-tags): Add wildcard to file name expansion. + +2010-04-10 Carsten Dominik + + * org.el (org-entry-properties): Fix some important bugs. + +2010-04-10 Carsten Dominik + + * org.el (org-link-unescape, org-link-escape): Only use hexlify if + the table is not explicitly given. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-out-when-done): Allow a list of keywords + as value. + (org-clock-out-if-current): Work with the new list value of + `org-clock-out-when-done'. + (org-clock-out, org-clock-out-if-current): Avoid circular logic + between clocking out and state changes. + + * org-ctags.el (org-ctags-path-to-ctags): Better system-type test. + + * org-latex.el (org-export-latex-treat-backslash-char): Do not by + accident protect a character that is before a backslash. + +2010-04-10 Paul Sexton + + * org-ctags.el: New file. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-class): Use + `org-order-calendar-date-args'. + + * org.el (org-order-calendar-date-args): New function. + + * org-exp.el (org-export-target-internal-links): Check for + protectedness after the first bracket. + + * org.el (org-entry-properties): Don't match wrong-case TODO + keywords. + + * org-agenda.el (org-agenda-schedule, org-agenda-deadline): + Document that ARG is passed through to remove the date. + (org-agenda-bulk-action): Accept prefix arg and pass it on. Do + not read a date when the user has given a `C-u' prefix. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all + tags are hidden. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-fix-inputenc): New function. + (org-export-latex-inputenc-alist): New option. + + * org-exp.el (org-export): New key SPC to publish enclosing + subtree. + +2010-04-10 Carsten Dominik + + * org-indent.el (org-indent-add-properties): Catch case when there + is no headline in the buffer. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Add checkmark symbol. + + * org-ascii.el (org-export-ascii-preprocess): Protect targets in + verbatim code for ASCII export. + + * org.el (org-update-statistics-cookies): Also see checkboxes in + ordered lists. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L' + key. + + * org-beamer.el (org-beamer-amend-header): Change the location + where `org-beamer-header-extra' is inserted. + + * org.el (org-compute-latex-and-specials-regexp): Don't do BIND + just for computing this regexp. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-frame-default-options): New option. + (org-beamer-sectioning): Use default options if the user does not + have defined any. + (org-beamer-fix-toc): Put a frame around the table of contents. + + * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make + sure case-folding works well when processing comment stuff. + + * org-latex.el (org-export-latex-after-save-hook): New hook. + (org-export-as-latex): Run the new hook. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-environments-default): Add the note + environments. + (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA + lines and collect and combine the content. + (org-beamer-after-initial-vars): Check for note tags and make sure + they will be seen like a property. + + * org.el (org-offer-links-in-entry): Fix bug when there is a + single link. + + * org-exp.el (org-export): Make sure the mark is activated, also + when `transient-mark-mode' is off. + + * org-agenda.el (org-agenda-search-view-always-boolean): New option. + (org-agenda-search-view-search-words-only): Obsolete variable, is + now an alias for `org-agenda-search-view-always-boolean'. + (org-agenda-search-view-force-full-words): New option. + (org-search-view): Improve docstring, and implement a better logic + for Boolean and phrase searches. + (org-agenda-last-search-view-search-was-boolean): New variable. + (org-agenda-manipulate-query): Consider the type of the last + search when modifying the search string. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-as-latex): Do the first letbind in the + right moment. + + * org-agenda.el (org-get-entries-from-diary): Add the new face to + these entries. + + * org-faces.el (org-agenda-diary): New face. + + * org.el (org-make-link-regexps): Allow regexp-special characters + in link types. + (org-open-file): When in-emacs is `system', also force system + opening, like when the value was `(16)'. + (org-update-statistics-cookies): Handle entries without children. + + * org-exp.el + (org-export-preprocess-before-normalizing-links-hook): New hook. + (org-export-preprocess-string): Run the new hook. + + * org.el (org-offer-links-in-entry): Make RET open all links. + + * org-html.el (org-export-as-html): Remove any leftover display + properties in the html file. + + * org-wl.el (org-wl-store-link): Work-around for format bug with + text properties. + + * org-habit.el (org-habit-insert-consistency-graphs): Turn off + invisibility while adding the graphs. + +2010-04-10 Carsten Dominik + + * org-remember.el (org-select-remember-template): Use C letter to + customize remember templates. + + * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark): + Move cursor to next visible line. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-sectioning): Leave columns environment + by specifying 0 or 1 for column width. + (org-beamer-column-widths): Make 0 stand for 0.0. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-mark-radio-links): Don't match inside + <>. + + * org.el (org-format-latex-header-extra): New variable. + (org-format-latex): Set org-format-latex-header-extra from + in-buffer stuff. + (org-format-latex): Add org-format-latex-header-extra to the + variables on which image creation depends. + (org-create-formula-image): Add the header stuff from in-buffer + settings. + (org-read-date-analyze): Base the analysis for future preference + on NOW, not on the default date. + + * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class + for TODO keyword in inline tasks. + + * org.el (org-log-note-headings): New headings for removing + deadline or scheduling date. + (org-deadline, org-schedule): Arrange for logging when removing a + date. + (org-add-log-note): Handle deadline and scheduling removal. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-visible): Add LaTeX/pdf export. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-class): New function. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-preprocess): Do process the text + of a radio target. + +2010-04-10 Carsten Dominik + + * org.el (org-entry-properties): Add TIMESTAMP properties back + in. + +2010-04-10 Carsten Dominik + + * org.el (org-all-time-keywords): New variable. + (org-set-regexps-and-options): Set `org-all-time-keywords'. + (org-entry-blocked-p): New function. + (org-special-properties): Add BLOCKED as a new special property. + (org-entry-properties): New optional argument SPECIFIC, only parse + for this property when it is specified. + (org-entry-get): Pass a SPECIFIC argument to + `org-entry-properties'. + + * org-latex.el (org-export-as-latex): Preprocess TEXT as well. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-tables): No forced line end if + there is no caption. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Add Euro symbols from Marvosym + package. + + * org-latex.el (org-export-latex-tables): Only add a caption when + macro in in longtable environments if one has been defined. + + * org-html.el (org-export-as-html): Only take title from buffer if + not exporting body-only. + + * org-latex.el (org-export-latex-preprocess): Better version of + the regular expression for protecting LaTeX macros. + (org-export-latex-preprocess): Start searching for macros to + protect from beginning of buffer. + + * org-exp.el (org-export-target-internal-links): Check for + protectedness earlier in the string. + + * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords + case sensitively. + + * org-id.el (org-id-store-link): Match TODO keywords case + sensitively. + + * org.el (org-heading-components, org-get-outline-path) + (org-display-outline-path): Match TODO keywords case sensitively. + + * org-latex.el (org-export-as-latex): Ignore read-only + properties. + + * org-exp.el (org-export-preprocess-string): Remove any + `read-only' properties. + + * org-agenda.el (org-agenda-inactive-leader): New option. + (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'. + (org-tags-view): Prompt for matcher if MATCH is an empty string. + (org-todo-list): Prompt for matcher if ARG is an empty string. + +2010-04-10 Carsten Dominik + + * org.el (org-open-link-functions): New hook. + (org-open-at-point): Run `org-open-link-functions'. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-date-prompt): Allow inactive time + stamps as well. + + * org.el (org-inhibit-startup-visibility-stuff): New variable. + (org-mode): Don't do startup visibility if inhibited. + (org-outline-overlay-data, org-set-outline-overlay-data): New + functions. + (org-save-outline-visibility): New macro. + (org-log-note-headings): Document that one should not change the + `state' note format. + +2010-04-10 Carsten Dominik + + * org.el (org-make-link-regexps): Capture link path into a group. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite + the options plist. + +2010-04-10 Carsten Dominik + + * org.el (org-startup-with-beamer-mode): New option. + (org-property-changed-functions) + (org-property-allowed-value-functions): New hooks. + (org-entry-put, org-property-get-allowed-values): Run the new + hooks. + (org-property-next-allowed-value): Run the new hooks. + + * org-exp.el (org-export-select-backend-specific-text): Add the + special beamer tags. + + * org-beamer.el: New file. + + * org-latex.el (org-export-latex-after-initial-vars-hook): New hook. + (org-export-as-latex): Run + `org-export-latex-after-initial-vars-hook'. + (org-export-latex-format-toc-function) + (org-export-latex-make-header): Call + `org-export-latex-format-toc-function'. + + * org.el (org-fill-template): Make template searches case sensitive. + + * org-exp.el (org-export): Use "1" as a sign to export only the + subtree. + + * org-colview-xemacs.el (org-columns-edit-value): Use + org-unrestricted property. + + * org-colview.el (org-columns-edit-value): Use + org-unrestricted property. + + * org.el (org-compute-property-at-point): Set org-unrestricted + text property if the list contains ":ETC". + (org-insert-property-drawer): Use + org-unrestricted property. + + * org-exp.el + (org-export-preprocess-before-selecting-backend-code-hook): New hook. + (org-export-preprocess-string): Run + `org-export-preprocess-before-selecting-backend-code-hook'. + + * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. + + * org-latex.el (org-export-region-as-latex): Run + `org-export-first-hook'. + + * org-html.el (org-export-as-html): Run `org-export-first-hook'. + + * org-docbook.el (org-export-as-docbook): Run + `org-export-first-hook'. + + * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. + + * org-exp.el (org-export-first-hook): New hook. + +2010-04-10 Carsten Dominik + + * org-list.el (org-previous-item): Exit at the beginning of the + buffer. + + * org-id.el (org-id-locations-save): Only write the id locations + if any are defined. + + * org-archive.el (org-archive-all-done): Make this work in a file + with org-odd-levels-only set. + + * org.el (org-get-refile-targets): Catch the case when a buffer + has no file. + + * org-latex.el (org-export-as-latex): Cleanup forced line ends + where they are not needed. + (org-export-latex-subcontent): Remove unnecessary newlines. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): Remove \obeylines. + (org-export-latex-fontify): Fix regexp bug that takes special + care of protecting the right boundary characters in emphasis + matches. + (org-export-latex-preprocess): Allow multiple arguments to latex + macros. + + * org.el (org-make-link-regexps): Use John Gruber's regexp for + urls. + + * org-macs.el (org-re): Interpret :punct: in regexps. + + * org-exp.el (org-export-replace-src-segments-and-examples): Also + take the final newline after the END line. + + * org.el (org-clean-visibility-after-subtree-move): Only fix + entries that are not entirely invisible already. + (org-insert-link): Respect org-link-file-path-type for + "docview:" links in addition to "file:" links. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-format-source-code-or-example): Avoid + additional extra white lines in LaTeX. + + * org-list.el (org-list-parse-list): Leave empty lines after the + list, don't consider them as part of the list. + + * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo + searches. + + * org-clock.el (org-clock-select-task): Convert integer to + character for XEmacs. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-resolve): Make reading a char XEmacs + compatible. + +2010-04-10 Tassilo Horn + + * org.el (org-complete-tags-always-offer-all-agenda-tags): New + variable. + (org-set-tags): Use it. + +2010-04-10 Carsten Dominik + + * org-list.el (org-empty-line-terminates-plain-lists): Update + docstring. + + * org.el (org-format-latex): Fix link creation for processed latex + snippets. + +2010-04-10 Carsten Dominik + + * org-footnote.el (org-footnote-normalize): Protect replacement + text. + + * org.el (org-inside-latex-macro-p): Save match data. + +2010-04-10 Jan Böcker + + * org-docview.el: New file. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-class-options): New variable. + (org-export-latex-set-initial-vars): Use the class options. + + * org.el (org-forward-same-level): Stop at headings that start + with an invisible character. + (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS. + +2010-04-10 Carsten Dominik + + * org-footnote.el (org-footnote-normalize): Don't take optional + arguments in LaTeX macros as footnotes. + + * org.el (org-inside-latex-macro-p): New function. + + * org-latex.el (org-latex-to-pdf-process): Change customization + group to `org-export-pdf'. + + * org-agenda.el (org-agenda-get-blocks): Look at time string also + on days after the first one. + + * org.el (org-insert-heading): Also check for item before assuming + before-first-heading condition. + + * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag. + (org-export-pdf-logfiles): New option. + (org-export-as-pdf): Use `org-export-pdf-logfiles'. + (org-export-pdf-logfiles): Fix customization type. + + * org.el (org-insert-link): Improve error message when there is no + default link to select with RET. + + * org-agenda.el (org-agenda-filter-by-tag): Use char argument from + parameter list. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-parse-global) + (org-export-latex-parse-content) + (org-export-latex-parse-subcontent): Use + `org-re-search-forward-unprotected'. + (org-export-as-pdf): Remove log files produced by XeTeX. + + * org-macs.el (org-re-search-forward-unprotected): New function. + +2010-04-10 James TD Smith + + * org-colview.el (org-agenda-colview-summarize): Sort out some + confusion between properties and titles, which resulted in + agenda summaries not working if a title was set for a column. + +2010-04-10 Carsten Dominik + + * org-mobile.el (org-mobile-agendas): New option. + (org-mobile-sumo-agenda-command): Select the right agendas. + + * org-latex.el (org-export-latex-format-image): Preserve the + original-indentation property. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-insert-selection-line): Catch error when + an old tasks no longer exists. + + * org-latex.el (org-export-as-pdf): Remove also the .idx file. + (org-export-as-pdf): Don't remove the old PDF file before making + the new one. + + * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item) + (org-mouse-context-menu): Use `org-looking-back'. + + * org.el (org-cycle-level): Use `org-looking-back'. + + * org-list.el (org-cycle-item-indentation): Use + `org-looking-back'. + + * org-compat.el (org-looking-back): New function. + + * org.el (org-insert-heading): Catch before-first-headline when + inserting a headline. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-format-image): Indent figure + environment, so that it does not interrupt plain list. + + * org.el (org-open-at-point): Allow long link descriptions. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html): Remove empty lines at the + beginning of the exported text. + 2010-03-12 Chong Yidong * org.el (org): Remove from hypermedia group. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-agenda.el --- a/lisp/org/org-agenda.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-agenda.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -88,7 +88,7 @@ (integer :tag "When more than N lines"))) (defcustom org-agenda-compact-blocks nil - "Non-nil means, make the block agenda more compact. + "Non-nil means make the block agenda more compact. This is done by leaving out unnecessary lines." :group 'org-agenda :type 'boolean) @@ -108,7 +108,7 @@ :group 'org-agenda) (defcustom org-agenda-with-colors t - "Non-nil means, use colors in agenda views." + "Non-nil means use colors in agenda views." :group 'org-agenda-export :type 'boolean) @@ -149,7 +149,7 @@ :type 'integer) (defcustom org-agenda-add-entry-text-descriptive-links t - "Non-nil means, export org-links as descriptive links in agenda added text. + "Non-nil means export org-links as descriptive links in agenda added text. This variable applies to the text added to the agenda when `org-agenda-add-entry-text-maxlines' is larger than 0. When this variable nil, the URL will (also) be shown." @@ -258,6 +258,13 @@ (const :format "" quote) (repeat (string :tag "+tag or -tag")))) + (list :tag "Set daily/weekly entry types" + (const org-agenda-entry-types) + (set :greedy t :value (:deadline :scheduled :timestamp :sexp) + (const :deadline) + (const :scheduled) + (const :timestamp) + (const :sexp))) (list :tag "Standard skipping condition" :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) (const org-agenda-skip-function) @@ -273,6 +280,24 @@ :tag "Condition type" (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp)) (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp)) + (list :tag "TODO state is" :inline t + (const 'todo) + (choice + (const :tag "any not-done state" 'todo) + (const :tag "any done state" 'done) + (const :tag "any state" 'any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) + (list :tag "TODO state is not" :inline t + (const 'nottodo) + (choice + (const :tag "any not-done state" 'todo) + (const :tag "any done state" 'done) + (const :tag "any state" 'any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) (const :tag "scheduled" 'scheduled) (const :tag "not scheduled" 'notscheduled) (const :tag "deadline" 'deadline) @@ -499,20 +524,20 @@ :group 'org-agenda) (defvar org-agenda-archives-mode nil - "Non-nil means, the agenda will include archived items. + "Non-nil means the agenda will include archived items. If this is the symbol `trees', trees in the selected agenda scope that are marked with the ARCHIVE tag will be included anyway. When this is t, also all archive files associated with the current selection of agenda files will be included.") (defcustom org-agenda-skip-comment-trees t - "Non-nil means, skip trees that start with the COMMENT keyword. + "Non-nil means skip trees that start with the COMMENT keyword. When nil, these trees are also scanned by agenda commands." :group 'org-agenda-skip :type 'boolean) (defcustom org-agenda-todo-list-sublevels t - "Non-nil means, check also the sublevels of a TODO entry for TODO entries. + "Non-nil means check also the sublevels of a TODO entry for TODO entries. When nil, the sublevels of a TODO entry are not checked, resulting in potentially much shorter TODO lists." :group 'org-agenda-skip @@ -520,7 +545,7 @@ :type 'boolean) (defcustom org-agenda-todo-ignore-with-date nil - "Non-nil means, don't show entries with a date in the global todo list. + "Non-nil means don't show entries with a date in the global todo list. You can use this if you prefer to mark mere appointments with a TODO keyword, but don't want them to show up in the TODO list. When this is set, it also covers deadlines and scheduled items, the settings @@ -532,27 +557,73 @@ :type 'boolean) (defcustom org-agenda-todo-ignore-scheduled nil - "Non-nil means, don't show scheduled entries in the global todo list. -The idea behind this is that by scheduling it, you have already taken care -of this item. + "Non-nil means, ignore some scheduled TODO items when making TODO list. +This applies when creating the global todo list. +Valid values are: + +past Don't show entries scheduled today or in the past. + +future Don't show entries scheduled in the future. + The idea behind this is that by scheduling it, you don't want to + think about it until the scheduled date. + +all Don't show any scheduled entries in the global todo list. + The idea behind this is that by scheduling it, you have already + \"taken care\" of this item. + +t Same as `all', for backward compatibility. + See also `org-agenda-todo-ignore-with-date'. -See also the variable `org-agenda-tags-todo-honor-ignore-options'." +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." :group 'org-agenda-skip :group 'org-agenda-todo-list - :type 'boolean) + :type '(choice + (const :tag "Ignore future-scheduled todos" future) + (const :tag "Ignore past- or present-scheduled todos" past) + (const :tag "Ignore all scheduled todos" all) + (const :tag "Ignore all scheduled todos (compatibility)" t) + (const :tag "Show scheduled todos" nil))) (defcustom org-agenda-todo-ignore-deadlines nil - "Non-nil means, don't show near deadline entries in the global todo list. -Near means closer than `org-deadline-warning-days' days. -The idea behind this is that such items will appear in the agenda anyway. + "Non-nil means ignore some deadlined TODO items when making TODO list. +There are different motivations for using different values, please think +carefully when configuring this variable. + +This applie when creating the global todo list. +Valid values are: + +near Don't show near deadline entries. A deadline is near when it is + closer than `org-deadline-warning-days' days. The idea behind this + is that such items will appear in the agenda anyway. + +far Don't show TODO entries where a deadline has been defined, but + the deadline is not near. This is useful if you don't want to + use the todo list to figure out what to do now. + +past Don't show entries with a deadline timestamp for today or in the past. + +future Don't show entries with a deadline timestamp in the future, not even + when they become `near' ones. Use it with caution. + +all Ignore all TODO entries that do have a deadline. + +t Same as `near', for backward compatibility. + See also `org-agenda-todo-ignore-with-date'. -See also the variable `org-agenda-tags-todo-honor-ignore-options'." +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." :group 'org-agenda-skip :group 'org-agenda-todo-list - :type 'boolean) + :type '(choice + (const :tag "Ignore near deadlines" near) + (const :tag "Ignore near deadlines (compatibility)" t) + (const :tag "Ignore far deadlines" far) + (const :tag "Ignore all TODOs with a deadlines" all) + (const :tag "Show all TODOs, even if they have a deadline" nil))) (defcustom org-agenda-tags-todo-honor-ignore-options nil - "Non-nil means, honor todo-list ...ignore options also in tags-todo search. + "Non-nil means honor todo-list ...ignore options also in tags-todo search. The variables `org-agenda-todo-ignore-with-date', `org-agenda-todo-ignore-scheduled' @@ -603,6 +674,24 @@ :group 'org-agenda-daily/weekly :type 'boolean) +(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil + "Non-nil means skip deadline prewarning when entry is also scheduled. +This will apply on all days where a prewarning for the deadline would +be shown, but not at the day when the entry is actually due. On that day, +the deadline will be shown anyway. +This variable may be set to nil, t, or a number which will then give +the number of days before the actual deadline when the prewarnings +should resume. +This can be used in a workflow where the first showing of the deadline will +trigger you to schedule it, and then you don't want to be reminded of it +because you will take care of it on the day when scheduled." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Alwas show prewarning" nil) + (const :tag "Remove prewarning if entry is scheduled" t) + (integer :tag "Restart prewarning N days before deadline"))) + (defcustom org-agenda-skip-additional-timestamps-same-entry t "When nil, multiple same-day timestamps in entry make multiple agenda lines. When non-nil, after the search for timestamps has matched once in an @@ -617,7 +706,7 @@ :type 'boolean) (defcustom org-agenda-dim-blocked-tasks t - "Non-nil means, dim blocked tasks in the agenda display. + "Non-nil means dim blocked tasks in the agenda display. This causes some overhead during agenda construction, but if you have turned on `org-enforce-todo-dependencies', `org-enforce-todo-checkbox-dependencies', or any other blocking @@ -639,7 +728,7 @@ (const :tag "Make invisible" invisible))) (defcustom org-timeline-show-empty-dates 3 - "Non-nil means, `org-timeline' also shows dates without an entry. + "Non-nil means `org-timeline' also shows dates without an entry. When nil, only the days which actually have entries are shown. When t, all days between the first and the last date are shown. When an integer, show also empty dates, but if there is a gap of more than @@ -661,7 +750,7 @@ :type 'hook) (defcustom org-agenda-mouse-1-follows-link nil - "Non-nil means, mouse-1 on a link will follow the link in the agenda. + "Non-nil means mouse-1 on a link will follow the link in the agenda. A longer mouse click will still set point. Does not work on XEmacs. Needs to be set before org.el is loaded." :group 'org-agenda-startup @@ -673,7 +762,7 @@ :type 'boolean) (defcustom org-agenda-show-outline-path t - "Non-il means, show outline path in echo area after line motion." + "Non-nil means show outline path in echo area after line motion." :group 'org-agenda-startup :type 'boolean) @@ -707,7 +796,7 @@ expressions listed in `org-agenda-entry-text-exclude-regexps'.") (defvar org-agenda-include-inactive-timestamps nil - "Non-nil means, include inactive time stamps in agenda and timeline.") + "Non-nil means include inactive time stamps in agenda and timeline.") (defgroup org-agenda-windows nil "Options concerning the windows used by the Agenda in Org Mode." @@ -740,7 +829,7 @@ :type '(cons (number :tag "Minimum") (number :tag "Maximum"))) (defcustom org-agenda-restore-windows-after-quit nil - "Non-nil means, restore window configuration open exiting agenda. + "Non-nil means restore window configuration open exiting agenda. Before the window configuration is changed for displaying the agenda, the current status is recorded. When the agenda is exited with `q' or `x' and this option is set, the old state is restored. If @@ -757,7 +846,7 @@ :type 'integer) (defcustom org-agenda-start-on-weekday 1 - "Non-nil means, start the overview always on the specified weekday. + "Non-nil means start the overview always on the specified weekday. 0 denotes Sunday, 1 denotes Monday etc. When nil, always start on the current day. Custom commands can set this variable in the options section." @@ -766,7 +855,7 @@ (integer :tag "Weekday No."))) (defcustom org-agenda-show-all-dates t - "Non-nil means, `org-agenda' shows every day in the selected range. + "Non-nil means `org-agenda' shows every day in the selected range. When nil, only the days which actually have entries are shown." :group 'org-agenda-daily/weekly :type 'boolean) @@ -805,6 +894,12 @@ (format "%-10s %2d %s %4d%s" dayname day monthname year weekstring))) +(defcustom org-agenda-time-leading-zero nil + "Non-nil means use leading zero for military times in agenda. +For example, 9:30am would become 09:30 rather than 9:30." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defcustom org-agenda-weekend-days '(6 0) "Which days are weekend? These days get the special face `org-agenda-date-weekend' in the agenda @@ -825,6 +920,12 @@ :group 'org-agenda-daily/weekly :type 'boolean) +(defcustom org-agenda-include-deadlines t + "If non-nil, include entries within their deadline warning period. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defcustom org-agenda-include-all-todo nil "Set means weekly/daily agenda will always contain all TODO entries. The TODO entries will be listed at the top of the agenda, before @@ -834,7 +935,7 @@ :type 'boolean) (defcustom org-agenda-repeating-timestamp-show-all t - "Non-nil means, show all occurrences of a repeating stamp in the agenda. + "Non-nil means show all occurrences of a repeating stamp in the agenda. When nil, only one occurrence is shown, either today or the nearest into the future." :group 'org-agenda-daily/weekly @@ -861,7 +962,7 @@ :type '(set :greedy t (const closed) (const clock) (const state))) (defcustom org-agenda-log-mode-add-notes t - "Non-nil means, add first line of notes to log entries in agenda views. + "Non-nil means add first line of notes to log entries in agenda views. If a log item like a state change or a clock entry is associated with notes, the first line of these notes will be added to the entry in the agenda display." @@ -891,14 +992,41 @@ :group 'org-agenda-daily/weekly :type 'plist) -(defcustom org-agenda-search-view-search-words-only nil - "Non-nil means, the search string is interpreted as individual words -The search then looks for each word separately in each entry and -selects entries that have matches for all words. -When nil, matching as loose words will only take place if the first -word is preceded by + or -. If that is not the case, the search -string will just be matched as a substring in the entry, but with -each space character allowing for any whitespace, including newlines." +(defcustom org-agenda-search-view-always-boolean nil + "Non-nil means the search string is interpreted as individual parts. + +The search string for search view can either be interpreted as a phrase, +or as a list of snippets that define a boolean search for a number of +strings. + +When this is non-nil, the string will be split on whitespace, and each +snippet will be searched individually, and all must match in order to +select an entry. A snippet is then a single string of non-white +characters, or a string in double quotes, or a regexp in {} braces. +If a snippet is preceeded by \"-\", the snippet must *not* match. +\"+\" is syntactic sugar for positive selection. Each snippet may +be found as a full word or a partial word, but see the variable +`org-agenda-search-view-force-full-words'. + +When this is nil, search will look for the entire search phrase as one, +with each space character matching any amount of whitespace, including +line breaks. + +Even when this is nil, you can still switch to Boolean search dynamically +by preceeding the first snippet with \"+\" or \"-\". If the first snippet +is a regexp marked with braces like \"{abc}\", this will also switch to +boolean search." + :group 'org-agenda-search-view + :type 'boolean) + +(if (fboundp 'defvaralias) + (defvaralias 'org-agenda-search-view-search-words-only + 'org-agenda-search-view-always-boolean)) + +(defcustom org-agenda-search-view-force-full-words nil + "Non-nil me +ans, search words must be matches as complete words. +When nil, they may also match part of a word." :group 'org-agenda-search-view :type 'boolean) @@ -908,7 +1036,7 @@ :group 'org-agenda) (defcustom org-agenda-search-headline-for-time t - "Non-nil means, search headline for a time-of-day. + "Non-nil means search headline for a time-of-day. If the headline contains a time-of-day in one format or another, it will be used to sort the entry into the time sequence of items for a day. Some people have time stamps in the headline that refer to the creation @@ -919,7 +1047,7 @@ :type 'boolean) (defcustom org-agenda-use-time-grid t - "Non-nil means, show a time grid in the agenda schedule. + "Non-nil means show a time grid in the agenda schedule. A time grid is a set of lines for specific times (like every two hours between 8:00 and 20:00). The items scheduled for a day at specific times are sorted in between these lines. @@ -1036,7 +1164,7 @@ :type 'symbol) (defcustom org-sort-agenda-notime-is-late t - "Non-nil means, items without time are considered late. + "Non-nil means items without time are considered late. This is only relevant for sorting. When t, items which have no explicit time like 15:30 will be considered as 99:01, i.e. later than any items which do have a time. When nil, the default time is before 0:00. You can use this @@ -1046,7 +1174,7 @@ :type 'boolean) (defcustom org-sort-agenda-noeffort-is-high t - "Non-nil means, items without effort estimate are sorted as high effort. + "Non-nil means items without effort estimate are sorted as high effort. This also applies when filtering an agenda view with respect to the < or > effort operator. Then, tasks with no effort defined will be treated as tasks with high effort. @@ -1163,6 +1291,14 @@ (string :tag "Scheduled today ") (string :tag "Scheduled previously"))) +(defcustom org-agenda-inactive-leader "[" + "Text preceeding item pulled into the agenda by inactive time stamps. +These entries are added to the agenda when pressing \"[\"." + :group 'org-agenda-line-format + :type '(list + (string :tag "Scheduled today ") + (string :tag "Scheduled previously"))) + (defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: ") "Text preceeding deadline items in the agenda view. This is a list with two strings. The first applies when the item has its @@ -1177,7 +1313,7 @@ (function)))) (defcustom org-agenda-remove-times-when-in-prefix t - "Non-nil means, remove duplicate time specifications in agenda items. + "Non-nil means remove duplicate time specifications in agenda items. When the format `org-agenda-prefix-format' contains a `%t' specifier, a time-of-day specification in a headline or diary entry is extracted and placed into the prefix. If this option is non-nil, the original specification @@ -1204,7 +1340,7 @@ (const :tag "No default duration"))) (defcustom org-agenda-show-inherited-tags t - "Non-nil means, show inherited tags in each agenda line." + "Non-nil means show inherited tags in each agenda line." :group 'org-agenda-line-format :type 'boolean) @@ -1219,7 +1355,7 @@ (string :tag "Regexp "))) (defcustom org-agenda-remove-tags nil - "Non-nil means, remove the tags from the headline copy in the agenda. + "Non-nil means remove the tags from the headline copy in the agenda. When this is the symbol `prefix', only remove tags when `org-agenda-prefix-format' contains a `%T' specifier." :group 'org-agenda-line-format @@ -1244,7 +1380,7 @@ (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)) (defcustom org-agenda-fontify-priorities 'cookies - "Non-nil means, highlight low and high priorities in agenda. + "Non-nil means highlight low and high priorities in agenda. When t, the highest priority entries are bold, lowest priority italic. However, settings in org-priority-faces will overrule these faces. When this variable is the symbol `cookies', only fontify the @@ -1252,8 +1388,10 @@ This may also be an association list of priority faces, whose keys are the character values of `org-highest-priority', `org-default-priority', and `org-lowest-priority' (the default values -are ?A, ?B, and ?C, respectively). The face may be a named face, -or a list like `(:background \"Red\")'." +are ?A, ?B, and ?C, respectively). The face may be a named face, a +color as a string, or a list like `(:background \"Red\")'. +If it is a color, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-agenda-line-format :type '(choice (const :tag "Never" nil) @@ -1261,7 +1399,9 @@ (const :tag "Cookies only" cookies) (repeat :tag "Specify" (list (character :tag "Priority" :value ?A) - (sexp :tag "face"))))) + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face")))))) (defgroup org-agenda-column-view nil "Options concerning column view in the agenda." @@ -1269,12 +1409,12 @@ :group 'org-agenda) (defcustom org-agenda-columns-show-summaries t - "Non-nil means, show summaries for columns displayed in the agenda view." + "Non-nil means show summaries for columns displayed in the agenda view." :group 'org-agenda-column-view :type 'boolean) (defcustom org-agenda-columns-remove-prefix-from-item t - "Non-nil means, remove the prefix from a headline for agenda column view. + "Non-nil means remove the prefix from a headline for agenda column view. The special ITEM field in the columns format contains the current line, with all information shown in other columns (like the TODO state or a tag). When this variable is non-nil, also the agenda prefix will be removed from @@ -1284,7 +1424,7 @@ :type 'boolean) (defcustom org-agenda-columns-compute-summary-properties t - "Non-nil means, recompute all summary properties before column view. + "Non-nil means recompute all summary properties before column view. When column view in the agenda is listing properties that have a summary operator, it can go to all relevant buffers and recompute the summaries there. This can mean overhead for the agenda column view, but is necessary @@ -1295,7 +1435,7 @@ :type 'boolean) (defcustom org-agenda-columns-add-appointments-to-effort-sum nil - "Non-nil means, the duration of an appointment will add to day effort. + "Non-nil means the duration of an appointment will add to day effort. The property to which appointment durations will be added is the one given in the option `org-effort-property'. If an appointment does not have an end time, `org-agenda-default-appointment-duration' will be used. If that @@ -1309,7 +1449,10 @@ The sole argument to the function, which is called once for each possible tag, is a string giving the name of the tag. The function should return either nil if the tag should be included -as normal, or \"-\" to exclude the tag." +as normal, or \"-\" to exclude the tag. +Note that for the purpose of tag filtering, only the lower-case version of +all tags will be considered, so that this function will only ever see +the lower-case version of all tags." :group 'org-agenda :type 'function) @@ -1456,6 +1599,7 @@ (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode) (org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch) (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary) +(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines) (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid) (org-defkey org-agenda-mode-map "r" 'org-agenda-redo) (org-defkey org-agenda-mode-map "g" 'org-agenda-redo) @@ -1556,6 +1700,9 @@ ["Include Diary" org-agenda-toggle-diary :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)] + ["Include Deadlines" org-agenda-toggle-deadlines + :style toggle :selected org-agenda-include-deadlines + :active (org-agenda-check-type nil 'agenda)] ["Use Time Grid" org-agenda-toggle-time-grid :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)] @@ -1674,7 +1821,7 @@ ;;; Agenda undo (defvar org-agenda-allow-remote-undo t - "Non-nil means, allow remote undo from the agenda buffer.") + "Non-nil means allow remote undo from the agenda buffer.") (defvar org-agenda-undo-list nil "List of undoable operations in the agenda since last refresh.") (defvar org-agenda-undo-has-started-in nil @@ -2186,7 +2333,7 @@ (princ (org-encode-for-stdout (mapconcat 'org-agenda-export-csv-mapper - '(org-category txt type todo tags date time-of-day extra + '(org-category txt type todo tags date time extra priority-letter priority agenda-day) ","))) (princ "\n")))))) @@ -2690,9 +2837,13 @@ ov (org-make-overlay b e)) (org-overlay-put ov 'face - (cond ((cdr (assoc p org-priority-faces))) + (cond ((org-face-from-face-or-color + 'priority nil + (cdr (assoc p org-priority-faces)))) ((and (listp org-agenda-fontify-priorities) - (cdr (assoc p org-agenda-fontify-priorities)))) + (org-face-from-face-or-color + 'priority nil + (cdr (assoc p org-agenda-fontify-priorities))))) ((equal p l) 'italic) ((equal p h) 'bold))) (org-overlay-put ov 'org-type 'org-priority))))) @@ -2981,6 +3132,39 @@ (defvar org-agenda-span nil) ; local variable in the agenda buffer (defvar org-include-all-loc nil) ; local variable +(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp) + "List of types searched for when creating the daily/weekly agenda. +This variable is a list of symbols that controls the types of +items that appear in the daily/weekly agenda. Allowed symbols in this +list are are + + :timestamp List items containing a date stamp or date range matching + the selected date. This includes sexp entries in + angular brackets. + + :sexp List entries resulting from plain diary-like sexps. + + :deadline List deadline due on that date. When the date is today, + also list any deadlines past due, or due within + `org-deadline-warning-days'. `:deadline' must appear before + `:scheduled' if the setting of + `org-agenda-skip-scheduled-if-deadline-is-shown' is to have + any effect. + + :scheduled List all items which are scheduled for the given date. + The diary for *today* also contains items which were + scheduled earlier and are not yet marked DONE. + +By default, all four types are turned on. + +Never set this variable globally using `setq', because then it +will apply to all future agenda commands. Instead, bind it with +`let' to scope it dynamically into the the agenda-constructing +command. A good way to set it is through options in +`org-agenda-custom-commands'. For a more flexible (though +somewhat less efficient) way of determining what is included in +the daily/weekly agenda, see `org-agenda-skip-function'.") + ;;;###autoload (defun org-agenda-list (&optional include-all start-day ndays) "Produce a daily/weekly view from all files in variable `org-agenda-files'. @@ -3104,18 +3288,22 @@ (while (setq file (pop files)) (catch 'nextfile (org-check-agenda-file file) - (cond - ((eq org-agenda-show-log 'only) - (setq rtn (org-agenda-get-day-entries - file date :closed))) - (org-agenda-show-log - (setq rtn (org-agenda-get-day-entries - file date - :deadline :scheduled :timestamp :sexp :closed))) - (t - (setq rtn (org-agenda-get-day-entries - file date - :deadline :scheduled :sexp :timestamp)))) + (let ((org-agenda-entry-types org-agenda-entry-types)) + (unless org-agenda-include-deadlines + (setq org-agenda-entry-types + (delq :deadline org-agenda-entry-types))) + (cond + ((eq org-agenda-show-log 'only) + (setq rtn (org-agenda-get-day-entries + file date :closed))) + (org-agenda-show-log + (setq rtn (apply 'org-agenda-get-day-entries + file date + (append '(:closed) org-agenda-entry-types)))) + (t + (setq rtn (apply 'org-agenda-get-day-entries + file date + org-agenda-entry-types))))) (setq rtnall (append rtnall rtn)))) (if org-agenda-include-diary (let ((org-agenda-search-headline-for-time t)) @@ -3195,11 +3383,11 @@ (modify-syntax-entry ?` "." org-search-syntax-table)) org-search-syntax-table) +(defvar org-agenda-last-search-view-search-was-boolean nil) + ;;;###autoload (defun org-search-view (&optional todo-only string edit-at) - "Show all entries that contain words or regular expressions. -If the first character of the search string is an asterisks, -search only the headlines. + "Show all entries that contain a phrase or words or regular expressions. With optional prefix argument TODO-ONLY, only consider entries that are TODO entries. The argument STRING can be used to pass a default search @@ -3207,28 +3395,37 @@ user should get a chance to edit this string, with cursor at position EDIT-AT. -The search string is broken into \"words\" by splitting at whitespace. -Depending on the variable `org-agenda-search-view-search-words-only' -and on whether the first character in the search string is \"+\" or \"-\", -The string is then interpreted either as a substring with variable amounts -of whitespace, or as a list or individual words that should be matched. - -The default is a substring match, where each space in the search string -can expand to an arbitrary amount of whitespace, including newlines. - -If matching individual words, these words are then interpreted as a -boolean expression with logical AND. Words prefixed with a minus must -not occur in the entry. Words without a prefix or prefixed with a plus -must occur in the entry. Matching is case-insensitive and the words -are enclosed by word delimiters. - -Words enclosed by curly braces are interpreted as regular expressions -that must or must not match in the entry. - -If the search string starts with an asterisk, search only in headlines. -If (possibly after the leading star) the search string starts with an -exclamation mark, this also means to look at TODO entries only, an effect -that can also be achieved with a prefix argument. +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceeding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceeded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to incude whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. This command searches the agenda files, and in addition the files listed in `org-agenda-text-search-extra-files'." @@ -3243,17 +3440,21 @@ 'org-complex-heading-regexp org-complex-heading-regexp 'mouse-face 'highlight 'help-echo (format "mouse-2 or RET jump to location"))) + (full-words org-agenda-search-view-force-full-words) regexp rtn rtnall files file pos - marker category tags c neg re as-words + marker category tags c neg re boolean ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) (unless (and (not edit-at) (stringp string) (string-match "\\S-" string)) - (setq string (read-string "[+-]Word/{Regexp} ...: " - (cond - ((integerp edit-at) (cons string edit-at)) - (edit-at string)) - 'org-agenda-search-history))) + (setq string (read-string + (if org-agenda-search-view-always-boolean + "[+-]Word/{Regexp} ...: " + "Phrase, or [+-]Word/{Regexp} ...: ") + (cond + ((integerp edit-at) (cons string edit-at)) + (edit-at string)) + 'org-agenda-search-history))) (org-set-local 'org-todo-only todo-only) (setq org-agenda-redo-command (list 'org-search-view (if todo-only t nil) string @@ -3267,21 +3468,41 @@ (when (equal (string-to-char words) ?!) (setq todo-only t words (substring words 1))) - (if (or org-agenda-search-view-search-words-only - (member (string-to-char string) '(?- ?+))) - (setq as-words t)) + (when (equal (string-to-char words) ?:) + (setq full-words t + words (substring words 1))) + (if (or org-agenda-search-view-always-boolean + (member (string-to-char words) '(?- ?+ ?\{))) + (setq boolean t)) (setq words (org-split-string words)) - (if as-words + (setq org-agenda-last-search-view-search-was-boolean boolean) + (when boolean + (let (wds w) + (while (setq w (pop words)) + (if (or (equal (substring w 0 1) "\"") + (and (> (length w) 1) + (member (substring w 0 1) '("+" "-")) + (equal (substring w 1 2) "\""))) + (while (and words (not (equal (substring w -1) "\""))) + (setq w (concat w " " (pop words))))) + (and (string-match "\\`\\([-+]?\\)\"" w) + (setq w (replace-match "\\1" nil nil w))) + (and (equal (substring w -1) "\"") (setq w (substring w 0 -1))) + (push w wds)) + (setq words (nreverse wds)))) + (if boolean (mapc (lambda (w) (setq c (string-to-char w)) (if (equal c ?-) (setq neg t w (substring w 1)) (if (equal c ?+) (setq neg nil w (substring w 1)) - (setq neg nil))) + (setq neg nil))) (if (string-match "\\`{.*}\\'" w) (setq re (substring w 1 -1)) - (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) + (if full-words + (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")) + (setq re (regexp-quote (downcase w))))) (if neg (push re regexps-) (push re regexps+))) words) (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") @@ -3407,6 +3628,7 @@ (org-compile-prefix-format 'todo) (org-set-sorting-strategy 'todo) (org-prepare-agenda "TODO") + (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil)) (let* ((today (time-to-days (current-time))) (date (calendar-gregorian-from-absolute today)) (kwds org-todo-keywords-for-agenda) @@ -3475,11 +3697,12 @@ (org-compile-prefix-format 'tags) (org-set-sorting-strategy 'tags) (let* ((org-tags-match-list-sublevels -;?????? (if todo-only t org-tags-match-list-sublevels)) org-tags-match-list-sublevels) (completion-ignore-case t) rtn rtnall files file pos matcher buffer) + (when (and (stringp match) (not (string-match "\\S-" match))) + (setq match nil)) (setq matcher (org-make-tags-matcher match) match (car matcher) matcher (cdr matcher)) (org-prepare-agenda (concat "TAGS " match)) @@ -3610,10 +3833,26 @@ nottimestamp Check if there is no timestamp (also deadline or scheduled) regexp Check if regexp matches notregexp Check if regexp does not match. +todo Check if TODO keyword matches +nottodo Check if TODO keyword does not match The regexp is taken from the conditions list, it must come right after the `regexp' or `notregexp' element. +`todo' and `nottodo' accept as an argument a list of todo +keywords, which may include \"*\" to match any todo keyword. + + (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\")) + +would skip all entries with \"TODO\" or \"WAITING\" keywords. + +Instead of a list a keyword class may be given + + (org-agenda-skip-entry-if 'nottodo 'done) + +would skip entries that haven't been marked with any of \"DONE\" +keywords. Possible classes are: `todo', `done', `any'. + If any of these conditions is met, this function returns the end point of the entity, causing the search to continue from there. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." @@ -3643,9 +3882,45 @@ (re-search-forward (nth 1 m) end t)) (and (setq m (memq 'notregexp conditions)) (stringp (nth 1 m)) - (not (re-search-forward (nth 1 m) end t)))) + (not (re-search-forward (nth 1 m) end t))) + (and (or + (setq m (memq 'todo conditions)) + (setq m (memq 'nottodo conditions))) + (org-agenda-skip-if-todo m end))) end))) +(defun org-agenda-skip-if-todo (args end) + "Helper function for `org-agenda-skip-if', do not use it directly. +ARGS is a list with first element either `todo' or `nottodo'. +The remainder is either a list of TODO keywords, or a state symbol +`todo' or `done' or `any'." + (let ((kw (car args)) + (arg (cadr args)) + todo-wds todo-re) + (setq todo-wds + (org-uniquify + (cond + ((listp arg) ;; list of keywords + (if (member "*" arg) + (mapcar 'substring-no-properties org-todo-keywords-1) + arg)) + ((symbolp arg) ;; keyword class name + (cond + ((eq arg 'todo) + (org-delete-all org-done-keywords + (mapcar 'substring-no-properties + org-todo-keywords-1))) + ((eq arg 'done) org-done-keywords) + ((eq arg 'any) + (mapcar 'substring-no-properties org-todo-keywords-1))))))) + (setq todo-re + (concat "^\\*+[ \t]+\\<\\(" + (mapconcat 'identity todo-wds "\\|") + "\\)\\>")) + (if (eq kw 'todo) + (re-search-forward todo-re end t) + (not (re-search-forward todo-re end t))))) + ;;;###autoload (defun org-agenda-list-stuck-projects (&rest ignore) "Create agenda view for projects that are stuck. @@ -3744,7 +4019,7 @@ (setq x (org-format-agenda-item "" x "Diary" nil 'time)) ;; Extend the text properties to the beginning of the line (org-add-props x (text-properties-at (1- (length x)) x) - 'type "diary" 'date date)) + 'type "diary" 'date date 'face 'org-agenda-diary)) entries))))) (defvar org-agenda-cleanup-fancy-diary-hook nil @@ -3811,33 +4086,16 @@ (apply 'diary-add-to-list args) (apply 'add-to-diary-list args))) +(defvar org-diary-last-run-time nil) + ;;;###autoload (defun org-diary (&rest args) "Return diary information from org-files. This function can be used in a \"sexp\" diary entry in the Emacs calendar. It accesses org files and extracts information from those files to be listed in the diary. The function accepts arguments specifying what -items should be listed. The following arguments are allowed: - - :timestamp List the headlines of items containing a date stamp or - date range matching the selected date. Deadlines will - also be listed, on the expiration day. - - :sexp List entries resulting from diary-like sexps. - - :deadline List any deadlines past due, or due within - `org-deadline-warning-days'. The listing occurs only - in the diary for *today*, not at any other date. If - an entry is marked DONE, it is no longer listed. - - :scheduled List all items which are scheduled for the given date. - The diary for *today* also contains items which were - scheduled earlier and are not yet marked DONE. - - :todo List all TODO items from the org-file. This may be a - long list - so this is not turned on by default. - Like deadlines, these entries only show up in the - diary for *today*, not at any other date. +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. The call in the diary file should look like this: @@ -3867,8 +4125,14 @@ (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) (list entry) (org-agenda-files t))) + (time (org-float-time)) file rtn results) - (org-prepare-agenda-buffers files) + (when (or (not org-diary-last-run-time) + (> (- time + org-diary-last-run-time) + 3)) + (org-prepare-agenda-buffers files)) + (setq org-diary-last-run-time time) ;; If this is called during org-agenda, don't return any entries to ;; the calendar. Org Agenda will list these entries itself. (if org-disable-agenda-to-diary (setq files nil)) @@ -3986,8 +4250,9 @@ (nreverse ee))) ;;;###autoload -(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end) - "Do we have a reason to ignore this todo entry because it has a time stamp?" +(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item + (&optional end) + "Do we have a reason to ignore this TODO entry because it has a time stamp?" (when (or org-agenda-todo-ignore-with-date org-agenda-todo-ignore-scheduled org-agenda-todo-ignore-deadlines) @@ -3996,10 +4261,24 @@ (or (and org-agenda-todo-ignore-with-date (re-search-forward org-ts-regexp end t)) (and org-agenda-todo-ignore-scheduled - (re-search-forward org-scheduled-time-regexp end t)) + (re-search-forward org-scheduled-time-regexp end t) + (cond + ((eq org-agenda-todo-ignore-scheduled 'future) + (> (org-days-to-time (match-string 1)) 0)) + ((eq org-agenda-todo-ignore-scheduled 'past) + (<= (org-days-to-time (match-string 1)) 0)) + (t))) (and org-agenda-todo-ignore-deadlines (re-search-forward org-deadline-time-regexp end t) - (org-deadline-close (match-string 1))))))) + (cond + ((memq org-agenda-todo-ignore-deadlines '(t all)) t) + ((eq org-agenda-todo-ignore-deadlines 'far) + (not (org-deadline-close (match-string 1)))) + ((eq org-agenda-todo-ignore-deadlines 'future) + (> (org-days-to-time (match-string 1)) 0)) + ((eq org-agenda-todo-ignore-deadlines 'past) + (<= (org-days-to-time (match-string 1)) 0)) + (t (org-deadline-close (match-string 1))))))))) (defconst org-agenda-no-heading-message "No heading for this item in buffer or region.") @@ -4083,7 +4362,7 @@ (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") (setq head (match-string 1)) (setq txt (org-format-agenda-item - (if inactivep "[" nil) + (if inactivep org-agenda-inactive-leader nil) head category tags timestr nil remove-re))) (setq priority (org-get-priority txt)) @@ -4141,6 +4420,30 @@ (push txt ee)))) (nreverse ee))) +(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks) + "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS. +The order of the first 2 times 3 arguments depends on the variable +`calendar-date-style' or, if that is not defined, on `european-calendar-style'. +So for american calendars, give this as MONTH DAY YEAR, for european as +DAY MONTH YEAR, and for ISO as YEAR MONTH DAY. +DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS +is any number of ISO weeks in the block period for which the item should +be skipped." + (let* ((date1 (calendar-absolute-from-gregorian + (org-order-calendar-date-args m1 d1 y1))) + (date2 (calendar-absolute-from-gregorian + (org-order-calendar-date-args m2 d2 y2))) + (d (calendar-absolute-from-gregorian date))) + (and + (<= date1 d) + (<= d date2) + (= (calendar-day-of-week date) dayname) + (or (not skip-weeks) + (progn + (require 'cal-iso) + (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) + entry))) + (defalias 'org-get-closed 'org-agenda-get-progress) (defun org-agenda-get-progress () "Return the logged TODO entries for agenda display." @@ -4248,11 +4551,22 @@ (todayp (org-agenda-todayp date)) ; DATE bound by calendar (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar d2 diff dfrac wdays pos pos1 category tags + suppress-prewarning ee txt head face s todo-state upcomingp donep timestr) (goto-char (point-min)) (while (re-search-forward regexp nil t) + (setq suppress-prewarning nil) (catch :skip (org-agenda-skip) + (when (and org-agenda-skip-deadline-prewarning-if-scheduled + (save-match-data + (string-match org-scheduled-time-regexp + (buffer-substring (point-at-bol) + (point-at-eol))))) + (setq suppress-prewarning + (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled) + org-agenda-skip-deadline-prewarning-if-scheduled + 0))) (setq s (match-string 1) txt nil pos (1- (match-beginning 1)) @@ -4260,7 +4574,10 @@ (match-string 1) d1 'past org-agenda-repeating-timestamp-show-all) diff (- d2 d1) - wdays (org-get-wdays s) + wdays (if suppress-prewarning + (let ((org-deadline-warning-days suppress-prewarning)) + (org-get-wdays s)) + (org-get-wdays s)) dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) upcomingp (and todayp (> diff 0))) ;; When to show a deadline in the calendar: @@ -4478,7 +4795,7 @@ org-agenda-timerange-leaders) (1+ (- d0 d1)) (1+ (- d2 d1))) head category tags - (if (= d0 d1) timestr)))) + timestr))) (org-add-props txt props 'org-marker marker 'org-hd-marker hdmarker 'type "block" 'date date @@ -4665,16 +4982,16 @@ (when (or add-inherited hide-re) (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt) (setq txt (substring txt 0 (match-beginning 0)))) + (setq tags + (delq nil + (mapcar (lambda (tg) + (if (or (and hide-re (string-match hide-re tg)) + (and (not add-inherited) + (get-text-property 0 'inherited tg))) + nil + tg)) + tags))) (when tags - (setq tags - (delq nil - (mapcar (lambda (tg) - (if (or (and hide-re (string-match hide-re tg)) - (and (not add-inherited) - (get-text-property 0 'inherited tg))) - nil - tg)) - tags))) (let ((have-i (get-text-property 0 'inherited (car tags))) i) (setq txt (concat txt " :" @@ -4805,6 +5122,8 @@ (mod h1 24) h1)) (t0 (+ (* 100 h2) m)) (t1 (concat (if (>= h1 24) "+" " ") + (if (and org-agenda-time-leading-zero + (< t0 1000)) "0" "") (if (< t0 100) "0" "") (if (< t0 10) "0" "") (int-to-string t0)))) @@ -4819,6 +5138,7 @@ (defun org-agenda-highlight-todo (x) (let ((org-done-keywords org-done-keywords-for-agenda) + (case-fold-search nil) re pl) (if (eq x 'line) (save-excursion @@ -5127,7 +5447,7 @@ (effort-prompt "") (inhibit-read-only t) (current org-agenda-filter) - char a n tag) + a n tag) (unless char (message "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>= (length time) 0) + ;; split-string removes trailing ...... if + ;; no end time given. First space + ;; separates time from date. + (concat " " (car (split-string time "\\."))) + nil) + text (get-text-property 0 'txt fmt))) + (if (eq org-agenda-insert-diary-strategy 'top-level) + (org-agenda-insert-diary-as-top-level text) + (require 'org-datetree) + (org-datetree-find-date-create d1) + (org-agenda-insert-diary-make-new-entry text)) + (org-insert-time-stamp (org-time-from-absolute + (calendar-absolute-from-gregorian d1)) + nil nil nil nil time2)) (end-of-line 0)) ((eq type 'block) (if (> (calendar-absolute-from-gregorian d1) @@ -6823,7 +7195,7 @@ (org-back-over-empty-lines) (or (looking-at "[ \t]*$") (progn (insert "\n") (backward-char 1))) - (org-insert-heading) + (org-insert-heading nil t) (org-do-demote) (setq col (current-column)) (insert text "\n") @@ -7007,6 +7379,8 @@ 'evaporate) (org-overlay-put ov 'type 'org-marked-entry-overlay)) (beginning-of-line 2) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2)) (message "%d entries marked for bulk action" (length org-agenda-bulk-marked-entries)))) @@ -7020,6 +7394,8 @@ (delete (org-get-at-bol 'org-hd-marker) org-agenda-bulk-marked-entries))) (beginning-of-line 2) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2)) (message "%d entries marked for bulk action" (length org-agenda-bulk-marked-entries))) @@ -7050,13 +7426,15 @@ (setq org-agenda-bulk-marked-entries nil) (org-agenda-bulk-remove-overlays (point-min) (point-max))) -(defun org-agenda-bulk-action () - "Execute an remote-editing action on all marked entries." - (interactive) +(defun org-agenda-bulk-action (&optional arg) + "Execute an remote-editing action on all marked entries. +The prefix arg is passed through to the command if possible." + (interactive "P") (unless org-agenda-bulk-marked-entries (error "No entries are marked")) (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline") (let* ((action (read-char-exclusive)) + (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) cmd rfloc state e tag pos (cnt 0) (cntskip 0)) (cond @@ -7098,17 +7476,18 @@ (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off)))) ((memq action '(?s ?d)) - (let* ((date (org-read-date - nil nil nil - (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))) - (ans org-read-date-final-answer) + (let* ((date (unless arg + (org-read-date + nil nil nil + (if (eq action ?s) "(Re)Schedule to" "Set Deadline to")))) + (ans (if arg nil org-read-date-final-answer)) (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline))) (setq cmd `(let* ((bound (fboundp 'read-string)) (old (and bound (symbol-function 'read-string)))) (unwind-protect (progn (fset 'read-string (lambda (&rest ignore) ,ans)) - (call-interactively ',c1)) + (eval '(,c1 arg))) (if bound (fset 'read-string old) (fmakunbound 'read-string))))))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-archive.el --- a/lisp/org/org-archive.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-archive.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -40,7 +40,12 @@ :type '(choice (const org-archive-subtree) (const org-archive-to-archive-sibling) - (const org-archive-set-tag))) + (const org-archive-set-tag))) + +(defcustom org-archive-reversed-order nil + "Non-nil means make the tree first child under the archive heading, not last." + :group 'org-archive + :type 'boolean) (defcustom org-archive-sibling-heading "Archive" "Name of the local archive sibling that is used to archive entries locally. @@ -50,7 +55,7 @@ :type 'string) (defcustom org-archive-mark-done nil - "Non-nil means, mark entries as DONE when they are moved to the archive file. + "Non-nil means mark entries as DONE when they are moved to the archive file. This can be a string to set the keyword to use. When t, Org-mode will use the first keyword in its list that means done." :group 'org-archive @@ -60,7 +65,7 @@ (string :tag "Use this keyword"))) (defcustom org-archive-stamp-time t - "Non-nil means, add a time stamp to entries moved to an archive file. + "Non-nil means add a time stamp to entries moved to an archive file. This variable is obsolete and has no effect anymore, instead add or remove `time' from the variable `org-archive-save-context-info'." :group 'org-archive @@ -273,7 +278,11 @@ (end-of-line 0)) ;; Make the subtree visible (show-subtree) - (org-end-of-subtree t) + (if org-archive-reversed-order + (progn + (org-back-to-heading t) + (outline-next-heading)) + (org-end-of-subtree t)) (skip-chars-backward " \t\r\n") (and (looking-at "[ \t\r\n]*") (replace-match "\n\n"))) @@ -355,7 +364,9 @@ (beginning-of-line 0) (org-toggle-tag org-archive-tag 'on)) (beginning-of-line 1) - (org-end-of-subtree t t) + (if org-archive-reversed-order + (outline-next-heading) + (org-end-of-subtree t t)) (save-excursion (goto-char pos) (let ((this-command this-command)) (org-cut-subtree))) @@ -389,7 +400,8 @@ (progn (setq re1 (concat "^" (regexp-quote (make-string - (1+ (- (match-end 0) (match-beginning 0) 1)) + (+ (- (match-end 0) (match-beginning 0) 1) + (if org-odd-levels-only 2 1)) ?*)) " ")) (move-marker begm (point)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-ascii.el --- a/lisp/org/org-ascii.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-ascii.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -52,19 +52,34 @@ :type '(repeat character)) (defcustom org-export-ascii-links-to-notes t - "Non-nil means, convert links to notes before the next headline. + "Non-nil means convert links to notes before the next headline. When nil, the link will be exported in place. If the line becomes long in this way, it will be wrapped." :group 'org-export-ascii :type 'boolean) (defcustom org-export-ascii-table-keep-all-vertical-lines nil - "Non-nil means, keep all vertical lines in ASCII tables. + "Non-nil means keep all vertical lines in ASCII tables. When nil, vertical lines will be removed except for those needed for column grouping." :group 'org-export-ascii :type 'boolean) +(defcustom org-export-ascii-table-widen-columns t + "Non-nil means widen narrowed columns for export. +When nil, narrowed columns will look in ASCII export just like in org-mode, +i.e. with \"=>\" as ellipsis." + :group 'org-export-ascii + :type 'boolean) + +(defvar org-export-ascii-entities 'ascii + "The ascii representation to be used during ascii export. +Possible values are: + +ascii Only use plain ASCII characters +latin1 Include Latin-1 character +utf8 Use all UTF-8 characters") + ;;; Hooks (defvar org-export-ascii-final-hook nil @@ -75,6 +90,41 @@ (defvar org-ascii-current-indentation nil) ; For communication ;;;###autoload +(defun org-export-as-latin1 (&rest args) + "Like `org-export-as-ascii', use latin1 encoding for special symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii (interactive-p) + 'latin1 args)) + +;;;###autoload +(defun org-export-as-latin1-to-buffer (&rest args) + "Like `org-export-as-ascii-to-buffer', use latin1 encoding for symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p) + 'latin1 args)) + +;;;###autoload +(defun org-export-as-utf8 (&rest args) + "Like `org-export-as-ascii', use use encoding for special symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii (interactive-p) + 'utf8 args)) + +;;;###autoload +(defun org-export-as-utf8-to-buffer (&rest args) + "Like `org-export-as-ascii-to-buffer', use utf8 encoding for symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p) + 'utf8 args)) + +(defun org-export-as-encoding (command interactivep encoding &rest args) + (let ((org-export-ascii-entities encoding)) + (if interactivep + (call-interactively command) + (apply command args)))) + + +;;;###autoload (defun org-export-as-ascii-to-buffer (arg) "Call `org-export-as-ascii` with output to a temporary buffer. No file is created. The prefix ARG is passed through to `org-export-as-ascii'." @@ -156,6 +206,7 @@ the file header and footer. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) (setq-default org-todo-line-regexp org-todo-line-regexp) (let* ((opt-plist (org-combine-plists (org-default-export-plist) ext-plist @@ -181,6 +232,11 @@ (if subtree-p (org-export-add-subtree-options opt-plist rbeg) opt-plist))) + ;; The following two are dynamically scoped into other + ;; routines below. + (org-current-export-dir + (or pub-dir (org-export-directory :html opt-plist))) + (org-current-export-file buffer-file-name) (custom-times org-display-custom-times) (org-ascii-current-indentation '(0 . 0)) (level 0) line txt @@ -219,8 +275,10 @@ (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension - (file-name-nondirectory bfname)))) + (and (buffer-file-name) + (file-name-sans-extension + (file-name-nondirectory bfname))) + "UNTITLED")) (email (plist-get opt-plist :email)) (language (plist-get opt-plist :language)) (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) @@ -287,7 +345,9 @@ (if (and (or author email) org-export-author-info) (insert(concat (nth 1 lang-words) ": " (or author "") - (if email (concat " <" email ">") "") + (if (and org-export-email-info + email (string-match "\\S-" email)) + (concat " <" email ">") "") "\n"))) (cond @@ -482,18 +542,31 @@ (defun org-export-ascii-preprocess (parameters) "Do extra work for ASCII export" + ;; + ;; Realign tables to get rid of narrowing + (when org-export-ascii-table-widen-columns + (let ((org-table-do-narrow nil)) + (goto-char (point-min)) + (org-ascii-replace-entities) + (goto-char (point-min)) + (org-table-map-tables + (lambda () + (org-if-unprotected + (org-table-align)))))) ;; Put quotes around verbatim text (goto-char (point-min)) (while (re-search-forward org-verbatim-re nil t) - (goto-char (match-end 2)) - (backward-delete-char 1) (insert "'") - (goto-char (match-beginning 2)) - (delete-char 1) (insert "`") - (goto-char (match-end 2))) + (org-if-unprotected-at (match-beginning 4) + (goto-char (match-end 2)) + (backward-delete-char 1) (insert "'") + (goto-char (match-beginning 2)) + (delete-char 1) (insert "`") + (goto-char (match-end 2)))) ;; Remove target markers (goto-char (point-min)) (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) - (replace-match "\\1\\2"))) + (org-if-unprotected-at (match-beginning 1) + (replace-match "\\1\\2")))) (defun org-html-expand-for-ascii (line) "Handle quoted HTML for ASCII export." @@ -503,6 +576,15 @@ (setq line (replace-match "" nil nil line)))) line) +(defun org-ascii-replace-entities () + "Replace entities with the ASCII representation." + (let (e) + (while (re-search-forward "\\\\\\([a-zA-Z]+[0-9]*\\)" nil t) + (org-if-unprotected-at (match-beginning 1) + (setq e (org-entity-get-representation (match-string 1) + org-export-ascii-entities)) + (and e (replace-match e t t)))))) + (defun org-export-ascii-wrap (line where) "Wrap LINE at or before WHERE." (let ((ind (org-get-indentation line)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-attach.el --- a/lisp/org/org-attach.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-attach.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ :type 'boolean) (defcustom org-attach-allow-inheritance t - "Non-nil means, allow attachment directories be inherited." + "Non-nil means allow attachment directories be inherited." :group 'org-attach :type 'boolean) @@ -241,12 +241,17 @@ "Commit changes to git if `org-attach-directory' is properly initialized. This checks for the existence of a \".git\" directory in that directory." (let ((dir (expand-file-name org-attach-directory))) - (if (file-exists-p (expand-file-name ".git" dir)) - (shell-command - (concat "(cd " dir "; " - " git add .; " - " git ls-files --deleted -z | xargs -0 git rm; " - " git commit -m 'Synchronized attachments')"))))) + (when (file-exists-p (expand-file-name ".git" dir)) + (with-temp-buffer + (cd dir) + (shell-command "git add .") + (shell-command "git ls-files --deleted" t) + (mapc '(lambda (file) + (unless (string= file "") + (shell-command + (concat "git rm \"" file "\"")))) + (split-string (buffer-string) "\n")) + (shell-command "git commit -m 'Synchronized attachments'"))))) (defun org-attach-tag (&optional off) "Turn the autotag on or (if OFF is set) off." @@ -322,7 +327,8 @@ (setq file (expand-file-name file attach-dir)) (unless (file-exists-p file) (error "No such attachment: %s" file)) - (delete-file file))) + (delete-file file) + (org-attach-commit))) (defun org-attach-delete-all (&optional force) "Delete all attachments from the current task. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-bbdb.el --- a/lisp/org/org-bbdb.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-bbdb.el Thu May 13 15:13:52 2010 +0200 @@ -7,7 +7,7 @@ ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-beamer.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-beamer.el Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,624 @@ +;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode +;; +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; +;; Version: 6.35i +;; Author: Carsten Dominik +;; Maintainer: Carsten Dominik +;; Keywords: org, wp, tex + +;; 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 GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This library implement the special treatment needed by using the +;; beamer class during LaTeX export. + +(require 'org) +(require 'org-exp) +(defvar org-export-latex-header) +(defvar org-export-latex-options-plist) +(defvar org-export-opt-plist) + +(defgroup org-beamer nil + "Options specific for using the beamer class in LaTeX export." + :tag "Org Beamer" + :group 'org-export-latex) + +(defcustom org-beamer-use-parts nil + "" + :group 'org-beamer + :type 'boolean) + +(defcustom org-beamer-frame-level 1 + "The level that should be interpreted as a frame. +The levels above this one will be translated into a sectioning structure. +Setting this to 2 will allow sections, 3 will allow subsections as well. +You can se this to 4 as well, if you at the same time set +`org-beamer-use-parts' to make the top levels `\part'." + :group 'org-beamer + :type '(choice + (const :tag "Frames need a BEAMER_env property" nil) + (integer :tag "Specific level makes a frame"))) + +(defcustom org-beamer-frame-default-options "" + "Default options string to use for frames, should contains the [brackets]. +And example for this is \"[allowframebreaks]\"." + :group 'org-beamer + :type '(string :tag "[options]")) + +(defcustom org-beamer-column-view-format + "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)" + "Default column view format that should be used to fill the template." + :group 'org-beamer + :type '(string :tag "Beamer column view format")) + +(defcustom org-beamer-themes + "\\usetheme{default}\\usecolortheme{default}" + "Default string to be used for extra heading stuff in beamer presentations. +When a beamer template is filled, this will be the default for +BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}." + :group 'org-beamer + :type '(string :tag "Beamer column view format")) + +(defconst org-beamer-column-widths + "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC" +"The column widths that should be installed as allowed property values.") + +(defconst org-beamer-transitions + "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC" + "Transitions available for beamer. +These are just a completion help.") + +(defconst org-beamer-environments-default + '(("frame" "f" "dummy- special handling hard coded" "dummy") + ("columns" "C" "\\begin{columns}%o %% %h%x" "\\end{columns}") + ("column" "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}") + ("block" "b" "\\begin{block}%a{%h}%x" "\\end{block}") + ("alertblock" "a" "\\begin{alertblock}%a{%h}%x" "\\end{alertblock}") + ("verse" "v" "\\begin{verse}%a %% %h%x" "\\end{verse}") + ("quotation" "q" "\\begin{quotation}%a %% %h%x" "\\end{quotation}") + ("quote" "Q" "\\begin{quote}%a %% %h%x" "\\end{quote}") + ("structureenv" "s" "\\begin{structureenv}%a %% %h%x" "\\end{structureenv}") + ("theorem" "t" "\\begin{theorem}%a%U%x" "\\end{theorem}") + ("definition" "d" "\\begin{definition}%a%U%x" "\\end{definition}") + ("example" "e" "\\begin{example}%a%U%x" "\\end{example}") + ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}") + ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x" "\\end{beamercolorbox}") + ("normal" "h" "%h" "") ; Emit the heading as normal text + ("note" "n" "\\note%o%a{%h" "}") + ("noteNH" "N" "\\note%o%a{" "}") ; note, ignore heading + ("ignoreheading" "i" "%%%% %h" "")) + "Environments triggered by properties in Beamer export. +These are the defaults - for user definitions, see +`org-beamer-environments-extra'. +\"normal\" is a special fake environment, which emite the heading as +normal text. It is needed when an environment should be surrounded +by normal text. Since beamer export converts nodes into environments, +you need to have a node to end the environment. +For example + + ** a frame + some text + *** Blocktitle :B_block: + inside the block + *** After the block :B_normal: + continuing here + ** next frame") + +(defcustom org-beamer-environments-extra nil + "Environments triggered by tags in Beamer export. +Each entry has 4 elements: + +name Name of the environment +key Selection key for `org-beamer-select-environment' +open The opening template for the environment, with the following excapes + %a the action/overlay specification + %A the default action/overlay specification + %o the options argument of the template + %h the headline text + %H if there is headline text, that text in {} braces + %U if there is headline text, that text in [] brackets +close The closing string of the environment." + + :group 'org-beamer + :type '(repeat + (list + (string :tag "Environment") + (string :tag "Selection key") + (string :tag "Begin") + (string :tag "End")))) + +(defvar org-beamer-frame-level-now nil) +(defvar org-beamer-header-extra nil) +(defvar org-beamer-export-is-beamer-p nil) +(defvar org-beamer-inside-frame-at-level nil) +(defvar org-beamer-columns-open nil) +(defvar org-beamer-column-open nil) + +(defun org-beamer-cleanup-column-width (width) + "Make sure the width is not empty, and that it has a unit." + (setq width (org-trim (or width ""))) + (unless (string-match "\\S-" width) (setq width "0.5")) + (if (string-match "\\`[.0-9]+\\'" width) + (setq width (concat width "\\textwidth"))) + width) + +(defun org-beamer-open-column (&optional width opt) + (org-beamer-close-column-maybe) + (setq org-beamer-column-open t) + (setq width (org-beamer-cleanup-column-width width)) + (insert (format "\\begin{column}%s{%s}\n" (or opt "") width))) +(defun org-beamer-close-column-maybe () + (when org-beamer-column-open + (setq org-beamer-column-open nil) + (insert "\\end{column}\n"))) +(defun org-beamer-open-columns-maybe (&optional opts) + (unless org-beamer-columns-open + (setq org-beamer-columns-open t) + (insert (format "\\begin{columns}%s\n" (or opts ""))))) +(defun org-beamer-close-columns-maybe () + (org-beamer-close-column-maybe) + (when org-beamer-columns-open + (setq org-beamer-columns-open nil) + (insert "\\end{columns}\n"))) + +(defun org-beamer-select-environment () + "Select the environment to be used by beamer for this entry. +While this uses (for convenince) a tag selection interface, the result +of this command will be that the BEAMER_env *property* of the entry is set. + +In addition to this, the command will also set a tag as a visual aid, but +the tag does not have any semantic meaning." + (interactive) + (let* ((envs (append org-beamer-environments-extra + org-beamer-environments-default)) + (org-tag-alist + (append '((:startgroup)) + (mapcar (lambda (e) (cons (concat "B_" (car e)) + (string-to-char (nth 1 e)))) + envs) + '((:endgroup)) + '(("BMCOL" . ?|)))) + (org-fast-tag-selection-single-key t)) + (org-set-tags) + (let ((tags (or (ignore-errors (org-get-tags-string)) ""))) + (cond + ((equal org-last-tag-selection-key ?|) + (if (string-match ":BMCOL:" tags) + (org-set-property "BEAMER_col" (read-string "Column width: ")) + (org-delete-property "BEAMER_col"))) + ((string-match (concat ":B_\\(" + (mapconcat 'car envs "\\|") + "\\):") + tags) + (org-entry-put nil "BEAMER_env" (match-string 1 tags))) + (t (org-entry-delete nil "BEAMER_env")))))) + + +(defun org-beamer-sectioning (level text) + "Return the sectioning entry for the current headline. +LEVEL is the reduced level of the headline. +TEXT is the text of the headline, everything except the leading stars. +The return value is a cons cell. The car is the headline text, usually +just TEXT, but possibly modified if options have been extracted from the +text. The cdr is the sectioning entry, similar to what is given +in org-export-latex-classes." + (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level)) + (default + (if org-beamer-use-parts + '((1 . ("\\part{%s}" . "\\part*{%s}")) + (2 . ("\\section{%s}" . "\\section*{%s}")) + (3 . ("\\subsection{%s}" . "\\subsection*{%s}"))) + '((1 . ("\\section{%s}" . "\\section*{%s}")) + (2 . ("\\subsection{%s}" . "\\subsection*{%s}"))))) + (envs (append org-beamer-environments-extra + org-beamer-environments-default)) + (props (org-get-text-property-any 0 'org-props text)) + (in "") (out "") option action defaction environment extra + columns-option column-option + env have-text ass tmp) + (if (= frame-level 0) (setq frame-level nil)) + (when (and org-beamer-inside-frame-at-level + (<= level org-beamer-inside-frame-at-level)) + (setq org-beamer-inside-frame-at-level nil)) + (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props)) + (if (and (string-match "\\`[0-9.]+\\'" tmp) + (or (= (string-to-number tmp) 1.0) + (= (string-to-number tmp) 0.0))) + ;; column width 1 means cloase columns, go back to full width + (org-beamer-close-columns-maybe) + (when (setq ass (assoc "BEAMER_envargs" props)) + (let (case-fold-search) + (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass)) + (setq columns-option (match-string 1 (cdr ass))) + (setcdr ass (replace-match "" t t (cdr ass)))) + (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass)) + (setq column-option (match-string 1 (cdr ass))) + (setcdr ass (replace-match "" t t (cdr ass)))))) + (org-beamer-open-columns-maybe columns-option) + (org-beamer-open-column tmp column-option))) + (cond + ((or (equal (cdr (assoc "BEAMER_env" props)) "frame") + (and frame-level (= level frame-level))) + ;; A frame + (org-beamer-get-special props) + + (setq in (org-fill-template + "\\begin{frame}%a%A%o%T%S%x" + (list (cons "a" (or action "")) + (cons "A" (or defaction "")) + (cons "o" (or option org-beamer-frame-default-options "")) + (cons "x" (if extra (concat "\n" extra) "")) + (cons "h" "%s") + (cons "T" (if (string-match "\\S-" text) + "\n\\frametitle{%s}" "")) + (cons "S" (if (string-match "\\\\\\\\" text) + "\n\\framesubtitle{%s}" "")))) + out (copy-sequence "\\end{frame}")) + (org-add-props out + '(org-insert-hook org-beamer-close-columns-maybe)) + (setq org-beamer-inside-frame-at-level level) + (cons text (list in out in out))) + ((and (setq env (cdr (assoc "BEAMER_env" props))) + (setq ass (assoc env envs))) + ;; A beamer environment selected by the BEAMER_env property + (if (string-match "[ \t]+:[ \t]*$" text) + (setq text (replace-match "" t t text))) + (if (member env '("note" "noteNH")) + ;; There should be no labels in a note, so we remove the targets + ;; FIXME??? + (remove-text-properties 0 (length text) '(target nil) text)) + (org-beamer-get-special props) + (setq text (org-trim text)) + (setq have-text (string-match "\\S-" text)) + (setq in (org-fill-template + (nth 2 ass) + (list (cons "a" (or action "")) + (cons "A" (or defaction "")) + (cons "o" (or option "")) + (cons "x" (if extra (concat "\n" extra) "")) + (cons "h" "%s") + (cons "H" (if have-text (concat "{" text "}") "")) + (cons "U" (if have-text (concat "[" text "]") "")))) + out (nth 3 ass)) + (cond + ((equal out "\\end{columns}") + (setq org-beamer-columns-open t) + (setq out (org-add-props (copy-sequence out) + '(org-insert-hook + (lambda () + (org-beamer-close-column-maybe) + (setq org-beamer-columns-open nil)))))) + ((equal out "\\end{column}") + (org-beamer-open-columns-maybe))) + (cons text (list in out in out))) + ((and (not org-beamer-inside-frame-at-level) + (or (not frame-level) + (< level frame-level)) + (assoc level default)) + ;; Normal sectioning + (cons text (cdr (assoc level default)))) + (t nil)))) + +(defvar extra) +(defvar option) +(defvar action) +(defvar defaction) +(defvar environment) +(defun org-beamer-get-special (props) + "Extract an option, action, and default action string from text. +The variables option, action, defaction, extra are all scoped into +this function dynamically." + (let (tmp) + (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props)) + (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props)) + (when extra + (setq extra (replace-regexp-in-string "\\\\n" "\n" extra))) + (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props)) + (when tmp + (setq tmp (copy-sequence tmp)) + (if (string-match "\\[<[^][<>]*>\\]" tmp) + (setq defaction (match-string 0 tmp) + tmp (replace-match "" t t tmp))) + (if (string-match "\\[[^][]*\\]" tmp) + (setq option (match-string 0 tmp) + tmp (replace-match "" t t tmp))) + (if (string-match "<[^<>]*>" tmp) + (setq action (match-string 0 tmp) + tmp (replace-match "" t t tmp)))))) + +(defun org-beamer-assoc-not-empty (elt list) + (let ((tmp (cdr (assoc elt list)))) + (and tmp (string-match "\\S-" tmp) tmp))) + + +(defvar org-beamer-mode-map (make-sparse-keymap) + "The keymap for `org-beamer-mode'.") +(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment) + +(define-minor-mode org-beamer-mode + "Special support for editing Org-mode files made to export to beamer." + nil " Bm" nil) +(when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords + 'org-mode + '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend)) + 'prepent)) + +(defun org-beamer-place-default-actions-for-lists () + "Find default overlay specifications in items, and move them. +The need to be after the begin statement of the environment." + (when org-beamer-export-is-beamer-p + (let (dovl) + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t) + (if (setq dovl (cdr (assoc "BEAMER_dovl" + (get-text-property (match-end 0) + 'org-props)))) + (save-excursion + (goto-char (1+ (match-end 1))) + (insert dovl))))))) + +(defun org-beamer-amend-header () + "Add `org-beamer-header-extra' to the LaTeX herder. +If the file contains the string BEAMER-HEADER-EXTRA-HERE on a line +by itself, it will be replaced with `org-beamer-header-extra'. If not, +the value will be inserted right after the documentclass statement." + (when (and org-beamer-export-is-beamer-p + org-beamer-header-extra) + (goto-char (point-min)) + (cond + ((re-search-forward "^[ \t]*BEAMER-HEADER-EXTRA-HERE[ \t]*$" nil t) + (replace-match org-beamer-header-extra t t) + (or (bolp) (insert "\n"))) + ((re-search-forward "^[ \t]*\\\\documentclass\\>" nil t) + (beginning-of-line 2) + (insert org-beamer-header-extra) + (or (bolp) (insert "\n")))))) + +(defcustom org-beamer-fragile-re "^[ \t]*\\\\begin{\\(verbatim\\|lstlisting\\)}" + "If this regexp matches in a frame, the frame is marked as fragile." + :group 'org-beamer + :type 'regexp) + +(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40)))) + "The special face for beamer tags." + :group 'org-beamer) + + +;; Functions to initialize and post-process +;; These fuctions will be hooked into various places in the export process + +(defun org-beamer-initialize-open-trackers () + "Reset variables that track if certain environments are open during export." + (setq org-beamer-columns-open nil) + (setq org-beamer-column-open nil) + (setq org-beamer-inside-frame-at-level nil) + (setq org-beamer-export-is-beamer-p nil)) + +(defun org-beamer-after-initial-vars () + "Find special setings for beamer and store them. +The effect is that these values will be accessible during export." + ;; First verify that we are exporting using the beamer class + (setq org-beamer-export-is-beamer-p + (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}" + org-export-latex-header)) + (when org-beamer-export-is-beamer-p + ;; Find the frame level + (setq org-beamer-frame-level-now + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "BEAMER_FRAME_LEVEL" 'selective)))) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (and (re-search-forward + "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (match-string 1)))) + (plist-get org-export-latex-options-plist :beamer-frame-level) + org-beamer-frame-level)) + ;; Normalize the value so that the functions can trust the value + (cond + ((not org-beamer-frame-level-now) + (setq org-beamer-frame-level-now nil)) + ((stringp org-beamer-frame-level-now) + (setq org-beamer-frame-level-now + (string-to-number org-beamer-frame-level-now)))) + ;; Find the header additons, most likely theme commands + (setq org-beamer-header-extra + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "BEAMER_HEADER_EXTRA" + 'selective)))) + (save-excursion + (save-restriction + (widen) + (let ((txt "")) + (goto-char (point-min)) + (while (re-search-forward + "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$" + nil t) + (setq txt (concat txt "\n" (match-string 1)))) + (if (> (length txt) 0) (substring txt 1))))) + (plist-get org-export-latex-options-plist + :beamer-header-extra))) + (let ((inhibit-read-only t) + (case-fold-search nil) + props) + (org-unmodified + (remove-text-properties (point-min) (point-max) '(org-props nil)) + (org-map-entries + '(progn + (setq props (org-entry-properties nil 'standard)) + (if (and (not (assoc "BEAMER_env" props)) + (looking-at ".*?:B_\\(note\\(NH\\)?\\):")) + (push (cons "BEAMER_env" (match-string 1)) props)) + (put-text-property (point-at-bol) (point-at-eol) 'org-props props))) + (setq org-export-latex-options-plist + (plist-put org-export-latex-options-plist :tags nil)))))) + +(defun org-beamer-auto-fragile-frames () + "Mark any frames containing verbatim environments as fragile. +This funcion will run in the final LaTeX document." + (when org-beamer-export-is-beamer-p + (let (opts) + (goto-char (point-min)) + ;; Find something that might be fragile + (while (re-search-forward org-beamer-fragile-re nil t) + (save-excursion + ;; Are we inside a frame here? + (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}" + nil t) + (equal (match-string 1) "begin")) + ;; yes, inside a frame, make sure "fragile" is one of the options + (goto-char (match-end 0)) + (if (not (looking-at "\\[.*?\\]")) + (insert "[fragile]") + (setq opts (substring (match-string 0) 1 -1)) + (delete-region (match-beginning 0) (match-end 0)) + (setq opts (org-split-string opts ",")) + (add-to-list 'opts "fragile") + (insert "[" (mapconcat 'identity opts ",") "]")))))))) + +(defcustom org-beamer-outline-frame-title "Outline" + "Default title of a frame containing an outline." + :group 'org-beamer + :type '(string :tag "Outline frame title") +) + +(defcustom org-beamer-outline-frame-options nil + "Outline frame options appended after \\begin{frame}. You might +want to put e.g. [allowframebreaks=0.9] here. Remember to include +square brackets." + :group 'org-beamer + :type '(string :tag "Outline frame options") +) + +(defun org-beamer-fix-toc () + "Fix the table of contents by removing the vspace line." + (when org-beamer-export-is-beamer-p + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\\(\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\)\\(\\\\vspace\\*.*\\)" + nil t) + (replace-match + (concat "\\\\begin{frame}" org-beamer-outline-frame-options + "\n\\\\frametitle{" + org-beamer-outline-frame-title + "}\n\\1\\\\end{frame}") + t nil))))) + +(defun org-beamer-property-changed (property value) + "Track the BEAMER_env property with tags." + (cond + ((equal property "BEAMER_env") + (save-excursion + (org-back-to-heading t) + (let ((tags (org-get-tags))) + (setq tags (delq nil (mapcar (lambda (x) + (if (string-match "^B_" x) nil x)) + tags))) + (org-set-tags-to tags)) + (when (and value (stringp value) (string-match "\\S-" value)) + (org-toggle-tag (concat "B_" value) 'on)))) + ((equal property "BEAMER_col") + (org-toggle-tag "BMCOL" (if (and value (string-match "\\S-" value)) + 'on 'off))))) + +(defun org-beamer-select-beamer-code () + "Take code marked for BEAMER and turn it into marked for LaTeX." + (when org-beamer-export-is-beamer-p + (goto-char (point-min)) + (while (re-search-forward + "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t) + (replace-match "\\1latex")))) + +;; OK, hook all these functions into appropriate places +(add-hook 'org-export-first-hook + 'org-beamer-initialize-open-trackers) +(add-hook 'org-property-changed-functions + 'org-beamer-property-changed) +(add-hook 'org-export-latex-after-initial-vars-hook + 'org-beamer-after-initial-vars) +(add-hook 'org-export-latex-final-hook + 'org-beamer-place-default-actions-for-lists) +(add-hook 'org-export-latex-final-hook + 'org-beamer-auto-fragile-frames) +(add-hook 'org-export-latex-final-hook + 'org-beamer-fix-toc) +(add-hook 'org-export-latex-final-hook + 'org-beamer-amend-header) +(add-hook 'org-export-preprocess-before-selecting-backend-code-hook + 'org-beamer-select-beamer-code) + +(defun org-beamer-settings-template (kind) + "Insert a settings template, to make sure users do this right." + (interactive (progn + (message "Current [s]ubtree or [g]lobal?") + (if (equal (read-char-exclusive) ?g) + (list 'global) + (list 'subtree)))) + (if (eq kind 'subtree) + (progn + (org-back-to-heading t) + (org-reveal) + (org-entry-put nil "LaTeX_CLASS" "beamer") + (org-entry-put nil "LaTeX_CLASS_OPTIONS" "[presentation]") + (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf") + (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string + org-beamer-frame-level)) + (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes) + (org-entry-put nil "COLUMNS" org-beamer-column-view-format) + (org-entry-put nil "BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC")) + (insert "#+LaTeX_CLASS: beamer\n") + (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n") + (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n") + (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n") + (insert "#+COLUMNS: " org-beamer-column-view-format "\n") + (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n"))) + + +(defun org-beamer-allowed-property-values (property) + "Supply allowed values for BEAMER properties." + (cond + ((and (equal property "BEAMER_env") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_env have been defined, + ;; supply all defined environments + (mapcar 'car (append org-beamer-environments-extra + org-beamer-environments-default))) + ((and (equal property "BEAMER_col") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_col have been defined, + ;; supply some + '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC")) + (t nil))) + +(add-hook 'org-property-allowed-value-functions + 'org-beamer-allowed-property-values) + +(provide 'org-beamer) + +;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c + +;;; org-beamer.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-bibtex.el --- a/lisp/org/org-bibtex.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-bibtex.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Bastien Guerry ;; Carsten Dominik ;; Keywords: org, wp, remember -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-clock.el --- a/lisp/org/org-clock.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-clock.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -63,13 +63,20 @@ (defcustom org-clock-out-when-done t "When non-nil, clock will be stopped when the clocked entry is marked DONE. -A nil value means, clock will keep running until stopped explicitly with -`C-c C-x C-o', or until the clock is started in a different item." +DONE here means any DONE-like state. +A nil value means clock will keep running until stopped explicitly with +`C-c C-x C-o', or until the clock is started in a different item. +Instead of t, this can also be a list of TODO states that should trigger +clocking out." :group 'org-clock - :type 'boolean) + :type '(choice + (const :tag "No" nil) + (const :tag "Yes, when done" t) + (repeat :tag "State list" + (string :tag "TODO keyword")))) (defcustom org-clock-out-remove-zero-time-clocks nil - "Non-nil means, remove the clock line when the resulting time is zero." + "Non-nil means remove the clock line when the resulting time is zero." :group 'org-clock :type 'boolean) @@ -105,7 +112,7 @@ :type 'integer) (defcustom org-clock-goto-may-find-recent-task t - "Non-nil means, `org-clock-goto' can go to recent task if no active clock." + "Non-nil means `org-clock-goto' can go to recent task if no active clock." :group 'org-clock :type 'boolean) @@ -193,6 +200,17 @@ (const :tag "All task time" all) (const :tag "Automatically, `all' or since `repeat'" auto))) +(defcustom org-task-overrun-text nil + "The extra modeline text that should indicate that the clock is overrun. +The can be nil to indicate that instead of adding text, the clock time +should get a different face (`org-mode-line-clock-overrun'). +When this is a string, it is prepended to the clock string as an indication, +also using the face `org-mode-line-clock-overrun'." + :group 'org-clock + :type '(choice + (const :tag "Just mark the time string" nil) + (string :tag "Text to prepend"))) + (defcustom org-show-notification-handler nil "Function or program to send notification with. The function or program will be called with the notification @@ -222,6 +240,11 @@ (const :tag "Always" t) (const :tag "When no clock is running" when-no-clock-is-running))) +(defcustom org-clock-report-include-clocking-task nil + "When non-nil, include the current clocking task time in clock reports." + :group 'org-clock + :type 'boolean) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -250,7 +273,7 @@ (defvar org-clock-heading-for-remember "") (defvar org-clock-start-time "") -(defvar org-clock-left-over-time nil +(defvar org-clock-leftover-time nil "If non-nil, user cancelled a clock; this is when leftover time started.") (defvar org-clock-effort "" @@ -310,6 +333,14 @@ (mapc (lambda (m) (org-check-and-save-marker m beg end)) org-clock-history)) +(defun org-clocking-buffer () + "Returns clocking buffer if we are currently clocking a task or nil" + (marker-buffer org-clock-marker)) + +(defun org-clocking-p () + "Returns t when clocking a task" + (not (equal (org-clocking-buffer) nil))) + (defun org-clock-select-task (&optional prompt) "Select a task that recently was associated with clocking." (interactive) @@ -326,7 +357,7 @@ (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold)) (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task)) (push s sel-list)) - (when (marker-buffer org-clock-marker) + (when (org-clocking-p) (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold)) (setq s (org-clock-insert-selection-line ?c org-clock-marker)) (push s sel-list)) @@ -339,6 +370,7 @@ (if (< i 10) (+ i ?0) (+ i (- ?A 10))) m)) + (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s)))) (push s sel-list))) org-clock-history) (org-fit-window-to-buffer) @@ -360,56 +392,82 @@ (save-excursion (save-restriction (widen) - (goto-char marker) - (setq file (buffer-file-name (marker-buffer marker)) - cat (or (org-get-category) - (progn (org-refresh-category-properties) - (org-get-category))) - heading (org-get-heading 'notags) - prefix (save-excursion - (org-back-to-heading t) - (looking-at "\\*+ ") - (match-string 0)) - task (substring - (org-fontify-like-in-org-mode - (concat prefix heading) - org-odd-levels-only) - (length prefix)))))) + (ignore-errors + (goto-char marker) + (setq file (buffer-file-name (marker-buffer marker)) + cat (or (org-get-category) + (progn (org-refresh-category-properties) + (org-get-category))) + heading (org-get-heading 'notags) + prefix (save-excursion + (org-back-to-heading t) + (looking-at "\\*+ ") + (match-string 0)) + task (substring + (org-fontify-like-in-org-mode + (concat prefix heading) + org-odd-levels-only) + (length prefix))))))) (when (and cat task) (insert (format "[%c] %-15s %s\n" i cat task)) (cons i marker))))) +(defvar org-task-overrun nil + "Internal flag indicating if the clock has overrun the planned time.") +(defvar org-clock-update-period 60 + "Number of seconds between mode line clock string updates.") + (defun org-clock-get-clock-string () - "Form a clock-string, that will be show in the mode line. -If an effort estimate was defined for current item, use + "Form a clock-string, that will be shown in the mode line. +If an effort estimate was defined for the current item, use 01:30/01:50 format (clocked/estimated). If not, show simply the clocked time like 01:50." (let* ((clocked-time (org-clock-get-clocked-time)) (h (floor clocked-time 60)) (m (- clocked-time (* 60 h)))) - (if (and org-clock-effort) - (let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) + (if org-clock-effort + (let* ((effort-in-minutes + (org-hh:mm-string-to-minutes org-clock-effort)) (effort-h (floor effort-in-minutes 60)) - (effort-m (- effort-in-minutes (* effort-h 60)))) - (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]") - h m effort-h effort-m org-clock-heading)) - (format (concat "-[" org-time-clocksum-format " (%s)]") - h m org-clock-heading)))) + (effort-m (- effort-in-minutes (* effort-h 60))) + (work-done-str + (org-propertize + (format org-time-clocksum-format h m) + 'face (if (and org-task-overrun (not org-task-overrun-text)) + 'org-mode-line-clock-overrun 'org-mode-line-clock))) + (effort-str (format org-time-clocksum-format effort-h effort-m)) + (clockstr (org-propertize + (concat "[%s/" effort-str + "] (" (replace-regexp-in-string "%" "%%" org-clock-heading) ")") + 'face 'org-mode-line-clock))) + (format clockstr work-done-str)) + (org-propertize (format + (concat "[" org-time-clocksum-format " (%s)]") + h m org-clock-heading) + 'face 'org-mode-line-clock)))) (defun org-clock-update-mode-line () + (if org-clock-effort + (org-clock-notify-once-if-expired) + (setq org-task-overrun nil)) (setq org-mode-line-string (org-propertize (let ((clock-string (org-clock-get-clock-string)) (help-text "Org-mode clock is running.\nmouse-1 shows a menu\nmouse-2 will jump to task")) (if (and (> org-clock-string-limit 0) (> (length clock-string) org-clock-string-limit)) - (org-propertize (substring clock-string 0 org-clock-string-limit) - 'help-echo (concat help-text ": " org-clock-heading)) + (org-propertize + (substring clock-string 0 org-clock-string-limit) + 'help-echo (concat help-text ": " org-clock-heading)) (org-propertize clock-string 'help-echo help-text))) 'local-map org-clock-mode-line-map 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight) - 'face 'org-mode-line-clock)) - (if org-clock-effort (org-clock-notify-once-if-expired)) + )) + (if (and org-task-overrun org-task-overrun-text) + (setq org-mode-line-string + (concat (org-propertize + org-task-overrun-text + 'face 'org-mode-line-clock-overrun) org-mode-line-string))) (force-mode-line-update)) (defun org-clock-get-clocked-time () @@ -461,10 +519,13 @@ (defun org-clock-notify-once-if-expired () "Show notification if we spent more time than we estimated before. Notification is shown only once." - (when (marker-buffer org-clock-marker) + (when (org-clocking-p) (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) (clocked-time (org-clock-get-clocked-time))) - (if (>= clocked-time effort-in-minutes) + (if (setq org-task-overrun + (if (or (null effort-in-minutes) (zerop effort-in-minutes)) + nil + (>= clocked-time effort-in-minutes))) (unless org-clock-notification-was-shown (setq org-clock-notification-was-shown t) (org-notify @@ -651,7 +712,7 @@ (org-clock-clock-out clock fail-quietly resolve-to) (unless org-clock-clocking-in (if close-p - (setq org-clock-left-over-time resolve-to) + (setq org-clock-leftover-time resolve-to) (org-clock-clock-in clock))))))) (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) @@ -699,12 +760,19 @@ (goto-char (match-end 0))) nil)))))) (let (char-pressed) - (while (null char-pressed) + (if (featurep 'xemacs) + (progn + (message (concat (funcall prompt-fn clock) + " [(kK)eep (sS)ubtract (C)ancel]? ")) + (setq char-pressed (read-char-exclusive))) + (while (or (null char-pressed) + (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i))) + (or (ding) t))) (setq char-pressed (read-char (concat (funcall prompt-fn clock) - " [(kK)eep (sS)ubtract (C)ancel]? ") + " [(kK)p (sS)ub (C)ncl (i)gn]? ") nil 45))) - char-pressed)))) + (and (not (eq char-pressed ?i)) char-pressed)))))) (default (floor (/ (org-float-time (time-subtract (current-time) last-valid)) 60))) (keep (and (memq ch '(?k ?K)) @@ -779,17 +847,13 @@ (defun org-user-idle-seconds () "Return the number of seconds the user has been idle for. This routine returns a floating point number." - (if (or (eq system-type 'darwin) (eq window-system 'x)) - (let ((emacs-idle (org-emacs-idle-seconds))) - ;; If Emacs has been idle for longer than the user's - ;; `org-clock-idle-time' value, check whether the whole system has - ;; really been idle for that long. - (if (> emacs-idle (* 60 org-clock-idle-time)) - (min emacs-idle (if (eq system-type 'darwin) - (org-mac-idle-seconds) - (org-x11-idle-seconds))) - emacs-idle)) - (org-emacs-idle-seconds))) + (cond + ((eq system-type 'darwin) + (org-mac-idle-seconds)) + ((eq window-system 'x) + (org-x11-idle-seconds)) + (t + (org-emacs-idle-seconds)))) (defvar org-clock-user-idle-seconds) @@ -800,11 +864,11 @@ so long." (when (and org-clock-idle-time (not org-clock-resolving-clocks) org-clock-marker) - (let ((org-clock-user-idle-seconds (org-user-idle-seconds)) - (org-clock-user-idle-start - (time-subtract (current-time) - (seconds-to-time org-clock-user-idle-seconds))) - (org-clock-resolving-clocks-due-to-idleness t)) + (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) + (org-clock-user-idle-start + (time-subtract (current-time) + (seconds-to-time org-clock-user-idle-seconds))) + (org-clock-resolving-clocks-due-to-idleness t)) (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) (org-clock-resolve (cons org-clock-marker @@ -829,16 +893,16 @@ (setq org-clock-notification-was-shown nil) (catch 'abort (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) - (marker-buffer org-clock-marker))) + (org-clocking-p))) ts selected-task target-pos (msg-extra "") - (left-over (and (not org-clock-resolving-clocks) - org-clock-left-over-time))) + (leftover (and (not org-clock-resolving-clocks) + org-clock-leftover-time))) (when (and org-clock-auto-clock-resolution (or (not interrupting) (eq t org-clock-auto-clock-resolution)) (not org-clock-clocking-in) (not org-clock-resolving-clocks)) - (setq org-clock-left-over-time nil) + (setq org-clock-leftover-time nil) (let ((org-clock-clocking-in t)) (org-resolve-clocks))) ; check if any clocks are dangling (when (equal select '(4)) @@ -849,15 +913,29 @@ (when interrupting ;; We are interrupting the clocking of a different task. ;; Save a marker to this task, so that we can go back. - (move-marker org-clock-interrupted-task - (marker-position org-clock-marker) - (marker-buffer org-clock-marker)) - (org-clock-out t)) - + ;; First check if we are trying to clock into the same task! + (if (save-excursion + (unless selected-task + (org-back-to-heading t)) + (and (equal (marker-buffer org-clock-hd-marker) + (if selected-task + (marker-buffer selected-task) + (current-buffer))) + (= (marker-position org-clock-hd-marker) + (if selected-task + (marker-position selected-task) + (point))))) + (message "Clock continues in \"%s\"" org-clock-heading) + (progn + (move-marker org-clock-interrupted-task + (marker-position org-clock-marker) + (org-clocking-buffer)) + (org-clock-out t)))) + (when (equal select '(16)) ;; Mark as default clocking task (org-clock-mark-default-task)) - + ;; Clock in at which position? (setq target-pos (if (and (eobp) (not (org-on-heading-p))) @@ -878,6 +956,7 @@ (org-back-to-heading t) (or interrupting (move-marker org-clock-interrupted-task nil)) (org-clock-history-push) + (org-clock-set-current) (cond ((functionp org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let ((newstate (funcall org-clock-in-switch-to-state @@ -898,7 +977,9 @@ (functionp org-clock-heading-function)) (funcall org-clock-heading-function)) ((looking-at org-complex-heading-regexp) - (match-string 4)) + (replace-regexp-in-string + "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1" + (match-string 4))) (t "???"))) (setq org-clock-heading (org-propertize org-clock-heading 'face nil)) @@ -939,13 +1020,13 @@ (setq org-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start))) (setq org-clock-start-time - (or (and left-over + (or (and leftover (y-or-n-p (format "You stopped another clock %d mins ago; start this one from then? " (/ (- (org-float-time (current-time)) - (org-float-time left-over)) 60))) - left-over) + (org-float-time leftover)) 60))) + leftover) (current-time))) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) @@ -963,7 +1044,9 @@ (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer nil)) (setq org-clock-mode-line-timer - (run-with-timer 60 60 'org-clock-update-mode-line)) + (run-with-timer org-clock-update-period + org-clock-update-period + 'org-clock-update-mode-line)) (when org-clock-idle-timer (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil)) @@ -972,6 +1055,15 @@ (message "Clock starts at %s - %s" ts msg-extra) (run-hooks 'org-clock-in-hook))))))) +(defvar org-clock-current-task nil + "Task currently clocked in.") +(defun org-clock-set-current () + "Set `org-clock-current-task' to the task currently clocked in." + (setq org-clock-current-task (org-get-heading))) +(defun org-clock-delete-current () + "Reset `org-clock-current-task' to nil." + (setq org-clock-current-task nil)) + (defun org-clock-mark-default-task () "Mark current task as default task." (interactive) @@ -1104,11 +1196,11 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (interactive) (catch 'exit - (if (not (marker-buffer org-clock-marker)) + (if (not (org-clocking-p)) (if fail-quietly (throw 'exit t) (error "No active clock"))) (let (ts te s h m remove) (save-excursion - (set-buffer (marker-buffer org-clock-marker)) + (set-buffer (org-clocking-buffer)) (save-restriction (widen) (goto-char org-clock-marker) @@ -1151,7 +1243,8 @@ (when org-clock-out-switch-to-state (save-excursion (org-back-to-heading t) - (let ((org-inhibit-logging t)) + (let ((org-inhibit-logging t) + (org-clock-out-when-done nil)) (cond ((functionp org-clock-out-switch-to-state) (looking-at org-complex-heading-regexp) @@ -1166,15 +1259,16 @@ (force-mode-line-update) (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m (if remove " => LINE REMOVED" "")) - (run-hooks 'org-clock-out-hook)))))) + (run-hooks 'org-clock-out-hook) + (org-clock-delete-current)))))) (defun org-clock-cancel () "Cancel the running clock be removing the start timestamp." (interactive) - (if (not (marker-buffer org-clock-marker)) + (if (not (org-clocking-p)) (error "No active clock")) (save-excursion - (set-buffer (marker-buffer org-clock-marker)) + (set-buffer (org-clocking-buffer)) (goto-char org-clock-marker) (delete-region (1- (point-at-bol)) (point-at-eol)) ;; Just in case, remove any empty LOGBOOK left over @@ -1196,7 +1290,7 @@ (select (or (org-clock-select-task "Select task to go to: ") (error "No task selected"))) - ((marker-buffer org-clock-marker) org-clock-marker) + ((org-clocking-p) org-clock-marker) ((and org-clock-goto-may-find-recent-task (car org-clock-history) (marker-buffer (car org-clock-history))) @@ -1210,6 +1304,7 @@ (org-back-to-heading t) (org-cycle-hide-drawers 'children) (recenter) + (org-reveal) (if recent (message "No running clock, this is the most recently clocked task")) (run-hooks 'org-clock-goto-hook))) @@ -1259,6 +1354,13 @@ (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) (t ;; A headline + ;; Add the currently clocking item time to the total + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point))) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) (setq level (- (match-end 1) (match-beginning 1))) (when (or (> t1 0) (> (aref ltimes level) 0)) (loop for l from 0 to level do @@ -1365,16 +1467,20 @@ This is used to stop the clock after a TODO entry is marked DONE, and is only done if the variable `org-clock-out-when-done' is not nil." (when (and org-clock-out-when-done - (member state org-done-keywords) - (equal (or (buffer-base-buffer (marker-buffer org-clock-marker)) - (marker-buffer org-clock-marker)) + (or (and (eq t org-clock-out-when-done) + (member state org-done-keywords)) + (and (listp org-clock-out-when-done) + (member state org-clock-out-when-done))) + (equal (or (buffer-base-buffer (org-clocking-buffer)) + (org-clocking-buffer)) (or (buffer-base-buffer (current-buffer)) (current-buffer))) (< (point) org-clock-marker) (> (save-excursion (outline-next-heading) (point)) org-clock-marker)) ;; Clock out, but don't accept a logging message for this. - (let ((org-log-note-clock-out nil)) + (let ((org-log-note-clock-out nil) + (org-clock-out-switch-to-state nil)) (org-clock-out)))) (add-hook 'org-after-todo-state-change-hook @@ -1857,7 +1963,7 @@ system-name (format-time-string (cdr org-time-stamp-formats)))) (if (and (memq org-clock-persist '(t clock)) - (setq b (marker-buffer org-clock-marker)) + (setq b (org-clocking-buffer)) (setq b (or (buffer-base-buffer b) b)) (buffer-live-p b) (buffer-file-name b) @@ -1866,7 +1972,7 @@ (substring-no-properties org-clock-heading) ") ")))) (insert "(setq resume-clock '(\"" - (buffer-file-name (marker-buffer org-clock-marker)) + (buffer-file-name (org-clocking-buffer)) "\" . " (int-to-string (marker-position org-clock-marker)) "))\n")) ;; Store clocked task history. Tasks are stored reversed to make diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-colview.el --- a/lisp/org/org-colview.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-colview.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -459,10 +459,16 @@ ((equal key "SCHEDULED") (setq eval '(org-with-point-at pom (call-interactively 'org-schedule)))) + ((equal key "BEAMER_env") + (setq eval '(org-with-point-at pom + (call-interactively 'org-beamer-set-environment-tag)))) (t (setq allowed (org-property-get-allowed-values pom key 'table)) (if allowed - (setq nval (org-icompleting-read "Value: " allowed nil t)) + (setq nval (org-icompleting-read + "Value: " allowed nil + (not (get-text-property 0 'org-unrestricted + (caar allowed))))) (setq nval (read-string "Edit: " value))) (setq nval (org-trim nval)) (when (not (equal nval value)) @@ -1377,10 +1383,11 @@ This will add overlays to the date lines, to show the summary for each day." (let* ((fmt (mapcar (lambda (x) (if (equal (car x) "CLOCKSUM") - (list "CLOCKSUM" (nth 2 x) nil 'add_times nil '+ 'identity) - (cdr x))) + (list "CLOCKSUM" (nth 1 x) (nth 2 x) ":" 'add_times + nil '+ nil) + x)) org-columns-current-fmt-compiled)) - line c c1 stype calc sumfunc props lsum entries prop v) + line c c1 stype calc sumfunc props lsum entries prop v title) (catch 'exit (when (delq nil (mapcar 'cadr fmt)) ;; OK, at least one summation column, it makes sense to try this @@ -1404,9 +1411,10 @@ (mapcar (lambda (f) (setq prop (car f) - stype (nth 3 f) - sumfunc (nth 5 f) - calc (or (nth 6 f) 'identity)) + title (nth 1 f) + stype (nth 4 f) + sumfunc (nth 6 f) + calc (or (nth 7 f) 'identity)) (cond ((equal prop "ITEM") (cons prop (buffer-substring (point-at-bol) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-compat.el --- a/lisp/org/org-compat.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-compat.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -362,6 +362,40 @@ (time-to-seconds (or time (current-time))) (float-time time))) +; XEmacs does not have `looking-back'. +(if (fboundp 'looking-back) + (defalias 'org-looking-back 'looking-back) + (defun org-looking-back (regexp &optional limit greedy) + "Return non-nil if text before point matches regular expression REGEXP. +Like `looking-at' except matches before point, and is slower. +LIMIT if non-nil speeds up the search by specifying a minimum +starting position, to avoid checking matches that would start +before LIMIT. + +If GREEDY is non-nil, extend the match backwards as far as +possible, stopping when a single additional previous character +cannot be part of a match for REGEXP. When the match is +extended, its starting position is allowed to occur before +LIMIT." + (let ((start (point)) + (pos + (save-excursion + (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t) + (point))))) + (if (and greedy pos) + (save-restriction + (narrow-to-region (point-min) start) + (while (and (> pos (point-min)) + (save-excursion + (goto-char pos) + (backward-char 1) + (looking-at (concat "\\(?:" regexp "\\)\\'")))) + (setq pos (1- pos))) + (save-excursion + (goto-char pos) + (looking-at (concat "\\(?:" regexp "\\)\\'"))))) + (not (null pos))))) + (provide 'org-compat) ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-crypt.el --- a/lisp/org/org-crypt.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-crypt.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; Emacs Lisp Archive Entry ;; Filename: org-crypt.el -;; Version: 6.33x +;; Version: 6.35i ;; Keywords: org-mode ;; Author: John Wiegley ;; Maintainer: Peter Jones @@ -94,7 +94,7 @@ "Returns the encryption key for the current heading." (save-excursion (org-back-to-heading t) - (or (org-entry-get nil "CRYPTKEY" 'selective) + (or (org-entry-get nil "CRYPTKEY" 'selective) org-crypt-key (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) (error "No crypt key set")))) @@ -116,7 +116,7 @@ (org-back-over-empty-lines) (setq end (point) encrypted-text - (epg-encrypt-string + (epg-encrypt-string epg-context (buffer-substring-no-properties beg end) (epg-list-keys epg-context crypt-key))) @@ -129,6 +129,7 @@ nil)))) (defun org-decrypt-entry () + "Decrypt the content of the current headline." (interactive) (require 'epg) (save-excursion @@ -136,12 +137,12 @@ (forward-line) (when (looking-at "-----BEGIN PGP MESSAGE-----") (let* ((beg (point)) - (end (save-excursion + (end (save-excursion (search-forward "-----END PGP MESSAGE-----") (forward-line) (point))) (epg-context (epg-make-context nil t t)) - (decrypted-text + (decrypted-text (decode-coding-string (epg-decrypt-string epg-context @@ -152,24 +153,28 @@ nil)))) (defun org-encrypt-entries () + "Encrypt all top-level entries in the current buffer." (interactive) (org-scan-tags 'org-encrypt-entry (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-decrypt-entries () + "Decrypt all entries in the current buffer." (interactive) - (org-scan-tags + (org-scan-tags 'org-decrypt-entry (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-crypt-use-before-save-magic () "Adds a hook that will automatically encrypt entries before a file is saved to disk." - (add-hook - 'org-mode-hook + (add-hook + 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) - + +(add-hook 'org-reveal-start-hook 'org-decrypt-entry) + (provide 'org-crypt) ;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-ctags.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-ctags.el Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,539 @@ +;;; org-ctags.el - Integrate Emacs "tags" facility with org mode. +;; +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;; Author: Paul Sexton +;; Version: 1.0 + +;; Keywords: org, wp +;; Version: 6.35i +;; +;; 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 GNU Emacs. If not, see . + +;; +;; Synopsis +;; ======== +;; +;; Allows org-mode to make use of the Emacs `etags' system. Defines tag +;; destinations in org-mode files as any text between <>. This allows the tags-generation program `exuberant ctags' to +;; parse these files and create tag tables that record where these +;; destinations are found. Plain [[links]] in org mode files which do not have +;; <> within the same file will then be interpreted as +;; links to these 'tagged' destinations, allowing seamless navigation between +;; multiple org-mode files. Topics can be created in any org mode file and +;; will always be found by plain links from other files. Other file types +;; recognised by ctags (source code files, latex files, etc) will also be +;; available as destinations for plain links, and similarly, org-mode links +;; will be available as tags from source files. Finally, the function +;; `org-ctags-find-tag-interactive' lets you choose any known tag, using +;; autocompletion, and quickly jump to it. +;; +;; Installation +;; ============ +;; +;; Install org mode +;; Ensure org-ctags.el is somewhere in your emacs load path. +;; Download and install Exuberant ctags -- "http://ctags.sourceforge.net/" +;; Edit your .emacs file (see next section) and load emacs. + +;; To put in your init file (.emacs): +;; ================================== +;; +;; Assuming you already have org mode installed and set up: +;; +;; (setq org-ctags-path-to-ctags "/path/to/ctags/executable") +;; (add-hook 'org-mode-hook +;; (lambda () +;; (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive))) +;; +;; By default, with org-ctags loaded, org will first try and visit the tag +;; with the same name as the link; then, if unsuccessful, ask the user if +;; he/she wants to rebuild the 'TAGS' database and try again; then ask if +;; the user wishes to append 'tag' as a new toplevel heading at the end of +;; the buffer; and finally, defer to org's default behaviour which is to +;; search the entire text of the current buffer for 'tag'. +;; +;; This behaviour can be modified by changing the value of +;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my +;; .emacs, which describes the same behaviour as the above paragraph with +;; one difference: +;; +;; (setq org-ctags-open-link-functions +;; '(org-ctags-find-tag +;; org-ctags-ask-rebuild-tags-file-then-find-tag +;; org-ctags-ask-append-topic +;; org-ctags-fail-silently)) ; <-- prevents org default behaviour +;; +;; +;; Usage +;; ===== +;; +;; When you click on a link "[[foo]]" and org cannot find a matching "<>" +;; in the current buffer, the tags facility will take over. The file TAGS in +;; the active directory is examined to see if the tags facility knows about +;; "<>" in any other files. If it does, the matching file will be opened +;; and the cursor will jump to the position of "<>" in that file. +;; +;; User-visible functions: +;; - `org-ctags-find-tag-interactive': type a tag (plain link) name and visit +;; it. With autocompletion. Bound to ctrl-O in the above setup. +;; - All the etags functions should work. These include: +;; +;; M-. `find-tag' -- finds the tag at point +;; +;; C-M-. find-tag based on regular expression +;; +;; M-x tags-search RET -- like C-M-. but searches through ENTIRE TEXT +;; of ALL the files referenced in the TAGS file. A quick way to +;; search through an entire 'project'. +;; +;; M-* "go back" from a tag jump. Like `org-mark-ring-goto'. +;; You may need to bind this key yourself with (eg) +;; (global-set-key (kbd "") 'pop-tag-mark) +;; +;; (see etags chapter in Emacs manual for more) +;; +;; +;; Keeping the TAGS file up to date +;; ================================ +;; +;; Tags mode has no way of knowing that you have created new tags by typing in +;; your org-mode buffer. New tags make it into the TAGS file in 3 ways: +;; +;; 1. You re-run (org-ctags-create-tags "directory") to rebuild the file. +;; 2. You put the function `org-ctags-ask-rebuild-tags-file-then-find-tag' in +;; your `org-open-link-functions' list, as is done in the setup +;; above. This will cause the TAGS file to be rebuilt whenever a link +;; cannot be found. This may be slow with large file collections however. +;; 3. You run the following from the command line (all 1 line): +;; +;; ctags --langdef=orgmode --langmap=orgmode:.org +;; --regex-orgmode="/<<([^>]+)>>/\1/d,definition/" +;; -f /your/path/TAGS -e -R /your/path/*.org +;; +;; If you are paranoid, you might want to run (org-ctags-create-tags +;; "/path/to/org/files") at startup, by including the following toplevel form +;; in .emacs. However this can cause a pause of several seconds if ctags has +;; to scan lots of files. +;; +;; (progn +;; (message "-- rebuilding tags tables...") +;; (mapc 'org-create-tags tags-table-list)) + +(eval-when-compile (require 'cl)) +(require 'org) + +(defgroup org-ctags nil + "Options concerning use of ctags within org mode." + :tag "Org-Ctags" + :group 'org-link) + +(defvar org-ctags-enabled-p t + "Activate ctags support in org mode?") + +(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/" + "Regexp expression used by ctags external program, that matches +tag destinations in org-mode files. +Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/ +See the ctags documentation for more information.") + +(defcustom org-ctags-path-to-ctags + (case system-type + (windows-nt "ctags.exe") + (darwin "ctags-exuberant") + (t "ctags-exuberant")) + "Full path to the ctags executable file." + :group 'org-ctags + :type 'file) + +(defcustom org-ctags-open-link-functions + '(org-ctags-find-tag + org-ctags-ask-rebuild-tags-file-then-find-tag + org-ctags-ask-append-topic) + "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when +ORG-CTAGS is active." + :group 'org-ctags + :type 'hook + :options '(org-ctags-find-tag + org-ctags-ask-rebuild-tags-file-then-find-tag + org-ctags-rebuild-tags-file-then-find-tag + org-ctags-ask-append-topic + org-ctags-append-topic + org-ctags-ask-visit-buffer-or-file + org-ctags-visit-buffer-or-file + org-ctags-fail-silently)) + + +(defvar org-ctags-tag-list nil + "List of all tags in the active TAGS file. Created as a local +variable in each buffer.") + +(defcustom org-ctags-new-topic-template + "* <<%t>>\n\n\n\n\n\n" + "Text to insert when creating a new org file via opening a hyperlink. +The following patterns are replaced in the string: + `%t' - replaced with the capitalized title of the hyperlink" + :group 'org-ctags + :type 'string) + + +(add-hook 'org-mode-hook + (lambda () + (when (and org-ctags-enabled-p + (buffer-file-name)) + ;; Make sure this file's directory is added to default + ;; directories in which to search for tags. + (let ((tags-filename + (expand-file-name + (concat (file-name-directory (buffer-file-name)) + "/TAGS")))) + (when (file-exists-p tags-filename) + (visit-tags-table tags-filename)))))) + + +(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile) + (when (and org-ctags-enabled-p tags-file-name) + (set (make-local-variable 'org-ctags-tag-list) + (org-ctags-all-tags-in-current-tags-table)))) + + +(defun org-ctags-enable () + (put 'org-mode 'find-tag-default-function 'org-ctags-find-tag-at-point) + (setq org-ctags-enabled-p t) + (dolist (fn org-ctags-open-link-functions) + (add-hook 'org-open-link-functions fn t))) + + +;;; General utility functions. =============================================== +;; These work outside org-ctags mode. + +(defun org-ctags-get-filename-for-tag (tag) + "TAG is a string. Search the active TAGS file for a matching tag, +and if found, return a list containing the filename, line number, and +buffer position where the tag is found." + (interactive "sTag: ") + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (when tags-file-name + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (cond + ((re-search-forward (format "^.*%s\\([0-9]+\\),\\([0-9]+\\)$" + (regexp-quote tag)) nil t) + (let ((line (string-to-number (match-string 1))) + (pos (string-to-number (match-string 2)))) + (cond + ((re-search-backward " \n\\(.*\\),[0-9]+\n") + (list (match-string 1) line pos)) + (t ; can't find a file name preceding the matched + ; tag?? + (error "Malformed TAGS file: %s" (buffer-name)))))) + (t ; tag not found + nil)))))) + + +(defun org-ctags-all-tags-in-current-tags-table () + "Read all tags defined in the active TAGS file, into a list of strings. +Return the list." + (interactive) + (let ((taglist nil)) + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (while (re-search-forward "^.*\\(.*\\)\\([0-9]+\\),\\([0-9]+\\)$" + nil t) + (push (substring-no-properties (match-string 1)) taglist))) + taglist))) + + +(defun org-ctags-string-search-and-replace (search replace string) + "Replace all instances of SEARCH with REPLACE in STRING." + (replace-regexp-in-string (regexp-quote search) replace string t t)) + + +(defun y-or-n-minibuffer (prompt) + (let ((use-dialog-box nil)) + (y-or-n-p prompt))) + + +;;; Internal functions ======================================================= + + +(defun org-ctags-open-file (name &optional title) + "Visit or create a file called `NAME.org', and insert a new topic titled +NAME (or TITLE if supplied)." + (interactive "sFile name: ") + (let ((filename (substitute-in-file-name (expand-file-name name)))) + (condition-case v + (progn + (org-open-file name t) + (message "Opened file OK") + (goto-char (point-max)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize (or title name)) + org-ctags-new-topic-template)) + (message "Inserted new file text OK") + (org-mode-restart)) + (error (error "Error %S in org-ctags-open-file" v))))) + + +;;;; Misc interoperability with etags system ================================= + + +(defadvice find-tag (before org-ctags-set-org-mark-before-finding-tag + activate compile) + "Before trying to find a tag, save our current position on org mark ring." + (save-excursion + (if (and (org-mode-p) org-ctags-enabled-p) + (org-mark-ring-push)))) + + + +(defun org-ctags-find-tag-at-point () + "Determine default tag to search for, based on text at point. +If there is no plausible default, return nil." + (let (from to bound) + (when (or (ignore-errors + ;; Look for hyperlink around `point'. + (save-excursion + (search-backward "[[") (setq from (+ 2 (point)))) + (save-excursion + (goto-char from) + (search-forward "]") (setq to (- (point) 1))) + (and (> to from) (>= (point) from) (<= (point) to))) + (progn + ;; Look at text around `point'. + (save-excursion + (skip-syntax-backward "w_") (setq from (point))) + (save-excursion + (skip-syntax-forward "w_") (setq to (point))) + (> to from)) + ;; Look between `line-beginning-position' and `point'. + (save-excursion + (and (setq bound (line-beginning-position)) + (skip-syntax-backward "^w_" bound) + (> (setq to (point)) bound) + (skip-syntax-backward "w_") + (setq from (point)))) + ;; Look between `point' and `line-end-position'. + (save-excursion + (and (setq bound (line-end-position)) + (skip-syntax-forward "^w_" bound) + (< (setq from (point)) bound) + (skip-syntax-forward "w_") + (setq to (point))))) + (buffer-substring-no-properties from to)))) + + +;;; Functions for use with 'org-open-link-functions' hook ================= + + +(defun org-ctags-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Look for a tag called `NAME' in the current TAGS table. If it is found, +visit the file and location where the tag is found." + (interactive "sTag: ") + (let ((old-buf (current-buffer)) + (old-pnt (point-marker)) + (old-mark (copy-marker (mark-marker)))) + (condition-case nil + (progn (find-tag name) + t) + (error + ;; only restore old location if find-tag raises error + (set-buffer old-buf) + (goto-char old-pnt) + (set-marker (mark-marker) old-mark) + nil)))) + + +(defun org-ctags-visit-buffer-or-file (name &optional create) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Visit buffer named `NAME.org'. If there is no such buffer, visit the file +with the same name if it exists. If the file does not exist, then behaviour +depends on the value of CREATE. + +If CREATE is nil (default), then return nil. Do not create a new file. +If CREATE is t, create the new file and visit it. +If CREATE is the symbol `ask', then ask the user if they wish to create +the new file." + (interactive) + (let ((filename (concat (substitute-in-file-name + (expand-file-name name)) + ".org"))) + (cond + ((get-buffer (concat name ".org")) + ;; Buffer is already open + (switch-to-buffer (get-buffer (concat name ".org")))) + ((file-exists-p filename) + ;; File exists but is not open --> open it + (message "Opening existing org file `%S'..." + filename) + (org-open-file filename t)) + ((or (eql create t) + (and (eql create 'ask) + (y-or-n-p (format "File `%s.org' not found; create?" name)))) + (org-ctags-open-file filename name)) + (t ;; File does not exist, and we don't want to create it. + nil)))) + + +(defun org-ctags-ask-visit-buffer-or-file (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-visit-buffer-or-file, which ensures the user is +asked before creating a new file." + (org-ctags-visit-buffer-or-file name 'ask)) + + +(defun org-ctags-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Append a new toplevel heading to the end of the current buffer. The +heading contains NAME surrounded by <>, thus making +the heading a destination for the tag `NAME'." + (interactive "sTopic: ") + (widen) + (goto-char (point-max)) + (newline 2) + (message "Adding topic in buffer %s" (buffer-name)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize name) org-ctags-new-topic-template)) + (backward-char 4) + (org-update-radio-target-regexp) + (end-of-line) + (forward-line 2) + (when narrowp + ;;(org-tree-to-indirect-buffer 1) ;; opens new frame + (org-narrow-to-subtree)) + t) + + +(defun org-ctags-ask-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-append-topic, which first asks the user if they want +to append a new topic." + (if (y-or-n-p (format "Topic `%s' not found; append to end of buffer?" + name)) + (org-ctags-append-topic name narrowp) + nil)) + + +(defun org-ctags-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first, +to rebuild (update) the TAGS file." + (unless tags-file-name + (call-interactively (visit-tags-table))) + (when (buffer-file-name) + (org-ctags-create-tags)) + (org-ctags-find-tag name)) + + +(defun org-ctags-ask-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-rebuild-tags-file-then-find-tag." + (if (and (buffer-file-name) + (y-or-n-p + (format + "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" + name + (file-name-directory (buffer-file-name))))) + (org-ctags-rebuild-tags-file-then-find-tag name) + nil)) + + +(defun org-ctags-fail-silently (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Put as the last function in the list if you want to prevent org's default +behaviour of free text search." + t) + + +;;; User-visible functions =================================================== + + +(defun org-ctags-create-tags (&optional directory-name) + "(Re)create tags file in the directory of the active buffer, +containing tag definitions for all the files in the directory and its +subdirectories which are recognised by ctags. This will include +files ending in `.org' as well as most other source files (.C, +.H, .EL, .LISP, etc). All the resulting tags end up in one file, +called TAGS, located in the directory. This function +may take several seconds to finish if the directory or its +subdirectories contain large numbers of taggable files." + (interactive) + (assert (buffer-file-name)) + (let ((dir-name (or directory-name + (file-name-directory (buffer-file-name)))) + (exitcode nil)) + (save-excursion + (setq exitcode + (shell-command + (format (concat "%s --langdef=orgmode --langmap=orgmode:.org " + "--regex-orgmode=\"%s\" -f \"%s\" -e -R \"%s\"") + org-ctags-path-to-ctags + org-ctags-tag-regexp + (expand-file-name (concat dir-name "/TAGS")) + (expand-file-name (concat dir-name "/*"))))) + (cond + ((eql 0 exitcode) + (set (make-local-variable 'org-ctags-tag-list) + (org-ctags-all-tags-in-current-tags-table))) + (t + ;; This seems to behave differently on Linux, so just ignore + ;; error codes for now + ;;(error "Calling ctags executable resulted in error code: %s" + ;; exitcode) + nil))))) + + +(defvar org-ctags-find-tag-history nil + "History of tags visited by org-ctags-find-tag-interactive.") + +(defun org-ctags-find-tag-interactive () + "Prompt for the name of a tag, with autocompletion, then visit +the named tag. Uses ido-mode if available. +If the user enters a string that does not match an existing tag, create +a new topic." + (interactive) + (let* ((completing-read-fn (if (fboundp 'ido-completing-read) + 'ido-completing-read + 'completing-read)) + (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list + nil 'confirm nil 'org-ctags-find-tag-history))) + (when tag + (cond + ((member tag org-ctags-tag-list) + ;; Existing tag + (push tag org-ctags-find-tag-history) + (find-tag tag)) + (t + ;; New tag + (run-hook-with-args-until-success + 'org-open-link-functions tag)))))) + + +(org-ctags-enable) + +(provide 'org-ctags) + +;; arch-tag: 4b1ddd5a-8529-4b17-bcde-96a922d26343 +;;; org-ctags.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-datetree.el --- a/lisp/org/org-datetree.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-datetree.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -39,10 +39,11 @@ property, the date tree will become a subtree under that entry, so the base level will be properly adjusted.") +;;;###autoload (defun org-datetree-find-date-create (date &optional keep-restriction) "Find or create an entry for DATE. If KEEP-RESTRICTION is non-nil, do not widen the buffer. -When it is nit, the buffer will be widened to make sure an existing date +When it is nil, the buffer will be widened to make sure an existing date tree can be found." (let ((year (nth 2 date)) (month (car date)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-docbook.el --- a/lisp/org/org-docbook.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-docbook.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-docbook.el -;; Version: 6.33x +;; Version: 6.35i ;; Author: Baoqiu Cui ;; Maintainer: Baoqiu Cui ;; Keywords: org, wp, docbook @@ -384,6 +384,8 @@ top-level sections). When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) @@ -609,7 +611,9 @@ \n" (org-docbook-expand title) firstname othername surname - (if email (concat "" email "") "") + (if (and org-export-email-info + email (string-match "\\S-" email)) + (concat "" email "") "") ))) (org-init-section-numbers) @@ -622,7 +626,7 @@ ;; End of quote section? (when (and inquote (string-match "^\\*+ " line)) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para) (setq inquote nil)) ;; Inside a quote section? @@ -642,7 +646,7 @@ (not (string-match "^[ \t]*\\(:.*\\)" (car lines)))) (setq infixed nil) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (throw 'nextline nil)) @@ -910,7 +914,8 @@ (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) (if (get-text-property (match-beginning 2) 'org-protected line) (setq start (match-end 2)) - (let ((num (match-string 2 line))) + (let* ((num (match-string 2 line)) + (footnote-def (assoc num footnote-list))) (if (assoc num footref-seen) (setq line (replace-match (format "%s" @@ -922,9 +927,10 @@ (match-string 1 line) org-export-docbook-footnote-id-prefix num - (save-match-data - (org-docbook-expand - (cdr (assoc num footnote-list))))) + (if footnote-def + (save-match-data + (org-docbook-expand (cdr footnote-def))) + (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) t t line)) (push (cons num 1) footref-seen)))))) @@ -1090,7 +1096,7 @@ ;; Properly close all local lists and other lists (when inquote - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (when in-local-list ;; Close any local lists before inserting a new header line @@ -1119,6 +1125,13 @@ "[ \r\n\t]*\\(\\)[ \r\n\t]*[ \r\n\t]*" nil t) (when (not (get-text-property (match-beginning 1) 'org-protected)) (replace-match "\n") + ;; Avoid empty caused by inline tasks. + ;; We should add an empty para to make everything valid. + (when (and (looking-at "") + (save-excursion + (backward-char (length "\n")) + (looking-at ""))) + (insert "")) (backward-char 1))) ;; Fill empty sections with . This is to make sure ;; that the DocBook document generated is valid and well-formed. @@ -1246,16 +1259,14 @@ (if org-export-with-sub-superscripts (setq s (org-export-docbook-convert-sub-super s))) (if org-export-with-TeX-macros - (let ((start 0) wd ass) + (let ((start 0) wd rep) (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" s start)) (if (get-text-property (match-beginning 0) 'org-protected s) (setq start (match-end 0)) (setq wd (match-string 1 s)) - (if (setq ass (assoc wd org-html-entities)) - (setq s (replace-match (or (cdr ass) - (concat "&" (car ass) ";")) - t t s)) + (if (setq rep (org-entity-get-representation wd 'html)) + (setq s (replace-match rep t t s)) (setq start (+ start (length wd)))))))) s) @@ -1312,6 +1323,7 @@ (label (org-find-text-property-in-string 'org-label src)) (default-attr org-export-docbook-default-image-attributes) tmp) + (setq caption (and caption (org-html-do-expand caption))) (while (setq tmp (pop default-attr)) (if (not (string-match (concat (car tmp) "=") attr)) (setq attr (concat attr " " (car tmp) "=" (cdr tmp))))) @@ -1337,18 +1349,33 @@ (replace-match "")))) (defun org-export-docbook-finalize-table (table) - "Change TABLE to informaltable if caption does not exist. + "Clean up TABLE and turn it into DocBook format. +This function adds a label to the table if it is available, and +also changes TABLE to informaltable if caption does not exist. TABLE is a string containing the HTML code generated by `org-format-table-html' for a table in Org-mode buffer." - (if (string-match - "^\n\\(\\(.\\|\n\\)+\\)
" - table) - (replace-match (concat "") - nil nil table) - table)) + (let (table-with-label) + ;; Get the label if it exists, and move it into the element. + (setq table-with-label + (if (string-match + "^
\n\\(\\(.\\|\n\\)+\\)
" + table) + (replace-match (concat "") + nil nil table) + table)) + ;; Change
into if caption does not exist. + (if (string-match + "^
\n\\(\\(.\\|\n\\)+\\)
" + table-with-label) + (replace-match (concat "") + nil nil table-with-label) + table-with-label))) ;; Note: This function is very similar to ;; org-export-html-convert-sub-super. They can be merged in the future. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-docview.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-docview.el Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,86 @@ +;;; org-docview.el --- support for links to doc-view-mode buffers + +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. + +;; Author: Jan Böcker +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 6.35i +;; +;; 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to open files in doc-view-mode. +;; Org-mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;; The links take the form +;; +;; docview::: +;; +;; for example: [[docview:~/.elisp/org/doc/org.pdf::1][Org-Mode Manual]] +;; +;; Autocompletion for inserting links is supported; you will be +;; prompted for a file and a page number. +;; +;; If you use org-store-link in a doc-view mode buffer, the stored +;; link will point to the current page. + +;;; Code: + + +(require 'org) + +(declare-function doc-view-goto-page "doc-view" (page)) +(declare-function doc-view-current-page "doc-view" (&optional win)) + +(org-add-link-type "docview" 'org-docview-open) +(add-hook 'org-store-link-functions 'org-docview-store-link) + +(defun org-docview-open (link) + (when (string-match "\\(.*\\)::\\([0-9]+\\)$" link) + (let* ((path (match-string 1 link)) + (page (string-to-number (match-string 2 link)))) + (org-open-file path 1) ;; let org-mode open the file (in-emacs = 1) + ;; to ensure org-link-frame-setup is respected + (doc-view-goto-page page) + ))) + +(defun org-docview-store-link () + "Store a link to a docview buffer" + (when (eq major-mode 'doc-view-mode) + ;; This buffer is in doc-view-mode + (let* ((path buffer-file-name) + (page (doc-view-current-page)) + (link (concat "docview:" path "::" (number-to-string page))) + (description "")) + (org-store-link-props + :type "docview" + :link link + :description path)))) + +(defun org-docview-complete-link () + "Use the existing file name completion for file: links to get the file name, + then ask the user for the page number and append it." + (concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link)) + "::" + (read-from-minibuffer "Page:" "1"))) + + +(provide 'org-docview) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-entities.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-entities.el Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,493 @@ +;;; org-entities.el --- Support for special entities in Org-mode + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Carsten Dominik , +;; Ulf Stegemann +;; Keywords: outlines, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 6.35i +;; +;; 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +(require 'org-macs) + +(declare-function org-table-align "org-table" ()) + +(eval-when-compile + (require 'cl)) + +(defgroup org-entities nil + "Options concerning entities in Org-mode." + :tag "Org Entities" + :group 'org) + +(defcustom org-entities-ascii-explanatory nil + "Non-nil means replace special entities in ASCII. +For example, this will replace \"\\nsup\" with \"[not a superset of]\" +in backends where the corresponding character is not available." + :group 'org-entities + :type 'boolean) + +(defcustom org-entities-user nil + "User-defined entities used in Org-mode to preduce special characters. +Each entry in this list is a list of strings. It associate the name +of the entity that can be inserted into an Org file as \\name with the +appropriate replacements for the different export backends. The order +of the fields is he following + +name As a string, without the leading backslash +LaTeX replacement In ready LaTeX, no further processing will take place +LaTeX mathp A Boolean, either t or nil. t if this entity needs + to be in math mode. +HTML replacement In ready HTML, no further processing will take place. + Usually this will be an &...; entity. +ASCII replacement Plain ASCII, no extensions. Symbols that cannot be + represented will be written out as an explanatory text. + But see the variable `org-entities-ascii-keep-macro-form'. +Latin1 replacement Use the special characters available in latin1. +utf-8 replacement Use special character available in utf-8. + +If you define new entities here that require specific LaTeX packages to be +loaded, add these packages to `org-export-latex-packages-alist'." + :group 'org-entities + :type '(repeat + (list + (string :tag "name ") + (string :tag "LaTeX ") + (boolean :tag "Require LaTeX math?") + (string :tag "HTML ") + (string :tag "ASCII ") + (string :tag "Latin1") + (string :tag "utf-8 ")))) + +(defconst org-entities + '(("nbsp" "~" nil " " " " " " " ") + ("iexcl" "!`" nil "¡" "!" "¡" "¡") + ("cent" "\\textcent{}" nil "¢" "cent" "¢" "¢") + ("pound" "\\pounds{}" nil "£" "pound" "£" "£") + ("curren" "\\textcurrency{}" nil "¤" "curr." "¤" "¤") + ("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥") + ("brvbar" "\\textbrokenbar{}" nil "¦" "|" "¦" "¦") + ("vert" "\\vert{}" t "|" "|" "|" "|") + ("sect" "\\S" nil "§" "paragraph" "§" "§") + ("uml" "\\textasciidieresis{}" nil "¨" "[diaeresis]" "¨" "¨") + ("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©") + ("ordf" "\\textordfeminine{}" nil "ª" "_a_" "ª" "ª") + ("laquo" "\\guillemotleft{}" nil "«" "<<" "«" "«") + ("not" "\\textlnot{}" nil "¬" "[angled dash]" "¬" "¬") + ("shy" "\\-" nil "­" "" "" "") + ("reg" "\\textregistered{}" nil "®" "(r)" "®" "®") + ("macr" "\\textasciimacron{}" nil "¯" "[macron]" "¯" "¯") + ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°") + ("pm" "\\textpm{}" nil "±" "+-" "±" "±") + ("plusmn" "\\textpm{}" nil "±" "+-" "±" "±") + ("sup2" "\\texttwosuperior{}" nil "²" "^2" "²" "²") + ("sup3" "\\textthreesuperior{}" nil "³" "^3" "³" "³") + ("acutex" "\\acute x" t "´x" "'x" "'x" "𝑥́") + ("micro" "\\textmu{}" nil "µ" "micro" "µ" "µ") + ("para" "\\P{}" nil "¶" "[pilcrow]" "¶" "¶") + ("middot" "\\textperiodcentered{}" nil "·" "." "·" "·") + ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ") + ("star" "\\star" t "*" "*" "*" "⋆") + ("cedil" "\\c{}" nil "¸" "[cedilla]" "¸" "¸") + ("sup1" "\\textonesuperior{}" nil "¹" "^1" "¹" "¹") + ("ordm" "\\textordmasculine{}" nil "º" "_o_" "º" "º") + ("raquo" "\\guillemotright{}" nil "»" ">>" "»" "»") + ("iquest" "?`" nil "¿" "?" "¿" "¿") + ("Agrave" "\\`{A}" nil "À" "A" "À" "À") + ("Aacute" "\\'{A}" nil "Á" "A" "Á" "Á") + ("Acirc" "\\^{A}" nil "Â" "A" "Â" "Â") + ("Atilde" "\\~{A}" nil "Ã" "A" "Ã" "Ã") + ("Auml" "\\\"{A}" nil "Ä" "Ae" "Ä" "Ä") + ("Aring" "\\AA{}" nil "Å" "A" "Å" "Å") + ("AA" "\\AA{}" nil "Å" "A" "Å" "Å") + ("AElig" "\\AE{}" nil "Æ" "AE" "Æ" "Æ") + ("Ccedil" "\\c{C}" nil "Ç" "C" "Ç" "Ç") + ("Egrave" "\\`{E}" nil "È" "E" "È" "È") + ("Eacute" "\\'{E}" nil "É" "E" "É" "É") + ("Ecirc" "\\^{E}" nil "Ê" "E" "Ê" "Ê") + ("Euml" "\\\"{E}" nil "Ë" "E" "Ë" "Ë") + ("Igrave" "\\`{I}" nil "Ì" "I" "Ì" "Ì") + ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") + ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") + ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") + ("ETH" "\\DH{}" nil "Ð" "D" "Ð" "Ð") + ("Ntilde" "\\~{N}" nil "Ñ" "N" "Ñ" "Ñ") + ("Ograve" "\\`{O}" nil "Ò" "O" "Ò" "Ò") + ("Oacute" "\\'{O}" nil "Ó" "O" "Ó" "Ó") + ("Ocirc" "\\^{O}" nil "Ô" "O" "Ô" "Ô") + ("Otilde" "\\~{O}" nil "Õ" "O" "Õ" "Õ") + ("Ouml" "\\\"{O}" nil "Ö" "Oe" "Ö" "Ö") + ("times" "\\texttimes{}" nil "×" "*" "×" "×") + ("Oslash" "\\O" nil "Ø" "O" "Ø" "Ø") + ("Ugrave" "\\`{U}" nil "Ù" "U" "Ù" "Ù") + ("Uacute" "\\'{U}" nil "Ú" "U" "Ú" "Ú") + ("Ucirc" "\\^{U}" nil "Û" "U" "Û" "Û") + ("Uuml" "\\\"{U}" nil "Ü" "Ue" "Ü" "Ü") + ("Yacute" "\\'{Y}" nil "Ý" "Y" "Ý" "Ý") + ("THORN" "\\TH{}" nil "Þ" "TH" "Þ" "Þ") + ("szlig" "\\ss{}" nil "ß" "ss" "ß" "ß") + ("agrave" "\\`{a}" nil "à" "a" "à" "à") + ("aacute" "\\'{a}" nil "á" "a" "á" "á") + ("acirc" "\\^{a}" nil "â" "a" "â" "â") + ("atilde" "\\~{a}" nil "ã" "a" "ã" "ã") + ("auml" "\\\"{a}" nil "ä" "ae" "ä" "ä") + ("aring" "\\aa{}" nil "å" "a" "å" "å") + ("aelig" "\\ae{}" nil "æ" "ae" "æ" "æ") + ("ccedil" "\\c{c}" nil "ç" "c" "ç" "ç") + ("checkmark" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + ("egrave" "\\`{e}" nil "è" "e" "è" "è") + ("eacute" "\\'{e}" nil "é" "e" "é" "é") + ("ecirc" "\\^{e}" nil "ê" "e" "ê" "ê") + ("euml" "\\\"{e}" nil "ë" "e" "ë" "ë") + ("igrave" "\\`{i}" nil "ì" "i" "ì" "ì") + ("iacute" "\\'{i}" nil "í" "i" "í" "í") + ("icirc" "\\^{i}" nil "î" "i" "î" "î") + ("iuml" "\\\"{i}" nil "ï" "i" "ï" "ï") + ("eth" "\\dh{}" nil "ð" "dh" "ð" "ð") + ("ntilde" "\\~{n}" nil "ñ" "n" "ñ" "ñ") + ("ograve" "\\`{o}" nil "ò" "o" "ò" "ò") + ("oacute" "\\'{o}" nil "ó" "o" "ó" "ó") + ("ocirc" "\\^{o}" nil "ô" "o" "ô" "ô") + ("otilde" "\\~{o}" nil "õ" "o" "õ" "õ") + ("ouml" "\\\"{o}" nil "ö" "oe" "ö" "ö") + ("oslash" "\\o{}" nil "ø" "o" "ø" "ø") + ("ugrave" "\\`{u}" nil "ù" "u" "ù" "ù") + ("uacute" "\\'{u}" nil "ú" "u" "ú" "ú") + ("ucirc" "\\^{u}" nil "û" "u" "û" "û") + ("uuml" "\\\"{u}" nil "ü" "ue" "ü" "ü") + ("yacute" "\\'{y}" nil "ý" "y" "ý" "ý") + ("thorn" "\\th{}" nil "þ" "th" "þ" "þ") + ("yuml" "\\\"{y}" nil "ÿ" "y" "ÿ" "ÿ") + ("fnof" "\\textit{f}" nil "ƒ" "f" "f" "ƒ") + ("Alpha" "A" nil "Α" "Alpha" "Alpha" "Α") + ("Beta" "B" nil "Β" "Beta" "Beta" "Β") + ("Gamma" "\\Gamma" t "Γ" "Gamma" "Gamma" "Γ") + ("Delta" "\\Delta" t "Δ" "Delta" "Gamma" "Δ") + ("Epsilon" "E" nil "Ε" "Epsilon" "Epsilon" "Ε") + ("Zeta" "Z" nil "Ζ" "Zeta" "Zeta" "Ζ") + ("Eta" "H" nil "Η" "Eta" "Eta" "Η") + ("Theta" "\\Theta" t "Θ" "Theta" "Theta" "Θ") + ("Iota" "I" nil "Ι" "Iota" "Iota" "Ι") + ("Kappa" "K" nil "Κ" "Kappa" "Kappa" "Κ") + ("Lambda" "\\Lambda" t "Λ" "Lambda" "Lambda" "Λ") + ("Mu" "M" nil "Μ" "Mu" "Mu" "Μ") + ("Nu" "N" nil "Ν" "Nu" "Nu" "Ν") + ("Xi" "\\Xi" t "Ξ" "Xi" "Xi" "Ξ") + ("Omicron" "O" nil "Ο" "Omicron" "Omicron" "Ο") + ("Pi" "\\Pi" t "Π" "Pi" "Pi" "Π") + ("Rho" "P" nil "Ρ" "Rho" "Rho" "Ρ") + ("Sigma" "\\Sigma" t "Σ" "Sigma" "Sigma" "Σ") + ("Tau" "T" nil "Τ" "Tau" "Tau" "Τ") + ("Upsilon" "\\Upsilon" t "Υ" "Upsilon" "Upsilon" "Υ") + ("Phi" "\\Phi" t "Φ" "Phi" "Phi" "Φ") + ("Chi" "X" nil "Χ" "Chi" "Chi" "Χ") + ("Psi" "\\Psi" t "Ψ" "Psi" "Psi" "Ψ") + ("Omega" "\\Omega" t "Ω" "Omega" "Omega" "Ω") + ("alpha" "\\alpha" t "α" "alpha" "alpha" "α") + ("beta" "\\beta" t "β" "beta" "beta" "β") + ("gamma" "\\gamma" t "γ" "gamma" "gamma" "γ") + ("delta" "\\delta" t "δ" "delta" "delta" "δ") + ("epsilon" "\\epsilon" t "ε" "epsilon" "epsilon" "ε") + ("varepsilon" "\\varepsilon" t "ε" "varepsilon" "varepsilon" "ε") + ("zeta" "\\zeta" t "ζ" "zeta" "zeta" "ζ") + ("eta" "\\eta" t "η" "eta" "eta" "η") + ("theta" "\\theta" t "θ" "theta" "theta" "θ") + ("iota" "\\iota" t "ι" "iota" "iota" "ι") + ("kappa" "\\kappa" t "κ" "kappa" "kappa" "κ") + ("lambda" "\\lambda" t "λ" "lambda" "lambda" "λ") + ("mu" "\\mu" t "μ" "mu" "mu" "μ") + ("nu" "\\nu" t "ν" "nu" "nu" "ν") + ("xi" "\\xi" t "ξ" "xi" "xi" "ξ") + ("omicron" "\\textit{o}" nil "ο" "omicron" "omicron" "ο") + ("pi" "\\pi" t "π" "pi" "pi" "π") + ("rho" "\\rho" t "ρ" "rho" "rho" "ρ") + ("sigmaf" "\\varsigma" t "ς" "sigmaf" "sigmaf" "ς") + ("varsigma" "\\varsigma" t "ς" "varsigma" "varsigma" "ς") + ("sigma" "\\sigma" t "σ" "sigma" "sigma" "σ") + ("tau" "\\tau" t "τ" "tau" "tau" "τ") + ("upsilon" "\\upsilon" t "υ" "upsilon" "upsilon" "υ") + ("phi" "\\phi" t "φ" "phi" "phi" "φ") + ("chi" "\\chi" t "χ" "chi" "chi" "χ") + ("psi" "\\psi" t "ψ" "psi" "psi" "ψ") + ("omega" "\\omega" t "ω" "omega" "omega" "ω") + ("thetasym" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("vartheta" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("upsih" "\\Upsilon" t "ϒ" "upsilon" "upsilon" "ϒ") + ("piv" "\\varpi" t "ϖ" "omega-pi" "omega-pi" "ϖ") + ("bull" "\\textbullet{}" nil "•" "*" "*" "•") + ("bullet" "\\textbullet{}" nil "•" "*" "*" "•") + ("hellip" "\\dots{}" nil "…" "..." "..." "…") + ("dots" "\\dots{}" nil "…" "..." "..." "…") + ("prime" "\\prime" t "′" "'" "'" "′") + ("Prime" "\\prime{}\\prime" t "″" "''" "''" "″") + ("oline" "\\overline{~}" t "‾" "[overline]" "¯" "‾") + ("frasl" "/" nil "⁄" "/" "/" "⁄") + ("weierp" "\\wp" t "℘" "P" "P" "℘") + ("image" "\\Im" t "ℑ" "I" "I" "ℑ") + ("real" "\\Re" t "ℜ" "R" "R" "ℜ") + ("trade" "\\texttrademark{}" nil "™" "TM" "TM" "™") + ("alefsym" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") + ("larr" "\\leftarrow" t "←" "<-" "<-" "←") + ("leftarrow" "\\leftarrow" t "←" "<-" "<-" "←") + ("gets" "\\gets" t "←" "<-" "<-" "←") + ("uarr" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uparrow" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("rarr" "\\rightarrow" t "→" "->" "->" "→") + ("to" "\\to" t "→" "->" "->" "→") + ("rightarrow" "\\rightarrow" t "→" "->" "->" "→") + ("darr" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("downarrow" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("harr" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("leftrightarrow" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("crarr" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("hookleftarrow" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("lArr" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("Leftarrow" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("uArr" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("Uparrow" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("rArr" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("Rightarrow" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("dArr" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("Downarrow" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("hArr" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("Leftrightarrow" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("forall" "\\forall" t "∀" "[for all]" "[for all]" "∀") + ("partial" "\\partial" t "∂" "[partial differential]" "[partial differential]" "∂") + ("exist" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("exists" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("empty" "\\empty" t "∅" "[empty set]" "[empty set]" "∅") + ("emptyset" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") + ("nabla" "\\nabla" t "∇" "[nabla]" "[nabla]" "∇") + ("isin" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("in" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("notin" "\\notin" t "∉" "[not an element of]" "[not an element of]" "∉") + ("ni" "\\ni" t "∋" "[contains as member]" "[contains as member]" "∋") + ("prod" "\\prod" t "∏" "[product]" "[n-ary product]" "∏") + ("sum" "\\sum" t "∑" "[sum]" "[sum]" "∑") +; ("minus" "\\minus" t "−" "-" "-" "−") + ("minus" "-" t "−" "-" "-" "−") + ("lowast" "\\ast" t "∗" "*" "*" "∗") + ("ast" "\\ast" t "∗" "*" "*" "*") + ("radic" "\\sqrt{\\,}" t "√" "[square root]" "[square root]" "√") + ("prop" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("proptp" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("infin" "\\propto" t "∞" "[infinity]" "[infinity]" "∞") + ("infty" "\\infty" t "∞" "[infinity]" "[infinity]" "∞") + ("ang" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("angle" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("and" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("wedge" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("or" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("vee" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("cap" "\\cap" t "∩" "[intersection]" "[intersection]" "∩") + ("cup" "\\cup" t "∪" "[union]" "[union]" "∪") + ("int" "\\int" t "∫" "[integral]" "[integral]" "∫") +; ("there4" "\\uptherefore" t "∴" "[therefore]" "[therefore]" "∴") + ("there4" "\\therefore" t "∴" "[therefore]" "[therefore]" "∴") + ("sim" "\\sim" t "∼" "~" "~" "∼") + ("cong" "\\cong" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("simeq" "\\simeq" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("asymp" "\\asymp" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("approx" "\\approx" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("ne" "\\ne" t "≠" "[not equal to]" "[not equal to]" "≠") + ("neq" "\\neq" t "≠" "[not equal to]" "[not equal to]" "≠") + ("equiv" "\\equiv" t "≡" "[identical to]" "[identical to]" "≡") + ("le" "\\le" t "≤" "<=" "<=" "≤") + ("ge" "\\ge" t "≥" ">=" ">=" "≥") + ("sub" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("subset" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("sup" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("supset" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("nsub" "\\not\\subset" t "⊄" "[not a subset of]" "[not a subset of" "⊄") + ("sube" "\\subseteq" t "⊆" "[subset of or equal to]" "[subset of or equal to]" "⊆") + ("supe" "\\supseteq" t "⊇" "[superset of or equal to]" "[superset of or equal to]" "⊇") + ("oplus" "\\oplus" t "⊕" "[circled plus]" "[circled plus]" "⊕") + ("otimes" "\\otimes" t "⊗" "[circled times]" "[circled times]" "⊗") + ("perp" "\\perp" t "⊥" "[up tack]" "[up tack]" "⊥") + ("sdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("cdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("lceil" "\\lceil" t "⌈" "[left ceiling]" "[left ceiling]" "⌈") + ("rceil" "\\rceil" t "⌉" "[right ceiling]" "[right ceiling]" "⌉") + ("lfloor" "\\lfloor" t "⌊" "[left floor]" "[left floor]" "⌊") + ("rfloor" "\\rfloor" t "⌋" "[right floor]" "[right floor]" "⌋") + ("lang" "\\langle" t "⟨" "<" "<" "⟨") + ("rang" "\\rangle" t "⟩" ">" ">" "⟩") + ("loz" "\\diamond" t "◊" "[lozenge]" "[lozenge]" "◊") + ("Diamond" "\\diamond" t "⋄" "[diamond]" "[diamond]" "⋄") + ("spades" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("spadesuit" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("clubsuit" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("hearts" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("heartsuit" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("diamondsuit" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("diams" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("smile" "\\smile" t "☺" ":-)" ":-)" "⌣") + ("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻") + ("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹") + ("quot" "\\textquotedbl{}" nil """ "\"" "\"" "\"") + ("amp" "\\&" nil "&" "&" "&" "&") + ("lt" "\\textless{}" nil "<" "<" "<" "<") + ("gt" "\\textgreater{}" nil ">" ">" ">" ">") + ("OElig" "\\OE{}" nil "Œ" "OE" "OE" "Œ") + ("oelig" "\\oe{}" nil "œ" "oe" "oe" "œ") + ("Scaron" "\\v{S}" nil "Š" "S" "S" "Š") + ("scaron" "\\v{s}" nil "š" "s" "s" "š") + ("Yuml" "\\\"{Y}" nil "Ÿ" "Y" "Y" "Ÿ") + ("circ" "\\circ" t "ˆ" "^" "^" "ˆ") + ("tilde" "\\~{}" nil "˜" "~" "~" "~") + ("ensp" "\\hspace*{.5em}" nil " " " " " " " ") + ("emsp" "\\hspace*{1em}" nil " " " " " " " ") + ("thinsp" "\\hspace*{.2em}" nil " " " " " " " ") + ("zwnj" "\\/{}" nil "‌" "" "" "‌") + ("zwj" "" nil "‍" "" "" "‍") + ("lrm" "" nil "‎" "" "" "‎") + ("rlm" "" nil "‏" "" "" "‏") + ("ndash" "--" nil "–" "-" "-" "–") + ("mdash" "---" nil "—" "--" "--" "—") + ("lsquo" "\\textquoteleft{}" nil "‘" "`" "`" "‘") + ("rsquo" "\\textquoteright{}" nil "’" "'" "'" "’") + ("sbquo" "\\quotesinglbase{}" nil "‚" "," "," "‚") + ("ldquo" "\\textquotedblleft{}" nil "“" "\"" "\"" "“") + ("rdquo" "\\textquotedblright{}" nil "”" "\"" "\"" "”") + ("bdquo" "\\quotedblbase{}" nil "„" "\"" "\"" "„") + ("dagger" "\\textdagger{}" nil "†" "[dagger]" "[dagger]" "†") + ("Dagger" "\\textdaggerdbl{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") + ("permil" "\\textperthousand{}" nil "‰" "per thousand" "per thousand" "‰") + ("lsaquo" "\\guilsinglleft{}" nil "‹" "<" "<" "‹") + ("rsaquo" "\\guilsinglright{}" nil "›" ">" ">" "›") + ("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€") + ("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€") + ("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€") + ("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€") + ("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€") + ("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€") + ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos") + ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin") + ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan") + ("arg" "\\arg" t "arg" "arg" "arg" "arg") + ("cos" "\\cos" t "cos" "cos" "cos" "cos") + ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh") + ("cot" "\\cot" t "cot" "cot" "cot" "cot") + ("coth" "\\coth" t "coth" "coth" "coth" "coth") + ("csc" "\\csc" t "csc" "csc" "csc" "csc") + ("deg" "\\deg" t "°" "deg" "deg" "deg") + ("det" "\\det" t "det" "det" "det" "det") + ("dim" "\\dim" t "dim" "dim" "dim" "dim") + ("exp" "\\exp" t "exp" "exp" "exp" "exp") + ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd") + ("hom" "\\hom" t "hom" "hom" "hom" "hom") + ("inf" "\\inf" t "inf" "inf" "inf" "inf") + ("ker" "\\ker" t "ker" "ker" "ker" "ker") + ("lg" "\\lg" t "lg" "lg" "lg" "lg") + ("lim" "\\lim" t "lim" "lim" "lim" "lim") + ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf") + ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup") + ("ln" "\\ln" t "ln" "ln" "ln" "ln") + ("log" "\\log" t "log" "log" "log" "log") + ("max" "\\max" t "max" "max" "max" "max") + ("min" "\\min" t "min" "min" "min" "min") + ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr") + ("sec" "\\sec" t "sec" "sec" "sec" "sec") + ("sin" "\\sin" t "sin" "sin" "sin" "sin") + ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh") + ("sup" "\\sup" t "⊃" "sup" "sup" "sup") + ("tan" "\\tan" t "tan" "tan" "tan" "tan") + ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh") + ("frac12" "\\textonehalf{}" nil "½" "1/2" "½" "½") + ("frac14" "\\textonequarter{}" nil "¼" "1/4" "¼" "¼") + ("frac34" "\\textthreequarters{}" nil "¾" "3/4" "¾" "¾") + ("div" "\\textdiv{}" nil "÷" "/" "÷" "÷") + ("acute" "\\textasciiacute{}" nil "´" "'" "´" "´") + ("nsup" "\\not\\supset" t "⊅" "[not a superset of]" "[not a superset of]" "⊅") + ("smiley" "\\smiley{}" nil "☺" ":-)" ":-)" "☺") + ) + "Default entities used in Org-mode to preduce special characters. +For details see `org-entities-user'.") + +(defsubst org-entity-get (name) + "Get the proper association for NAME from the entity lists. +This first checks the user list, then the built-in list." + (or (assoc name org-entities-user) + (assoc name org-entities))) + +(defun org-entity-get-representation (name kind) + "Get the correct representation of entity NAME for export type KIND. +Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'." + (let* ((e (org-entity-get name)) + (n (cdr (assq kind '((latex . 1) (html . 3) (ascii . 4) + (latin1 . 5) (utf8 . 6))))) + (r (and e n (nth n e)))) + (if (and e r + (not org-entities-ascii-explanatory) + (memq kind '(ascii latin1 utf8)) + (= (string-to-char r) ?\[)) + (concat "\\" name) + r))) + +(defsubst org-entity-latex-math-p (name) + "Does entity NAME require math mode in LaTeX?" + (nth 2 (org-entity-get name))) + +;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org + +(defun org-entities-create-table () + "Create an org-mode table with all entities." + (interactive) + (let ((ll org-entities) + (pos (point)) + e latex mathp html latin utf8 name ascii) + (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n") + (while ll + (setq e (pop ll)) + (setq name (car e) + latex (nth 1 e) + mathp (nth 2 e) + html (nth 3 e) + ascii (nth 4 e) + latin (nth 5 e) + utf8 (nth 6 e)) + (if (equal ascii "|") (setq ascii "\\vert")) + (if (equal latin "|") (setq latin "\\vert")) + (if (equal utf8 "|") (setq utf8 "\\vert")) + (if (equal ascii "=>") (setq ascii "= >")) + (if (equal latin "=>") (setq latin "= >")) + (insert "|" name + "|" (format "=%s=" latex) + "|" (format (if mathp "$%s$" "$\\mbox{%s}$") + latex) + "|" (format "=%s=" html) "|" html + "|" ascii "|" latin "|" utf8 + "|\n")) + (goto-char pos) + (org-table-align))) + +(defun replace-amp () + "Postprocess HTML file to unescape the ampersant." + (interactive) + (while (re-search-forward "&\\([^<;]+;\\)" nil t) + (replace-match (concat "&" (match-string 1)) t t))) + +(provide 'org-entities) + +;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424 + +;;; org-entities.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-exp-blocks.el --- a/lisp/org/org-exp-blocks.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-exp-blocks.el Thu May 13 15:13:52 2010 +0200 @@ -4,6 +4,7 @@ ;; Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -166,7 +167,7 @@ (save-window-excursion (let ((case-fold-search t) (types '()) - indentation type func start body headers preserve-indent) + indentation type func start body headers preserve-indent progress-marker) (flet ((interblock (start end) (mapcar (lambda (pair) (funcall (second pair) start end)) org-export-interblocks))) @@ -183,13 +184,15 @@ (setq body (save-match-data (org-remove-indentation body)))) (unless (memq type types) (setq types (cons type types))) (save-match-data (interblock start (match-beginning 0))) - (if (setq func (cadr (assoc type org-export-blocks))) - (progn - (replace-match (save-match-data + (when (setq func (cadr (assoc type org-export-blocks))) + (let ((replacement (save-match-data (if (memq type org-export-blocks-witheld) "" - (apply func body headers))) t t) + (apply func body headers))))) + (when replacement + (replace-match replacement t t) (unless preserve-indent - (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))) + (indent-code-rigidly + (match-beginning 0) (match-end 0) indentation))))) (setq start (match-end 0))) (interblock start (point-max)))))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-exp.el --- a/lisp/org/org-exp.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-exp.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -54,7 +54,7 @@ :group 'org-export) (defcustom org-export-allow-BIND 'confirm - "Non-nil means, allow #+BIND to define local variable values for export. + "Non-nil means allow #+BIND to define local variable values for export. This is a potential security risk, which is why the user must confirm the use of these lines." :group 'org-export-general @@ -67,7 +67,7 @@ (defvar org-export-publishing-directory nil) (defcustom org-export-show-temporary-export-buffer t - "Non-nil means, show buffer after exporting to temp buffer. + "Non-nil means show buffer after exporting to temp buffer. When Org exports to a file, the buffer visiting that file is ever shown, but remains buried. However, when exporting to a temporary buffer, that buffer is popped up in a second window. When this variable @@ -76,7 +76,14 @@ :type 'boolean) (defcustom org-export-copy-to-kill-ring t - "Non-nil means, exported stuff will also be pushed onto the kill ring." + "Non-nil means exported stuff will also be pushed onto the kill ring." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-kill-product-buffer-when-displayed nil + "Non-nil means kill the product buffer if it is displayed immediately. +This applied to the commands `org-export-html-and-open' and +`org-export-as-pdf-and-open'." :group 'org-export-general :type 'boolean) @@ -114,7 +121,7 @@ ;; FIXME: rename, this is a general variable (defcustom org-export-html-expand t - "Non-nil means, for HTML export, treat @<...> as HTML tag. + "Non-nil means for HTML export, treat @<...> as HTML tag. When nil, these tags will be exported as plain text and therefore not be interpreted by a browser. @@ -124,7 +131,7 @@ :type 'boolean) (defcustom org-export-with-special-strings t - "Non-nil means, interpret \"\-\", \"--\" and \"---\" for export. + "Non-nil means interpret \"\-\", \"--\" and \"---\" for export. When this option is turned on, these strings will be exported as: Org HTML LaTeX @@ -198,7 +205,7 @@ sense to set this globally.") (defcustom org-export-skip-text-before-1st-heading nil - "Non-nil means, skip all text before the first headline when exporting. + "Non-nil means skip all text before the first headline when exporting. When nil, that text is exported as well." :group 'org-export-general :type 'boolean) @@ -214,7 +221,7 @@ :type 'integer) (defcustom org-export-with-section-numbers t - "Non-nil means, add section numbers to headlines when exporting. + "Non-nil means add section numbers to headlines when exporting. This option can also be set with the +OPTIONS line, e.g. \"num:t\"." :group 'org-export-general @@ -241,7 +248,7 @@ (string :tag "Terminator"))) (defcustom org-export-with-toc t - "Non-nil means, create a table of contents in exported files. + "Non-nil means create a table of contents in exported files. The TOC contains headlines with levels up to`org-export-headline-levels'. When an integer, include levels up to N in the toc, this may then be different from `org-export-headline-levels', but it will not be allowed @@ -263,24 +270,24 @@ (integer :tag "TOC to level"))) (defcustom org-export-mark-todo-in-toc nil - "Non-nil means, mark TOC lines that contain any open TODO items." + "Non-nil means mark TOC lines that contain any open TODO items." :group 'org-export-general :type 'boolean) (defcustom org-export-with-todo-keywords t - "Non-nil means, include TODO keywords in export. + "Non-nil means include TODO keywords in export. When nil, remove all these keywords from the export." :group 'org-export-general :type 'boolean) (defcustom org-export-with-priority nil - "Non-nil means, include priority cookies in export. + "Non-nil means include priority cookies in export. When nil, remove priority cookies for export." :group 'org-export-general :type 'boolean) (defcustom org-export-preserve-breaks nil - "Non-nil means, preserve all line breaks when exporting. + "Non-nil means preserve all line breaks when exporting. Normally, in HTML output paragraphs will be reformatted. In ASCII export, line breaks will always be preserved, regardless of this variable. @@ -302,21 +309,29 @@ (const :tag "entirely" t))) (defcustom org-export-author-info t - "Non-nil means, insert author name and email into the exported file. + "Non-nil means insert author name and email into the exported file. This option can also be set with the +OPTIONS line, -e.g. \"author-info:nil\"." +e.g. \"author:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-email-info nil + "Non-nil means insert author name and email into the exported file. + +This option can also be set with the +OPTIONS line, +e.g. \"email:t\"." :group 'org-export-general :type 'boolean) (defcustom org-export-creator-info t - "Non-nil means, the postamble should contain a creator sentence. + "Non-nil means the postamble should contain a creator sentence. This sentence is \"HTML generated by org-mode XX in emacs XXX\"." :group 'org-export-general :type 'boolean) (defcustom org-export-time-stamp-file t - "Non-nil means, insert a time stamp into the exported file. + "Non-nil means insert a time stamp into the exported file. The time stamp shows when the file was created. This option can also be set with the +OPTIONS line, @@ -347,7 +362,7 @@ (const :tag "On" t))) (defcustom org-export-with-drawers nil - "Non-nil means, export with drawers like the property drawer. + "Non-nil means export with drawers like the property drawer. When t, all drawers are exported. This may also be a list of drawer names to export." :group 'org-export-general @@ -357,9 +372,19 @@ (repeat :tag "Selected drawers" (string :tag "Drawer name")))) +(defvar org-export-first-hook nil + "Hook called as the first thing in each exporter. +Point will be still in the original buffer. +Good for general initialization") + (defvar org-export-preprocess-hook nil "Hook for preprocessing an export buffer. -Pretty much the first thing when exporting is running this hook.") +Pretty much the first thing when exporting is running this hook. +Point will be in a temporary buffer that contains a copy of +the original buffer, or of the section that is being export. +All the other hooks in the org-export-preprocess... category +also work in that temporary buffer, already modified by various +stages of the processing.") (defvar org-export-preprocess-after-include-files-hook nil "Hook for preprocessing an export buffer. @@ -371,11 +396,24 @@ This selection includes tags-based selection, as well as removal of commented and archived trees.") +(defvar org-export-preprocess-after-headline-targets-hook nil + "Hook for preprocessing export buffer. +This is run just after the headline targets have been defined and +the target-alist has been set up.") + +(defvar org-export-preprocess-before-selecting-backend-code-hook nil + "Hook for preprocessing an export buffer. +This is run just before backend-specific blocks get selected.") + (defvar org-export-preprocess-after-blockquote-hook nil "Hook for preprocessing an export buffer. This is run after blockquote/quote/verse/center have been marked with cookies.") +(defvar org-export-preprocess-before-normalizing-links-hook nil + "Hook for preprocessing an export buffer. +This hook is run before links are normalized.") + (defvar org-export-preprocess-before-backend-specifics-hook nil "Hook run before backend-specific functions are called during preprocessing.") @@ -390,7 +428,7 @@ :group 'org-export) (defcustom org-export-with-emphasize t - "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text. + "Non-nil means interpret *word*, /word/, and _word_ as emphasized text. If the export target supports emphasizing text, the word will be typeset in bold, italic, or underlined, respectively. Works only for single words, but you can say: I *really* *mean* *this*. @@ -409,7 +447,7 @@ :type 'boolean) (defcustom org-export-with-sub-superscripts t - "Non-nil means, interpret \"_\" and \"^\" for export. + "Non-nil means interpret \"_\" and \"^\" for export. When this option is turned on, you can use TeX-like syntax for sub- and superscripts. Several characters after \"_\" or \"^\" will be considered as a single item - so grouping with {} is normally not @@ -438,11 +476,12 @@ (const :tag "Never interpret" nil))) (defcustom org-export-with-TeX-macros t - "Non-nil means, interpret simple TeX-like macros when exporting. + "Non-nil means interpret simple TeX-like macros when exporting. For example, HTML export converts \\alpha to α and \\AA to Å. Not only real TeX macros will work here, but the standard HTML entities for math can be used as macro names as well. For a list of supported -names in HTML export, see the constant `org-html-entities'. +names in HTML export, see the constant `org-entities' and the user option +`org-entities-user'. Not all export backends support this. This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." @@ -451,7 +490,7 @@ :type 'boolean) (defcustom org-export-with-LaTeX-fragments nil - "Non-nil means, convert LaTeX fragments to images when exporting to HTML. + "Non-nil means convert LaTeX fragments to images when exporting to HTML. When set, the exporter will find LaTeX environments if the \\begin line is the first non-white thing on a line. It will also find the math delimiters like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for @@ -466,7 +505,7 @@ :type 'boolean) (defcustom org-export-with-fixed-width t - "Non-nil means, lines starting with \":\" will be in fixed width font. + "Non-nil means lines starting with \":\" will be in fixed width font. This can be used to have pre-formatted text, fragments of code etc. For example: : ;; Some Lisp examples @@ -505,7 +544,7 @@ :type 'boolean) (defcustom org-export-highlight-first-table-line t - "Non-nil means, highlight the first table line. + "Non-nil means highlight the first table line. In HTML export, this means use instead of . In tables created with table.el, this applies to the first table line. In Org-mode tables, all lines before the first horizontal separator @@ -523,13 +562,14 @@ :type 'boolean) (defcustom org-export-prefer-native-exporter-for-tables nil - "Non-nil means, always export tables created with table.el natively. -Natively means, use the HTML code generator in table.el. + "Non-nil means always export tables created with table.el natively. +Natively means use the HTML code generator in table.el. When nil, Org-mode's own HTML generator is used when possible (i.e. if the table does not use row- or column-spanning). This has the advantage, that the automatic HTML conversions for math symbols and sub/superscripts can be applied. Org-mode's HTML generator is also -much faster." +much faster. The LaTeX exporter always use the native exporter for +table.el tables." :group 'org-export-tables :type 'boolean) @@ -581,6 +621,7 @@ (:fixed-width ":" org-export-with-fixed-width) (:timestamps "<" org-export-with-timestamps) (:author-info "author" org-export-author-info) + (:email-info "email" org-export-email-info) (:creator-info "creator" org-export-creator-info) (:time-stamp-file "timestamp" org-export-time-stamp-file) (:tables "|" org-export-with-tables) @@ -772,9 +813,10 @@ (defun org-install-letbind () "Install the values from #+BIND lines as local variables." - (let ((letbind (plist-get org-export-opt-plist :let-bind))) - (while letbind - (org-set-local (caar letbind) (nth 1 (pop letbind)))))) + (let ((letbind (plist-get org-export-opt-plist :let-bind)) + pair) + (while (setq pair (pop letbind)) + (org-set-local (car pair) (nth 1 pair))))) (defun org-export-add-options-to-plist (p options) "Parse an OPTIONS line and set values in the property list P." @@ -835,29 +877,28 @@ value of `org-export-run-in-background'." (interactive "P") (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background)) + subtree-p (help "[t] insert the export option template \[v] limit export to visible part of outline tree +\[1] only export the current subtree +\[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop) -\[a] export as ASCII [A] to temporary buffer +\[a/n/u] export as ASCII/Latin-1/UFT-8 [A/N/U] to temporary buffer -\[h] export as HTML [H] to temporary buffer [R] export region +\[h] export as HTML [H] to temporary buffer [R] export region \[b] export as HTML and open in browser -\[l] export as LaTeX [L] to temporary buffer -\[p] export as LaTeX and process to PDF -\[d] export as LaTeX, process to PDF, and open the resulting PDF document +\[l] export as LaTeX [L] to temporary buffer +\[p] export as LaTeX and process to PDF [d] ... and open PDF file -\[D] export as DocBook -\[V] export as DocBook, process to PDF, and open the resulting PDF document +\[D] export as DocBook [V] export as DocBook, process to PDF, and open \[m] export as Freemind mind map - \[x] export as XOXO \[g] export using Wes Hardaker's generic exporter \[i] export current file as iCalendar file -\[I] export all agenda files as iCalendar files -\[c] export agenda files into combined iCalendar file +\[I] export all agenda files as iCalendar files [c] ...as one combined file \[F] publish current file [P] publish current project \[X] publish a project... [E] publish every projects") @@ -866,6 +907,10 @@ (?v org-export-visible nil) (?a org-export-as-ascii t) (?A org-export-as-ascii-to-buffer t) + (?n org-export-as-latin1 t) + (?N org-export-as-latin1-to-buffer t) + (?u org-export-as-utf8 t) + (?U org-export-as-utf8-to-buffer t) (?h org-export-as-html t) (?b org-export-as-html-and-open t) (?H org-export-as-html-to-buffer nil) @@ -886,7 +931,8 @@ (?P org-publish-current-project t) (?X org-publish t) (?E org-publish-all t))) - r1 r2 ass) + r1 r2 ass + (cpos (point)) (cbuf (current-buffer)) bpos) (save-excursion (save-window-excursion (delete-other-windows) @@ -895,7 +941,25 @@ (org-fit-window-to-buffer (get-buffer-window "*Org Export/Publishing Help*")) (message "Select command: ") - (setq r1 (read-char-exclusive)))) + (setq r1 (read-char-exclusive)) + (when (eq r1 ?1) + (setq subtree-p t) + (message "Select command (for subtree): ") + (setq r1 (read-char-exclusive))) + (when (eq r1 ?\ ) + (let ((case-fold-search t)) + (if (re-search-backward + "^[ \t]+\\(:latex_class:\\|:export_title:\\)[ \t]+\\S-" + nil t) + (progn + (org-back-to-heading t) + (setq subtree-p t) + (setq bpos (point)) + (message "Select command (for subtree): ") + (setq r1 (read-char-exclusive))) + (error "No enclosing node with LaTeX_CLASS or EXPORT_FILE_NAME") + ))))) + (and bpos (goto-char bpos)) (setq r2 (if (< r1 27) (+ r1 96) r1)) (unless (setq ass (assq r2 cmds)) (error "No command associated with key %c" r1)) @@ -916,320 +980,28 @@ (set-process-sentinel p 'org-export-process-sentinel) (message "Background process \"%s\": started" p)) ;; background processing not requested, or not possible - (call-interactively (nth 1 ass))))) + (if subtree-p (progn (outline-mark-subtree) (activate-mark))) + (call-interactively (nth 1 ass)) + (when (and bpos (get-buffer-window cbuf)) + (let ((cw (selected-window))) + (select-window (get-buffer-window cbuf)) + (goto-char cpos) + (deactivate-mark) + (select-window cw)))))) (defun org-export-process-sentinel (process status) (if (string-match "\n+\\'" status) (setq status (substring status 0 -1))) (message "Background process \"%s\": %s" process status)) -(defconst org-html-entities - '(("nbsp") - ("iexcl") - ("cent") - ("pound") - ("curren") - ("yen") - ("brvbar") - ("vert" . "|") - ("sect") - ("uml") - ("copy") - ("ordf") - ("laquo") - ("not") - ("shy") - ("reg") - ("macr") - ("deg") - ("pm" . "±") - ("plusmn") - ("sup2") - ("sup3") - ("acute") - ("micro") - ("para") - ("middot") - ("odot"."o") - ("star"."*") - ("cedil") - ("sup1") - ("ordm") - ("raquo") - ("frac14") - ("frac12") - ("frac34") - ("iquest") - ("Agrave") - ("Aacute") - ("Acirc") - ("Atilde") - ("Auml") - ("Aring") ("AA"."Å") - ("AElig") - ("Ccedil") - ("Egrave") - ("Eacute") - ("Ecirc") - ("Euml") - ("Igrave") - ("Iacute") - ("Icirc") - ("Iuml") - ("ETH") - ("Ntilde") - ("Ograve") - ("Oacute") - ("Ocirc") - ("Otilde") - ("Ouml") - ("times") - ("Oslash") - ("Ugrave") - ("Uacute") - ("Ucirc") - ("Uuml") - ("Yacute") - ("THORN") - ("szlig") - ("agrave") - ("aacute") - ("acirc") - ("atilde") - ("auml") - ("aring") - ("aelig") - ("ccedil") - ("egrave") - ("eacute") - ("ecirc") - ("euml") - ("igrave") - ("iacute") - ("icirc") - ("iuml") - ("eth") - ("ntilde") - ("ograve") - ("oacute") - ("ocirc") - ("otilde") - ("ouml") - ("divide") - ("oslash") - ("ugrave") - ("uacute") - ("ucirc") - ("uuml") - ("yacute") - ("thorn") - ("yuml") - ("fnof") - ("Alpha") - ("Beta") - ("Gamma") - ("Delta") - ("Epsilon") - ("Zeta") - ("Eta") - ("Theta") - ("Iota") - ("Kappa") - ("Lambda") - ("Mu") - ("Nu") - ("Xi") - ("Omicron") - ("Pi") - ("Rho") - ("Sigma") - ("Tau") - ("Upsilon") - ("Phi") - ("Chi") - ("Psi") - ("Omega") - ("alpha") - ("beta") - ("gamma") - ("delta") - ("epsilon") - ("varepsilon"."ε") - ("zeta") - ("eta") - ("theta") - ("iota") - ("kappa") - ("lambda") - ("mu") - ("nu") - ("xi") - ("omicron") - ("pi") - ("rho") - ("sigmaf") ("varsigma"."ς") - ("sigma") - ("tau") - ("upsilon") - ("phi") - ("chi") - ("psi") - ("omega") - ("thetasym") ("vartheta"."ϑ") - ("upsih") - ("piv") - ("bull") ("bullet"."•") - ("hellip") ("dots"."…") - ("prime") - ("Prime") - ("oline") - ("frasl") - ("weierp") - ("image") - ("real") - ("trade") - ("alefsym") - ("larr") ("leftarrow"."←") ("gets"."←") - ("uarr") ("uparrow"."↑") - ("rarr") ("to"."→") ("rightarrow"."→") - ("darr")("downarrow"."↓") - ("harr") ("leftrightarrow"."↔") - ("crarr") ("hookleftarrow"."↵") ; has round hook, not quite CR - ("lArr") ("Leftarrow"."⇐") - ("uArr") ("Uparrow"."⇑") - ("rArr") ("Rightarrow"."⇒") - ("dArr") ("Downarrow"."⇓") - ("hArr") ("Leftrightarrow"."⇔") - ("forall") - ("part") ("partial"."∂") - ("exist") ("exists"."∃") - ("empty") ("emptyset"."∅") - ("nabla") - ("isin") ("in"."∈") - ("notin") - ("ni") - ("prod") - ("sum") - ("minus") - ("lowast") ("ast"."∗") - ("radic") - ("prop") ("proptp"."∝") - ("infin") ("infty"."∞") - ("ang") ("angle"."∠") - ("and") ("wedge"."∧") - ("or") ("vee"."∨") - ("cap") - ("cup") - ("int") - ("there4") - ("sim") - ("cong") ("simeq"."≅") - ("asymp")("approx"."≈") - ("ne") ("neq"."≠") - ("equiv") - ("le") - ("ge") - ("sub") ("subset"."⊂") - ("sup") ("supset"."⊃") - ("nsub") - ("sube") - ("supe") - ("oplus") - ("otimes") - ("perp") - ("sdot") ("cdot"."⋅") - ("lceil") - ("rceil") - ("lfloor") - ("rfloor") - ("lang") - ("rang") - ("loz") ("Diamond"."◊") - ("spades") ("spadesuit"."♠") - ("clubs") ("clubsuit"."♣") - ("hearts") ("diamondsuit"."♥") - ("diams") ("diamondsuit"."♦") - ("smile"."☺") ("blacksmile"."☻") ("sad"."☹") - ("quot") - ("amp") - ("lt") - ("gt") - ("OElig") - ("oelig") - ("Scaron") - ("scaron") - ("Yuml") - ("circ") - ("tilde") - ("ensp") - ("emsp") - ("thinsp") - ("zwnj") - ("zwj") - ("lrm") - ("rlm") - ("ndash") - ("mdash") - ("lsquo") - ("rsquo") - ("sbquo") - ("ldquo") - ("rdquo") - ("bdquo") - ("dagger") - ("Dagger") - ("permil") - ("lsaquo") - ("rsaquo") - ("euro") - - ("arccos"."arccos") - ("arcsin"."arcsin") - ("arctan"."arctan") - ("arg"."arg") - ("cos"."cos") - ("cosh"."cosh") - ("cot"."cot") - ("coth"."coth") - ("csc"."csc") - ("deg"."deg") - ("det"."det") - ("dim"."dim") - ("exp"."exp") - ("gcd"."gcd") - ("hom"."hom") - ("inf"."inf") - ("ker"."ker") - ("lg"."lg") - ("lim"."lim") - ("liminf"."liminf") - ("limsup"."limsup") - ("ln"."ln") - ("log"."log") - ("max"."max") - ("min"."min") - ("Pr"."Pr") - ("sec"."sec") - ("sin"."sin") - ("sinh"."sinh") - ("sup"."sup") - ("tan"."tan") - ("tanh"."tanh") - ) - "Entities for TeX->HTML translation. -Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to -\"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\"). -In that case, \"\\ent\" will be translated to \"&other;\". -The list contains HTML entities for Latin-1, Greek and other symbols. -It is supplemented by a number of commonly used TeX macros with appropriate -translations. There is currently no way for users to extend this.") - ;;; General functions for all backends (defvar org-export-target-aliases nil "Alist of targets with invisible aliases.") (defvar org-export-preferred-target-alist nil "Alist of section id's with preferred aliases.") +(defvar org-export-id-target-alist nil + "Alist of section id's with preferred aliases.") (defvar org-export-code-refs nil "Alist of code references and line numbers") @@ -1254,15 +1026,20 @@ (outline-regexp "\\*+ ") target-alist rtn) - (setq org-export-target-aliases nil) - (setq org-export-preferred-target-alist nil) - (setq org-export-code-refs nil) + (setq org-export-target-aliases nil + org-export-preferred-target-alist nil + org-export-id-target-alist nil + org-export-code-refs nil) (with-current-buffer (get-buffer-create " org-mode-tmp") (erase-buffer) (insert string) (setq case-fold-search t) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) + '(read-only t))) + ;; Remove license-to-kill stuff ;; The caller marks some stuff for killing, stuff that has been ;; used to create the page title, for example. @@ -1309,6 +1086,11 @@ ;; Find all headings and compute the targets for them (setq target-alist (org-export-define-heading-targets target-alist)) + (run-hooks 'org-export-preprocess-after-headline-targets-hook) + + ;; Find HTML special classes for headlines + (org-export-remember-html-container-classes) + ;; Get rid of drawers (org-export-remove-or-extract-drawers drawers (plist-get parameters :drawers) backend) @@ -1333,6 +1115,7 @@ ;; Select and protect backend specific stuff, throw away stuff ;; that is specific for other backends + (run-hooks 'org-export-preprocess-before-selecting-backend-code-hook) (org-export-select-backend-specific-text backend) ;; Protect quoted subtrees @@ -1364,6 +1147,7 @@ ;; Normalize links: Convert angle and plain links into bracket links ;; and expand link abbreviations + (run-hooks 'org-export-preprocess-before-normalizing-links-hook) (org-export-normalize-links) ;; Find all internal links. If they have a fuzzy match (i.e. not @@ -1442,7 +1226,12 @@ (if (not (assoc last-section-target org-export-preferred-target-alist)) (push (cons last-section-target id) - org-export-preferred-target-alist)))) + org-export-preferred-target-alist))) + (when (equal (match-string 1) "ID") + (if (not (assoc last-section-target + org-export-id-target-alist)) + (push (cons last-section-target (concat "ID-" id)) + org-export-id-target-alist)))) (setq level (org-reduced-level (save-excursion (goto-char (point-at-bol)) (org-outline-level)))) @@ -1488,7 +1277,7 @@ the current file." (goto-char (point-min)) (while (re-search-forward org-bracket-link-regexp nil t) - (org-if-unprotected + (org-if-unprotected-at (1+ (match-beginning 0)) (let* ((md (match-data)) (desc (match-end 2)) (link (org-link-unescape (match-string 1))) @@ -1535,6 +1324,17 @@ (unless desc (insert "][" link)) (add-text-properties pos (point) props)))))) +(defun org-export-remember-html-container-classes () + "Store the HTML_CONTAINER_CLASS properties in a text property." + (goto-char (point-min)) + (let (class) + (while (re-search-forward + "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t) + (setq class (match-string 1)) + (save-excursion + (org-back-to-heading t) + (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class))))) + (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. The function must accept three parameters: @@ -1739,6 +1539,7 @@ (let ((formatters '((docbook "DOCBOOK" "BEGIN_DOCBOOK" "END_DOCBOOK") (html "HTML" "BEGIN_HTML" "END_HTML") + (beamer "BEAMER" "BEGIN_BEAMER" "END_BEAMER") (ascii "ASCII" "BEGIN_ASCII" "END_ASCII") (latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX"))) (case-fold-search t) @@ -1811,10 +1612,10 @@ "\\|" "^[ \t]*#\\+label:[ \t]+\\(.*\\)" "\\|" - "^[ \t]*|[^-]" + "^[ \t]*\\(|[^-]\\)" "\\|" "^[ \t]*\\[\\[.*\\]\\][ \t]*$")) - cap attr label) + cap attr label end) (while (re-search-forward re nil t) (cond ((match-end 1) @@ -1824,25 +1625,32 @@ ((match-end 3) (setq label (org-trim (match-string 3)))) (t - (add-text-properties (point-at-bol) (point-at-eol) + (setq end (if (match-end 4) + (let ((ee (org-table-end))) + (prog1 (1- (marker-position ee)) (move-marker ee nil))) + (point-at-eol))) + (add-text-properties (point-at-bol) end (list 'org-caption cap 'org-attributes attr 'org-label label)) (if label (push (cons label label) target-alist)) + (goto-char end) (setq cap nil attr nil label nil))))) target-alist) (defun org-export-remove-comment-blocks-and-subtrees () "Remove the comment environment, and also commented subtrees." (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) - (case-fold-search nil)) + case-fold-search) ;; Remove comment environment (goto-char (point-min)) + (setq case-fold-search t) (while (re-search-forward - "^#\\+BEGIN_COMMENT[ \t]*\n[^\000]*?^#\\+END_COMMENT\\>.*" nil t) + "^#\\+begin_comment[ \t]*\n[^\000]*?^#\\+end_comment\\>.*" nil t) (replace-match "" t t)) ;; Remove subtrees that are commented (goto-char (point-min)) + (setq case-fold-search nil) (while (re-search-forward re-commented nil t) (goto-char (match-beginning 0)) (delete-region (point) (org-end-of-subtree t))))) @@ -1877,7 +1685,8 @@ (unless (save-match-data (or (org-in-regexp org-bracket-link-regexp) - (org-in-regexp org-plain-link-re))) + (org-in-regexp org-plain-link-re) + (org-in-regexp "<<[^<>]+>>"))) (org-if-unprotected (replace-match "\\1[[\\2]]"))))))) @@ -1887,7 +1696,7 @@ (while (re-search-forward "^[ \t]*|" nil t) (beginning-of-line 1) (if (or (looking-at "[ \t]*| *[!_^] *|") - (not + (not (memq nil (mapcar @@ -1962,7 +1771,7 @@ can work correctly." (goto-char (point-min)) (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t) - (org-if-unprotected + (org-if-unprotected-at (match-beginning 1) (replace-match "\\1 \\3") (goto-char (match-beginning 0))))) @@ -2263,24 +2072,26 @@ "Replace source code segments with special code for export." (setq org-export-last-code-line-counter-value 0) (let ((case-fold-search t) - lang code trans opts indent) + lang code trans opts indent caption) (goto-char (point-min)) (while (re-search-forward - "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)" + "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)" nil t) (if (match-end 1) ;; src segments (setq lang (match-string 3) opts (match-string 4) code (match-string 5) - indent (length (match-string 2))) + indent (length (match-string 2)) + caption (get-text-property 0 'org-caption (match-string 0))) (setq lang nil opts (match-string 8) code (match-string 9) - indent (length (match-string 7)))) + indent (length (match-string 7)) + caption (get-text-property 0 'org-caption (match-string 0)))) (setq trans (org-export-format-source-code-or-example - backend lang code opts indent)) + backend lang code opts indent caption)) (replace-match trans t t)))) (defvar htmlp) ;; dynamically scoped @@ -2290,7 +2101,7 @@ (defvar org-export-latex-listings-langs) ;; defined in org-latex.el (defun org-export-format-source-code-or-example - (backend lang code &optional opts indent) + (backend lang code &optional opts indent caption) "Format CODE from language LANG and return it formatted for export. If LANG is nil, do not add any fontification. OPTS contains formatting options, like `-n' for triggering numbering lines, @@ -2341,7 +2152,7 @@ (concat "\n#+BEGIN_DOCBOOK\n" (org-add-props (concat "\n\n") + "]]>\n") '(org-protected t)) "#+END_DOCBOOK\n")) ((eq backend 'html) @@ -2378,12 +2189,22 @@ (org-export-htmlize-region-for-paste (point-min) (point-max)))) (if (string-match "]*\\)>\n*" rtn) - (setq rtn (replace-match - (format "
\n" lang)
-				   t t rtn))))
+			(setq rtn
+                              (concat
+                               (if caption
+                                   (concat
+                                    "
" + (format + "" + caption)) + "") + (replace-match + (format "
\n" lang)
+                                t t rtn)
+                               (if caption "
" ""))))) (if textareap (setq rtn (concat - (format "

\n\n

\n")) (with-temp-buffer @@ -2403,7 +2224,7 @@ (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n")) ((eq backend 'latex) (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt)) - (concat "\n#+BEGIN_LaTeX\n" + (concat "#+BEGIN_LaTeX\n" (org-add-props (if org-export-latex-listings (concat @@ -2417,17 +2238,20 @@ org-export-latex-listings-langs)) lang))) (format "\\lstset{language=%s}\n" lstlang)) - "") + "\n") + (when caption + (format "\n%s $\\equiv$ \n" caption)) "\\begin{lstlisting}\n" rtn "\\end{lstlisting}\n") (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))) '(org-protected t)) - "#+END_LaTeX\n\n")) + "#+END_LaTeX\n")) ((eq backend 'ascii) ;; This is not HTML or LaTeX, so just make it an example. (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt)) - (concat "#+BEGIN_ASCII\n" + (concat caption "\n" + "#+BEGIN_ASCII\n" (org-add-props (concat (mapconcat @@ -2546,14 +2370,19 @@ command." (interactive (list (progn - (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]uffer with HTML [D]ocBook [x]OXO [ ]keep buffer") + (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]buffer with HTML [D]ocBook [l]atex [p]df [d]view pdf [L]atex buffer [x]OXO [ ]keep buffer") (read-char-exclusive)) current-prefix-arg)) - (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?D ?x ?\ ))) + (if (not (member type '(?a ?n ?u ?\C-a ?b ?\C-b ?h ?D ?x ?\ ?l ?p ?d ?L))) (error "Invalid export key")) (let* ((binding (cdr (assoc type - '((?a . org-export-as-ascii) + '( + (?a . org-export-as-ascii) (?A . org-export-as-ascii-to-buffer) + (?n . org-export-as-latin1) + (?N . org-export-as-latin1-to-buffer) + (?u . org-export-as-utf8) + (?U . org-export-as-utf8-to-buffer) (?\C-a . org-export-as-ascii) (?b . org-export-as-html-and-open) (?\C-b . org-export-as-html-and-open) @@ -2561,6 +2390,12 @@ (?H . org-export-as-html-to-buffer) (?R . org-export-region-as-html) (?D . org-export-as-docbook) + + (?l . org-export-as-latex) + (?p . org-export-as-pdf) + (?d . org-export-as-pdf-and-open) + (?L . org-export-as-latex-to-buffer) + (?x . org-export-as-xoxo))))) (keepp (equal type ?\ )) (file buffer-file-name) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-faces.el --- a/lisp/org/org-faces.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-faces.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -49,7 +49,7 @@ (defgroup org-faces nil "Faces in Org-mode." :tag "Org Faces" - :group 'org-font-lock) + :group 'org-appearance) (defface org-hide '((((background light)) (:foreground "white")) @@ -338,29 +338,53 @@ to the part of the headline after the DONE keyword." :group 'org-faces) +(defcustom org-faces-easy-properties + '((todo . :foreground) (tag . :foreground) (priority . :foreground)) + "The property changes by easy faces. +This is an alist, the keys show the area of application, the values +can be `:foreground' or `:background'. A color string for special +keywords will then be interpreted as either foreground or background +color." + :group 'org-faces + :group 'org-todo + :type '(repeat + (cons (choice (const todo) (const tag) (const priority)) + (choice (const :foreground) (const :background))))) + (defcustom org-todo-keyword-faces nil "Faces for specific TODO keywords. This is a list of cons cells, with TODO keywords in the car -and faces in the cdr. The face can be a symbol, or a property -list of attributes, like (:foreground \"blue\" :weight bold :underline t)." +and faces in the cdr. The face can be a symbol, a color +as a string (in which case the rest is inherited from the `org-todo' face), +or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-faces :group 'org-todo :type '(repeat (cons - (string :tag "keyword") - (sexp :tag "face")))) + (string :tag "Keyword") + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) (defcustom org-priority-faces nil "Faces for specific Priorities. This is a list of cons cells, with priority character in the car -and faces in the cdr. The face can be a symbol, or a property -list of attributes, like (:foreground \"blue\" :weight bold :underline t)." +and faces in the cdr. The face can be a symbol, a color as +as a string, or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-faces :group 'org-todo :type '(repeat (cons (character :tag "Priority") - (sexp :tag "face")))) + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) (defvar org-tags-special-faces-re nil) (defun org-set-tag-faces (var value) @@ -378,15 +402,16 @@ (org-copy-face 'org-todo 'org-checkbox-statistics-todo - "Face used for unfinished checkbox statistics.") + "Face used for unfinished checkbox statistics.") (org-copy-face 'org-done 'org-checkbox-statistics-done - "Face used for finished checkbox statistics.") + "Face used for finished checkbox statistics.") (defcustom org-tag-faces nil "Faces for specific tags. This is a list of cons cells, with tags in the car and faces in the cdr. -The face can be a symbol, or a property list of attributes, +The face can be a symbol, a foreground color (in which case the rest is +inherited from the `org-tag' face) or a property list of attributes, like (:foreground \"blue\" :weight bold :underline t). If you set this variable through customize, it will immediately be effective in new buffers and in modified lines. @@ -397,8 +422,10 @@ :set 'org-set-tag-faces :type '(repeat (cons - (string :tag "Tag") - (sexp :tag "Face")))) + (string :tag "Tag ") + (choice :tag "Face" + (string :tag "Foreground color") + (sexp :tag "Face"))))) (defface org-table ;; originally copied from font-lock-function-name-face (org-compatible-face nil @@ -441,6 +468,34 @@ :group 'org-faces :version "22.1") +(defface org-document-title + '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44)) + (((class color) (background dark)) (:foreground "pale turquoise" :weight bold :height 1.44)) + (t (:weight bold :height 1.44))) + "Face for document title, i.e. that which follows the #+TITLE: keyword." + :group 'org-faces) + +(defface org-document-info + '((((class color) (background light)) (:foreground "midnight blue")) + (((class color) (background dark)) (:foreground "pale turquoise")) + (t nil)) + "Face for document date, author and email; i.e. that which +follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword." + :group 'org-faces) + +(defface org-document-info-keyword + (org-compatible-face 'shadow + '((((class color grayscale) (min-colors 88) (background light)) + (:foreground "grey50")) + (((class color grayscale) (min-colors 88) (background dark)) + (:foreground "grey70")) + (((class color) (min-colors 8) (background light)) + (:foreground "green")) + (((class color) (min-colors 8) (background dark)) + (:foreground "yellow")))) + "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords." + :group 'org-faces) + (defface org-block (org-compatible-face 'shadow '((((class color grayscale) (min-colors 88) (background light)) @@ -474,6 +529,13 @@ (org-copy-face 'org-block 'org-verse "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.") +(defcustom org-fontify-quote-and-verse-blocks nil + "Non-nil means, add a special face to #+begin_quote and #+begin_verse block. +When nil, format these as normal Org. This is the default, because the +content of these blocks will still be treated as Org syntax." + :group 'org-faces + :type 'boolean) + (defface org-clock-overlay ;; copied from secondary-selection (org-compatible-face nil '((((class color) (min-colors 88) (background light)) @@ -502,17 +564,17 @@ :group 'org-faces) (org-copy-face 'org-agenda-structure 'org-agenda-date - "Face used in agenda for normal days.") + "Face used in agenda for normal days.") (org-copy-face 'org-agenda-date 'org-agenda-date-today - "Face used in agenda for today." - :weight 'bold :italic 't) + "Face used in agenda for today." + :weight 'bold :italic 't) (org-copy-face 'secondary-selection 'org-agenda-clocking - "Face marking the current clock item in the agenda.") + "Face marking the current clock item in the agenda.") (org-copy-face 'org-agenda-date 'org-agenda-date-weekend - "Face used in agenda for weekend days. + "Face used in agenda for weekend days. See the variable `org-agenda-weekend-days' for a definition of which days belong to the weekend." :weight 'bold) @@ -605,6 +667,12 @@ "Face used for time grids." :group 'org-faces) +(defface org-agenda-diary + (org-compatible-face 'default + nil) + "Face used for agenda entries that come from the Emacs diary." + :group 'org-faces) + (defconst org-level-faces '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5 org-level-6 org-level-7 org-level-8 @@ -634,7 +702,10 @@ :group 'org-faces) (org-copy-face 'modeline 'org-mode-line-clock - "Face used for clock display in mode line.") + "Face used for clock display in mode line.") +(org-copy-face 'modeline 'org-mode-line-clock-overrun + "Face used for clock display for overrun tasks in mode line." + :background "red") (provide 'org-faces) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-feed.el --- a/lisp/org/org-feed.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-feed.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -234,7 +234,7 @@ :type '(string :tag "Template")) (defcustom org-feed-save-after-adding t - "Non-nil means, save buffer after adding new feed items." + "Non-nil means save buffer after adding new feed items." :group 'org-feed :type 'boolean) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-footnote.el --- a/lisp/org/org-footnote.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-footnote.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -47,6 +47,7 @@ (declare-function org-back-to-heading "org" (&optional invisible-ok)) (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) (declare-function org-in-verbatim-emphasis "org" ()) +(declare-function org-inside-latex-macro-p "org" ()) (defvar org-odd-levels-only) ;; defined in org.el (defconst org-footnote-re @@ -90,7 +91,7 @@ :type 'string) (defcustom org-footnote-define-inline nil - "Non-nil means, define footnotes inline, at reference location. + "Non-nil means define footnotes inline, at reference location. When nil, footnotes will be defined in a special section near the end of the document. When t, the [fn:label:definition] notation will be used to define the footnote at the reference position." @@ -98,7 +99,7 @@ :type 'boolean) (defcustom org-footnote-auto-label t - "Non-nil means, define automatically new labels for footnotes. + "Non-nil means define automatically new labels for footnotes. Possible values are: nil prompt the user for each label @@ -115,7 +116,7 @@ (const :tag "Create automatic [N]" plain))) (defcustom org-footnote-auto-adjust nil - "Non-nil means, automatically adjust footnotes after insert/delete. + "Non-nil means automatically adjust footnotes after insert/delete. When this is t, after each insertion or deletion of a footnote, simple fn:N footnotes will be renumbered, and all footnotes will be sorted. If you want to have just sorting or just renumbering, set this variable @@ -132,7 +133,7 @@ (const :tag "Renumber and Sort" t))) (defcustom org-footnote-fill-after-inline-note-extraction nil - "Non-nil means, fill paragraphs after extracting footnotes. + "Non-nil means fill paragraphs after extracting footnotes. When extracting inline footnotes, the lengths of lines can change a lot. When this option is set, paragraphs from which an inline footnote has been extracted will be filled again." @@ -182,7 +183,7 @@ (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) (defun org-footnote-goto-next-reference (label) - "Find the definition of the footnote with label LABEL." + "Find the next reference of the footnote with label LABEL." (interactive "sLabel: ") (org-mark-ring-push) (setq label (org-footnote-normalize-label label)) @@ -366,7 +367,8 @@ ;; Now find footnote references, and extract the definitions (goto-char (point-min)) (while (re-search-forward org-footnote-re nil t) - (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)) + (unless (or (org-in-commented-line) (org-in-verbatim-emphasis) + (org-inside-latex-macro-p)) (org-if-unprotected (setq def (match-string 4) idef def @@ -397,13 +399,13 @@ (skip-chars-backward " \t\n\t") (delete-region (1+ (point)) (match-beginning 0)))))) (unless sort-only - (replace-match (concat before "[" marker "]")) + (replace-match (concat before "[" marker "]") t t) (and idef org-footnote-fill-after-inline-note-extraction (fill-paragraph))) (if (not a) (push (list ref marker def (if idef t nil)) ref-table))))) - + ;; First find and remove the footnote section (goto-char (point-min)) (cond diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-freemind.el --- a/lisp/org/org-freemind.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-freemind.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Lennart Borgman (lennart O borgman A gmail O com) ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -81,6 +81,7 @@ (require 'xml) (require 'org) +(require 'rx) (require 'org-exp) (eval-when-compile (require 'cl)) @@ -240,7 +241,7 @@ ;; file is utf-8: ;; ;; (format "&#x%x;" (- cc ;; ?\x800)) - (format "&#x%x" (encode-char cc 'ucs)) + (format "&#x%x;" (encode-char cc 'ucs)) )))) fm-str)) @@ -561,11 +562,10 @@ (num-top2-nodes 0) num-left-nodes (unclosed-nodes 0) + (odd-only org-odd-levels-only) (first-time t) (current-level 1) base-level - skipping-odd - (skipped-odd 0) prev-node-end rich-text unfinished-tag @@ -671,21 +671,6 @@ (setq next-node-start (match-beginning 0)) (setq next-m2 (match-string-no-properties 2)) (setq next-level (length next-m1)) - (when (> next-level current-level) - (if (not (and org-odd-levels-only - (/= (mod current-level 2) 0) - (= next-level (+ 2 current-level)))) - (setq skipping-odd nil) - (setq skipping-odd t) - (setq skipped-odd (1+ skipped-odd))) - (unless (or (= next-level (1+ current-level)) - skipping-odd) - (if (or org-odd-levels-only - (/= next-level (+ 2 current-level))) - (error "Next level step > +1 for node ending at line %s" (line-number-at-pos)) - (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?" - (line-number-at-pos))) - )) (setq next-children-visible (not (eq 'outline (get-char-property (line-end-position) 'invisible)))) @@ -698,11 +683,8 @@ (while (>= current-level next-level) (with-current-buffer mm-buffer (insert "\n") - (setq current-level (1- current-level)) - (when (< 0 skipped-odd) - (setq skipped-odd (1- skipped-odd)) - (setq current-level (1- current-level))) - ))) + (setq current-level + (- current-level (if odd-only 2 1)))))) (setq this-node-end (1+ next-node-end)) (setq this-m2 next-m2) (setq current-level next-level) @@ -725,7 +707,8 @@ (with-current-buffer mm-buffer (while (> current-level base-level) (insert "\n") - (setq current-level (1- current-level)) + (setq current-level + (- current-level (if odd-only 2 1))) )) (with-current-buffer mm-buffer (insert "") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-gnus.el --- a/lisp/org/org-gnus.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-gnus.el Thu May 13 15:13:52 2010 +0200 @@ -7,7 +7,7 @@ ;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,7 +48,7 @@ (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) (defcustom org-gnus-prefer-web-links nil - "Non-nil means, `org-store-link' will create web links to Google groups. + "Non-nil means `org-store-link' will create web links to Google groups. When nil, Gnus will be used for such links. Using a prefix arg to the command \\[org-store-link] (`org-store-link') negates this setting for the duration of the command." @@ -169,19 +169,28 @@ (cond ((and group article) (gnus-activate-group group t) (condition-case nil - (let ((articles 1) - group-opened) - (while (and (not group-opened) - ;; stop on integer overflows - (> articles 0)) - (setq group-opened (gnus-group-read-group articles nil group) - articles (if (< articles 16) - (1+ articles) - (* articles 2)))) - (if group-opened - (gnus-summary-goto-article article nil t) - (message "Couldn't follow gnus link. %s" - "The summary couldn't be opened."))) + (let ((backend (car (gnus-find-method-for-group group)))) + (cond + ((eq backend 'nndoc) + (if (gnus-group-read-group t nil group) + (gnus-summary-goto-article article nil t) + (message "Couldn't follow gnus link. %s" + "The summary couldn't be opened."))) + (t + (let ((articles 1) + group-opened) + (while (and (not group-opened) + ;; stop on integer overflows + (> articles 0)) + (setq group-opened (gnus-group-read-group + articles nil group) + articles (if (< articles 16) + (1+ articles) + (* articles 2)))) + (if group-opened + (gnus-summary-goto-article article nil t) + (message "Couldn't follow gnus link. %s" + "The summary couldn't be opened.")))))) (quit (message "Couldn't follow gnus link. %s" "The linked group is empty.")))) (group (gnus-group-jump-to-group group)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-habit.el --- a/lisp/org/org-habit.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-habit.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -67,52 +67,52 @@ :type 'boolean) (defface org-habit-clear-face - '((((background light)) (:background "slateblue")) + '((((background light)) (:background "#8270f9")) (((background dark)) (:background "blue"))) "Face for days on which a task shouldn't be done yet." :group 'org-habit :group 'org-faces) (defface org-habit-clear-future-face - '((((background light)) (:background "powderblue")) + '((((background light)) (:background "#d6e4fc")) (((background dark)) (:background "midnightblue"))) "Face for future days on which a task shouldn't be done yet." :group 'org-habit :group 'org-faces) (defface org-habit-ready-face - '((((background light)) (:background "green")) + '((((background light)) (:background "#4df946")) (((background dark)) (:background "forestgreen"))) "Face for days on which a task should start to be done." :group 'org-habit :group 'org-faces) (defface org-habit-ready-future-face - '((((background light)) (:background "palegreen")) + '((((background light)) (:background "#acfca9")) (((background dark)) (:background "darkgreen"))) "Face for days on which a task should start to be done." :group 'org-habit :group 'org-faces) (defface org-habit-alert-face - '((((background light)) (:background "yellow")) + '((((background light)) (:background "#f5f946")) (((background dark)) (:background "gold"))) "Face for days on which a task is due." :group 'org-habit :group 'org-faces) (defface org-habit-alert-future-face - '((((background light)) (:background "palegoldenrod")) + '((((background light)) (:background "#fafca9")) (((background dark)) (:background "darkgoldenrod"))) "Face for days on which a task is due." :group 'org-habit :group 'org-faces) (defface org-habit-overdue-face - '((((background light)) (:background "red")) + '((((background light)) (:background "#f9372d")) (((background dark)) (:background "firebrick"))) "Face for days on which a task is overdue." :group 'org-habit :group 'org-faces) (defface org-habit-overdue-future-face - '((((background light)) (:background "mistyrose")) + '((((background light)) (:background "#fc9590")) (((background dark)) (:background "darkred"))) "Face for days on which a task is overdue." :group 'org-habit @@ -305,6 +305,7 @@ (defun org-habit-insert-consistency-graphs (&optional line) "Insert consistency graph for any habitual tasks." (let ((inhibit-read-only t) l c + (buffer-invisibility-spec '(org-link)) (moment (time-subtract (current-time) (list 0 (* 3600 org-extend-today-until) 0)))) (save-excursion diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-html.el --- a/lisp/org/org-html.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-html.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -81,7 +81,7 @@ (string :tag "Declaration"))))) (defcustom org-export-html-style-include-scripts t - "Non-nil means, include the javascript snippets in exported HTML files. + "Non-nil means include the javascript snippets in exported HTML files. The actual script is defined in `org-export-html-scripts' and should not be modified." :group 'org-export-html @@ -137,6 +137,7 @@ dt { font-weight: bold; } div.figure { padding: 0.5em; } div.figure p { text-align: center; } + textarea { overflow-x: auto; } .linenr { font-size:smaller } .code-highlighted {background-color:#ffff00;} .org-info-js_info-navigation { border-style:none; } @@ -153,7 +154,7 @@ `org-export-html-style-include-default'.") (defcustom org-export-html-style-include-default t - "Non-nil means, include the default style in exported HTML files. + "Non-nil means include the default style in exported HTML files. The actual style is defined in `org-export-html-style-default' and should not be modified. Use the variables `org-export-html-style' to add your own style information." @@ -253,7 +254,7 @@ :type 'string) (defcustom org-export-html-link-org-files-as-html t - "Non-nil means, make file links to `file.org' point to `file.html'. + "Non-nil means make file links to `file.org' point to `file.html'. When org-mode is exporting an org-mode file to HTML, links to non-html files are directly put into a href tag in HTML. However, links to other Org-mode files (recognized by the @@ -265,7 +266,7 @@ :type 'boolean) (defcustom org-export-html-inline-images 'maybe - "Non-nil means, inline images into exported HTML pages. + "Non-nil means inline images into exported HTML pages. This is done using an tag. When nil, an anchor with href is used to link to the image. If this option is `maybe', then images in links with an empty description will be inlined, while images with a description will @@ -333,13 +334,13 @@ (defcustom org-export-html-table-use-header-tags-for-first-column nil - "Non-nil means, format column one in tables with header tags. + "Non-nil means format column one in tables with header tags. When nil, also column one will use data tags." :group 'org-export-tables :type 'boolean) (defcustom org-export-html-validation-link nil - "Non-nil means, add validationlink to postamble of HTML exported files." + "Non-nil means add validationlink to postamble of HTML exported files." :group 'org-export-html :type '(choice (const :tag "Nothing" nil) @@ -420,7 +421,7 @@ "Hook run during HTML export, after blockquote, verse, center are done.") (defvar org-export-html-final-hook nil - "Hook run during HTML export, after blockquote, verse, center are done.") + "Hook run at the end of HTML export, in the new buffer.") ;;; HTML export @@ -433,7 +434,16 @@ (file-name-nondirectory org-current-export-file))) org-current-export-dir nil "Creating LaTeX image %s")) - (message "Exporting...")) + (goto-char (point-min)) + (let (label l1) + (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) + (org-if-unprotected-at (match-beginning 1) + (setq label (match-string 1)) + (save-match-data + (if (string-match "\\`[a-z]\\{1,10\\}:\\(.+\\)" label) + (setq l1 (substring label (match-beginning 1))) + (setq l1 label))) + (replace-match (format "[[#%s][%s]]" label l1) t t))))) ;;;###autoload (defun org-export-as-html-and-open (arg) @@ -443,7 +453,9 @@ headlines. The default is 3. Lower levels will become bulleted lists." (interactive "P") (org-export-as-html arg 'hidden) - (org-open-file buffer-file-name)) + (org-open-file buffer-file-name) + (when org-export-kill-product-buffer-when-displayed + (kill-buffer))) ;;;###autoload (defun org-export-as-html-batch () @@ -539,6 +551,7 @@ ..., without even the body tags themselves. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) @@ -624,7 +637,8 @@ (author (plist-get opt-plist :author)) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) - (and (not + (and (not body-only) + (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) (and buffer-file-name @@ -804,7 +818,8 @@ (push "
    \n
  • " thetoc) (setq lines (mapcar '(lambda (line) - (if (string-match org-todo-line-regexp line) + (if (and (string-match org-todo-line-regexp line) + (not (get-text-property 0 'org-protected line))) ;; This is a headline (progn (setq have-headings t) @@ -999,7 +1014,7 @@ "\" class=\"target\">" (match-string 1 line) "@ ") t t line))))) - + (setq line (org-html-handle-time-stamps line)) ;; replace "&" by "&", "<" and ">" by "<" and ">" @@ -1125,9 +1140,11 @@ (not (string-match "^[0-9]*$" search)) (not (string-match "^\\*" search)) (not (string-match "^/.*/$" search))) - (setq thefile (concat thefile "#" - (org-solidify-link-text - (org-link-unescape search))))) + (setq thefile + (concat thefile + (if (= (string-to-char search) ?#) "" "#") + (org-solidify-link-text + (org-link-unescape search))))) (when (string-match "^file:" desc) (setq desc (replace-match "" t t desc)) (if (string-match "\\.org$" desc) @@ -1402,7 +1419,7 @@ (when (and org-export-author-info author) (insert "

    " (nth 1 lang-words) ": " author "\n") - (when email + (when (and org-export-email-info email (string-match "\\S-" email)) (if (listp (split-string email ",+ *")) (mapc (lambda(e) (insert "<" @@ -1469,6 +1486,12 @@ (delete-region beg end) (insert (format "%s" (make-string n ?x))))) + ;; Remove empty lines at the beginning of the file. + (goto-char (point-min)) + (when (looking-at "\\s-+\n") (replace-match "")) + ;; Remove display properties + (remove-text-properties (point-min) (point-max) '(display t)) + ;; Run the hook (run-hooks 'org-export-html-final-hook) (or to-buffer (save-buffer)) (goto-char (point-min)) @@ -1506,10 +1529,12 @@ "Create image tag with source and attributes." (save-match-data (if (string-match "^ltxpng/" src) - (format "" src) + (format "\"%s\"/" + src (org-find-text-property-in-string 'org-latex-src src)) (let* ((caption (org-find-text-property-in-string 'org-caption src)) (attr (org-find-text-property-in-string 'org-attributes src)) (label (org-find-text-property-in-string 'org-label src))) + (setq caption (and caption (org-html-do-expand caption))) (concat (if caption (format "%s

    @@ -1585,16 +1610,10 @@ ;; column and the special lines (setq lines (org-table-clean-before-export lines))) - (let* ((caption (or (get-text-property 0 'org-caption (car lines)) - (get-text-property (or (next-single-property-change - 0 'org-caption (car lines)) - 0) - 'org-caption (car lines)))) - (attributes (or (get-text-property 0 'org-attributes (car lines)) - (get-text-property (or (next-single-property-change - 0 'org-attributes (car lines)) - 0) - 'org-attributes (car lines)))) + (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) + (label (org-find-text-property-in-string 'org-label (car lines))) + (attributes (org-find-text-property-in-string 'org-attributes + (car lines))) (html-table-tag (org-export-splice-attributes html-table-tag attributes)) (head (and org-export-highlight-first-table-line @@ -1604,6 +1623,7 @@ (nline 0) fnum i tbopen line fields html gr colgropen rowstart rowend) + (setq caption (and caption (org-html-do-expand caption))) (if splice (setq head nil)) (unless splice (push (if head "" "") html)) (setq tbopen t) @@ -1676,6 +1696,8 @@ ;; DocBook document, we want to always include the caption to make ;; DocBook XML file valid. (push (format "%s" (or caption "")) html) + (when label (push (format "" label label) + html)) (push html-table-tag html)) (concat (mapconcat 'identity html "\n") "\n"))) @@ -1865,14 +1887,16 @@ (let* ((re (concat org-bracket-link-regexp "\\|" (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))) m s l res) - (while (setq m (string-match re string)) - (setq s (substring string 0 m) - l (match-string 0 string) - string (substring string (match-end 0))) - (push (org-html-do-expand s) res) - (push l res)) - (push (org-html-do-expand string) res) - (apply 'concat (nreverse res)))) + (if (string-match "^[ \t]*\\+-[-+]*\\+[ \t]*$" string) + string + (while (setq m (string-match re string)) + (setq s (substring string 0 m) + l (match-string 0 string) + string (substring string (match-end 0))) + (push (org-html-do-expand s) res) + (push l res)) + (push (org-html-do-expand string) res) + (apply 'concat (nreverse res))))) (defun org-html-do-expand (s) "Apply all active conversions to translate special ASCII to HTML." @@ -1887,16 +1911,14 @@ (if org-export-with-sub-superscripts (setq s (org-export-html-convert-sub-super s))) (if org-export-with-TeX-macros - (let ((start 0) wd ass) - (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" + (let ((start 0) wd rep) + (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?" s start)) (if (get-text-property (match-beginning 0) 'org-protected s) (setq start (match-end 0)) (setq wd (match-string 1 s)) - (if (setq ass (assoc wd org-html-entities)) - (setq s (replace-match (or (cdr ass) - (concat "&" (car ass) ";")) - t t s)) + (if (setq rep (org-entity-get-representation wd 'html)) + (setq s (replace-match rep t t s)) (setq start (+ start (length wd)))))))) s) @@ -1994,8 +2016,11 @@ When TITLE is nil, just close all open levels." (org-close-par-maybe) (let* ((target (and title (org-get-text-property-any 0 'target title))) - (extra-targets (assoc target org-export-target-aliases)) - (preferred (cdr (assoc target org-export-preferred-target-alist))) + (extra-targets (and target + (assoc target org-export-target-aliases))) + (extra-class (and title (org-get-text-property-any 0 'html-container-class title))) + (preferred (and target + (cdr (assoc target org-export-preferred-target-alist)))) (remove (or preferred target)) (l org-level-max) snumber href suffix) @@ -2058,8 +2083,9 @@ (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) (setq suffix (or href snumber)) (setq href (or href (concat "sec-" snumber))) - (insert (format "\n
    \n%s%s\n
    \n" - suffix level level href + (insert (format "\n
    \n%s%s\n
    \n" + suffix level (if extra-class (concat " " extra-class) "") + level href extra-targets title level level suffix)) (org-open-par))))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-icalendar.el --- a/lisp/org/org-icalendar.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-icalendar.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,7 +48,7 @@ :type 'string) (defcustom org-icalendar-use-plain-timestamp t - "Non-nil means, make an event from every plain time stamp." + "Non-nil means make an event from every plain time stamp." :group 'org-export-icalendar :type 'boolean) @@ -104,7 +104,7 @@ (const :tag "All tags, including inherited ones" all-tags)))) (defcustom org-icalendar-include-todo nil - "Non-nil means, export to iCalendar files should also cover TODO items. + "Non-nil means export to iCalendar files should also cover TODO items. Valid values are: nil don't include any TODO items t include all TODO items that are not in a DONE state @@ -129,13 +129,13 @@ for whatever you need.") (defcustom org-icalendar-include-bbdb-anniversaries nil - "Non-nil means, a combined iCalendar files should include anniversaries. + "Non-nil means a combined iCalendar files should include anniversaries. The anniversaries are define in the BBDB database." :group 'org-export-icalendar :type 'boolean) (defcustom org-icalendar-include-sexps t - "Non-nil means, export to iCalendar files should also cover sexp entries. + "Non-nil means export to iCalendar files should also cover sexp entries. These are entries like in the diary, but directly in an Org-mode file." :group 'org-export-icalendar :type 'boolean) @@ -152,7 +152,7 @@ (integer :tag "Max characters"))) (defcustom org-icalendar-store-UID nil - "Non-nil means, store any created UIDs in properties. + "Non-nil means store any created UIDs in properties. The iCalendar standard requires that all entries have a unique identifier. Org will create these identifiers as needed. When this variable is non-nil, the created UIDs will be stored in the ID property of the entry. Then the diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-id.el --- a/lisp/org/org-id.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-id.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -123,7 +123,7 @@ (string :tag "Prefix"))) (defcustom org-id-include-domain nil - "Non-nil means, add the domain name to new IDs. + "Non-nil means add the domain name to new IDs. This ensures global uniqueness of IDs, and is also suggested by RFC 2445 in combination with RFC 822. This is only relevant if `org-id-method' is `org'. When uuidgen is used, the domain will never @@ -135,7 +135,7 @@ :type 'boolean) (defcustom org-id-track-globally t - "Non-nil means, track IDs through files, so that links work globally. + "Non-nil means track IDs through files, so that links work globally. This work by maintaining a hash table for IDs and writing this table to disk when exiting Emacs. Because of this, it works best if you use a single Emacs process, not many. @@ -178,7 +178,7 @@ (file)))) (defcustom org-id-search-archives t - "Non-nil means, search also the archive files of agenda files for entries. + "Non-nil means search also the archive files of agenda files for entries. This is a possibility to reduce overhead, but it means that entries moved to the archives can no longer be found by ID. This variable is only relevant when `org-id-track-globally' is set." @@ -466,7 +466,7 @@ (defun org-id-locations-save () "Save `org-id-locations' in `org-id-locations-file'." - (when org-id-track-globally + (when (and org-id-track-globally org-id-locations) (let ((out (if (hash-table-p org-id-locations) (org-id-hash-to-alist org-id-locations) org-id-locations))) @@ -545,7 +545,9 @@ (defun org-id-find-id-file (id) "Query the id database for the file in which this ID is located." (unless org-id-locations (org-id-locations-load)) - (or (gethash id org-id-locations) + (or (and org-id-locations + (hash-table-p org-id-locations) + (gethash id org-id-locations)) ;; ball back on current buffer (buffer-file-name (or (buffer-base-buffer (current-buffer)) (current-buffer))))) @@ -576,6 +578,7 @@ "Store a link to the current entry, using its ID." (interactive) (let* ((link (org-make-link "id:" (org-id-get-create))) + (case-fold-search nil) (desc (save-excursion (org-back-to-heading t) (or (and (looking-at org-complex-heading-regexp) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-indent.el --- a/lisp/org/org-indent.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-indent.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -38,7 +38,7 @@ (defgroup org-indent nil "Options concerning dynamic virtual outline indentation." - :tag "Org Structure" + :tag "Org Indent" :group 'org) (defconst org-indent-max 40 @@ -67,13 +67,13 @@ :type 'character) (defcustom org-indent-mode-turns-off-org-adapt-indentation t - "Non-nil means, turning on org-indent-mode turns off indentation adaptation. + "Non-nil means turning on `org-indent-mode' turns off indentation adaptation. For details see the variable `org-adapt-indentation'." :group 'org-indent :type 'boolean) (defcustom org-indent-mode-turns-on-hiding-stars t - "Non-nil means, turning on org-indent-mode turns on `org-hide-leading-stars'." + "Non-nil means turning on `org-indent-mode' turns on `org-hide-leading-stars'." :group 'org-indent :type 'boolean) @@ -227,7 +227,7 @@ b e (list 'line-prefix (aref org-indent-strings n) 'wrap-prefix (aref org-indent-strings n)))) (setq b (1+ (point-at-eol)) - n (* level org-indent-indentation-per-level)))))))) + n (* (or level 0) org-indent-indentation-per-level)))))))) (defun org-indent-refresh-section () "Refresh indentation properties in the current outline section. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-info.el --- a/lisp/org/org-info.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-info.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-inlinetask.el --- a/lisp/org/org-inlinetask.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-inlinetask.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. @@ -94,7 +94,7 @@ :type 'boolean) (defcustom org-inlinetask-export t - "Non-nil means, export inline tasks. + "Non-nil means export inline tasks. When nil, they will not be exported." :group 'org-inlinetask :type 'boolean) @@ -149,7 +149,17 @@ (when (string-match org-complex-heading-regexp headline) (setq headline (concat (if (match-end 2) - (concat (match-string 2 headline) " ") "") + (concat + (org-add-props + (format + "@ %s@" + (if (member (match-string 2 headline) + org-done-keywords) + "done" "todo") + (match-string 2 headline) + (match-string 2 headline)) + nil 'org-protected t) + " ") "") (match-string 4 headline))) (when content (if (not (string-match "\\S-" content)) @@ -232,5 +242,4 @@ (provide 'org-inlinetask) -;; arch-tag: 59fdac51-8bcc-469e-a21e-6897dd6697bb ;;; org-inlinetask.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-irc.el --- a/lisp/org/org-irc.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-irc.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-jsinfo.el --- a/lisp/org/org-jsinfo.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-jsinfo.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-latex.el --- a/lisp/org/org-latex.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-latex.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-latex.el -;; Version: 6.33x +;; Version: 6.35i ;; Author: Bastien Guerry ;; Maintainer: Carsten Dominik ;; Keywords: org, wp, tex @@ -50,9 +50,11 @@ (require 'org) (require 'org-exp) (require 'org-macs) +(require 'org-beamer) ;;; Variables: (defvar org-export-latex-class nil) +(defvar org-export-latex-class-options nil) (defvar org-export-latex-header nil) (defvar org-export-latex-append-header nil) (defvar org-export-latex-options-plist nil) @@ -89,53 +91,30 @@ (defcustom org-export-latex-classes '(("article" - "\\documentclass[11pt]{article} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) ("report" - "\\documentclass[11pt]{report} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) ("book" - "\\documentclass[11pt]{book} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) + ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) + ("beamer" + "\\documentclass{beamer}" + org-beamer-sectioning + )) "Alist of LaTeX classes and associated header and structure. If #+LaTeX_CLASS is set in the buffer, use its value and the associated information. Here is the structure of each cell: @@ -145,11 +124,59 @@ (numbered-section . unnumbered-section\) ...\) -A %s formatter is mandatory in each section string and will be -replaced by the title of the section. +The header string +----------------- + +The HEADER-STRING is the header that will be inserted into the LaTeX file. +It should contain the \\documentclass macro, and anything else that is needed +for this setup. To this header, the following commands will be added: + +- Calls to \\usepackage for all packages mentioned in the variables + `org-export-latex-default-packages-alist' and + `org-export-latex-packages-alist'. Thus, your header definitions should + avoid to also request these packages. + +- Lines specified via \"#+LaTeX_HEADER:\" + +If you need more control about the sequence in which the header is built +up, or if you want to exclude one of these building blocks for a particular +class, you can use the following macro-like placeholders. + + [DEFAULT-PACKAGES] \\usepackage statements for default packages + [NO-DEFAULT-PACKAGES] do not include any of the default packages + [PACKAGES] \\usepackage statements for packages + [NO-PACKAGES] do not include the packages + [EXTRA] the stuff from #+LaTeX_HEADER + [NO-EXTRA] do not include #+LaTeX_HEADER stuff + +So a header like + + \\documentclass{article} + [NO-DEFAULT-PACKAGES] + [EXTRA] + \\providecommand{\\alert}[1]{\\textbf{#1}} + [PACKAGES] + +will omit the default packages, and will include the #+LaTeX_HEADER lines, +then have a call to \\providecommand, and then place \\usepackage commands +based on the content of `org-export-latex-packages-alist'. + +If your header or `org-export-latex-default-packages-alist' inserts +\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be replaced with +a coding system derived from `buffer-file-coding-system'. See also the +variable `org-export-latex-inputenc-alist' for a way to influence this +mechanism. + +The sectioning structure +------------------------ + +The sectioning structure of the class is given by the elements following +the header string. For each sectioning level, a number of strings is +specified. A %s formatter is mandatory in each section string and will +be replaced by the title of the section. Instead of a cons cell (numbered . unnumbered), you can also provide a list -of 2-4 elements, +of 2 or 4 elements, (numbered-open numbered-close) @@ -157,9 +184,15 @@ (numbered-open numbered-close unnumbered-open unnumbered-close) -providing opening and closing strings for an environment that should +providing opening and closing strings for a LaTeX environment that should represent the document section. The opening clause should have a %s -to represent the section title." +to represent the section title. + +Instead of a list of sectioning commands, you can also specify a +function name. That function will be called with two parameters, +the (reduced) level of the headline, and the headline text. The function +must return a cons cell with the (possibly modified) headline text, and the +sectioning list in the cdr." :group 'org-export-latex :type '(repeat (list (string :tag "LaTeX class") @@ -167,13 +200,29 @@ (repeat :tag "Levels" :inline t (choice (cons :tag "Heading" - (string :tag "numbered") - (string :tag "unnumbered)")) + (string :tag " numbered") + (string :tag "unnumbered")) (list :tag "Environment" - (string :tag "Opening (numbered) ") - (string :tag "Closing (numbered) ") + (string :tag "Opening (numbered)") + (string :tag "Closing (numbered)") (string :tag "Opening (unnumbered)") - (string :tag "Closing (unnumbered)"))))))) + (string :tag "Closing (unnumbered)")) + (function :tag "Hook computing sectioning")))))) + +(defcustom org-export-latex-inputenc-alist nil + "Alist of inputenc coding system names, and what should really be used. +For example, adding an entry + + (\"utf8\" . \"utf8x\") + +will cause \\usepackage[utf8x]{inputenc} to be used for buffers that +are written as utf8 files." + :group 'org-export-latex + :type '(repeat + (cons + (string :tag "Derived from buffer") + (string :tag "Use this instead")))) + (defcustom org-export-latex-emphasis-alist '(("*" "\\textbf{%s}" nil) @@ -240,6 +289,13 @@ :group 'org-export-latex :type 'string) +(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}" + "A printf format string to be applied to hyperref links. +The format must contain two %s instances. The first will be filled with +the link, the second with the link description." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-tables-verbatim nil "When non-nil, tables are exported verbatim." :group 'org-export-latex @@ -305,7 +361,7 @@ (string :tag "Close"))) (defcustom org-export-latex-listings nil - "Non-nil means, export source code using the listings package. + "Non-nil means export source code using the listings package. This package will fontify source code, possibly even with color. If you want to use this, you also need to make LaTeX use the listings package, and if you want to have color, the color @@ -376,7 +432,7 @@ (defgroup org-export-pdf nil "Options for exporting Org-mode files to PDF, via LaTeX." - :tag "Org Export LaTeX" + :tag "Org Export PDF" :group 'org-export-latex :group 'org-export) @@ -395,25 +451,39 @@ Alternatively, this may be a Lisp function that does the processing, so you could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. This function should accept the file name as its single argument." - :group 'org-export-latex + :group 'org-export-pdf :type '(choice (repeat :tag "Shell command sequence" (string :tag "Shell command")) (function))) +(defcustom org-export-pdf-logfiles + '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb") + "The list of file extensions to consider as LaTeX logfiles." + :group 'org-export-pdf + :type '(repeat (string :tag "Extension"))) + (defcustom org-export-pdf-remove-logfiles t - "Non-nil means, remove the logfiles produced by PDF production. + "Non-nil means remove the logfiles produced by PDF production. These are the .aux, .log, .out, and .toc files." :group 'org-export-pdf :type 'boolean) ;;; Hooks +(defvar org-export-latex-after-initial-vars-hook nil + "Hook run before LaTeX export. +The exact moment is after the initial variables like org-export-latex-class +have been determined from the environment.") + (defvar org-export-latex-after-blockquotes-hook nil "Hook run during LaTeX export, after blockquote, verse, center are done.") (defvar org-export-latex-final-hook nil "Hook run in the finalized LaTeX buffer.") +(defvar org-export-latex-after-save-hook nil + "Hook run in the finalized LaTeX buffer, after it has been saved.") + ;;; Autoload functions: ;;;###autoload @@ -514,6 +584,8 @@ without even the \begin{document} and \end{document} commands. when PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) @@ -525,10 +597,14 @@ (message "Exporting to LaTeX...") (org-unmodified - (remove-text-properties (point-min) (point-max) - '(:org-license-to-kill nil))) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) + '(:org-license-to-kill nil)))) (org-update-radio-target-regexp) (org-export-latex-set-initial-vars ext-plist arg) + (setq org-export-opt-plist org-export-latex-options-plist) + (org-install-letbind) + (run-hooks 'org-export-latex-after-initial-vars-hook) (let* ((wcf (current-window-configuration)) (opt-plist org-export-latex-options-plist) (region-p (org-region-active-p)) @@ -547,27 +623,40 @@ (org-export-add-subtree-options opt-plist rbeg) opt-plist))) ;; Make sure the variable contains the updated values. - (org-export-latex-options-plist opt-plist) + (org-export-latex-options-plist (setq org-export-opt-plist opt-plist)) + ;; The following two are dynamically scoped into other + ;; routines below. + (org-current-export-dir + (or pub-dir (org-export-directory :html opt-plist))) + (org-current-export-file buffer-file-name) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension - (file-name-nondirectory buffer-file-name)))) - (filename (concat (file-name-as-directory - (or pub-dir - (org-export-directory :LaTeX ext-plist))) - (file-name-sans-extension - (or (and subtree-p - (org-entry-get rbeg "EXPORT_FILE_NAME" t)) - (file-name-nondirectory ;sans-extension - buffer-file-name))) - ".tex")) - (filename (if (equal (file-truename filename) - (file-truename buffer-file-name)) - (concat filename ".tex") - filename)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "No Title")) + (filename + (and (not to-buffer) + (concat + (file-name-as-directory + (or pub-dir + (org-export-directory :LaTeX ext-plist))) + (file-name-sans-extension + (or (and subtree-p + (org-entry-get rbeg "EXPORT_FILE_NAME" t)) + (file-name-nondirectory ;sans-extension + (or buffer-file-name + (error "Don't know which export file to use."))))) + ".tex"))) + (filename + (and filename + (if (equal (file-truename filename) + (file-truename (or buffer-file-name "dummy.org"))) + (concat filename ".tex") + filename))) (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -602,6 +691,24 @@ (region (buffer-substring (if region-p (region-beginning) (point-min)) (if region-p (region-end) (point-max)))) + (text + (and text (string-match "\\S-" text) + (org-export-preprocess-string + text + :emph-multiline t + :for-LaTeX t + :comments nil + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) + :footnotes (plist-get opt-plist :footnotes) + :drawers (plist-get opt-plist :drawers) + :timestamps (plist-get opt-plist :timestamps) + :todo-keywords (plist-get opt-plist :todo-keywords) + :add-text nil + :skip-before-1st-heading skip + :select-tags nil + :exclude-tags nil + :LaTeX-fragments nil))) (string-for-export (org-export-preprocess-string region @@ -656,6 +763,11 @@ ;; finalization (unless body-only (insert "\n\\end{document}")) + ;; Attach description terms to the \item macro + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\\\item\\([ \t]+\\)\\[" nil t) + (delete-region (match-beginning 1) (match-end 1))) + ;; Relocate the table of contents (goto-char (point-min)) (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) @@ -666,8 +778,23 @@ (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) (replace-match "\\tableofcontents" t t))) + ;; Cleanup forced line ends in items where they are not needed + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*\n\\\\begin" + nil t) + (delete-region (match-beginning 1) (match-end 1))) + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*" + nil t) + (if (looking-at "[\n \t]+") + (replace-match "\n"))) + (run-hooks 'org-export-latex-final-hook) (or to-buffer (save-buffer)) + (org-export-latex-fix-inputenc) + (run-hooks 'org-export-latex-after-save-hook) (goto-char (point-min)) (or (org-export-push-to-kill-ring "LaTeX") (message "Exporting to LaTeX...done")) @@ -698,7 +825,6 @@ (re-search-forward "\\\\bibliography{" nil t)))) cmd) (with-current-buffer outbuf (erase-buffer)) - (and (file-exists-p pdffile) (delete-file pdffile)) (message "Processing LaTeX file...") (if (and cmds (symbolp cmds)) (funcall cmds file) @@ -720,7 +846,7 @@ (error "PDF file was not produced") (set-window-configuration wconfig) (when org-export-pdf-remove-logfiles - (dolist (ext '("aux" "log" "out" "toc")) + (dolist (ext org-export-pdf-logfiles) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)))) (message "Exporting to PDF...done") @@ -732,7 +858,12 @@ (interactive "P") (let ((pdffile (org-export-as-pdf arg))) (if pdffile - (org-open-file pdffile) + (progn + (org-open-file pdffile) + (when org-export-kill-product-buffer-when-displayed + (kill-buffer (find-buffer-visiting + (concat (file-name-sans-extension (buffer-file-name)) + ".tex"))))) (error "PDF file was not produced")))) ;;; Parsing functions: @@ -745,7 +876,7 @@ (goto-char (point-min)) (let* ((cnt 0) output (depth org-export-latex-sectioning-depth)) - (while (re-search-forward + (while (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 2 1) level)) "\\}\\) \\(.*\\)$") @@ -753,7 +884,7 @@ (when (> level 0) (save-excursion (save-match-data - (re-search-forward + (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string level) "\\}\\) \\(.*\\)$") nil t)))) t) @@ -765,7 +896,7 @@ (narrow-to-region (point) (save-match-data - (if (re-search-forward + (if (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 2 1) level)) "\\}\\) \\(.*\\)$") nil t) @@ -789,7 +920,7 @@ (defun org-export-latex-parse-content () "Extract the content of a section." (let ((beg (point)) - (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t) + (end (if (org-re-search-forward-unprotected "^\\(\\*\\)+ .*$" nil t) (progn (beginning-of-line) (point)) (point-max)))) (buffer-substring beg end))) @@ -797,7 +928,7 @@ (defun org-export-latex-parse-subcontent (level odd) "Extract the subcontent of a section at LEVEL. If ODD Is non-nil, assume subcontent only contains odd sections." - (if (not (re-search-forward + (if (not (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 4 2) level)) "\\}\\) \\(.*\\)$") @@ -824,8 +955,7 @@ (defun org-export-latex-subcontent (subcontent num) "Export each cell of SUBCONTENT to LaTeX. If NUM, export sections as numerical sections." - (let* ((heading (org-export-latex-fontify-headline - (cdr (assoc 'heading subcontent)))) + (let* ((heading (cdr (assoc 'heading subcontent))) (level (- (cdr (assoc 'level subcontent)) org-export-latex-add-level)) (occur (number-to-string (cdr (assoc 'occur subcontent)))) @@ -833,32 +963,61 @@ (subcontent (cadr (assoc 'subcontent subcontent))) (label (org-get-text-property-any 0 'target heading)) (label-list (cons label (cdr (assoc label - org-export-target-aliases))))) + org-export-target-aliases)))) + (sectioning org-export-latex-sectioning) + (depth org-export-latex-sectioning-depth) + main-heading sub-heading) + (when (symbolp (car sectioning)) + (setq sectioning (funcall (car sectioning) level heading)) + (when sectioning + (setq heading (car sectioning) + sectioning (cdr sectioning) + ;; target property migh have changed... + label (org-get-text-property-any 0 'target heading) + label-list (cons label (cdr (assoc label + org-export-target-aliases))))) + (if sectioning (setq sectioning (make-list 10 sectioning))) + (setq depth (if sectioning 10000 0))) + (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading) + (setq main-heading (substring heading 0 (match-beginning 0)) + sub-heading (substring heading (match-end 0)))) + (setq heading (org-export-latex-fontify-headline heading) + sub-heading (and sub-heading + (org-export-latex-fontify-headline sub-heading)) + main-heading (and main-heading + (org-export-latex-fontify-headline main-heading))) (cond ;; Normal conversion - ((<= level org-export-latex-sectioning-depth) - (let* ((sec (nth (1- level) org-export-latex-sectioning)) + ((<= level depth) + (let* ((sec (nth (1- level) sectioning)) start end) (if (consp (cdr sec)) (setq start (nth (if num 0 2) sec) end (nth (if num 1 3) sec)) (setq start (if num (car sec) (cdr sec)))) - (insert (format start heading) "\n") + (insert (format start (if main-heading main-heading heading) + (or sub-heading ""))) + (insert "\n") (when label (insert (mapconcat (lambda (l) (format "\\label{%s}" l)) label-list "\n") "\n")) (insert (org-export-latex-content content)) (cond ((stringp subcontent) (insert subcontent)) - ((listp subcontent) (org-export-latex-sub subcontent))) - (if end (insert end "\n")))) + ((listp subcontent) + (while (org-looking-back "\n\n") (backward-delete-char 1)) + (org-export-latex-sub subcontent))) + (when (and end (string-match "[^ \t]" end)) + (let ((hook (org-get-text-property-any 0 'org-insert-hook end))) + (and (functionp hook) (funcall hook))) + (insert end "\n")))) ;; At a level under the hl option: we can drop this subsection - ((> level org-export-latex-sectioning-depth) + ((> level depth) (cond ((eq org-export-latex-low-levels 'description) (if (string-match "% ends low level$" (buffer-substring (point-at-bol 0) (point))) (delete-region (point-at-bol 0) (point)) (insert "\\begin{description}\n")) - (insert (format "\n\\item[%s]%s~\n\n" + (insert (format "\n\\item[%s]%s~\n" heading (if label (format "\\label{%s}" label) ""))) (insert (org-export-latex-content content)) @@ -871,7 +1030,7 @@ (delete-region (point-at-bol 0) (point)) (insert (format "\\begin{%s}\n" (symbol-name org-export-latex-low-levels)))) - (insert (format "\n\\item %s\\\\\n%s\n" + (insert (format "\n\\item %s\\\\\n%s%%" heading (if label (format "\\label{%s}" label) ""))) (insert (org-export-latex-content content)) @@ -930,6 +1089,19 @@ (match-string 1)))) (plist-get org-export-latex-options-plist :latex-class) org-export-latex-default-class) + org-export-latex-class-options + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "LaTeX_CLASS_OPTIONS" 'selective)))) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (and (re-search-forward "^#\\+LaTeX_CLASS_OPTIONS:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (match-string 1)))) + (plist-get org-export-latex-options-plist :latex-class-options)) org-export-latex-class (or (car (assoc org-export-latex-class org-export-latex-classes)) (error "No definition for class `%s' in `org-export-latex-classes'" @@ -943,32 +1115,42 @@ (let ((hl-levels (plist-get org-export-latex-options-plist :headline-levels)) (sec-depth (length org-export-latex-sectioning))) - (if (> hl-levels sec-depth) sec-depth hl-levels))))) + (if (> hl-levels sec-depth) sec-depth hl-levels)))) + (when (and org-export-latex-class-options + (string-match "\\S-" org-export-latex-class-options) + (string-match "^[ \t]*\\(\\\\documentclass\\)\\(\\[.*?\\]\\)?" + org-export-latex-header)) + (setq org-export-latex-header + (concat (substring org-export-latex-header 0 (match-end 1)) + org-export-latex-class-options + (substring org-export-latex-header (match-end 0)))))) + +(defvar org-export-latex-format-toc-function + 'org-export-latex-format-toc-default + "The function formatting returning the string to createthe table of contents. +The function mus take one parameter, the depth of the table of contents.") (defun org-export-latex-make-header (title opt-plist) "Make the LaTeX header and return it as a string. TITLE is the current title from the buffer or region. OPT-PLIST is the options plist for current buffer." (let ((toc (plist-get opt-plist :table-of-contents)) - (author (plist-get opt-plist :author))) + (author (org-export-apply-macros-in-string + (plist-get opt-plist :author)))) (concat (if (plist-get opt-plist :time-stamp-file) (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) - ;; insert LaTeX custom header - (org-export-apply-macros-in-string org-export-latex-header) - "\n" - ;; insert information on LaTeX packages - (when org-export-latex-packages-alist - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n")) - ;; insert additional commands in the header - (org-export-apply-macros-in-string - (plist-get opt-plist :latex-header-extra)) + ;; insert LaTeX custom header and packages from the list + (org-splice-latex-header + (org-export-apply-macros-in-string org-export-latex-header) + org-export-latex-default-packages-alist + org-export-latex-packages-alist + (org-export-apply-macros-in-string + (plist-get opt-plist :latex-header-extra))) + ;; append another special variable (org-export-apply-macros-in-string org-export-latex-append-header) + ;; define align if not yet defined + "\n\\providecommand{\\alert}[1]{\\textbf{#1}}" ;; insert the title (format "\n\n\\title{%s}\n" @@ -980,7 +1162,7 @@ (format "\\author{%s}\n" (org-export-latex-fontify-headline (or author user-full-name))) (format "%%\\author{%s}\n" - (or author user-full-name))) + (org-export-latex-fontify-headline (or author user-full-name)))) ;; insert the date (format "\\date{%s}\n" (format-time-string @@ -997,13 +1179,15 @@ ;; table of contents (when (and org-export-with-toc (plist-get opt-plist :section-numbers)) - (cond ((numberp toc) - (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" - (min toc (plist-get opt-plist :headline-levels)))) - (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" - (plist-get opt-plist :headline-levels))))) - (when (plist-get opt-plist :preserve-breaks) - "\\obeylines\n")))) + (funcall org-export-latex-format-toc-function + (cond ((numberp toc) + (min toc (plist-get opt-plist :headline-levels))) + (toc (plist-get opt-plist :headline-levels)))))))) + +(defun org-export-latex-format-toc-default (depth) + (when depth + (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" + depth))) (defun org-export-latex-first-lines (opt-plist &optional beg end) "Export the first lines before first headline. @@ -1028,8 +1212,9 @@ :timestamps (plist-get opt-plist :timestamps) :footnotes (plist-get opt-plist :footnotes))) (org-unmodified - (add-text-properties pt (max pt (1- end)) - '(:org-license-to-kill t))))))) + (let ((inhibit-read-only t)) + (add-text-properties pt (max pt (1- end)) + '(:org-license-to-kill t)))))))) (defvar org-export-latex-header-defs nil "The header definitions that might be used in the LaTeX body.") @@ -1127,13 +1312,20 @@ ;; the beginning of the buffer - inserting "\n" is safe here though. (insert "\n" string) (goto-char (point-min)) - (let ((re (concat "\\\\[a-zA-Z]+\\(?:" - "\\[.*\\]" - "\\)?" - (org-create-multibrace-regexp "{" "}" 3)))) + (let ((re (concat "\\\\\\([a-zA-Z]+\\)" + "\\(?:<[^<>\n]*>\\)*" + "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" + "\\(" + (org-create-multibrace-regexp "{" "}" 3) + "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) - (unless (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (unless (or + ;; check for comment line + (save-excursion (goto-char (match-beginning 0)) + (equal (char-after (point-at-bol)) ?#)) + ;; Check if this is a defined entity, so that is may need conversion + (org-entity-get (match-string 1))) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))))) (when (plist-get org-export-latex-options-plist :emphasize) @@ -1192,7 +1384,8 @@ (if (equal (match-string 1) "\\") (replace-match (match-string 2) t t) (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))) + (match-string 2)) t t) + (backward-char 1))) ((equal (match-string 2) "...") (replace-match (concat (match-string 1) @@ -1216,7 +1409,19 @@ (org-export-latex-treat-backslash-char (match-string 1) (or (match-string 3) ""))) - "") t t)) + "") t t) + (when (and (get-text-property (1- (point)) 'org-entity) + (looking-at "{}")) + ;; OK, this was an entity replacement, and the user + ;; had terminated the entity with {}. Make sure + ;; {} is protected as well, and remove the extra {} + ;; inserted by the conversion. + (put-text-property (point) (+ 2 (point)) 'org-protected t) + (if (save-excursion (goto-char (max (- (point) 2) (point-min))) + (looking-at "{}")) + (replace-match "")) + (forward-char 2)) + (backward-char 1)) ((member (match-string 2) '("_" "^")) (replace-match (or (save-match-data (org-export-latex-treat-sub-super-char @@ -1227,8 +1432,8 @@ (backward-char 1))))))) '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" "\\(\\(\\\\?\\$\\)\\)" - "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" - "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" + "\\([a-zA-Z0-9()]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-zA-Z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-zA-Z0-9]+}\\|([a-zA-Z0-9]+)\\)" + "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|\\([&#%{}\"]\\|[a-zA-Z][a-zA-Z0-9]*\\)\\)" "\\(.\\|^\\)\\(&\\)" "\\(.\\|^\\)\\(#\\)" "\\(.\\|^\\)\\(%\\)" @@ -1280,29 +1485,35 @@ (defun org-export-latex-treat-backslash-char (string-before string-after) "Convert the \"$\" special character to LaTeX. The conversion is made depending of STRING-BEFORE and STRING-AFTER." - (cond ((member (list string-after) org-html-entities) - ;; backslash is part of a special entity (like "\alpha") - (concat string-before "$\\" - (or (cdar (member (list string-after) org-html-entities)) - string-after) "$")) - ((and (not (string-match "^[ \n\t]" string-after)) - (not (string-match "[ \t]\\'\\|^" string-before))) - ;; backslash is inside a word - (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))) - ((not (or (equal string-after "") - (string-match "^[ \t\n]" string-after))) - ;; backslash might escape a character (like \#) or a user TeX - ;; macro (like \setcounter) - (org-export-latex-protect-string - (concat string-before "\\" string-after))) - ((and (string-match "^[ \t\n]" string-after) - (string-match "[ \t\n]\\'" string-before)) - ;; backslash is alone, convert it to $\backslash$ - (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))) - (t (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))))) + (let ((ass (org-entity-get string-after))) + (cond + (ass (org-add-props + (if (nth 2 ass) + (concat string-before + (org-export-latex-protect-string + (concat "$" (nth 1 ass) "$"))) + (concat string-before (org-export-latex-protect-string + (nth 1 ass)))) + nil 'org-entity t)) + ((and (not (string-match "^[ \n\t]" string-after)) + (not (string-match "[ \t]\\'\\|^" string-before))) + ;; backslash is inside a word + (concat string-before + (org-export-latex-protect-string + (concat "\\textbackslash{}" string-after)))) + ((not (or (equal string-after "") + (string-match "^[ \t\n]" string-after))) + ;; backslash might escape a character (like \#) or a user TeX + ;; macro (like \setcounter) + (concat string-before + (org-export-latex-protect-string (concat "\\" string-after)))) + ((and (string-match "^[ \t\n]" string-after) + (string-match "[ \t\n]\\'" string-before)) + ;; backslash is alone, convert it to $\backslash$ + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) + (t (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after)))))) (defun org-export-latex-keywords () "Convert special keywords to LaTeX." @@ -1312,9 +1523,9 @@ (match-string 0)) t t) (save-excursion (beginning-of-line 1) - (unless (looking-at ".*\\\\newline[ \t]*$") + (unless (looking-at ".*\n[ \t]*\n") (end-of-line 1) - (insert "\\newline"))))) + (insert "\n"))))) (defun org-export-latex-fixed-width (opt) "When OPT is non-nil convert fixed-width sections to LaTeX." @@ -1340,6 +1551,14 @@ (declare-function orgtbl-to-latex "org-table" (table params) t) (defun org-export-latex-tables (insert) "Convert tables to LaTeX and INSERT it." + ;; First, get the table.el tables + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\(\\+-[-+]*\\+\\)[ \t]*\n[ \t]*|" nil t) + (org-if-unprotected + (require 'table) + (org-export-latex-convert-table.el-table))) + + ;; And now the Org-mode tables (goto-char (point-min)) (while (re-search-forward "^\\([ \t]*\\)|" nil t) (org-if-unprotected-at (1- (point)) @@ -1370,6 +1589,7 @@ (string-match "\\" attr)) + floatp (or label caption)) + (and (get-buffer "*org-export-table*") + (kill-buffer (get-buffer "*org-export-table*"))) + (table-generate-source 'latex "*org-export-table*" "caption") + (setq tbl (with-current-buffer "*org-export-table*" + (buffer-string))) + (while (string-match "^%.*\n" tbl) + (setq tbl (replace-match "" t t tbl))) + ;; fix the hlines + (when rmlines + (let ((n 0) lines) + (setq lines (mapcar (lambda (x) + (if (string-match "^\\\\hline$" x) + (progn + (setq n (1+ n)) + (if (= n 2) x nil)) + x)) + (org-split-string tbl "\n"))) + (setq tbl (mapconcat 'identity (delq nil lines) "\n")))) + (when (and align (string-match "\\\\begin{tabular}{.*}" tbl)) + (setq tbl (replace-match (concat "\\begin{tabular}{" align "}") + t t tbl))) + (and (get-buffer "*org-export-table*") + (kill-buffer (get-buffer "*org-export-table*"))) + (beginning-of-line 0) + (while (looking-at "[ \t]*\\(|\\|\\+-\\)") + (delete-region (point) (1+ (point-at-eol)))) + (when org-export-latex-tables-centered + (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}"))) + (when floatp + (setq tbl (concat "\\begin{table}\n" + (format "\\caption{%s%s}\n" + (if label (format "\\label{%s}" label) "") + (or caption "")) + tbl + "\n\\end{table}\n"))) + (insert (org-export-latex-protect-string tbl)))) + (defun org-export-latex-fontify () "Convert fontification to LaTeX." (goto-char (point-min)) @@ -1473,7 +1743,10 @@ (save-match-data (and (org-at-table-p) (string-match - "[|\n]" (buffer-substring beg end)))))) + "[|\n]" (buffer-substring beg end))))) + (and (equal (match-string 3) "+") + (save-match-data + (string-match "\\`-+\\'" (match-string 4))))) (setq s (match-string 4)) (setq rpl (concat (match-string 1) (org-export-latex-emph-format (cadr emph) @@ -1482,7 +1755,7 @@ (if (caddr emph) (setq rpl (org-export-latex-protect-string rpl)) (save-match-data - (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) + (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) (progn (add-text-properties (match-beginning 1) (match-end 1) '(org-protected t) rpl) @@ -1573,6 +1846,7 @@ raw-path)))))))) ;; process with link inserting (apply 'delete-region remove) + (setq caption (and caption (org-export-latex-fontify-headline caption))) (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) ;; OK, we need to inline an image @@ -1589,27 +1863,28 @@ (org-remove-initial-hash (org-solidify-link-text raw-path)) desc))) - (path + (path (when (org-at-table-p) ;; There is a strange problem when we have a link in a table, ;; ampersands then cause a problem. I think this must be ;; a LaTeX issue, but we here implement a work-around anyway. (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) - (insert (format "\\href{%s}{%s}" path desc))) + (insert (format org-export-latex-hyperref-format path desc))) (t (insert "\\texttt{" desc "}"))))))) (defun org-export-latex-format-image (path caption label attr) "Format the image element, depending on user settings." - (let (floatp wrapp placement figenv) + (let (ind floatp wrapp placement figenv) (setq floatp (or caption label)) + (setq ind (org-get-text-property-any 0 'original-indentation path)) (when (and attr (stringp attr)) (if (string-match "[ \t]*\\" attr) (setq wrapp t floatp nil attr (replace-match "" t t attr))) (if (string-match "[ \t]*\\" attr) (setq wrapp nil floatp t attr (replace-match "" t t attr)))) - + (setq placement (cond (wrapp "{l}{0.5\\textwidth}") @@ -1639,20 +1914,28 @@ \\end{figure}") (t "\\includegraphics[%attr]{%path}"))) + + (setq figenv (mapconcat 'identity (split-string figenv "\n") + (save-excursion (beginning-of-line 1) + (looking-at "[ \t]*") + (concat "\n" (match-string 0))))) + (if (and (not label) (not caption) (string-match "^\\\\caption{.*\n" figenv)) (setq figenv (replace-match "" t t figenv))) - (org-fill-template - figenv - (list (cons "path" - (if (file-name-absolute-p path) - (expand-file-name path) - path)) - (cons "attr" attr) - (cons "labelcmd" (if label (format "\\label{%s}" - label)"")) - (cons "caption" (or caption "")) - (cons "placement" (or placement "")))))) + (org-add-props + (org-fill-template + figenv + (list (cons "path" + (if (file-name-absolute-p path) + (expand-file-name path) + path)) + (cons "attr" attr) + (cons "labelcmd" (if label (format "\\label{%s}" + label)"")) + (cons "caption" (or caption "")) + (cons "placement" (or placement "")))) + nil 'original-indentation ind))) (defun org-export-latex-protect-amp (s) (while (string-match "\\([^\\\\]\\)\\(&\\)" s) @@ -1705,13 +1988,15 @@ (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0)) (add-text-properties beg end '(org-protected t org-latex-math t)))))) - ;; Convert LaTeX to \LaTeX{} + ;; Convert LaTeX to \LaTeX{} and TeX to \TeX{} (goto-char (point-min)) (let ((case-fold-search nil)) - (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) - (org-if-unprotected - (replace-match (org-export-latex-protect-string - (concat (match-string 1) "\\LaTeX{}")) t t)))) + (while (re-search-forward "\\<\\(\\(La\\)?TeX\\)\\>" nil t) + (unless (eq (char-before (match-beginning 1)) ?\\) + (org-if-unprotected-1 + (replace-match (org-export-latex-protect-string + (concat "\\" (match-string 1) + "{}")) t t))))) ;; Convert blockquotes (goto-char (point-min)) @@ -1759,13 +2044,21 @@ (replace-match (org-export-latex-protect-string "\\hrule") t t))) ;; Protect LaTeX commands like \command[...]{...} or \command{...} - (let ((re (concat "\\\\[a-zA-Z]+\\(?:" - "\\[.*\\]" - "\\)?" - (org-create-multibrace-regexp "{" "}" 3)))) + (goto-char (point-min)) + (let ((re (concat + "\\\\\\([a-zA-Z]+\\)" + "\\(?:<[^<>\n]*>\\)*" + "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" + "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) - (unless (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (unless (or + ;; check for comment line + (save-excursion (goto-char (match-beginning 0)) + (equal (char-after (point-at-bol)) ?#)) + ;; Check if this is a defined entity, so that is may need conversion + (org-entity-get (match-string 1)) + ) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))))) @@ -1786,10 +2079,12 @@ ">>>?\\((INVISIBLE)\\)?") nil t) (org-if-unprotected-at (+ (match-beginning 0) 2) (replace-match - (org-export-latex-protect-string - (format "\\label{%s}%s" (save-match-data (org-solidify-link-text - (match-string 1))) - (if (match-string 2) "" (match-string 1)))) t t))) + (concat + (org-export-latex-protect-string + (format "\\label{%s}" (save-match-data (org-solidify-link-text + (match-string 1))))) + (if (match-string 2) "" (match-string 1))) + t t))) ;; Delete @<...> constructs ;; Thanks to Daniel Clemente for this regexp @@ -1832,6 +2127,10 @@ (add-text-properties (1- (length footnote-rpl)) (length footnote-rpl) '(org-protected t) footnote-rpl) + (if (org-on-heading-p) + (setq footnote-rpl + (concat (org-export-latex-protect-string "\\protect") + footnote-rpl))) (insert footnote-rpl))) ))))) @@ -1842,6 +2141,24 @@ (org-if-unprotected (replace-match ""))))) +(defun org-export-latex-fix-inputenc () + "Set the codingsystem in inputenc to what the buffer is." + (let* ((cs buffer-file-coding-system) + (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs)) + "utf8"))) + (when opt + ;; Translate if that is requested + (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt)) + ;; find the \usepackage statement and replace the option + (goto-char (point-min)) + (while (re-search-forward "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}" + nil t) + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1)) + (insert opt)) + (and buffer-file-name + (save-buffer))))) + ;;; List handling: (defun org-export-latex-lists () diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-list.el --- a/lisp/org/org-list.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-list.el Thu May 13 15:13:52 2010 +0200 @@ -7,7 +7,7 @@ ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -125,13 +125,15 @@ (regexp))) (defcustom org-empty-line-terminates-plain-lists nil - "Non-nil means, an empty line ends all plain list levels. + "Non-nil means an empty line ends all plain list levels. +This is currently effective only during export. It should also have +an effect for indentation and plain list folding, but it does not. When nil, empty lines are part of the preceding item." :group 'org-plain-lists :type 'boolean) (defcustom org-auto-renumber-ordered-lists t - "Non-nil means, automatically renumber ordered plain lists. + "Non-nil means automatically renumber ordered plain lists. Renumbering happens when the sequence have been changed with \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, use \\[org-ctrl-c-ctrl-c] to trigger renumbering." @@ -139,7 +141,7 @@ :type 'boolean) (defcustom org-provide-checkbox-statistics t - "Non-nil means, update checkbox statistics after insert and toggle. + "Non-nil means update checkbox statistics after insert and toggle. When this is set, checkbox statistics is updated each time you either insert a new checkbox with \\[org-insert-todo-heading] or toggle a checkbox with \\[org-ctrl-c-ctrl-c]." @@ -147,7 +149,7 @@ :type 'boolean) (defcustom org-hierarchical-checkbox-statistics t - "Non-nil means, checkbox statistics counts only the state of direct children. + "Non-nil means checkbox statistics counts only the state of direct children. When nil, all boxes below the cookie are counted. This can be set to nil on a per-node basis using a COOKIE_DATA property with the word \"recursive\" in the value." @@ -432,7 +434,9 @@ (recursive (or (not org-hierarchical-checkbox-statistics) (string-match "\\" - (or (org-entry-get nil "COOKIE_DATA") "")))) + (or (ignore-errors + (org-entry-get nil "COOKIE_DATA")) + "")))) (cstat 0) ) (when all @@ -614,7 +618,8 @@ (if (looking-at "[ \t]*$") nil (if (<= (setq ind1 (org-get-indentation)) ind) - (throw 'exit t))))) + (throw 'exit t))) + (if (bobp) (throw 'exit t)))) (condition-case nil (if (or (not (org-at-item-p)) (< ind1 (1- ind))) @@ -847,7 +852,7 @@ (interactive) (unless (org-at-item-p) (error "This is not a list")) (let ((line (org-current-line)) - (col (current-column)) + (chars-from-eol (- (point-at-eol) (point))) (ind (current-indentation)) ind1 bullet oldbullet) ;; find where this list begins @@ -878,7 +883,7 @@ (org-shift-item-indentation (- (length bullet) (length oldbullet)))))) (org-goto-line line) - (org-move-to-column col) + (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol))) (if (string-match "[0-9]" bullet) (org-renumber-ordered-list 1)))) @@ -1049,7 +1054,7 @@ (org-adapt-indentation nil)) (cond ((and (looking-at "[ \t]*$") - (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) + (org-looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) (setq this-command 'org-cycle-item-indentation) (if (eq last-command 'org-cycle-item-indentation) (condition-case nil @@ -1081,7 +1086,10 @@ sublevels as a list of strings." (let* ((item-beginning (org-list-item-beginning)) (start (car item-beginning)) - (end (org-list-end (cdr item-beginning))) + (end (save-excursion + (goto-char (org-list-end (cdr item-beginning))) + (org-back-over-empty-lines) + (point))) output itemsep ltype) (while (re-search-forward org-list-beginning-re end t) (goto-char (match-beginning 3)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-mac-message.el --- a/lisp/org/org-mac-message.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-mac-message.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: John Wiegley ;; Christopher Suckling -;; Version: 6.33x +;; Version: 6.35i ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -209,7 +209,7 @@ (insert "\n" (org-mac-message-get-links "f"))) (goto-char (point-max)) (insert "\n") - (org-insert-heading) + (org-insert-heading nil t) (insert org-heading "\n" (org-mac-message-get-links "f")))))) (provide 'org-mac-message) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-macs.el --- a/lisp/org/org-macs.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-macs.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -63,6 +63,8 @@ (setq ss (replace-match "a-zA-Z0-9" t t ss))) (while (string-match "\\[:alpha:\\]" ss) (setq ss (replace-match "a-zA-Z" t t ss))) + (while (string-match "\\[:punct:\\]" ss) + (setq ss (replace-match "\001-@[-`{-~" t t ss))) ss)) s)) @@ -123,6 +125,14 @@ ,@body)) (put 'org-if-unprotected-at 'lisp-indent-function 1) +(defun org-re-search-forward-unprotected (&rest args) + "Like re-search-forward, but stop only in unprotected places." + (catch 'exit + (while t + (unless (apply 're-search-forward args) + (throw 'exit nil)) + (unless (get-text-property (match-beginning 0) 'org-protected) + (throw 'exit (point)))))) (defmacro org-with-remote-undo (_buffer &rest _body) "Execute BODY while recording undo information in two buffers." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-mew.el --- a/lisp/org/org-mew.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-mew.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-mhe.el --- a/lisp/org/org-mhe.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-mhe.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-mobile.el --- a/lisp/org/org-mobile.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-mobile.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -47,7 +47,7 @@ In addition to this, the list may also contain the following symbols: org-agenda-files - This means, include the complete, unrestricted list of files given in + This means include the complete, unrestricted list of files given in the variable `org-agenda-files'. org-agenda-text-search-extra-files Include the files given in the variable @@ -65,6 +65,34 @@ :group 'org-mobile :type 'directory) +(defcustom org-mobile-use-encryption nil + "Non-nil means keep only encrypted files on the webdav server. +Encryption uses AES-256, with a password given in +`org-mobile-encryption-password'. +When nil, plain files are kept on the server. +Turning on encryption requires to set the same password in the MobileOrg +application." + :group 'org-mobile + :type 'boolean) + +(defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt" + "File that is being used as a temporary file for encryption. +This must be local file on your local machine (not on the webdav server). +You might want to put this file into a directory where only you have access." + :group 'org-mobile + :type 'directory) + +(defcustom org-mobile-encryption-password "" + "Password for encrypting files uploaded to the server. +This is a single password which is used for AES-256 encryption. The same +password must also be set in the MobileOrg application. All Org files, +including mobileorg.org will be encrypted using this password. +Note that, whe Org runs the encryption commands, the password could +be visible on your system with the `ps' command. So this method is only +intended to keep the files secure on the server, not on your own machine." + :group 'org-mobile + :type '(string :tag "Password")) + (defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org" "The file where captured notes and flags will be appended to. During the execution of `org-mobile-pull', the file @@ -85,13 +113,29 @@ :group 'org-mobile :type 'file) +(defcustom org-mobile-agendas 'all + "The agendas that should be pushed to MobileOrg. +Allowed values: + +default the weekly agenda and the global TODO list +custom all custom agendas defined by the user +all the custom agendas and the default ones +list a list of selection key(s) as string." + :group 'org-mobile + :type '(choice + (const :tag "Default Agendas" default) + (const :tag "Custom Agendas" custom) + (const :tag "Default and Custom Agendas" all) + (repeat :tag "Selected" + (string :tag "Selection Keys")))) + (defcustom org-mobile-force-id-on-agenda-items t "Non-nil means make all agenda items carry and ID." :group 'org-mobile :type 'boolean) (defcustom org-mobile-force-mobile-change nil - "Non-nil means, force the change made on the mobile device. + "Non-nil means force the change made on the mobile device. So even if there have been changes to the computer version of the entry, force the new value set on the mobile. When nil, mark the entry from the mobile with an error message. @@ -247,15 +291,14 @@ (kill-buffer a-buffer) (let ((cw (selected-window))) (select-window (get-buffer-window a-buffer)) - (org-agenda-redo) (select-window cw))))) (message "Files for mobile viewer staged")) - + (defvar org-mobile-before-process-capture-hook nil "Hook that is run after content was moved to `org-mobile-inbox-for-pull'. -The inbox file is in the current buffer, and the buffer is arrowed to the -new captured data.") +The inbox file is visited by the current buffer, and the buffer is +narrowed to the newly captured data.") ;;;###autoload (defun org-mobile-pull () @@ -305,7 +348,16 @@ (file-exists-p (file-name-directory org-mobile-inbox-for-pull))) (error - "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))) + "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")) + (when org-mobile-use-encryption + (unless (string-match "\\S-" org-mobile-encryption-password) + (error + "To use encryption, you must set `org-mobile-encryption-password'")) + (unless (file-writable-p org-mobile-encryption-tempfile) + (error "Cannot write to entryption tempfile %s" + org-mobile-encryption-tempfile)) + (unless (executable-find "openssl") + (error "openssl is needed to encrypt files.")))) (defun org-mobile-create-index-file () "Write the index file in the WebDAV directory." @@ -314,7 +366,7 @@ (def-todo (default-value 'org-todo-keywords)) (def-tags (default-value 'org-tag-alist)) file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds) - + (org-prepare-agenda-buffers (mapcar 'car files-alist)) (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) (setq todo-kwds (org-delete-all @@ -385,7 +437,9 @@ target-dir (file-name-directory target-path)) (unless (file-directory-p target-dir) (make-directory target-dir 'parents)) - (copy-file file target-path 'ok-if-exists) + (if org-mobile-use-encryption + (org-mobile-encrypt-and-move file target-path) + (copy-file file target-path 'ok-if-exists)) (setq check (shell-command-to-string (concat org-mobile-checksum-binary " " (shell-quote-argument (expand-file-name file))))) @@ -426,8 +480,22 @@ ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) (t (cons (car x) (cons "" (cdr x)))))) org-agenda-custom-commands))) - new e key desc type match settings cmds gkey gdesc gsettings cnt) - (while (setq e (pop custom-list)) + (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo))) + thelist new e key desc type match settings cmds gkey gdesc gsettings cnt) + (cond + ((eq org-mobile-agendas 'custom) + (setq thelist custom-list)) + ((eq org-mobile-agendas 'default) + (setq thelist default-list)) + ((eq org-mobile-agendas 'all) + (setq thelist custom-list) + (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist)) + (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist))) + ((listp org-mobile-agendas) + (setq thelist (append custom-list default-list)) + (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist)) + org-mobile-agendas))))) + (while (setq e (pop thelist)) (cond ((stringp (cdr e)) ;; this is a description entry - skip it @@ -438,7 +506,12 @@ ((memq (nth 2 e) '(todo-tree tags-tree occur-tree)) ;; These are trees, not really agenda commands ) - ((memq (nth 2 e) '(agenda todo tags)) + ((and (memq (nth 2 e) '(todo tags tags-todo)) + (or (null (nth 3 e)) + (not (string-match "\\S-" (nth 3 e))))) + ;; These would be interactive because the match string is empty + ) + ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo)) ;; a normal command (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e) settings (nth 4 e)) @@ -541,26 +614,66 @@ (interactive) (let* ((file (expand-file-name "agendas.org" org-mobile-directory)) + (file1 (if org-mobile-use-encryption + org-mobile-encryption-tempfile + file)) (sumo (org-mobile-sumo-agenda-command)) (org-agenda-custom-commands - (list (append sumo (list (list file))))) + (list (append sumo (list (list file1))))) (org-mobile-creating-agendas t)) - (unless (file-writable-p file) - (error "Cannot write to file %s" file)) + (unless (file-writable-p file1) + (error "Cannot write to file %s" file1)) (when sumo - (org-store-agenda-views)))) + (org-store-agenda-views)) + (when org-mobile-use-encryption + (org-mobile-encrypt-file file1 file) + (delete-file file1)))) + +(defun org-mobile-encrypt-and-move (infile outfile) + "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE. +We do this in two steps so that remote paths will work, even if the +encryption program does not understand them." + (let ((encfile (concat infile "_enc"))) + (org-mobile-encrypt-file infile encfile) + (when outfile + (copy-file encfile outfile 'ok-if-exists) + (delete-file encfile)))) + +(defun org-mobile-encrypt-file (infile outfile) + "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" org-mobile-encryption-password)) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) + +(defun org-mobile-decrypt-file (infile outfile) + "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -d -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" org-mobile-encryption-password)) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) (defun org-mobile-move-capture () "Move the contents of the capture file to the inbox file. Return a marker to the location where the new content has been added. If nothing new has been added, return nil." (interactive) - (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) - (capture-buffer (find-file-noselect - (expand-file-name org-mobile-capture-file - org-mobile-directory))) - (insertion-point (make-marker)) - not-empty content) + (let* ((encfile nil) + (capture-file (expand-file-name org-mobile-capture-file + org-mobile-directory)) + (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) + (capture-buffer + (if (not org-mobile-use-encryption) + (find-file-noselect capture-file) + (delete-file org-mobile-encryption-tempfile) + (setq encfile (concat org-mobile-encryption-tempfile "_enc")) + (copy-file capture-file encfile) + (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile) + (find-file-noselect org-mobile-encryption-tempfile))) + (insertion-point (make-marker)) + not-empty content) (with-current-buffer capture-buffer (setq content (buffer-string)) (setq not-empty (string-match "\\S-" content)) @@ -577,9 +690,13 @@ (save-buffer) (org-mobile-update-checksum-for-capture-file (buffer-string)))) (kill-buffer capture-buffer) + (when org-mobile-use-encryption + (org-mobile-encrypt-and-move org-mobile-encryption-tempfile + capture-file)) (if not-empty insertion-point))) (defun org-mobile-update-checksum-for-capture-file (buffer-string) + "Find the checksum line and modify it to match BUFFER-STRING." (let* ((file (expand-file-name "checksums.dat" org-mobile-directory)) (buffer (find-file-noselect file))) (when buffer @@ -856,7 +973,7 @@ (org-todo (or new 'none)) t) (t (error "State before change was expected as \"%s\", but is \"%s\"" old current)))) - + ((eq what 'tags) (setq current (org-get-tags) new1 (and new (org-split-string new ":+")) @@ -869,7 +986,7 @@ (org-set-tags-to new1) t) (t (error "Tags before change were expected as \"%s\", but are \"%s\"" (or old "") (or current ""))))) - + ((eq what 'priority) (when (looking-at org-complex-heading-regexp) (setq current (and (match-end 3) (substring (match-string 3) 2 3))) @@ -895,7 +1012,7 @@ (delete-region (point) (+ (point) (length current))) (org-set-tags nil 'align)) (t (error "Heading changed in MobileOrg and on the computer"))))) - + ((eq what 'body) (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) (save-excursion (outline-next-heading) @@ -915,7 +1032,7 @@ (point)))) t) (t (error "Body was changed in MobileOrg and on the computer"))))))) - + (defun org-mobile-tags-same-p (list1 list2) "Are the two tag lists the same?" diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-mouse.el --- a/lisp/org/org-mouse.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-mouse.el Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -189,7 +189,7 @@ (interactive) (end-of-line) (skip-chars-backward "\t ") - (when (looking-back ":[A-Za-z]+:") + (when (org-looking-back ":[A-Za-z]+:") (skip-chars-backward ":A-Za-z") (skip-chars-backward "\t "))) @@ -607,7 +607,7 @@ (:end ; insert text here (skip-chars-backward " \t") (kill-region (point) (point-at-eol)) - (unless (looking-back org-mouse-punctuation) + (unless (org-looking-back org-mouse-punctuation) (insert (concat org-mouse-punctuation " "))))) (insert text) @@ -674,7 +674,7 @@ 'org-mode-restart)))) ((or (eolp) (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") - (looking-back " \\|\t"))) + (org-looking-back " \\|\t"))) (org-mouse-popup-global-menu)) ((get-context :checkbox) (popup-menu diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-plot.el --- a/lisp/org/org-plot.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-plot.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -134,7 +134,7 @@ (defun org-plot/gnuplot-to-grid-data (table data-file params) "Export the data in TABLE to DATA-FILE for gnuplot. -This means, in a format appropriate for grid plotting by gnuplot. +This means in a format appropriate for grid plotting by gnuplot. PARAMS specifies which columns of TABLE should be plotted as independent and dependant variables." (interactive) @@ -250,8 +250,9 @@ (setf plot-lines (cons (format plot-str data-file - (or (and (not text-ind) ind - (> ind 0) (format "%d:" ind)) "") + (or (and ind (> ind 0) + (not text-ind) + (format "%d:" ind)) "") (+ 1 col) (if text-ind (format ":xticlabel(%d)" ind) "") with @@ -300,7 +301,7 @@ (setf table (delq 'hline (cdr table)))) ;; clean non-data from table ;; collect options (save-excursion (while (and (equal 0 (forward-line -1)) - (looking-at "#\\+")) + (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; dump table to datafile (very different for grid) (case (plist-get params :plot-type) @@ -320,7 +321,6 @@ (mapcar (lambda (row) (nth ind row)) table)))) 0) (plist-put params :timeind t) ;; check for text ind column - (if (or (string= (plist-get params :with) "hist") (> (length (delq 0 (mapcar diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-protocol.el --- a/lisp/org/org-protocol.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-protocol.el Thu May 13 15:13:52 2010 +0200 @@ -9,7 +9,7 @@ ;; Author: Ross Patterson ;; Maintainer: Sebastian Rose ;; Keywords: org, emacsclient, wp -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -470,9 +470,10 @@ (url (org-protocol-sanitize-uri (car parts))) (type (if (string-match "^\\([a-z]+\\):" url) (match-string 1 url))) - (title (cadr parts)) - (region (caddr parts)) - (orglink (org-make-link-string url title)) + (title (or (cadr parts) "")) + (region (or (caddr parts) "")) + (orglink (org-make-link-string + url (if (string-match "[^[:space:]]" title) title url))) remember-annotation-functions) (setq org-stored-links (cons (list url title) org-stored-links)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-publish.el --- a/lisp/org/org-publish.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-publish.el Thu May 13 15:13:52 2010 +0200 @@ -1,10 +1,11 @@ ;;; org-publish.el --- publish related org-mode files as a website -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; Author: David O'Toole ;; Maintainer: Carsten Dominik ;; Keywords: hypermedia, outlines, wp -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -31,7 +32,7 @@ ;; + Publish all one's org-files to HTML or PDF ;; + Upload HTML, images, attachments and other files to a web server ;; + Exclude selected private pages from publishing -;; + Publish a clickable index of pages +;; + Publish a clickable sitemap of pages ;; + Manage local timestamps for publishing only changed files ;; + Accept plugin functions to extend range of publishable content ;; @@ -39,6 +40,17 @@ ;;; Code: + +(defun org-publish-sanitize-plist (plist) + (mapcar (lambda (x) + (or (cdr (assq x '((:index-filename . :sitemap-filename) + (:index-title . :sitemap-title) + (:index-function . :sitemap-function) + (:index-style . :sitemap-style) + (:auto-index . :auto-sitemap)))) + x)) + plist)) + (eval-when-compile (require 'cl)) (require 'org) @@ -112,9 +124,11 @@ certain makefile, to ensure published files are built up to date. :preparation-function Function to be called before publishing - this project. + this project. This may also be a list + of functions. :completion-function Function to be called after publishing - this project. + this project. This may also be a list + of functions. Some properties control details of the Org publishing process, and are equivalent to the corresponding user variables listed in @@ -144,22 +158,22 @@ :author `user-full-name' :email `user-mail-address' -The following properties may be used to control publishing of an -index of files or summary page for a given project. +The following properties may be used to control publishing of a +sitemap of files or summary page for a given project. - :auto-index Whether to publish an index during + :auto-sitemap Whether to publish a sitemap during `org-publish-current-project' or `org-publish-all'. - :index-filename Filename for output of index. Defaults + :sitemap-filename Filename for output of sitemap. Defaults to 'sitemap.org' (which becomes 'sitemap.html'). - :index-title Title of index page. Defaults to name of file. - :index-function Plugin function to use for generation of index. - Defaults to `org-publish-org-index', which + :sitemap-title Title of sitemap page. Defaults to name of file. + :sitemap-function Plugin function to use for generation of sitemap. + Defaults to `org-publish-org-sitemap', which generates a plain list of links to all files in the project. - :index-style Can be `list' (index is just an itemized list + :sitemap-style Can be `list' (sitemap is just an itemized list of the titles of the files involved) or `tree' (the directory structure of the source - files is reflected in the index). Defaults to + files is reflected in the sitemap). Defaults to `tree'." :group 'org-publish :type 'alist) @@ -177,7 +191,7 @@ :type 'directory) (defcustom org-publish-list-skipped-files t - "Non-nil means, show message about files *not* published." + "Non-nil means show message about files *not* published." :group 'org-publish :type 'boolean) @@ -306,6 +320,7 @@ list)) (declare-function org-publish-delete-dups "org-publish" (list)) +(declare-function find-lisp-find-files "find-lisp" (directory regexp)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Getting project information out of org-publish-project-alist @@ -426,8 +441,8 @@ (buffer-live-p export-buf-or-file)) (set-buffer export-buf-or-file) ;; run hooks after export and save export - (and (run-hooks 'org-publish-after-export-hook) - (if (buffer-modified-p) (save-buffer))) + (progn (run-hooks 'org-publish-after-export-hook) + (if (buffer-modified-p) (save-buffer))) (kill-buffer export-buf-or-file)) ;; maybe restore buffer's content (set-buffer init-buf) @@ -439,20 +454,33 @@ (unless visiting (kill-buffer init-buf)))))) +(defmacro org-publish-with-aux-preprocess-maybe (&rest body) + "Execute BODY with a modified hook to preprocess for index." + `(let ((org-export-preprocess-after-headline-targets-hook + (if (plist-get project-plist :makeindex) + (cons 'org-publish-aux-preprocess + org-export-preprocess-after-headline-targets-hook) + org-export-preprocess-after-headline-targets-hook))) + ,@body)) + +(defvar project-plist) (defun org-publish-org-to-latex (plist filename pub-dir) "Publish an org file to LaTeX. See `org-publish-org-to' to the list of arguments." - (org-publish-org-to "latex" plist filename pub-dir)) + (org-publish-with-aux-preprocess-maybe + (org-publish-org-to "latex" plist filename pub-dir))) (defun org-publish-org-to-pdf (plist filename pub-dir) "Publish an org file to PDF (via LaTeX). See `org-publish-org-to' to the list of arguments." - (org-publish-org-to "pdf" plist filename pub-dir)) + (org-publish-with-aux-preprocess-maybe + (org-publish-org-to "pdf" plist filename pub-dir))) (defun org-publish-org-to-html (plist filename pub-dir) "Publish an org file to HTML. See `org-publish-org-to' to the list of arguments." - (org-publish-org-to "html" plist filename pub-dir)) + (org-publish-with-aux-preprocess-maybe + (org-publish-org-to "html" plist filename pub-dir))) (defun org-publish-org-to-org (plist filename pub-dir) "Publish an org file to HTML. @@ -518,31 +546,39 @@ (defun org-publish-projects (projects) "Publish all files belonging to the PROJECTS alist. -If :auto-index is set, publish the index too." +If :auto-sitemap is set, publish the sitemap too. +If :makeindex is set, also produce a file theindex.org." (mapc (lambda (project) (let* ((project-plist (cdr project)) (exclude-regexp (plist-get project-plist :exclude)) - (index-p (plist-get project-plist :auto-index)) - (index-filename (or (plist-get project-plist :index-filename) - "sitemap.org")) - (index-function (or (plist-get project-plist :index-function) - 'org-publish-org-index)) + (sitemap-p (plist-get project-plist :auto-sitemap)) + (sitemap-filename (or (plist-get project-plist :sitemap-filename) + "sitemap.org")) + (sitemap-function (or (plist-get project-plist :sitemap-function) + 'org-publish-org-sitemap)) (preparation-function (plist-get project-plist :preparation-function)) (completion-function (plist-get project-plist :completion-function)) (files (org-publish-get-base-files project exclude-regexp)) file) - (when preparation-function (funcall preparation-function)) - (if index-p (funcall index-function project index-filename)) + (when preparation-function (run-hooks 'preparation-function)) + (if sitemap-p (funcall sitemap-function project sitemap-filename)) (while (setq file (pop files)) (org-publish-file file project)) - (when completion-function (funcall completion-function)))) + (when (plist-get project-plist :makeindex) + (org-publish-index-generate-theindex.inc + (plist-get project-plist :base-directory)) + (org-publish-file (expand-file-name + "theindex.org" + (plist-get project-plist :base-directory)) + project)) + (when completion-function (run-hooks 'completion-function)))) (org-publish-expand-projects projects))) -(defun org-publish-org-index (project &optional index-filename) - "Create an index of pages in set defined by PROJECT. -Optionally set the filename of the index with INDEX-FILENAME. -Default for INDEX-FILENAME is 'sitemap.org'." +(defun org-publish-org-sitemap (project &optional sitemap-filename) + "Create an sitemap of pages in set defined by PROJECT. +Optionally set the filename of the sitemap with SITEMAP-FILENAME. +Default for SITEMAP-FILENAME is 'sitemap.org'." (let* ((project-plist (cdr project)) (dir (file-name-as-directory (plist-get project-plist :base-directory))) @@ -550,28 +586,28 @@ (indent-str (make-string 2 ?\ )) (exclude-regexp (plist-get project-plist :exclude)) (files (nreverse (org-publish-get-base-files project exclude-regexp))) - (index-filename (concat dir (or index-filename "sitemap.org"))) - (index-title (or (plist-get project-plist :index-title) - (concat "Index for project " (car project)))) - (index-style (or (plist-get project-plist :index-style) + (sitemap-filename (concat dir (or sitemap-filename "sitemap.org"))) + (sitemap-title (or (plist-get project-plist :sitemap-title) + (concat "Sitemap for project " (car project)))) + (sitemap-style (or (plist-get project-plist :sitemap-style) 'tree)) - (visiting (find-buffer-visiting index-filename)) - (ifn (file-name-nondirectory index-filename)) - file index-buffer) - (with-current-buffer (setq index-buffer - (or visiting (find-file index-filename))) + (visiting (find-buffer-visiting sitemap-filename)) + (ifn (file-name-nondirectory sitemap-filename)) + file sitemap-buffer) + (with-current-buffer (setq sitemap-buffer + (or visiting (find-file sitemap-filename))) (erase-buffer) - (insert (concat "#+TITLE: " index-title "\n\n")) + (insert (concat "#+TITLE: " sitemap-title "\n\n")) (while (setq file (pop files)) (let ((fn (file-name-nondirectory file)) (link (file-relative-name file dir)) (oldlocal localdir)) - ;; index shouldn't index itself - (unless (equal (file-truename index-filename) + ;; sitemap shouldn't list itself + (unless (equal (file-truename sitemap-filename) (file-truename file)) - (if (eq index-style 'list) - (message "Generating list-style index for %s" index-title) - (message "Generating tree-style index for %s" index-title) + (if (eq sitemap-style 'list) + (message "Generating list-style sitemap for %s" sitemap-title) + (message "Generating tree-style sitemap for %s" sitemap-title) (setq localdir (concat (file-name-as-directory dir) (file-name-directory link))) (unless (string= localdir oldlocal) @@ -600,7 +636,7 @@ (org-publish-find-title file) "]]\n"))))) (save-buffer)) - (or visiting (kill-buffer index-buffer)))) + (or visiting (kill-buffer sitemap-buffer)))) (defun org-publish-find-title (file) "Find the title of file in project." @@ -650,18 +686,19 @@ (interactive "P") (when force (org-publish-remove-all-timestamps)) - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) (org-publish-projects org-publish-project-alist)))) + ;;;###autoload (defun org-publish-current-file (&optional force) "Publish the current file. With prefix argument, force publish the file." (interactive "P") - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) @@ -673,7 +710,7 @@ With a prefix argument, force publishing of all files in the project." (interactive "P") - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) (org-publish-use-timestamps-flag @@ -682,6 +719,96 @@ (error "File %s is not part of any known project" (buffer-file-name))) (org-publish project)))) + +;;; Index generation + +(defvar backend) ; dynamically scoped +(defun org-publish-aux-preprocess () + "Find index entries and write them to an .orgx file." + (let ((case-fold-search t) + entry index target) + (goto-char (point-min)) + (while + (and + (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (> (match-end 1) (match-beginning 1))) + (setq entry (match-string 1)) + (when (eq backend 'latex) + (replace-match (format "\\index{%s}" entry) t t)) + (save-excursion + (org-back-to-heading t) + (setq target (get-text-property (point) 'target)) + (setq target (or (cdr (assoc target org-export-preferred-target-alist)) + (cdr (assoc target org-export-id-target-alist)) + target)) + (push (cons entry target) index))) + (with-temp-file + (concat (file-name-sans-extension org-current-export-file) ".orgx") + (dolist (entry (nreverse index)) + (insert (format "INDEX: (%s) %s\n" (cdr entry) (car entry))))))) + +(defun org-publish-index-generate-theindex.inc (directory) + "Generate the index from all .orgx files in the current directory and below." + (require 'find-lisp) + (let* ((fulldir (file-name-as-directory + (expand-file-name directory))) + (full-files (find-lisp-find-files directory "\\.orgx\\'")) + (re (concat "\\`" fulldir)) + (files (mapcar (lambda (f) (if (string-match re f) + (substring f (match-end 0)) + f)) + full-files)) + (default-directory directory) + index origfile buf target entry ibuffer + main last-main letter last-letter file sub link) + ;; `files' contains the list of relative file names + (dolist (file files) + (setq origfile (substring file 0 -1)) + (setq buf (find-file-noselect file)) + (with-current-buffer buf + (goto-char (point-min)) + (while (re-search-forward "^INDEX: (\\(.*?\\)) \\(.*\\)" nil t) + (setq target (match-string 1) + entry (match-string 2)) + (push (list entry origfile target) index))) + (kill-buffer buf)) + (setq index (sort index (lambda (a b) (string< (downcase (car a)) + (downcase (car b)))))) + (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory))) + (with-current-buffer ibuffer + (erase-buffer) + (insert "* Index\n") + (setq last-letter nil) + (dolist (idx index) + (setq entry (car idx) file (nth 1 idx) target (nth 2 idx)) + (setq letter (upcase (substring entry 0 1))) + (when (not (equal letter last-letter)) + (insert "** " letter "\n") + (setq last-letter letter)) + (if (string-match "!" entry) + (setq main (substring entry 0 (match-beginning 0)) + sub (substring entry (match-end 0))) + (setq main nil sub nil last-main nil)) + (when (and main (not (equal main last-main))) + (insert " - " main "\n") + (setq last-main main)) + (setq link (concat "[[file:" file "::#" target "]" + "[" (or sub entry) "]]")) + (if (and main sub) + (insert " - " link "\n") + (insert " - " link "\n"))) + (save-buffer)) + (kill-buffer ibuffer) + + (let ((index-file (expand-file-name "theindex.org" directory))) + (unless (file-exists-p index-file) + (setq ibuffer (find-file-noselect index-file)) + (with-current-buffer ibuffer + (erase-buffer) + (insert "\n\n#+include: \"theindex.inc\"\n\n") + (save-buffer)) + (kill-buffer ibuffer))))) + (provide 'org-publish) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-remember.el --- a/lisp/org/org-remember.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-remember.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -54,7 +54,7 @@ :group 'org) (defcustom org-remember-store-without-prompt t - "Non-nil means, `C-c C-c' stores remember note without further prompts. + "Non-nil means `C-c C-c' stores remember note without further prompts. It then uses the file and headline specified by the template or (if the template does not specify them) by the variables `org-default-notes-file' and `org-remember-default-headline'. To force prompting anyway, use @@ -131,7 +131,7 @@ You may define a prompt like %^{Please specify birthday %n user name (taken from `user-full-name') %a annotation, normally the link created with org-store-link - %i initial content, copied from the active region. If %i is + %i initial content, copied from the active region. If %i is indented, the entire inserted text will be indented as well. %c current kill ring head %x content of the X clipboard @@ -225,7 +225,7 @@ (define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill) (defcustom org-remember-clock-out-on-exit 'query - "Non-nil means, stop the clock when exiting a clocking remember buffer. + "Non-nil means stop the clock when exiting a clocking remember buffer. This only applies if the clock is running in the remember buffer. If the clock is not stopped, it continues to run in the storage location. Instead of nil or t, this may also be the symbol `query' to prompt the @@ -248,7 +248,7 @@ (directory :tag "Directory"))) (defcustom org-remember-auto-remove-backup-files t - "Non-nil means, remove remember backup files after successfully storage. + "Non-nil means remove remember backup files after successfully storage. When remember is finished successfully, with storing the note at the desired target, remove the backup files related to this remember process and show a message about remaining backup files, from previous, unfinished @@ -351,7 +351,7 @@ org-force-remember-template-char)) (t (setq msg (format - "Select template: %s" + "Select template: %s%s" (mapconcat (lambda (x) (cond @@ -362,13 +362,17 @@ (format "[%c]%s" (car x) (substring (nth 1 x) 1))) (t (format "[%c]%s" (car x) (nth 1 x))))) - templates " "))) + templates " ") + (if (assoc ?C templates) + "" + " [C]customize templates"))) (let ((inhibit-quit t) char0) (while (not char0) (message msg) (setq char0 (read-char-exclusive)) (when (and (not (assoc char0 templates)) - (not (equal char0 ?\C-g))) + (not (equal char0 ?\C-g)) + (not (equal char0 ?C))) (message "No such template \"%c\"" char0) (ding) (sit-for 1) (setq char0 nil))) @@ -376,6 +380,11 @@ (jump-to-register remember-register) (kill-buffer remember-buffer) (error "Abort")) + (when (not (assoc char0 templates)) + (jump-to-register remember-register) + (kill-buffer remember-buffer) + (customize-variable 'org-remember-templates) + (error "Customize templates")) char0)))))) (cddr (assoc char templates))))) @@ -470,7 +479,7 @@ ## C-u C-c C-c like C-c C-c, and immediately visit note at target location ## C-0 C-c C-c \"%s\" -> \"* %s\" ## %s to select file and header location interactively. -## C-2 C-c C-c as child of the currently clocked item +## C-2 C-c C-c as child (C-3: as sibling) of the currently clocked item ## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n" (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c") (abbreviate-file-name (or file org-default-notes-file)) @@ -479,21 +488,6 @@ (or (cdr org-remember-previous-location) "???") (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c")))) (insert tpl) - (goto-char (point-min)) - - ;; Simple %-escapes - (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) - (unless (org-remember-escaped-%) - (when (and initial (equal (match-string 0) "%i")) - (save-match-data - (let* ((lead (buffer-substring - (point-at-bol) (match-beginning 0)))) - (setq v-i (mapconcat 'identity - (org-split-string initial "\n") - (concat "\n" lead)))))) - (replace-match - (or (eval (intern (concat "v-" (match-string 1)))) "") - t t))) ;; %[] Insert contents of a file. (goto-char (point-min)) @@ -508,6 +502,21 @@ (insert-file-contents filename) (error (insert (format "%%![Couldn't insert %s: %s]" filename error))))))) + ;; Simple %-escapes + (goto-char (point-min)) + (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) + (unless (org-remember-escaped-%) + (when (and initial (equal (match-string 0) "%i")) + (save-match-data + (let* ((lead (buffer-substring + (point-at-bol) (match-beginning 0)))) + (setq v-i (mapconcat 'identity + (org-split-string initial "\n") + (concat "\n" lead)))))) + (replace-match + (or (eval (intern (concat "v-" (match-string 1)))) "") + t t))) + ;; %() embedded elisp (goto-char (point-min)) (while (re-search-forward "%\\((.+)\\)" nil t) @@ -860,6 +869,7 @@ (previousp (and (member current-prefix-arg '((16) 0)) org-remember-previous-location)) (clockp (equal current-prefix-arg 2)) + (clocksp (equal current-prefix-arg 3)) (fastp (org-xor (equal current-prefix-arg 1) org-remember-store-without-prompt)) (file (cond @@ -882,7 +892,7 @@ visiting (and file (org-find-base-buffer-visiting file)) heading (cdr org-remember-previous-location) fastp t)) - (when clockp + (when (or clockp clocksp) (setq file (buffer-file-name (marker-buffer org-clock-marker)) visiting (and file (org-find-base-buffer-visiting file)) heading org-clock-heading-for-remember @@ -1015,7 +1025,9 @@ (beginning-of-line 2) (end-of-line 1) (insert "\n")))) - (org-paste-subtree (org-get-valid-level level 1) txt) + (org-paste-subtree (if clocksp + level + (org-get-valid-level level 1)) txt) (and org-auto-align-tags (org-set-tags nil t)) (bookmark-set "org-remember-last-stored") (move-marker org-remember-last-stored-marker (point))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-rmail.el --- a/lisp/org/org-rmail.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-rmail.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-src.el --- a/lisp/org/org-src.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-src.el Thu May 13 15:13:52 2010 +0200 @@ -8,7 +8,7 @@ ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -38,6 +38,7 @@ (require 'cl)) (declare-function org-do-remove-indentation "org" (&optional n)) +(declare-function org-at-table.el-p "org" ()) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) @@ -113,7 +114,6 @@ :group 'org-edit-structure :type 'boolean) - (defcustom org-src-window-setup 'reorganize-frame "How the source code edit buffer should be displayed. Possible values for this option are: @@ -192,7 +192,7 @@ The example is copied to a separate buffer, and that buffer is switched to the correct language mode. When done, exit with \\[org-edit-src-exit]. This will remove the original code in the Org buffer, and replace it with -the edited version. Optional argument CONTEXT is used by +the edited version. Optional argument CONTEXT is used by \\[org-edit-src-save] when calling this function." (interactive) (unless (eq context 'save) @@ -221,6 +221,13 @@ block-nindent (nth 5 info) lang-f (intern (concat lang "-mode")) begline (save-excursion (goto-char beg) (org-current-line))) + (if (equal lang-f 'table.el-mode) + (setq lang-f (lambda () + (text-mode) + (if (org-bound-and-true-p flyspell-mode) + (flyspell-mode -1)) + (table-recognize) + (org-set-local 'org-edit-src-content-indentation 0)))) (unless (functionp lang-f) (error "No such language mode: %s" lang-f)) (org-goto-line line) @@ -452,6 +459,15 @@ (pos (point)) re1 re2 single beg end lang lfmt match-re1 ind entry) (catch 'exit + (when (org-at-table.el-p) + (re-search-backward "^[\t]*[^ \t|\\+]" nil t) + (setq beg (1+ (point-at-eol))) + (goto-char beg) + (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) + (progn (goto-char (point-max)) (newline))) + (setq end (point-at-bol)) + (setq ind (org-edit-src-get-indentation beg)) + (throw 'exit (list beg end 'table.el nil nil ind))) (while (setq entry (pop re-list)) (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) single (nth 3 entry)) @@ -515,6 +531,7 @@ (interactive) (unless org-edit-src-from-org-mode (error "This is not a sub-editing buffer, something is wrong...")) + (widen) (let* ((beg org-edit-src-beg-marker) (end org-edit-src-end-marker) (ovl org-edit-src-overlay) @@ -525,7 +542,7 @@ org-edit-src-content-indentation)) (preserve-indentation org-src-preserve-indentation) (delta 0) code line col indent) - (untabify (point-min) (point-max)) + (unless preserve-indentation (untabify (point-min) (point-max))) (save-excursion (goto-char (point-min)) (if (looking-at "[ \t\n]*\n") (replace-match "")) @@ -575,8 +592,15 @@ (insert code) (goto-char beg) (if single (just-one-space)) - (org-goto-line (1- (+ (org-current-line) line))) - (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))) + (if (memq t (mapcar (lambda (overlay) + (eq (org-overlay-get overlay 'invisible) + 'org-hide-block)) + (org-overlays-at (point)))) + ;; Block is hidden; put point at start of block + (beginning-of-line 0) + ;; Block is visible, put point where it was in the code buffer + (org-goto-line (1- (+ (org-current-line) line))) + (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))) (move-marker beg nil) (move-marker end nil)) (unless (eq context 'save) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-table.el --- a/lisp/org/org-table.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-table.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -49,7 +49,7 @@ (defvar constants-unit-system) (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) - "Non-nil means, use the optimized table editor version for `orgtbl-mode'. + "Non-nil means use the optimized table editor version for `orgtbl-mode'. In the optimized version, the table editor takes over all simple keys that normally just insert a character. In tables, the characters are inserted in a way to minimize disturbing the table structure (i.e. in overwrite mode @@ -142,14 +142,14 @@ :group 'org-table) (defcustom org-table-automatic-realign t - "Non-nil means, automatically re-align table when pressing TAB or RETURN. + "Non-nil means automatically re-align table when pressing TAB or RETURN. When nil, aligning is only done with \\[org-table-align], or after column removal/insertion." :group 'org-table-editing :type 'boolean) (defcustom org-table-auto-blank-field t - "Non-nil means, automatically blank table field when starting to type into it. + "Non-nil means automatically blank table field when starting to type into it. This only happens when typing immediately after a field motion command (TAB, S-TAB or RET). Only relevant when `org-enable-table-editor' is equal to `optimized'." @@ -157,7 +157,7 @@ :type 'boolean) (defcustom org-table-tab-jumps-over-hlines t - "Non-nil means, tab in the last column of a table with jump over a hline. + "Non-nil means tab in the last column of a table with jump over a hline. If a horizontal separator line is following the current line, `org-table-next-field' can either create a new row before that line, or jump over the line. When this option is nil, a new line will be created before @@ -183,7 +183,7 @@ (const :tag "Convert user input, don't offer during editing" 'from))) (defcustom org-table-copy-increment t - "Non-nil means, increment when copying current field with \\[org-table-copy-down]." + "Non-nil means increment when copying current field with \\[org-table-copy-down]." :group 'org-table-calculation :type 'boolean) @@ -204,7 +204,7 @@ :type 'plist) (defcustom org-table-formula-evaluate-inline t - "Non-nil means, TAB and RET evaluate a formula in current table field. + "Non-nil means TAB and RET evaluate a formula in current table field. If the current field starts with an equal sign, it is assumed to be a formula which should be evaluated as described in the manual and in the documentation string of the command `org-table-eval-formula'. This feature requires the @@ -215,7 +215,7 @@ :type 'boolean) (defcustom org-table-formula-use-constants t - "Non-nil means, interpret constants in formulas in tables. + "Non-nil means interpret constants in formulas in tables. A constant looks like `$c' or `$Grav' and will be replaced before evaluation by the value given in `org-table-formula-constants', or by a value obtained from the `constants.el' package." @@ -241,8 +241,8 @@ (string :tag "value")))) (defcustom org-table-allow-automatic-line-recalculation t - "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. -Automatically means, when TAB or RET or C-c C-c are pressed in the line." + "Non-nil means lines marked with |#| or |*| will be recomputed automatically. +Automatically means when TAB or RET or C-c C-c are pressed in the line." :group 'org-table-calculation :type 'boolean) @@ -252,7 +252,7 @@ :type 'boolean) (defcustom org-table-relative-ref-may-cross-hline t - "Non-nil means, relative formula references may cross hlines. + "Non-nil means relative formula references may cross hlines. Here are the allowed values: nil Relative references may not cross hlines. They will reference the @@ -567,7 +567,7 @@ "List of max width of fields in each column. This is being used to correctly align a single field after TAB or RET.") (defvar org-table-formula-debug nil - "Non-nil means, debug table formulas. + "Non-nil means debug table formulas. When nil, simply write \"#ERROR\" in corrupted fields.") (make-variable-buffer-local 'org-table-formula-debug) (defvar org-table-overlay-coordinates nil @@ -575,6 +575,7 @@ (make-variable-buffer-local 'org-table-overlay-coordinates) (defvar org-last-recalc-line nil) +(defvar org-table-do-narrow t) ; for dynamic scoping (defconst org-narrow-column-arrow "=>" "Used as display property in narrowed table columns.") @@ -621,7 +622,8 @@ ;; Check if we are narrowing any columns (goto-char beg) - (setq narrow (and org-format-transports-properties-p + (setq narrow (and org-table-do-narrow + org-format-transports-properties-p (re-search-forward "<[rl]?[0-9]+>" end t))) (goto-char beg) (setq falign (re-search-forward "<[rl][0-9]*>" end t)) @@ -660,13 +662,14 @@ (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) ;; Check if there is an explicit width specified + (setq fmax nil) (when (or narrow falign) (setq c column fmax nil falign1 nil) (while c (setq e (pop c)) (when (and (stringp e) (string-match "^<\\([rl]\\)?\\([0-9]+\\)?>$" e)) (if (match-end 1) (setq falign1 (match-string 1 e))) - (if (match-end 2) + (if (and org-table-do-narrow (match-end 2)) (setq fmax (string-to-number (match-string 2 e)) c nil)))) ;; Find fields that are wider than fmax, and shorten them (when fmax @@ -685,7 +688,8 @@ (list 'display org-narrow-column-arrow) xx))))) ;; Get the maximum width for each column - (push (apply 'max 1 (mapcar 'org-string-width column)) lengths) + (push (apply 'max (or fmax 1) 1 (mapcar 'org-string-width column)) + lengths) ;; Get the fraction of numbers, to decide about alignment of the column (if falign1 (push (equal (downcase falign1) "r") typenums) @@ -1003,6 +1007,47 @@ (defvar org-table-clip nil "Clipboard for table regions.") +(defun org-table-get (line column) + "Get the field in table line LINE, column COLUMN. +If LINE is larger than the number of data lines in the table, the function +returns nil. However, if COLUMN is too large, we will simply return an +empty string. +If LINE is nil, use the current line. +If column is nil, use the current column." + (setq column (or column (org-table-current-column))) + (save-excursion + (and (or (not line) (org-table-goto-line line)) + (org-trim (org-table-get-field column))))) + +(defun org-table-put (line column value &optional align) + "Put VALUE into line LINE, column COLUMN. +When ALIGN is set, als realign the table." + (setq column (or column (org-table-current-column))) + (prog1 (save-excursion + (and (or (not line) (org-table-goto-line line)) + (progn (org-table-goto-column column nil 'force) t) + (org-table-get-field column value))) + (and align (org-table-align)))) + +(defun org-table-current-line () + "Return the index of the current data line." + (let ((pos (point)) (end (org-table-end)) (cnt 0)) + (save-excursion + (goto-char (org-table-begin)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (setq cnt (1+ cnt)) + (< (point-at-eol) pos)))) + cnt)) + +(defun org-table-goto-line (N) + "Go to the Nth data line in the current table. +Return t when the line exists, nil if it does not exist." + (goto-char (org-table-begin)) + (let ((end (org-table-end)) (cnt 0)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (< (setq cnt (1+ cnt)) N))) + (= cnt N))) + (defun org-table-blank-field () "Blank the current table field or active region." (interactive) @@ -1102,22 +1147,20 @@ If there are less than N fields, just go to after the last delimiter. However, when FORCE is non-nil, create new columns if necessary." (interactive "p") - (let ((pos (point-at-eol))) - (beginning-of-line 1) - (when (> n 0) - (while (and (> (setq n (1- n)) -1) - (or (search-forward "|" pos t) - (and force - (progn (end-of-line 1) - (skip-chars-backward "^|") - (insert " | ")))))) -; (backward-char 2) t))))) - (when (and force (not (looking-at ".*|"))) - (save-excursion (end-of-line 1) (insert " | "))) - (if on-delim - (backward-char 1) - (if (looking-at " ") (forward-char 1)))))) - + (beginning-of-line 1) + (when (> n 0) + (while (and (> (setq n (1- n)) -1) + (or (search-forward "|" (point-at-eol) t) + (and force + (progn (end-of-line 1) + (skip-chars-backward "^|") + (insert " | ") + t))))) + (when (and force (not (looking-at ".*|"))) + (save-excursion (end-of-line 1) (insert " | "))) + (if on-delim + (backward-char 1) + (if (looking-at " ") (forward-char 1))))) (defun org-table-insert-column () "Insert a new column into the table." @@ -2243,6 +2286,20 @@ (setq form (copy-sequence formula) lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) (if (and lispp literal) (setq lispp 'literal)) + + ;; Insert row and column number of formula result field + (while (string-match "[@$]#" form) + (setq form + (replace-match + (format "%d" + (save-match-data + (if (equal (substring form (match-beginning 0) + (1+ (match-beginning 0))) + "@") + (org-table-current-dline) + (org-table-current-column)))) + t t form))) + ;; Check for old vertical references (setq form (org-table-rewrite-old-row-references form)) ;; Insert remote references @@ -2340,7 +2397,7 @@ "Get a calc vector from a column, according to descriptor DESC. Optional arguments TBEG and COL can give the beginning of the table and the current column, to avoid unnecessary parsing. -HIGHLIGHT means, just highlight the range." +HIGHLIGHT means just highlight the range." (if (not (equal (string-to-char desc) ?@)) (setq desc (concat "@" desc))) (save-excursion @@ -2797,6 +2854,12 @@ (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) ;; 3.e5 or something like this. (setq start (match-end 0))) + ((or (> (- (match-end 1) (match-beginning 1)) 2) + ;; (member (match-string 1 s) + ;; '("arctan" "exp" "expm" "lnp" "log" "stir")) + ) + ;; function name, just advance + (setq start (match-end 0))) (t (setq start (match-beginning 0) s (replace-match @@ -3338,11 +3401,6 @@ ;; active, this binding is ignored inside tables and replaced with a ;; modified self-insert. -(defvar orgtbl-mode nil - "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode' -table editor in arbitrary modes.") -(make-variable-buffer-local 'orgtbl-mode) - (defvar orgtbl-mode-map (make-keymap) "Keymap for `orgtbl-mode'.") @@ -3363,49 +3421,51 @@ 0 (quote 'org-table) 'prepend)) "Extra font-lock-keywords to be added when orgtbl-mode is active.") +;; Install it as a minor mode. +(put 'orgtbl-mode :included t) +(put 'orgtbl-mode :menu-tag "Org Table Mode") ;;;###autoload -(defun orgtbl-mode (&optional arg) +(define-minor-mode orgtbl-mode "The `org-mode' table editor as a minor mode for use in other modes." - (interactive) + :lighter " OrgTbl" :keymap orgtbl-mode-map (org-load-modules-maybe) - (if (org-mode-p) - ;; Exit without error, in case some hook functions calls this - ;; by accident in org-mode. - (message "Orgtbl-mode is not useful in org-mode, command ignored") - (setq orgtbl-mode - (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) - (if orgtbl-mode - (progn - (and (orgtbl-setup) (defun orgtbl-setup () nil)) - ;; Make sure we are first in minor-mode-map-alist - (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) - (and c (setq minor-mode-map-alist - (cons c (delq c minor-mode-map-alist))))) - (org-set-local (quote org-table-may-need-update) t) - (org-add-hook 'before-change-functions 'org-before-change-function - nil 'local) - (org-set-local 'org-old-auto-fill-inhibit-regexp - auto-fill-inhibit-regexp) - (org-set-local 'auto-fill-inhibit-regexp - (if auto-fill-inhibit-regexp - (concat orgtbl-line-start-regexp "\\|" - auto-fill-inhibit-regexp) - orgtbl-line-start-regexp)) - (org-add-to-invisibility-spec '(org-cwidth)) - (when (fboundp 'font-lock-add-keywords) - (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) - (org-restart-font-lock)) - (easy-menu-add orgtbl-mode-menu) - (run-hooks 'orgtbl-mode-hook)) - (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) - (org-table-cleanup-narrow-column-properties) - (org-remove-from-invisibility-spec '(org-cwidth)) - (remove-hook 'before-change-functions 'org-before-change-function t) - (when (fboundp 'font-lock-remove-keywords) - (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) - (org-restart-font-lock)) - (easy-menu-remove orgtbl-mode-menu) - (force-mode-line-update 'all)))) + (cond + ((org-mode-p) + ;; Exit without error, in case some hook functions calls this + ;; by accident in org-mode. + (message "Orgtbl-mode is not useful in org-mode, command ignored")) + (orgtbl-mode + (and (orgtbl-setup) (defun orgtbl-setup () nil)) ;; FIXME: Yuck!?! + ;; Make sure we are first in minor-mode-map-alist + (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) + ;; FIXME: maybe it should use emulation-mode-map-alists? + (and c (setq minor-mode-map-alist + (cons c (delq c minor-mode-map-alist))))) + (org-set-local (quote org-table-may-need-update) t) + (org-add-hook 'before-change-functions 'org-before-change-function + nil 'local) + (org-set-local 'org-old-auto-fill-inhibit-regexp + auto-fill-inhibit-regexp) + (org-set-local 'auto-fill-inhibit-regexp + (if auto-fill-inhibit-regexp + (concat orgtbl-line-start-regexp "\\|" + auto-fill-inhibit-regexp) + orgtbl-line-start-regexp)) + (org-add-to-invisibility-spec '(org-cwidth)) + (when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock)) + (easy-menu-add orgtbl-mode-menu)) + (t + (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) + (org-table-cleanup-narrow-column-properties) + (org-remove-from-invisibility-spec '(org-cwidth)) + (remove-hook 'before-change-functions 'org-before-change-function t) + (when (fboundp 'font-lock-remove-keywords) + (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock)) + (easy-menu-remove orgtbl-mode-menu) + (force-mode-line-update 'all)))) (defun org-table-cleanup-narrow-column-properties () "Remove all properties related to narrow-column invisibility." @@ -3420,11 +3480,6 @@ (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth)) (remove-text-properties s (1+ s) '(invisible t))))) -;; Install it as a minor mode. -(put 'orgtbl-mode :included t) -(put 'orgtbl-mode :menu-tag "Org Table Mode") -(add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map) - (defun orgtbl-make-binding (fun n &rest keys) "Create a function for binding in the table minor mode. FUN is the command to call inside a table. N is used to create a unique @@ -3459,34 +3514,33 @@ "Setup orgtbl keymaps." (let ((nfunc 0) (bindings - (list - '([(meta shift left)] org-table-delete-column) - '([(meta left)] org-table-move-column-left) - '([(meta right)] org-table-move-column-right) - '([(meta shift right)] org-table-insert-column) - '([(meta shift up)] org-table-kill-row) - '([(meta shift down)] org-table-insert-row) - '([(meta up)] org-table-move-row-up) - '([(meta down)] org-table-move-row-down) - '("\C-c\C-w" org-table-cut-region) - '("\C-c\M-w" org-table-copy-region) - '("\C-c\C-y" org-table-paste-rectangle) - '("\C-c-" org-table-insert-hline) - '("\C-c}" org-table-toggle-coordinate-overlays) - '("\C-c{" org-table-toggle-formula-debugger) - '("\C-m" org-table-next-row) - '([(shift return)] org-table-copy-down) - '("\C-c?" org-table-field-info) - '("\C-c " org-table-blank-field) - '("\C-c+" org-table-sum) - '("\C-c=" org-table-eval-formula) - '("\C-c'" org-table-edit-formulas) - '("\C-c`" org-table-edit-field) - '("\C-c*" org-table-recalculate) - '("\C-c^" org-table-sort-lines) - '("\M-a" org-table-beginning-of-field) - '("\M-e" org-table-end-of-field) - '([(control ?#)] org-table-rotate-recalc-marks))) + '(([(meta shift left)] org-table-delete-column) + ([(meta left)] org-table-move-column-left) + ([(meta right)] org-table-move-column-right) + ([(meta shift right)] org-table-insert-column) + ([(meta shift up)] org-table-kill-row) + ([(meta shift down)] org-table-insert-row) + ([(meta up)] org-table-move-row-up) + ([(meta down)] org-table-move-row-down) + ("\C-c\C-w" org-table-cut-region) + ("\C-c\M-w" org-table-copy-region) + ("\C-c\C-y" org-table-paste-rectangle) + ("\C-c-" org-table-insert-hline) + ("\C-c}" org-table-toggle-coordinate-overlays) + ("\C-c{" org-table-toggle-formula-debugger) + ("\C-m" org-table-next-row) + ([(shift return)] org-table-copy-down) + ("\C-c?" org-table-field-info) + ("\C-c " org-table-blank-field) + ("\C-c+" org-table-sum) + ("\C-c=" org-table-eval-formula) + ("\C-c'" org-table-edit-formulas) + ("\C-c`" org-table-edit-field) + ("\C-c*" org-table-recalculate) + ("\C-c^" org-table-sort-lines) + ("\M-a" org-table-beginning-of-field) + ("\M-e" org-table-end-of-field) + ([(control ?#)] org-table-rotate-recalc-marks))) elt key fun cmd) (while (setq elt (pop bindings)) (setq nfunc (1+ nfunc)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-timer.el --- a/lisp/org/org-timer.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-timer.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,6 +48,24 @@ :group 'org-time :type 'string) +(defvar org-timer-start-hook nil + "Hook run after relative timer is started.") + +(defvar org-timer-stop-hook nil + "Hook run before relative timer is stopped.") + +(defvar org-timer-pause-hook nil + "Hook run before relative timer is paused.") + +(defvar org-timer-set-hook nil + "Hook run after countdown timer is set.") + +(defvar org-timer-done-hook nil + "Hook run after countdown timer reaches zero.") + +(defvar org-timer-cancel-hook nil + "Hook run before countdown timer is canceled.") + ;;;###autoload (defun org-timer-start (&optional offset) "Set the starting time for the relative timer to now. @@ -82,7 +100,8 @@ (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" (format-time-string "%T" org-timer-start-time) - (org-timer-secs-to-hms (or delta 0)))))) + (org-timer-secs-to-hms (or delta 0))) + (run-hooks 'org-timer-start-hook)))) (defun org-timer-pause-or-continue (&optional stop) "Pause or continue the relative timer. With prefix arg, stop it entirely." @@ -103,6 +122,7 @@ (message "Timer continues at %s" (org-timer-value-string))) (t ;; pause timer + (run-hooks 'org-timer-pause-hook) (setq org-timer-pause-time (current-time)) (org-timer-set-mode-line 'pause) (message "Timer paused at %s" (org-timer-value-string))))) @@ -110,6 +130,7 @@ (defun org-timer-stop () "Stop the relative timer." (interactive) + (run-hooks 'org-timer-stop-hook) (setq org-timer-start-time nil org-timer-pause-time nil) (org-timer-set-mode-line 'off)) @@ -254,37 +275,28 @@ (concat " <" (substring (org-timer-value-string) 0 -1) ">")) (force-mode-line-update))) -(defvar org-timer-timer1 nil) -(defvar org-timer-timer2 nil) -(defvar org-timer-timer3 nil) -(defvar org-timer-last-timer nil) - -(defun org-timer-cancel-timers () - "Reset all timers." +(defvar org-timer-current-timer nil) +(defun org-timer-cancel-timer () + "Cancel the current timer." (interactive) - (mapc (lambda(timer) - (when (eval timer) - (cancel-timer timer) - (setq timer nil))) - '(org-timer-timer1 - org-timer-timer2 - org-timer-timer3)) - (message "All timers reset")) + (when (eval org-timer-current-timer) + (run-hooks 'org-timer-cancel-hook) + (cancel-timer org-timer-current-timer) + (setq org-timer-current-timer nil)) + (message "Last timer canceled")) (defun org-timer-show-remaining-time () "Display the remaining time before the timer ends." (interactive) (require 'time) - (if (and (not org-timer-timer1) - (not org-timer-timer2) - (not org-timer-timer3)) + (if (not org-timer-current-timer) (message "No timer set") (let* ((rtime (decode-time - (time-subtract (timer--time org-timer-last-timer) + (time-subtract (timer--time org-timer-current-timer) (current-time)))) (rsecs (nth 0 rtime)) (rmins (nth 1 rtime))) - (message "%d minutes %d seconds left before next time out" + (message "%d minute(s) %d seconds left before next time out" rmins rsecs)))) ;;;###autoload @@ -311,16 +323,15 @@ (org-get-heading)) (t (error "Not in an Org buffer")))) timer-set) - (mapcar (lambda(timer) - (when (not (or (eval timer) timer-set)) - (setq timer-set t) - (setq org-timer-last-timer - (run-with-timer - secs nil 'org-notify (format "%s: time out" hl) t)) - (set timer org-timer-last-timer))) - '(org-timer-timer1 - org-timer-timer2 - org-timer-timer3))))) + (if org-timer-current-timer + (error "You cannot run several timers at the same time") + (setq org-timer-current-timer + (run-with-timer + secs nil `(lambda () + (setq org-timer-current-timer nil) + (org-notify ,(format "%s: time out" hl) t) + (run-hooks 'org-timer-done-hook)))) + (run-hooks 'org-timer-set-hook))))) (provide 'org-timer) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-vm.el --- a/lisp/org/org-vm.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-vm.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-w3m.el --- a/lisp/org/org-w3m.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-w3m.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Andy Stewart ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-wl.el --- a/lisp/org/org-wl.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-wl.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -104,6 +104,10 @@ (subject (let (wl-thr-indent-string wl-parent-message-entity) (wl-summary-line-subject))) desc link) + ;; remove text properties of subject string to avoid possible bug + ;; when formatting the subject + (set-text-properties 0 (length subject) nil subject) + (org-store-link-props :type "wl" :from from :to to :subject subject :message-id message-id) (setq message-id (org-remove-angle-brackets message-id)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org-xoxo.el --- a/lisp/org/org-xoxo.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org-xoxo.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -43,6 +43,7 @@ "Export the org buffer as XOXO. The XOXO buffer is named *xoxo-*" (interactive (list (current-buffer))) + (run-hooks 'org-export-first-hook) ;; A quickie abstraction ;; Output everything as XOXO diff -r e56f669f17ce -r fe07c47cf7a7 lisp/org/org.el --- a/lisp/org/org.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/org/org.el Thu May 13 15:13:52 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -85,6 +85,7 @@ (require 'easymenu) (require 'org-macs) +(require 'org-entities) (require 'org-compat) (require 'org-faces) (require 'org-list) @@ -95,7 +96,7 @@ ;;; Version -(defconst org-version "6.33x" +(defconst org-version "6.35i" "The version number of the file org.el.") (defun org-version (&optional here) @@ -169,7 +170,7 @@ (let ((a (member 'org-infojs org-modules))) (and a (setcar a 'org-jsinfo)))) -(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) +(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) "Modules that should always be loaded together with org.el. If a description starts with , the file is not part of Emacs and loading it will require that you have downloaded and properly installed @@ -188,6 +189,8 @@ (const :tag " bbdb: Links to BBDB entries" org-bbdb) (const :tag " bibtex: Links to BibTeX entries" org-bibtex) (const :tag " crypt: Encryption of subtrees" org-crypt) + (const :tag " ctags: Access to Emacs tags with links" org-ctags) + (const :tag " docview: Links to doc-view buffers" org-docview) (const :tag " gnus: Links to GNUS folders/messages" org-gnus) (const :tag " id: Global IDs for identifying entries" org-id) (const :tag " info: Links to Info nodes" org-info) @@ -228,10 +231,10 @@ (const :tag "C man: Support for links to manpages in Org-mode" org-man) (const :tag "C mtags: Support for muse-like tags" org-mtags) (const :tag "C panel: Simple routines for us with bad memory" org-panel) - (const :tag "C R: Computation using the R language" org-R) (const :tag "C registry: A registry for Org-mode links" org-registry) (const :tag "C org2rem: Convert org appointments into reminders" org2rem) (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) + (const :tag "C secretary: Team management with org-mode" org-secretary) (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks) (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) @@ -239,7 +242,7 @@ (repeat :tag "External packages" :inline t (symbol :tag "Package")))) (defcustom org-support-shift-select nil - "Non-nil means, make shift-cursor commands select text when possible. + "Non-nil means make shift-cursor commands select text when possible. In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start selecting a region, or enlarge thusly regions started in this way. @@ -287,7 +290,7 @@ :group 'org) (defcustom org-startup-folded t - "Non-nil means, entering Org-mode will switch to OVERVIEW. + "Non-nil means entering Org-mode will switch to OVERVIEW. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -303,14 +306,14 @@ (const :tag "show everything, even drawers" showeverything))) (defcustom org-startup-truncated t - "Non-nil means, entering Org-mode will set `truncate-lines'. + "Non-nil means entering Org-mode will set `truncate-lines'. This is useful since some lines containing links can be very long and uninteresting. Also tables look terrible when wrapped." :group 'org-startup :type 'boolean) (defcustom org-startup-indented nil - "Non-nil means, turn on `org-indent-mode' on startup. + "Non-nil means turn on `org-indent-mode' on startup. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -321,8 +324,17 @@ (const :tag "Not" nil) (const :tag "Globally (slow on startup in large files)" t))) +(defcustom org-startup-with-beamer-mode nil + "Non-nil means turn on `org-beamer-mode' on startup. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: beamer" + :group 'org-startup + :type 'boolean) + (defcustom org-startup-align-all-tables nil - "Non-nil means, align all tables when visiting a file. + "Non-nil means align all tables when visiting a file. This is useful when the column width in tables is forced with cookies in table fields. Such tables will look correct only after the first re-align. This can also be configured on a per-file basis by adding one of @@ -513,7 +525,7 @@ "Contexts for the reveal options.") (defcustom org-show-hierarchy-above '((default . t)) - "Non-nil means, show full hierarchy when revealing a location. + "Non-nil means show full hierarchy when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the hierarchy of headings above the exposed location is shown. @@ -533,7 +545,7 @@ :type org-context-choice) (defcustom org-show-following-heading '((default . nil)) - "Non-nil means, show following heading when revealing a location. + "Non-nil means show following heading when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the heading following the match is shown. @@ -546,7 +558,7 @@ :type org-context-choice) (defcustom org-show-siblings '((default . nil) (isearch t)) - "Non-nil means, show all sibling heading when revealing a location. + "Non-nil means show all sibling heading when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the sibling of the current entry heading are all made visible. If `org-show-hierarchy-above' is t, @@ -562,7 +574,7 @@ :type org-context-choice) (defcustom org-show-entry-below '((default . nil)) - "Non-nil means, show the entry below a headline when revealing a location. + "Non-nil means show the entry below a headline when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the text below the headline that is exposed is also shown. @@ -593,7 +605,7 @@ (const :tag "One dedicated frame" dedicated-frame))) (defcustom org-use-speed-commands nil - "Non-nil means, activate single letter commands at beginning of a headline. + "Non-nil means activate single letter commands at beginning of a headline. This may also be a function to test for appropriate locations where speed commands should be active." :group 'org-structure @@ -630,7 +642,7 @@ :group 'org-structure) (defcustom org-cycle-skip-children-state-if-no-children t - "Non-nil means, skip CHILDREN state in entries that don't have any." + "Non-nil means skip CHILDREN state in entries that don't have any." :group 'org-cycle :type 'boolean) @@ -667,7 +679,7 @@ :type '(repeat (string :tag "Drawer Name"))) (defcustom org-hide-block-startup nil - "Non-nil means, , entering Org-mode will fold all blocks. + "Non-nil means entering Org-mode will fold all blocks. This can also be set in on a per-file basis with #+STARTUP: hideblocks @@ -689,7 +701,7 @@ :type 'boolean) (defcustom org-cycle-level-after-item/entry-creation t - "Non-nil means, cycle entry level or item indentation in new empty entries. + "Non-nil means cycle entry level or item indentation in new empty entries. When the cursor is at the end of an empty headline, i.e with only stars and maybe a TODO keyword, TAB will then switch the entry to become a child, @@ -726,7 +738,7 @@ headline, this empty line is hidden when the subtree is folded. Org-mode will leave (exactly) one empty line visible if the number of empty lines is equal or larger to the number given in this variable. -So the default 2 means, at least 2 empty lines after the end of a subtree +So the default 2 means at least 2 empty lines after the end of a subtree are needed to produce free space between a collapsed subtree and the following headline. @@ -767,7 +779,7 @@ :group 'org-structure) (defcustom org-odd-levels-only nil - "Non-nil means, skip even levels and only use odd levels for the outline. + "Non-nil means skip even levels and only use odd levels for the outline. This has the effect that two stars are being added/taken away in promotion/demotion commands. It also influences how levels are handled by the exporters. @@ -779,11 +791,11 @@ #+STARTUP: odd #+STARTUP: oddeven" :group 'org-edit-structure - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-adapt-indentation t - "Non-nil means, adapt indentation to outline node level. + "Non-nil means adapt indentation to outline node level. When this variable is set, Org assumes that you write outlines by indenting text in each node to align with the headline (after the stars). @@ -857,7 +869,7 @@ :type 'boolean) (defcustom org-yank-folded-subtrees t - "Non-nil means, when yanking subtrees, fold them. + "Non-nil means when yanking subtrees, fold them. If the kill is a single subtree, or a sequence of subtrees, i.e. if it starts with a heading and all other headings in it are either children or siblings, then fold all the subtrees. However, do this only if no @@ -866,14 +878,14 @@ :type 'boolean) (defcustom org-yank-adjusted-subtrees nil - "Non-nil means, when yanking subtrees, adjust the level. + "Non-nil means when yanking subtrees, adjust the level. With this setting, `org-paste-subtree' is used to insert the subtree, see this function for details." :group 'org-edit-structure :type 'boolean) (defcustom org-M-RET-may-split-line '((default . t)) - "Non-nil means, M-RET will split the line at the cursor position. + "Non-nil means M-RET will split the line at the cursor position. When nil, it will go to the end of the line before making a new line. You may also set this option in a different way for different @@ -900,7 +912,7 @@ (defcustom org-insert-heading-respect-content nil - "Non-nil means, insert new headings after the current subtree. + "Non-nil means insert new headings after the current subtree. When nil, the new heading is created directly after the current line. The commands \\[org-insert-heading-respect-content] and \\[org-insert-todo-heading-respect-content] turn this variable on @@ -932,8 +944,8 @@ :type 'hook) (defcustom org-enable-fixed-width-editor t - "Non-nil means, lines starting with \":\" are treated as fixed-width. -This currently only means, they are never auto-wrapped. + "Non-nil means lines starting with \":\" are treated as fixed-width. +This currently only means they are never auto-wrapped. When nil, such lines will be treated like ordinary lines. See also the QUOTE keyword." :group 'org-edit-structure @@ -941,7 +953,7 @@ (defcustom org-goto-auto-isearch t - "Non-nil means, typing characters in org-goto starts incremental search." + "Non-nil means typing characters in org-goto starts incremental search." :group 'org-edit-structure :type 'boolean) @@ -951,14 +963,14 @@ :group 'org-structure) (defcustom org-highlight-sparse-tree-matches t - "Non-nil means, highlight all matches that define a sparse tree. + "Non-nil means highlight all matches that define a sparse tree. The highlights will automatically disappear the next time the buffer is changed by an edit command." :group 'org-sparse-trees :type 'boolean) (defcustom org-remove-highlights-with-change t - "Non-nil means, any change to the buffer will remove temporary highlights. + "Non-nil means any change to the buffer will remove temporary highlights. Such highlights are created by `org-occur' and `org-clock-display'. When nil, `C-c C-c needs to be used to get rid of the highlights. The highlights created by `org-preview-latex-fragment' always need @@ -992,7 +1004,7 @@ :group 'org) (defcustom org-enable-table-editor 'optimized - "Non-nil means, lines starting with \"|\" are handled by the table editor. + "Non-nil means lines starting with \"|\" are handled by the table editor. When nil, such lines will be treated like ordinary lines. When equal to the symbol `optimized', the table editor will be optimized to @@ -1031,7 +1043,7 @@ :type 'boolean) (defcustom org-table-tab-recognizes-table.el t - "Non-nil means, TAB will automatically notice a table.el table. + "Non-nil means TAB will automatically notice a table.el table. When it sees such a table, it moves point into it and - if necessary - calls `table-recognize-table'." :group 'org-table-editing @@ -1076,7 +1088,7 @@ (function))))) (defcustom org-descriptive-links t - "Non-nil means, hide link part and only show description of bracket links. + "Non-nil means hide link part and only show description of bracket links. Bracket links are like [[link][description]]. This variable sets the initial state in new org-mode buffers. The setting can then be toggled on a per-buffer basis from the Org->Hyperlinks menu." @@ -1173,7 +1185,7 @@ :type 'regexp) (defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id - "Non-nil means, storing a link to an Org file will use entry IDs. + "Non-nil means storing a link to an Org file will use entry IDs. Note that before this variable is even considered, org-id must be loaded, so please customize `org-modules' and turn it on. @@ -1213,7 +1225,7 @@ (const :tag "Do not use ID to create link" nil))) (defcustom org-context-in-file-links t - "Non-nil means, file links from `org-store-link' contain context. + "Non-nil means file links from `org-store-link' contain context. A search string will be added to the file name with :: as separator and used to find the context when the link is activated by the command `org-open-at-point'. @@ -1223,7 +1235,7 @@ :type 'boolean) (defcustom org-keep-stored-link-after-insertion nil - "Non-nil means, keep link in list for entire session. + "Non-nil means keep link in list for entire session. The command `org-store-link' adds a link pointing to the current location to an internal list. These links accumulate during a session. @@ -1260,7 +1272,7 @@ :type 'hook) (defcustom org-tab-follows-link nil - "Non-nil means, on links TAB will follow the link. + "Non-nil means on links TAB will follow the link. Needs to be set before org.el is loaded. This really should not be used, it does not make sense, and the implementation is bad." @@ -1268,14 +1280,14 @@ :type 'boolean) (defcustom org-return-follows-link nil - "Non-nil means, on links RET will follow the link. + "Non-nil means on links RET will follow the link. Needs to be set before org.el is loaded." :group 'org-link-follow :type 'boolean) (defcustom org-mouse-1-follows-link (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) - "Non-nil means, mouse-1 on a link will follow the link. + "Non-nil means mouse-1 on a link will follow the link. A longer mouse click will still set point. Does not work on XEmacs. Needs to be set before org.el is loaded." :group 'org-link-follow @@ -1328,7 +1340,7 @@ (const find-file-other-frame))))) (defcustom org-display-internal-link-with-indirect-buffer nil - "Non-nil means, use indirect buffer to display infile links. + "Non-nil means use indirect buffer to display infile links. Activating internal links (from one location in a file to another location in the same file) normally just jumps to the location. When the link is activated with a C-u prefix (or with mouse-3), the link is displayed in @@ -1339,7 +1351,7 @@ :type 'boolean) (defcustom org-open-non-existing-files nil - "Non-nil means, `org-open-file' will open non-existing files. + "Non-nil means `org-open-file' will open non-existing files. When nil, an error will be generated. This variable applies only to external applications because they might choke on non-existing files. If the link is to a file that @@ -1348,7 +1360,7 @@ :type 'boolean) (defcustom org-open-directory-means-index-dot-org nil - "Non-nil means, a link to a directory really means to index.org. + "Non-nil means a link to a directory really means to index.org. When nil, following a directory link will run dired or open a finder/explorer window on that directory." :group 'org-link-follow @@ -1368,7 +1380,7 @@ (cons :tag "other" (function) (repeat :tag "argument" sexp)))) (defcustom org-confirm-shell-link-function 'yes-or-no-p - "Non-nil means, ask for confirmation before executing shell links. + "Non-nil means ask for confirmation before executing shell links. Shell links can be dangerous: just think about a link [[shell:rm -rf ~/*][Google Search]] @@ -1385,7 +1397,7 @@ (const :tag "no confirmation (dangerous)" nil))) (defcustom org-confirm-elisp-link-function 'yes-or-no-p - "Non-nil means, ask for confirmation before executing Emacs Lisp links. + "Non-nil means ask for confirmation before executing Emacs Lisp links. Elisp links can be dangerous: just think about a link [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] @@ -1451,9 +1463,10 @@ extension. The entries in this list are cons cells where the car identifies files and the cdr the corresponding command. Possible values for the file identifier are - \"regex\" Regular expression matched against the file name. For backward - compatibility, this can also be a string with only alphanumeric - characters, which is then interpreted as an extension. + \"regex\" Regular expression matched against the file: link. For + backward compatibility, this can also be a string with only + alphanumeric characters, which is then interpreted as an + extension. `directory' Matches a directory `remote' Matches a remote file, accessible through tramp or efs. Remote files most likely should be visited through Emacs @@ -1482,9 +1495,13 @@ does define this command, but you can overrule/replace it here. string A command to be executed by a shell; %s will be replaced - by the path to the file. + by the path to the file. If the file identifier is a regex, + %n will be replaced by the match of the nth match group. sexp A Lisp form which will be evaluated. The file path will - be available in the Lisp variable `file'. + be available in the Lisp variable `file', the link itself + in the Lisp variable `link'. If the file identifier is a regex, + the original match data will be restored, so subexpression + matches are accessible using (match-string n link). For more examples, see the system specific constants `org-file-apps-defaults-macosx' `org-file-apps-defaults-windowsnt' @@ -1559,7 +1576,7 @@ :type 'integer) (defcustom org-reverse-note-order nil - "Non-nil means, store new notes at the beginning of a file or entry. + "Non-nil means store new notes at the beginning of a file or entry. When nil, new notes will be filed to the end of a file or entry. This can also be a list with cons cells of regular expressions that are matched against file names, and values." @@ -1571,13 +1588,40 @@ (repeat :tag "By file name regexp" (cons regexp boolean)))) +(defcustom org-log-refile nil + "Information to record when a task is refiled. + +Possible values are: + +nil Don't add anything +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologrefile + #+STARTUP: logrefile + #+STARTUP: lognoterefile + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords. + +When bulk-refiling from the agenda, the value `note' is forbidden and +will temporarily be changed to `time'." + :group 'org-refile + :group 'org-progress + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record timestamp" time) + (const :tag "Record timestamp with note." note))) + (defcustom org-refile-targets nil "Targets for refiling entries with \\[org-refile]. This is list of cons cells. Each cell contains: - a specification of the files to be considered, either a list of files, or a symbol whose function or variable value will be used to retrieve a file name or a list of file names. If you use `org-agenda-files' for - that, all agenda files will be scanned for targets. Nil means, consider + that, all agenda files will be scanned for targets. Nil means consider headings in the current buffer. - A specification of how to find candidate refile targets. This may be any of: @@ -1629,7 +1673,7 @@ :type 'function) (defcustom org-refile-use-outline-path nil - "Non-nil means, provide refile targets as paths. + "Non-nil means provide refile targets as paths. So a level 3 headline will be available as level1/level2/level3. When the value is `file', also include the file name (without directory) @@ -1645,7 +1689,7 @@ (const :tag "Start with full file path" full-file-path))) (defcustom org-outline-path-complete-in-steps t - "Non-nil means, complete the outline path in hierarchical steps. + "Non-nil means complete the outline path in hierarchical steps. When Org-mode uses the refile interface to select an outline path \(see variable `org-refile-use-outline-path'), the completion of the path can be done is a single go, or if can be done in steps down @@ -1657,7 +1701,7 @@ :type 'boolean) (defcustom org-refile-allow-creating-parent-nodes nil - "Non-nil means, allow to create new nodes as refile targets. + "Non-nil means allow to create new nodes as refile targets. New nodes are then created by adding \"/new node name\" to the completion of an existing node. When the value of this variable is `confirm', new node creation must be confirmed by the user (recommended) @@ -1793,7 +1837,7 @@ (const type))) (defcustom org-use-fast-todo-selection t - "Non-nil means, use the fast todo selection scheme with C-c C-t. + "Non-nil means use the fast todo selection scheme with C-c C-t. This variable describes if and under what circumstances the cycling mechanism for TODO keywords will be replaced by a single-key, direct selection scheme. @@ -1817,7 +1861,7 @@ (const :tag "Only with C-u C-c C-t" prefix))) (defcustom org-provide-todo-statistics t - "Non-nil means, update todo statistics after insert and toggle. + "Non-nil means update todo statistics after insert and toggle. ALL-HEADLINES means update todo statistics by including headlines with no TODO keyword as well, counting them as not done. A list of TODO keywords means the same, but skip keywords that are @@ -1834,7 +1878,7 @@ (other :tag "No TODO statistics" nil))) (defcustom org-hierarchical-todo-statistics t - "Non-nil means, TODO statistics covers just direct children. + "Non-nil means TODO statistics covers just direct children. When nil, all entries in the subtree are considered. This has only an effect if `org-provide-todo-statistics' is set. To set this to nil for only a single subtree, use a COOKIE_DATA @@ -1879,7 +1923,7 @@ :to new state, like in :from") (defcustom org-enforce-todo-dependencies nil - "Non-nil means, undone TODO entries will block switching the parent to DONE. + "Non-nil means undone TODO entries will block switching the parent to DONE. Also, if a parent has an :ORDERED: property, switching an entry to DONE will be blocked if any prior sibling is not yet done. Finally, if the parent is blocked because of ordered siblings of its own, @@ -1898,7 +1942,7 @@ :type 'boolean) (defcustom org-enforce-todo-checkbox-dependencies nil - "Non-nil means, unchecked boxes will block switching the parent to DONE. + "Non-nil means unchecked boxes will block switching the parent to DONE. When this is nil, checkboxes have no influence on switching TODO states. When non-nil, you first need to check off all check boxes before the TODO entry can be switched to DONE. @@ -1916,7 +1960,7 @@ :type 'boolean) (defcustom org-treat-insert-todo-heading-as-state-change nil - "Non-nil means, inserting a TODO heading is treated as state change. + "Non-nil means inserting a TODO heading is treated as state change. So when the command \\[org-insert-todo-heading] is used, state change logging will apply if appropriate. When nil, the new TODO item will be inserted directly, and no logging will take place." @@ -1924,7 +1968,7 @@ :type 'boolean) (defcustom org-treat-S-cursor-todo-selection-as-state-change t - "Non-nil means, switching TODO states with S-cursor counts as state change. + "Non-nil means switching TODO states with S-cursor counts as state change. This is the default behavior. However, setting this to nil allows a convenient way to select a TODO state and bypass any logging associated with that." @@ -2028,7 +2072,7 @@ (const :tag "Record timestamp with note." note))) (defcustom org-log-note-clock-out nil - "Non-nil means, record a note when clocking out of an item. + "Non-nil means record a note when clocking out of an item. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -2039,7 +2083,7 @@ :type 'boolean) (defcustom org-log-done-with-time t - "Non-nil means, the CLOSED time stamp will contain date and time. + "Non-nil means the CLOSED time stamp will contain date and time. When nil, only the date will be recorded." :group 'org-progress :type 'boolean) @@ -2049,7 +2093,10 @@ (state . "State %-12s from %-12S %t") (note . "Note taken on %t") (reschedule . "Rescheduled from %S on %t") + (delschedule . "Not scheduled, was %S on %t") (redeadline . "New deadline from %S on %t") + (deldeadline . "Removed deadline, was %S on %t") + (refile . "Refiled on %t") (clock-out . "")) "Headings for notes added to entries. The value is an alist, with the car being a symbol indicating the note @@ -2059,7 +2106,10 @@ %s will be replaced by the new TODO state, in double quotes. %S will be replaced by the old TODO state, in double quotes. %u will be replaced by the user name. -%U will be replaced by the full user name." +%U will be replaced by the full user name. + +In fact, it is not a good idea to change the `state' entry, because +agenda log mode depends on the format of these entries." :group 'org-todo :group 'org-progress :type '(list :greedy t @@ -2069,14 +2119,17 @@ state) string) (cons (const :tag "Heading when just taking a note" note) string) (cons (const :tag "Heading when clocking out" clock-out) string) + (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string) (cons (const :tag "Heading when rescheduling" reschedule) string) - (cons (const :tag "Heading when changing deadline" redeadline) string))) + (cons (const :tag "Heading when changing deadline" redeadline) string) + (cons (const :tag "Heading when deleting a deadline" deldeadline) string) + (cons (const :tag "Heading when refiling" refile) string))) (unless (assq 'note org-log-note-headings) (push '(note . "%t") org-log-note-headings)) (defcustom org-log-into-drawer nil - "Non-nil means, insert state change notes and time stamps into a drawer. + "Non-nil means insert state change notes and time stamps into a drawer. When nil, state changes notes will be inserted after the headline and any scheduling and clock lines, but not inside a drawer. @@ -2112,7 +2165,7 @@ (t p)))) (defcustom org-log-state-notes-insert-after-drawers nil - "Non-nil means, insert state change notes after any drawers in entry. + "Non-nil means insert state change notes after any drawers in entry. Only the drawers that *immediately* follow the headline and the deadline/scheduled line are skipped. When nil, insert notes right after the heading and perhaps the line @@ -2125,14 +2178,14 @@ :type 'boolean) (defcustom org-log-states-order-reversed t - "Non-nil means, the latest state change note will be directly after heading. -When nil, the notes will be orderer according to time." + "Non-nil means the latest state note will be directly after heading. +When nil, the state change notes will be ordered according to time." :group 'org-todo :group 'org-progress :type 'boolean) (defcustom org-log-repeat 'time - "Non-nil means, record moving through the DONE state when triggering repeat. + "Non-nil means record moving through the DONE state when triggering repeat. An auto-repeating task is immediately switched back to TODO when marked DONE. If you are not logging state changes (by adding \"@\" or \"!\" to the TODO keyword definition), or set `org-log-done' to @@ -2165,7 +2218,7 @@ :group 'org-todo) (defcustom org-enable-priority-commands t - "Non-nil means, priority commands are active. + "Non-nil means priority commands are active. When nil, these commands will be disabled, so that you never accidentally set a priority." :group 'org-priorities @@ -2190,7 +2243,7 @@ :type 'character) (defcustom org-priority-start-cycle-with-default t - "Non-nil means, start with default priority when starting to cycle. + "Non-nil means start with default priority when starting to cycle. When this is nil, the first step in the cycle will be (depending on the command used) one higher or lower that the default priority." :group 'org-priorities @@ -2202,7 +2255,7 @@ :group 'org) (defcustom org-insert-labeled-timestamps-at-point nil - "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point. + "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point. When nil, these labeled time stamps are forces into the second line of an entry, just after the headline. When scheduling from the global TODO list, the time stamp will always be forced into the second line." @@ -2243,7 +2296,7 @@ org-time-stamp-rounding-minutes))) (defcustom org-display-custom-times nil - "Non-nil means, overlay custom formats over all time stamps. + "Non-nil means overlay custom formats over all time stamps. The formats are defined through the variable `org-time-stamp-custom-formats'. To turn this on on a per-file basis, insert anywhere in the file: #+STARTUP: customtime" @@ -2300,7 +2353,7 @@ :type 'integer) (defcustom org-read-date-prefer-future t - "Non-nil means, assume future for incomplete date input from user. + "Non-nil means assume future for incomplete date input from user. This affects the following situations: 1. The user gives a month but not a year. For example, if it is april and you enter \"feb 2\", this will be read @@ -2327,13 +2380,13 @@ (const :tag "Check month, day, and time" time))) (defcustom org-read-date-display-live t - "Non-nil means, display current interpretation of date prompt live. + "Non-nil means display current interpretation of date prompt live. This display will be in an overlay, in the minibuffer." :group 'org-time :type 'boolean) (defcustom org-read-date-popup-calendar t - "Non-nil means, pop up a calendar when prompting for a date. + "Non-nil means pop up a calendar when prompting for a date. In the calendar, the date can be selected with mouse-1. However, the minibuffer will also be active, and you can simply enter the date as well. When nil, only the minibuffer will be available." @@ -2366,13 +2419,13 @@ :type 'integer) (defcustom org-edit-timestamp-down-means-later nil - "Non-nil means, S-down will increase the time in a time stamp. + "Non-nil means S-down will increase the time in a time stamp. When nil, S-up will increase." :group 'org-time :type 'boolean) (defcustom org-calendar-follow-timestamp-change t - "Non-nil means, make the calendar window follow timestamp changes. + "Non-nil means make the calendar window follow timestamp changes. When a timestamp is modified and the calendar window is visible, it will be moved to the new date." :group 'org-time @@ -2424,6 +2477,20 @@ (const :tag "End radio group" (:endgroup)) (const :tag "New line" (:newline))))) +(defcustom org-complete-tags-always-offer-all-agenda-tags nil + "If non-nil, always offer completion for all tags of all agenda files. +Instead of customizing this variable directly, you might want to +set it locally for remember buffers, because there no list of +tags in that file can be created dynamically (there are none). + + (add-hook 'org-remember-mode-hook + (lambda () + (set (make-local-variable + 'org-complete-tags-always-offer-all-agenda-tags) + t)))" + :group 'org-tags + :type 'boolean) + (defvar org-file-tags nil "List of tags that can be inherited by all entries in the file. The tags will be inherited if the variable `org-use-tag-inheritance' @@ -2431,7 +2498,7 @@ This variable is populated from #+FILETAGS lines.") (defcustom org-use-fast-tag-selection 'auto - "Non-nil means, use fast tag selection scheme. + "Non-nil means use fast tag selection scheme. This is a special interface to select and deselect tags with single keys. When nil, fast selection is never used. When the symbol `auto', fast selection is used if and only if selection @@ -2446,7 +2513,7 @@ (const :tag "When selection characters are configured" 'auto))) (defcustom org-fast-tag-selection-single-key nil - "Non-nil means, fast tag selection exits after first change. + "Non-nil means fast tag selection exits after first change. When nil, you have to press RET to exit it. During fast tag selection, you can toggle this flag with `C-c'. This variable can also have the value `expert'. In this case, the window @@ -2458,7 +2525,7 @@ (const :tag "Expert" expert))) (defvar org-fast-tag-selection-include-todo nil - "Non-nil means, fast tags selection interface will also offer TODO states. + "Non-nil means fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") (defcustom org-tags-column (if (featurep 'xemacs) -76 -77) @@ -2470,7 +2537,7 @@ :type 'integer) (defcustom org-auto-align-tags t - "Non-nil means, realign tags after pro/demotion of TODO state change. + "Non-nil means realign tags after pro/demotion of TODO state change. These operations change the length of a headline and therefore shift the tags around. With this options turned on, after each such operation the tags are again aligned to `org-tags-column'." @@ -2478,7 +2545,7 @@ :type 'boolean) (defcustom org-use-tag-inheritance t - "Non-nil means, tags in levels apply also for sublevels. + "Non-nil means tags in levels apply also for sublevels. When nil, only the tags directly given in a specific line apply there. This may also be a list of tags that should be inherited, or a regexp that matches tags that should be inherited. Additional control is possible @@ -2569,7 +2636,7 @@ :type 'string) (defcustom org-use-property-inheritance nil - "Non-nil means, properties apply also for sublevels. + "Non-nil means properties apply also for sublevels. This setting is chiefly used during property searches. Turning it on can cause significant overhead when doing a search, which is why it is not @@ -2713,7 +2780,9 @@ If the value of the variable is not a list but a single file name, then the list of agenda files is actually stored and maintained in that file, one -agenda file per line." +agenda file per line. In this file paths can be given relative to +`org-directory'. Tilde expansion and environment variable substitution +are also made." :group 'org-agenda :type '(choice (repeat :tag "List of files and directories" file) @@ -2831,13 +2900,19 @@ :group 'org-latex :type 'plist) +(defcustom org-format-latex-signal-error t + "Non-nil means signal an error when image creation of LaTeX snippets fails. +When nil, just push out a message." + :group 'org-latex + :type 'boolean) + (defcustom org-format-latex-header "\\documentclass{article} -\\usepackage{amssymb} \\usepackage[usenames]{color} \\usepackage{amsmath} -\\usepackage{latexsym} \\usepackage[mathscr]{eucal} \\pagestyle{empty} % do not remove +\[PACKAGES] +\[DEFAULT-PACKAGES] % The settings below are copied from fullpage.sty \\setlength{\\textwidth}{\\paperwidth} \\addtolength{\\textwidth}{-3cm} @@ -2853,25 +2928,83 @@ \\addtolength{\\topmargin}{-2.54cm}" "The document header used for processing LaTeX fragments. It is imperative that this header make sure that no page number -appears on the page." +appears on the page. The package defined in the variables +`org-export-latex-default-packages-alist' and `org-export-latex-packages-alist' +will either replace the placeholder \"[PACKAGES]\" in this header, or they +will be appended." :group 'org-latex :type 'string) -;; The following variable is defined here because is it also used +(defvar org-format-latex-header-extra nil) + +;; The following variables are defined here because is it also used ;; when formatting latex fragments. Originally it was part of the ;; LaTeX exporter, which is why the name includes "export". -(defcustom org-export-latex-packages-alist nil - "Alist of packages to be inserted in the header. -Each cell is of the format \( \"option\" . \"package\" \)." +(defcustom org-export-latex-default-packages-alist + '(("AUTO" "inputenc") + ("T1" "fontenc") + ("" "fixltx2e") + ("" "graphicx") + ("" "longtable") + ("" "float") + ("" "wrapfig") + ("" "soul") + ("" "t1enc") + ("" "textcomp") + ("" "marvosym") + ("" "wasysym") + ("" "latexsym") + ("" "amssymb") + ("" "hyperref") + "\\tolerance=1000" + ) + "Alist of default packages to be inserted in the header. +Change this only if one of the packages here causes an incompatibility +with another package you are using. +The packages in this list are needed by one part or another of Org-mode +to function properly. + +- inputenc, fontenc, t1enc: for basic font and character selection +- textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used + for interpreting the entities in `org-entities'. You can skip some of these + packages if you don't use any of the symbols in it. +- graphicx: for including images +- float, wrapfig: for figure placement +- longtable: for long tables +- hyperref: for cross references + +Therefore you should not modify this variable unless you know what you +are doing. The one reason to change it anyway is that you might be loading +some other package that conflicts with one of the default packages. +Each cell is of the format \( \"options\" \"package\" \)." :group 'org-export-latex :type '(repeat - (list - (string :tag "option") - (string :tag "package")))) - -(defgroup org-font-lock nil - "Font-lock settings for highlighting in Org-mode." - :tag "Org Font Lock" + (choice + (string :tag "A line of LaTeX") + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package"))))) + +(defcustom org-export-latex-packages-alist nil + "Alist of packages to be inserted in every LaTeX the header. +These will be inserted after `org-export-latex-default-packages-alist'. +Each cell is of the format \( \"options\" \"package\" \). +Make sure that you only lis packages here which: +- you want in every file +- do not conflict with the default packages in + `org-export-latex-default-packages-alist' +- do not conflict with the setup in `org-format-latex-header'." + :group 'org-export-latex + :type '(repeat + (choice + (string :tag "A line of LaTeX") + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package"))))) + +(defgroup org-appearance nil + "Settings for Org-mode appearance." + :tag "Org Appearance" :group 'org) (defcustom org-level-color-stars-only nil @@ -2879,11 +3012,11 @@ When nil, the entire headline is fontified. Changing it requires restart of `font-lock-mode' to become effective also in regions already fontified." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-hide-leading-stars nil - "Non-nil means, hide the first N-1 stars in a headline. + "Non-nil means hide the first N-1 stars in a headline. This works by using the face `org-hide' for these stars. This face is white for a light background, and black for a dark background. You may have to customize the face `org-hide' to @@ -2895,38 +3028,49 @@ #+STARTUP: hidestars #+STARTUP: showstars" - :group 'org-font-lock - :type 'boolean) + :group 'org-appearance + :type 'boolean) + +(defcustom org-hidden-keywords nil + "List of keywords that should be hidden when typed in the org buffer. +For example, add #+TITLE to this list in order to make the +document title appear in the buffer without the initial #+TITLE: +keyword." + :group 'org-appearance + :type '(set (const :tag "#+AUTHOR" author) + (const :tag "#+DATE" date) + (const :tag "#+EMAIL" email) + (const :tag "#+TITLE" title))) (defcustom org-fontify-done-headline nil - "Non-nil means, change the face of a headline if it is marked DONE. + "Non-nil means change the face of a headline if it is marked DONE. Normally, only the TODO/DONE keyword indicates the state of a headline. When this is non-nil, the headline after the keyword is set to the `org-headline-done' as an additional indication." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-fontify-emphasized-text t "Non-nil means fontify *bold*, /italic/ and _underlined_ text. Changing this variable requires a restart of Emacs to take effect." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-fontify-whole-heading-line nil "Non-nil means fontify the whole line for headings. This is useful when setting a background color for the org-level-* faces." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-highlight-latex-fragments-and-specials nil - "Non-nil means, fontify what is treated specially by the exporters." - :group 'org-font-lock + "Non-nil means fontify what is treated specially by the exporters." + :group 'org-appearance :type 'boolean) (defcustom org-hide-emphasis-markers nil "Non-nil mean font-lock should hide the emphasis marker characters." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defvar org-emph-re nil @@ -3007,7 +3151,7 @@ newline The maximum number of newlines allowed in an emphasis exp. Use customize to modify this, or restart Emacs after changing it." - :group 'org-font-lock + :group 'org-appearance :set 'org-set-emph-re :type '(list (sexp :tag "Allowed chars in pre ") @@ -3033,7 +3177,7 @@ Emacs buffers, and the HTML tags to be used for this. For LaTeX export, see the variable `org-export-latex-emphasis-alist'. Use customize to modify this, or restart Emacs after changing it." - :group 'org-font-lock + :group 'org-appearance :set 'org-set-emph-re :type '(repeat (list @@ -3058,7 +3202,7 @@ :group 'org) (defcustom org-completion-use-ido nil - "Non-nil means, use ido completion wherever possible. + "Non-nil means use ido completion wherever possible. Note that `ido-mode' must be active for this variable to be relevant. If you decide to turn this variable on, you might well want to turn off `org-outline-path-complete-in-steps'. @@ -3067,7 +3211,7 @@ :type 'boolean) (defcustom org-completion-use-iswitchb nil - "Non-nil means, use iswitchb completion wherever possible. + "Non-nil means use iswitchb completion wherever possible. Note that `iswitchb-mode' must be active for this variable to be relevant. If you decide to turn this variable on, you might well want to turn off `org-outline-path-complete-in-steps'. @@ -3077,7 +3221,7 @@ (defcustom org-completion-fallback-command 'hippie-expand "The expansion command called by \\[org-complete] in normal context. -Normal means, no org-mode-specific context." +Normal means no org-mode-specific context." :group 'org-completion :type 'function) @@ -3266,16 +3410,27 @@ '(org-export-as-ascii org-export-ascii-preprocess org-export-as-ascii-to-buffer org-replace-region-by-ascii org-export-region-as-ascii)) + (org-autoload "org-latex" + '(org-export-as-latex-batch org-export-as-latex-to-buffer + org-replace-region-by-latex org-export-region-as-latex + org-export-as-latex org-export-as-pdf + org-export-as-pdf-and-open)) (org-autoload "org-html" '(org-export-as-html-and-open org-export-as-html-batch org-export-as-html-to-buffer org-replace-region-by-html org-export-region-as-html org-export-as-html)) + (org-autoload "org-docbook" + '(org-export-as-docbook-batch org-export-as-docbook-to-buffer + org-replace-region-by-docbook org-export-region-as-docbook + org-export-as-docbook-pdf org-export-as-docbook-pdf-and-open + org-export-as-docbook)) (org-autoload "org-icalendar" '(org-export-icalendar-this-file org-export-icalendar-all-agenda-files org-export-icalendar-combine-agenda-files)) - (org-autoload "org-xoxo" '(org-export-as-xoxo))) + (org-autoload "org-xoxo" '(org-export-as-xoxo)) + (org-autoload "org-beamer" '(org-beamer-mode org-beamer-sectioning))) ;; Declare and autoload functions from org-agenda.el @@ -3486,7 +3641,7 @@ :type 'string) (defcustom org-agenda-skip-archived-trees t - "Non-nil means, the agenda will skip any items located in archived trees. + "Non-nil means the agenda will skip any items located in archived trees. An archived tree is a tree marked with the tag ARCHIVE. The use of this variable is no longer recommended, you should leave it at the value t. Instead, use the key `v' to cycle the archives-mode in the agenda." @@ -3495,13 +3650,13 @@ :type 'boolean) (defcustom org-columns-skip-archived-trees t - "Non-nil means, ignore archived trees when creating column view." + "Non-nil means ignore archived trees when creating column view." :group 'org-archive :group 'org-properties :type 'boolean) (defcustom org-cycle-open-archived-trees nil - "Non-nil means, `org-cycle' will open archived trees. + "Non-nil means `org-cycle' will open archived trees. An archived tree is a tree marked with the tag ARCHIVE. When nil, archived trees will stay folded. You can still open them with normal outline commands like `show-all', but not with the cycling commands." @@ -3544,8 +3699,9 @@ (let* ((re (concat ":" org-archive-tag ":"))) (goto-char beg) (while (re-search-forward re end t) - (and (org-on-heading-p) (org-flag-subtree t)) - (org-end-of-subtree t))))) + (when (org-on-heading-p) + (org-flag-subtree t) + (org-end-of-subtree t)))))) (defun org-flag-subtree (flag) (save-excursion @@ -3663,6 +3819,9 @@ (defvar org-planning-or-clock-line-re nil "Matches a line with planning or clock info.") (make-variable-buffer-local 'org-planning-or-clock-line-re) +(defvar org-all-time-keywords nil + "List of time keywords.") +(make-variable-buffer-local 'org-all-time-keywords) (defconst org-plain-time-of-day-regexp (concat @@ -3734,6 +3893,9 @@ ("logredeadline" org-log-redeadline time) ("lognoteredeadline" org-log-redeadline note) ("nologredeadline" org-log-redeadline nil) + ("logrefile" org-log-refile time) + ("lognoterefile" org-log-refile note) + ("nologrefile" org-log-refile nil) ("fninline" org-footnote-define-inline t) ("nofninline" org-footnote-define-inline nil) ("fnlocal" org-footnote-section nil) @@ -3747,7 +3909,8 @@ ("constSI" constants-unit-system SI) ("noptag" org-tag-persistent-alist nil) ("hideblocks" org-hide-block-startup t) - ("nohideblocks" org-hide-block-startup nil)) + ("nohideblocks" org-hide-block-startup nil) + ("beamer" org-startup-with-beamer-mode t)) "Variable associated with STARTUP options for org-mode. Each element is a list of three items: The startup options as written in the #+STARTUP line, the corresponding variable, and the value to @@ -3770,11 +3933,11 @@ (let ((re (org-make-options-regexp '("CATEGORY" "TODO" "COLUMNS" "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES" - "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE") + "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS") "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)")) (splitre "[ \t]+") kwds kws0 kwsa key log value cat arch tags const links hw dws - tail sep kws1 prio props ftags drawers + tail sep kws1 prio props ftags drawers beamer-p ext-setup-or-nil setup-contents (start 0)) (save-excursion (save-restriction @@ -3845,6 +4008,8 @@ (setq arch (replace-match "" t t value)) (remove-text-properties 0 (length arch) '(face t fontified t) arch)) + ((equal key "LATEX_CLASS") + (setq beamer-p (equal value "beamer"))) ((equal key "SETUPFILE") (setq setup-contents (org-file-contents (expand-file-name @@ -4032,6 +4197,10 @@ "\\|" org-deadline-string "\\|" org-closed-string "\\|" org-clock-string "\\)\\>\\)") + org-all-time-keywords + (mapcar (lambda (w) (substring w 0 -1)) + (list org-scheduled-string org-deadline-string + org-clock-string org-closed-string)) ) (org-compute-latex-and-specials-regexp) (org-set-font-lock-defaults)))) @@ -4072,30 +4241,24 @@ x)) list)) -;; FIXME: this could be done much better, using second characters etc. (defun org-assign-fast-keys (alist) "Assign fast keys to a keyword-key alist. Respect keys that are already there." - (let (new e k c c1 c2 (char ?a)) + (let (new e (alt ?0)) (while (setq e (pop alist)) - (cond - ((equal e '(:startgroup)) (push e new)) - ((equal e '(:endgroup)) (push e new)) - ((equal e '(:newline)) (push e new)) - (t - (setq k (car e) c2 nil) - (if (cdr e) - (setq c (cdr e)) - ;; automatically assign a character. - (setq c1 (string-to-char - (downcase (substring - k (if (= (string-to-char k) ?@) 1 0))))) - (if (or (rassoc c1 new) (rassoc c1 alist)) - (while (or (rassoc char new) (rassoc char alist)) - (setq char (1+ char))) - (setq c2 c1)) - (setq c (or c2 char))) - (push (cons k c) new)))) + (if (or (memq (car e) '(:newline :endgroup :startgroup)) + (cdr e)) ;; Key already assigned. + (push e new) + (let ((clist (string-to-list (downcase (car e)))) + (used (append new alist))) + (when (= (car clist) ?@) + (pop clist)) + (while (and clist (rassoc (car clist) used)) + (pop clist)) + (unless clist + (while (rassoc alt used) + (incf alt))) + (push (cons (car e) (or (car clist) alt)) new)))) (nreverse new))) ;;; Some variables used in various places @@ -4116,7 +4279,7 @@ (defvar date) ;; Defined somewhere in this file, but used before definition. -(defvar org-html-entities) +(defvar org-entities) ;; defined in org-entities.el (defvar org-struct-menu) (defvar org-org-menu) (defvar org-tbl-menu) @@ -4138,6 +4301,7 @@ (setq org-table-may-need-update t)) (defvar org-mode-map) (defvar org-inhibit-startup nil) ; Dynamically-scoped param. +(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. (defvar org-inhibit-logging nil) ; Dynamically-scoped param. (defvar org-inhibit-blocking nil) ; Dynamically-scoped param. @@ -4259,12 +4423,14 @@ (org-set-local 'outline-isearch-open-invisible-function (lambda (&rest ignore) (org-show-context 'isearch)))) + ;; Turn on org-beamer-mode? + (and org-startup-with-beamer-mode (org-beamer-mode 1)) + ;; If empty file that did not turn on org-mode automatically, make it to. (if (and org-insert-mode-line-in-empty-file (interactive-p) (= (point-min) (point-max))) (insert "# -*- mode: org -*-\n\n")) - (unless org-inhibit-startup (when org-startup-align-all-tables (let ((bmp (buffer-modified-p))) @@ -4273,7 +4439,8 @@ (when org-startup-indented (require 'org-indent) (org-indent-mode 1)) - (org-set-startup-visibility))) + (unless org-inhibit-startup-visibility-stuff + (org-set-startup-visibility)))) (when (fboundp 'abbrev-table-put) (abbrev-table-put org-mode-abbrev-table @@ -4341,40 +4508,41 @@ This should be called after the variable `org-link-types' has changed." (setq org-link-types-re (concat - "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):") + "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):") org-link-re-with-space (concat - "?") org-link-re-with-space2 (concat - "?") org-link-re-with-space3 (concat - "") org-plain-link-re (concat - "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" - "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") + "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" + (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) + ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") org-bracket-link-regexp "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" org-bracket-link-analytic-regexp (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -4382,7 +4550,7 @@ org-bracket-link-analytic-regexp++ (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -4494,8 +4662,9 @@ (string-match (concat "[" (nth 0 erc) "\n]") (char-to-string (char-before (point))))) (insert " ")) - (unless (string-match (concat "[" (nth 1 erc) "\n]") - (char-to-string (char-after (point)))) + (unless (or (eobp) + (string-match (concat "[" (nth 1 erc) "\n]") + (char-to-string (char-after (point))))) (insert " ") (backward-char 1)) (insert string) (and move (backward-char 1)))) @@ -4573,11 +4742,23 @@ (cond (quoting (add-text-properties beg1 end1 '(face org-block))) + ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") (add-text-properties beg1 end1 '(face org-quote))) ((string= block-type "verse") (add-text-properties beg1 end1 '(face org-verse)))) t)) + ((member dc1 '("title:" "author:" "email:" "date:")) + (add-text-properties + beg (match-end 3) + (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) + '(font-lock-fontified t invisible t) + '(font-lock-fontified t face org-document-info-keyword))) + (add-text-properties + (match-beginning 6) (match-end 6) + (if (string-equal dc1 "title:") + '(font-lock-fontified t face org-document-title) + '(font-lock-fontified t face org-document-info)))) ((not (member (char-after beg) '(?\ ?\t))) ;; just any other in-buffer setting, but not indented (add-text-properties @@ -4741,6 +4922,7 @@ ((matchers (plist-get org-format-latex-options :matchers)) (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x)) org-latex-regexps))) + (org-export-allow-BIND nil) (options (org-combine-plists (org-default-export-plist) (org-infile-export-plist))) (org-export-with-sub-superscripts (plist-get options :sub-superscript)) @@ -4762,7 +4944,8 @@ (if org-export-with-TeX-macros (list (concat "\\\\" (regexp-opt - (append (mapcar 'car org-html-entities) + (append (mapcar 'car (append org-entities-user + org-entities)) (if (boundp 'org-latex-entities) (mapcar (lambda (x) (or (car-safe x) x)) @@ -4841,7 +5024,7 @@ (defun org-activate-tags (limit) (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) (progn - (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) (add-text-properties (match-beginning 1) (match-end 1) (list 'mouse-face 'highlight 'keymap org-mouse-map)) @@ -4994,10 +5177,20 @@ "Get the right face for a TODO keyword KWD. If KWD is a number, get the corresponding match group." (if (numberp kwd) (setq kwd (match-string kwd))) - (or (cdr (assoc kwd org-todo-keyword-faces)) + (or (org-face-from-face-or-color + 'todo 'org-todo (cdr (assoc kwd org-todo-keyword-faces))) (and (member kwd org-done-keywords) 'org-done) 'org-todo)) +(defun org-face-from-face-or-color (context inherit face-or-color) + "Create a face list that inherits INHERIT, but sets the foreground color. +When FACE-OR-COLOR is not a string, just return it." + (if (stringp face-or-color) + (list :inherit inherit + (cdr (assoc context org-faces-easy-properties)) + face-or-color) + face-or-color)) + (defun org-font-lock-add-tag-faces (limit) "Add the special tag faces." (when (and org-tag-faces org-tags-special-faces-re) @@ -5012,8 +5205,10 @@ (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t) (add-text-properties (match-beginning 0) (match-end 0) - (list 'face (or (cdr (assoc (char-after (match-beginning 1)) - org-priority-faces)) + (list 'face (or (org-face-from-face-or-color + 'priority 'org-special-keyword + (cdr (assoc (char-after (match-beginning 1)) + org-priority-faces))) 'org-special-keyword) 'font-lock-fontified t)))) @@ -5021,7 +5216,8 @@ "Get the right face for a TODO keyword KWD. If KWD is a number, get the corresponding match group." (if (numberp kwd) (setq kwd (match-string kwd))) - (or (cdr (assoc kwd org-tag-faces)) + (or (org-face-from-face-or-color + 'tag 'org-tag (cdr (assoc kwd org-tag-faces))) 'org-tag)) (defun org-unfontify-region (beg end &optional maybe_loudly) @@ -5085,6 +5281,12 @@ 3. SUBTREE: Show the entire subtree, including body text. If there is no subtree, switch directly from CHILDREN to FOLDED. +- When point is at the beginning of an empty headline and the variable + `org-cycle-level-after-item/entry-creation' is set, cycle the level + of the headline by demoting and promoting it to likely levels. This + speeds up creation document structure by presing TAB once or several + times right after creating a new headline. + - When there is a numeric prefix, go up to a heading with level ARG, do a `show-subtree' and return to the previous cursor position. If ARG is negative, go up that many levels. @@ -5145,11 +5347,11 @@ ((org-at-table-p 'any) ;; Enter the table or move to the next field in the table - (or (org-table-recognize-table.el) - (progn - (if arg (org-table-edit-field t) - (org-table-justify-field-maybe) - (call-interactively 'org-table-next-field))))) + (if (org-at-table.el-p) + (message "Use C-c ' to edit table.el tables") + (if arg (org-table-edit-field t) + (org-table-justify-field-maybe) + (call-interactively 'org-table-next-field)))) ((run-hook-with-args-until-success 'org-tab-after-check-for-table-hook)) @@ -5465,7 +5667,9 @@ ;; Properly fold already folded siblings (goto-char (point-min)) (while (re-search-forward re nil t) - (if (save-excursion (goto-char (point-at-eol)) (org-invisible-p)) + (if (and (not (org-invisible-p)) + (save-excursion + (goto-char (point-at-eol)) (org-invisible-p))) (hide-entry)))) (org-cycle-show-empty-lines 'overview) (org-cycle-hide-drawers 'overview))))) @@ -5579,12 +5783,68 @@ (defun org-first-headline-recenter (&optional N) "Move cursor to the first headline and recenter the headline. -Optional argument N means, put the headline into the Nth line of the window." +Optional argument N means put the headline into the Nth line of the window." (goto-char (point-min)) (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t) (beginning-of-line) (recenter (prefix-numeric-value N)))) +;;; Saving and restoring visibility + +(defun org-outline-overlay-data (&optional use-markers) + "Return a list of the locations of all outline overlays. +The are overlays with the `invisible' property value `outline'. +The return valus is a list of cons cells, with start and stop +positions for each overlay. +If USE-MARKERS is set, return the positions as markers." + (let (beg end) + (save-excursion + (save-restriction + (widen) + (delq nil + (mapcar (lambda (o) + (when (eq (org-overlay-get o 'invisible) 'outline) + (setq beg (org-overlay-start o) + end (org-overlay-end o)) + (and beg end (> end beg) + (if use-markers + (cons (move-marker (make-marker) beg) + (move-marker (make-marker) end)) + (cons beg end))))) + (org-overlays-in (point-min) (point-max)))))))) + +(defun org-set-outline-overlay-data (data) + "Create visibility overlays for all positions in DATA. +DATA should have been made by `org-outline-overlay-data'." + (let (o) + (save-excursion + (save-restriction + (widen) + (show-all) + (mapc (lambda (c) + (setq o (org-make-overlay (car c) (cdr c))) + (org-overlay-put o 'invisible 'outline)) + data))))) + +(defmacro org-save-outline-visibility (use-markers &rest body) + "Save and restore outline visibility around BODY. +If USE-MARKERS is non-nil, use markers for the positions. +This means that the buffer may change while running BODY, +but it also means that the buffer should stay alive +during the operation, because otherwise all these markers will +point nowhere." + `(let ((data (org-outline-overlay-data ,use-markers))) + (unwind-protect + (progn + ,@body + (org-set-outline-overlay-data data)) + (when ,use-markers + (mapc (lambda (c) + (and (markerp (car c)) (move-marker (car c) nil)) + (and (markerp (cdr c)) (move-marker (cdr c) nil))) + data))))) + + ;;; Folding of blocks (defconst org-block-regexp @@ -5775,7 +6035,11 @@ (isearch-hide-immediately nil) (isearch-search-fun-function (lambda () 'org-goto-local-search-headings)) - (org-goto-selected-point org-goto-exit-command)) + (org-goto-selected-point org-goto-exit-command) + (pop-up-frames nil) + (special-display-buffer-names nil) + (special-display-regexps nil) + (special-display-function nil)) (save-excursion (save-window-excursion (delete-other-windows) @@ -5902,7 +6166,9 @@ (outline-up-heading 1 t))) (setq beg (point) heading (org-get-heading)) - (org-end-of-subtree t t) (setq end (point))) + (org-end-of-subtree t t) + (if (org-on-heading-p) (backward-char 1)) + (setq end (point))) (if (and (buffer-live-p org-last-indirect-buffer) (not (eq org-indirect-buffer-display 'new-frame)) (not arg)) @@ -5964,21 +6230,26 @@ (save-match-data (looking-at "[ \t]*$"))))) -(defun org-insert-heading (&optional force-heading) +(defun org-insert-heading (&optional force-heading invisible-ok) "Insert a new heading or item with same depth at point. If point is in a plain list and FORCE-HEADING is nil, create a new list item. If point is at the beginning of a headline, insert a sibling before the current headline. If point is not at the beginning, do not split the line, -but create the new headline after the current line." - (interactive "P") - (if (= (buffer-size) 0) +but create the new headline after the current line. +When INVISIBLE-OK is set, stop at invisible headlines when going back. +This is important for non-interactive uses of the command." + (interactive "P") + (if (or (= (buffer-size) 0) + (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok)) + (org-on-heading-p)))) + (not (org-in-item-p)))) (insert "\n* ") (when (or force-heading (not (org-insert-item))) (let* ((empty-line-p nil) (head (save-excursion (condition-case nil (progn - (org-back-to-heading) + (org-back-to-heading invisible-ok) (setq empty-line-p (org-previous-line-empty-p)) (match-string 0)) (error "*")))) @@ -6031,6 +6302,9 @@ (setq pos (point-at-bol)) (or split (end-of-line 1)) (delete-horizontal-space) + (if (string-match "\\`\\*+\\'" + (buffer-substring (point-at-bol) (point))) + (insert " ")) (newline (if blank 2 1)) (when tags (save-excursion @@ -6072,7 +6346,7 @@ - the tags string, or nil." (save-excursion (org-back-to-heading t) - (if (looking-at org-complex-heading-regexp) + (if (let (case-fold-search) (looking-at org-complex-heading-regexp)) (list (length (match-string 1)) (org-reduced-level (length (match-string 1))) (org-match-string-no-properties 2) @@ -6225,11 +6499,30 @@ (funcall outline-level)) (error nil)))) +(defun org-get-previous-line-level () + "Return the outline depth of the last headline before the current line. +Returns 0 for the first headline in the buffer, and nil if before the +first headline." + (let ((current-level (org-current-level)) + (prev-level (when (> (line-number-at-pos) 1) + (save-excursion + (beginning-of-line 0) + (org-current-level))))) + (cond ((null current-level) nil) ; Before first headline + ((null prev-level) 0) ; At first headline + (prev-level)))) + (defun org-reduced-level (l) "Compute the effective level of a heading. This takes into account the setting of `org-odd-levels-only'." (if org-odd-levels-only (1+ (floor (/ l 2))) l)) +(defun org-level-increment () + "Return the number of stars that will be added or removed at a +time to headlines when structure editing, based on the value of +`org-odd-levels-only'." + (if org-odd-levels-only 2 1)) + (defun org-get-valid-level (level &optional change) "Rectify a level change under the influence of `org-odd-levels-only' LEVEL is a current level, CHANGE is by how much the level should be @@ -6277,30 +6570,41 @@ (if org-adapt-indentation (org-fixup-indentation diff)) (run-hooks 'org-after-demote-entry-hook))) -(defvar org-tab-ind-state nil) - (defun org-cycle-level () + "Cycle the level of an empty headline through possible states. +This goes first to child, then to parent, level, then up the hierarchy. +After top level, it switches back to sibling level." + (interactive) (let ((org-adapt-indentation nil)) - (when (and (looking-at "[ \t]*$") - (looking-back - (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp "\\)?[ \t]*"))) - (setq this-command 'org-cycle-level) - (if (eq last-command 'org-cycle-level) - (condition-case nil - (progn (org-do-promote) - (if (equal org-tab-ind-state (org-current-level)) - (org-do-promote))) - (error - (progn - (save-excursion - (beginning-of-line 1) - (and (looking-at "\\*+") - (replace-match - (make-string org-tab-ind-state ?*)))) - (setq this-command 'org-cycle)))) - (setq org-tab-ind-state (- (match-end 1) (match-beginning 1))) - (org-do-demote)) - t))) + (when (org-point-at-end-of-empty-headline) + (setq this-command 'org-cycle-level) ; Only needed for caching + (let ((cur-level (org-current-level)) + (prev-level (org-get-previous-line-level))) + (cond + ;; If first headline in file, promote to top-level. + ((= prev-level 0) + (loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If same level as prev, demote one. + ((= prev-level cur-level) + (org-do-demote)) + ;; If parent is top-level, promote to top level if not already. + ((= prev-level 1) + (loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If top-level, return to prev-level. + ((= cur-level 1) + (loop repeat (/ (- prev-level 1) (org-level-increment)) + do (org-do-demote))) + ;; If less than prev-level, promote one. + ((< cur-level prev-level) + (org-do-promote)) + ;; If deeper than prev-level, promote until higher than + ;; prev-level. + ((> cur-level prev-level) + (loop repeat (+ 1 (/ (- cur-level prev-level) (org-level-increment))) + do (org-do-promote)))) + t)))) (defun org-map-tree (fun) "Call FUN for every heading underneath the current one." @@ -6706,7 +7010,9 @@ (save-match-data (narrow-to-region (progn (org-back-to-heading t) (point)) - (progn (org-end-of-subtree t t) (point)))))) + (progn (org-end-of-subtree t t) + (if (org-on-heading-p) (backward-char 1)) + (point)))))) (defun org-clone-subtree-with-time-shift (n &optional shift) "Clone the task (subtree) at point N times. @@ -7539,11 +7845,14 @@ ((eq major-mode 'dired-mode) ;; link to the file in the current line - (setq cpltxt (concat "file:" - (abbreviate-file-name - (expand-file-name - (dired-get-filename nil t)))) - link (org-make-link cpltxt))) + (let ((file (dired-get-filename nil t))) + (setq file (if file + (abbreviate-file-name + (expand-file-name (dired-get-filename nil t))) + ;; otherwise, no file so use current directory. + default-directory)) + (setq cpltxt (concat "file:" file) + link (org-make-link cpltxt)))) ((and buffer-file-name (org-mode-p)) (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID"))) @@ -7754,7 +8063,7 @@ (?\371 . "%F9") ; `u (?\373 . "%FB") ; ^u (?\; . "%3B") - (?? . "%3F") +;; (?? . "%3F") (?= . "%3D") (?+ . "%2B") ) @@ -7770,7 +8079,7 @@ (defun org-link-escape (text &optional table) "Escape characters in TEXT that are problematic for links." - (if org-url-encoding-use-url-hexify + (if (and org-url-encoding-use-url-hexify (not table)) (url-hexify-string text) (setq table (or table org-link-escape-chars)) (when text @@ -7787,16 +8096,18 @@ (defun org-link-unescape (text &optional table) "Reverse the action of `org-link-escape'." - (if org-url-encoding-use-url-hexify + (if (and org-url-encoding-use-url-hexify (not table)) (url-unhex-string text) (setq table (or table org-link-escape-chars)) (when text - (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) + (let ((case-fold-search t) + (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x)))) table "\\|"))) (while (string-match re text) (setq text (replace-match - (char-to-string (car (rassoc (match-string 0 text) table))) + (char-to-string (car (rassoc (upcase (match-string 0 text)) + table))) t t text))) text)))) @@ -7898,7 +8209,7 @@ (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) (reverse org-stored-links) "\n")))) (let ((cw (selected-window))) - (select-window (get-buffer-window "*Org Links*")) + (select-window (get-buffer-window "*Org Links*" 'visible)) (setq truncate-lines t) (unless (pos-visible-in-window-p (point-max)) (org-fit-window-to-buffer)) @@ -7923,6 +8234,8 @@ nil nil nil 'tmphist (car (car org-stored-links))))) + (if (not (string-match "\\S-" link)) + (error "No link selected")) (if (or (member link all-prefixes) (and (equal ":" (substring link -1)) (member (substring link 0 -1) all-prefixes) @@ -7955,8 +8268,9 @@ (setq link search))))) ;; Check if we can/should use a relative path. If yes, simplify the link - (when (string-match "^file:\\(.*\\)" link) - (let* ((path (match-string 1 link)) + (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link) + (let* ((type (match-string 1 link)) + (path (match-string 2 link)) (origpath path) (case-fold-search nil)) (cond @@ -7977,7 +8291,7 @@ (setq path (substring (expand-file-name path) (match-end 0))) (setq path (abbreviate-file-name (expand-file-name path))))))) - (setq link (concat "file:" path)) + (setq link (concat type path)) (if (equal desc origpath) (setq desc path)))) @@ -8096,6 +8410,23 @@ (defvar org-link-search-failed nil) +(defvar org-open-link-functions nil + "Hook for functions finding a plain text link. +These functions must take a single argument, the link content. +They will be called for links that look like [[link text][description]] +when LINK TEXT does not have a protocol like \"http:\" and does not look +like a filename (e.g. \"./blue.png\"). + +These functions will be called *before* Org attempts to resolve the +link by doing text searches in the current buffer - so if you want a +link \"[[target]]\" to still find \"<>\", your function should +handle this as a special case. + +When the function does handle the link, it must return a non-nil value. +If it decides that it is not responsible for this link, it must return +nil to indicate that that Org-mode can continue with other options +like exact and fuzzy text search.") + (defun org-next-link () "Move forward to the next link. If the link is in hidden text, expose it." @@ -8208,6 +8539,10 @@ (org-mode) (insert s) (goto-char (point-min)) + (when reference-buffer + (setq org-link-abbrev-alist-local + (with-current-buffer reference-buffer + org-link-abbrev-alist-local))) (org-open-at-point arg reference-buffer))))) (defun org-open-at-point (&optional in-emacs reference-buffer) @@ -8229,7 +8564,8 @@ (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" - "[ \t]:[^ \t\n]+:[ \t]*$")))) + "[ \t]:[^ \t\n]+:[ \t]*$"))) + (not (get-text-property (point) 'org-linked-text))) (or (org-offer-links-in-entry in-emacs) (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) @@ -8240,7 +8576,7 @@ (catch 'match (save-excursion (skip-chars-forward "^]\n\r") - (when (org-in-regexp org-bracket-link-regexp) + (when (org-in-regexp org-bracket-link-regexp 1) (setq link (org-extract-attributes (org-link-unescape (org-match-string-no-properties 1)))) (while (string-match " *\n *" link) @@ -8329,19 +8665,6 @@ ((string= type "tags") (org-tags-view in-emacs path)) - ((string= type "thisfile") - (if in-emacs - (switch-to-buffer-other-window - (org-get-buffer-for-internal-link (current-buffer))) - (org-mark-ring-push)) - (let ((cmd `(org-link-search - ,path - ,(cond ((equal in-emacs '(4)) 'occur) - ((equal in-emacs '(16)) 'org-occur) - (t nil)) - ,pos))) - (condition-case nil (eval cmd) - (error (progn (widen) (eval cmd)))))) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) @@ -8386,6 +8709,24 @@ (call-interactively (read cmd)))) (error "Abort")))) + ((and (string= type "thisfile") + (run-hook-with-args-until-success + 'org-open-link-functions path))) + + ((string= type "thisfile") + (if in-emacs + (switch-to-buffer-other-window + (org-get-buffer-for-internal-link (current-buffer))) + (org-mark-ring-push)) + (let ((cmd `(org-link-search + ,path + ,(cond ((equal in-emacs '(4)) 'occur) + ((equal in-emacs '(16)) 'org-occur) + (t nil)) + ,pos))) + (condition-case nil (eval cmd) + (error (progn (widen) (eval cmd)))))) + (t (browse-url-at-point))))))) (move-marker org-open-link-marker nil) @@ -8417,7 +8758,7 @@ ((null links) (message "No links")) ((equal (length links) 1) - (setq link (car links))) + (setq link (list (car links)))) ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) (setq link (nth (if have-zero nth (1- nth)) links))) (t ; we have to select a link @@ -8436,19 +8777,44 @@ (match-string 1 l)))))) links)) (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) - (message "Select link to open:") + (message "Select link to open, RET to open all:") (setq c (read-char-exclusive)) (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) (when (equal c ?q) (error "Abort")) - (setq nth (- c ?0)) - (if have-zero (setq nth (1+ nth))) - (unless (and (integerp nth) (>= (length links) nth)) - (error "Invalid link selection")) - (setq link (nth (1- nth) links)))) + (if (equal c ?\C-m) + (setq link links) + (setq nth (- c ?0)) + (if have-zero (setq nth (1+ nth))) + (unless (and (integerp nth) (>= (length links) nth)) + (error "Invalid link selection")) + (setq link (list (nth (1- nth) links)))))) (if link - (progn (org-open-link-from-string link in-emacs (current-buffer)) t) + (let ((buf (current-buffer))) + (dolist (l link) + (org-open-link-from-string l in-emacs buf)) + t) nil))) +;; Add special file links that specify the way of opening + +(org-add-link-type "file+sys" 'org-open-file-with-system) +(org-add-link-type "file+emacs" 'org-open-file-with-emacs) +(defun org-open-file-with-system (path) + "Open file at PATH using the system way of opeing it." + (org-open-file path 'system)) +(defun org-open-file-with-emacs (path) + "Open file at PATH in emacs." + (org-open-file path 'emacs)) +(defun org-remove-file-link-modifiers () + "Remove the file link modifiers in `file+sys:' and `file+emacs:' links." + (goto-char (point-min)) + (while (re-search-forward "\\ level 19) - (error "Outline path failure, more than 19 levels")) + (error "Outline path failure, more than 19 levels.")) (loop for i from level upto 19 do (aset org-olpa i nil)) (prog1 (delq nil (append org-olpa nil)) (aset org-olpa level heading))) - (let (rtn) + (let (rtn case-fold-search) (save-excursion (save-restriction (widen) @@ -9074,8 +9479,9 @@ (defun org-display-outline-path (&optional file current) "Display the current outline path in the echo area." (interactive "P") - (let ((bfn (buffer-file-name (buffer-base-buffer))) - (path (and (org-mode-p) (org-get-outline-path)))) + (let* ((bfn (buffer-file-name (buffer-base-buffer))) + (case-fold-search nil) + (path (and (org-mode-p) (org-get-outline-path)))) (if current (setq path (append path (save-excursion (org-back-to-heading t) @@ -9201,8 +9607,14 @@ (goto-char (point-min)) (or (outline-next-heading) (goto-char (point-max))))) (if (not (bolp)) (newline)) + (org-paste-subtree level) + (when org-log-refile + (org-add-log-setup 'refile nil nil 'findpos + org-log-refile) + (unless (eq org-log-refile 'note) + (save-excursion (org-add-log-note)))) + (and org-auto-align-tags (org-set-tags nil t)) (bookmark-set "org-refile-last-stored") - (org-paste-subtree level) (if (fboundp 'deactivate-mark) (deactivate-mark)) (run-hooks 'org-after-refile-insert-hook)))) (if regionp @@ -9264,15 +9676,19 @@ (if (equal (car org-refile-history) (nth 1 org-refile-history)) (pop org-refile-history))) pa) - (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) - (setq parent (match-string 1 answ) - child (match-string 2 answ)) - (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl))) - (when (and parent-target - (or (eq new-nodes t) - (and (eq new-nodes 'confirm) - (y-or-n-p (format "Create new node \"%s\"? " child))))) - (org-refile-new-child parent-target child)))))) + (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) + (progn + (setq parent (match-string 1 answ) + child (match-string 2 answ)) + (setq parent-target (or (assoc parent tbl) + (assoc (concat parent "/") tbl))) + (when (and parent-target + (or (eq new-nodes t) + (and (eq new-nodes 'confirm) + (y-or-n-p (format "Create new node \"%s\"? " + child))))) + (org-refile-new-child parent-target child))) + (error "Invalid target location"))))) (defun org-refile-new-child (parent-target child) "Use refile target PARENT-TARGET to add new CHILD below it." @@ -9397,16 +9813,15 @@ (defun org-map-dblocks (&optional command) "Apply COMMAND to all dynamic blocks in the current buffer. If COMMAND is not given, use `org-update-dblock'." - (let ((cmd (or command 'org-update-dblock)) - pos) + (let ((cmd (or command 'org-update-dblock))) (save-excursion (goto-char (point-min)) (while (re-search-forward org-dblock-start-re nil t) - (goto-char (setq pos (match-beginning 0))) - (condition-case nil - (funcall cmd) - (error (message "Error during update of dynamic block"))) - (goto-char pos) + (goto-char (match-beginning 0)) + (save-excursion + (condition-case nil + (funcall cmd) + (error (message "Error during update of dynamic block")))) (unless (re-search-forward org-dblock-end-re nil t) (error "Dynamic block not terminated")))))) @@ -9475,7 +9890,8 @@ (defconst org-additional-option-like-keywords '("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML" "BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook" - "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "LATEX_CLASS:" "ATTR_LaTeX" + "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" + "LATEX_CLASS:" "LATEX_CLASS_OPTIONS:" "ATTR_LaTeX" "BEGIN:" "END:" "ORGTBL" "TBLFM:" "TBLNAME:" "BEGIN_EXAMPLE" "END_EXAMPLE" @@ -9635,7 +10051,7 @@ org-link-abbrev-alist)) (texp (setq type :tex) - org-html-entities) + (append org-entities-user org-entities)) ((string-match "\\`\\*+[ \t]+\\'" (buffer-substring (point-at-bol) beg)) (setq type :todo) @@ -9979,54 +10395,56 @@ 3. The parent of the task is blocked because it has siblings that should be done first, or is child of a block grandparent TODO entry." - (catch 'dont-block - ;; If this is not a todo state change, or if this entry is already DONE, - ;; do not block - (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) - (member (plist-get change-plist :from) - (cons 'done org-done-keywords)) - (member (plist-get change-plist :to) - (cons 'todo org-not-done-keywords)) - (not (plist-get change-plist :to))) - (throw 'dont-block t)) - ;; If this task has children, and any are undone, it's blocked - (save-excursion - (org-back-to-heading t) - (let ((this-level (funcall outline-level))) - (outline-next-heading) - (let ((child-level (funcall outline-level))) - (while (and (not (eobp)) - (> child-level this-level)) - ;; this todo has children, check whether they are all - ;; completed - (if (and (not (org-entry-is-done-p)) - (org-entry-is-todo-p)) - (throw 'dont-block nil)) - (outline-next-heading) - (setq child-level (funcall outline-level)))))) - ;; Otherwise, if the task's parent has the :ORDERED: property, and - ;; any previous siblings are undone, it's blocked - (save-excursion - (org-back-to-heading t) - (let* ((pos (point)) - (parent-pos (and (org-up-heading-safe) (point)))) - (if (not parent-pos) (throw 'dont-block t)) ; no parent - (when (and (org-entry-get (point) "ORDERED") - (forward-line 1) - (re-search-forward org-not-done-heading-regexp pos t)) - (throw 'dont-block nil)) ; block, there is an older sibling not done. - ;; Search further up the hierarchy, to see if an anchestor is blocked - (while t - (goto-char parent-pos) - (if (not (looking-at org-not-done-heading-regexp)) - (throw 'dont-block t)) ; do not block, parent is not a TODO - (setq pos (point)) - (setq parent-pos (and (org-up-heading-safe) (point))) + (if (not org-enforce-todo-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has children, and any are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((this-level (funcall outline-level))) + (outline-next-heading) + (let ((child-level (funcall outline-level))) + (while (and (not (eobp)) + (> child-level this-level)) + ;; this todo has children, check whether they are all + ;; completed + (if (and (not (org-entry-is-done-p)) + (org-entry-is-todo-p)) + (throw 'dont-block nil)) + (outline-next-heading) + (setq child-level (funcall outline-level)))))) + ;; Otherwise, if the task's parent has the :ORDERED: property, and + ;; any previous siblings are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let* ((pos (point)) + (parent-pos (and (org-up-heading-safe) (point)))) (if (not parent-pos) (throw 'dont-block t)) ; no parent (when (and (org-entry-get (point) "ORDERED") (forward-line 1) (re-search-forward org-not-done-heading-regexp pos t)) - (throw 'dont-block nil))))))) ; block, older sibling not done. + (throw 'dont-block nil)) ; block, there is an older sibling not done. + ;; Search further up the hierarchy, to see if an anchestor is blocked + (while t + (goto-char parent-pos) + (if (not (looking-at org-not-done-heading-regexp)) + (throw 'dont-block t)) ; do not block, parent is not a TODO + (setq pos (point)) + (setq parent-pos (and (org-up-heading-safe) (point))) + (if (not parent-pos) (throw 'dont-block t)) ; no parent + (when (and (org-entry-get (point) "ORDERED") + (forward-line 1) + (re-search-forward org-not-done-heading-regexp pos t)) + (throw 'dont-block nil)))))))) ; block, older sibling not done. (defcustom org-track-ordered-property-with-tag nil "Should the ORDERED property also be shown as a tag? @@ -10070,30 +10488,44 @@ "Block turning an entry into a TODO, using checkboxes. This checks whether the current task should be blocked from state changes because there are unchecked boxes in this entry." - (catch 'dont-block - ;; If this is not a todo state change, or if this entry is already DONE, - ;; do not block - (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) - (member (plist-get change-plist :from) - (cons 'done org-done-keywords)) - (member (plist-get change-plist :to) - (cons 'todo org-not-done-keywords)) - (not (plist-get change-plist :to))) - (throw 'dont-block t)) - ;; If this task has checkboxes that are not checked, it's blocked - (save-excursion - (org-back-to-heading t) - (let ((beg (point)) end) - (outline-next-heading) - (setq end (point)) - (goto-char beg) - (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" - end t) - (progn - (if (boundp 'org-blocked-by-checkboxes) - (setq org-blocked-by-checkboxes t)) - (throw 'dont-block nil))))) - t)) ; do not block + (if (not org-enforce-todo-checkbox-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has checkboxes that are not checked, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((beg (point)) end) + (outline-next-heading) + (setq end (point)) + (goto-char beg) + (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" + end t) + (progn + (if (boundp 'org-blocked-by-checkboxes) + (setq org-blocked-by-checkboxes t)) + (throw 'dont-block nil))))) + t))) ; do not block + +(defun org-entry-blocked-p () + "Is the current entry blocked?" + (if (org-entry-get nil "NOBLOCKING") + nil ;; Never block this entry + (not + (run-hook-with-args-until-failure + 'org-blocker-hook + (list :type 'todo-state-change + :position (point) + :from 'todo + :to 'done))))) (defun org-update-statistics-cookies (all) "Update the statistics cookie, either from TODO or from checkboxes. @@ -10115,8 +10547,9 @@ (outline-next-heading) (if (org-on-heading-p) (setq l2 (org-outline-level))) (point))) - (if (and (save-excursion (re-search-forward - "^[ \t]*[-+*] \\[[- X]\\]" end t)) + (if (and (save-excursion + (re-search-forward + "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t)) (not (save-excursion (re-search-forward ":COOKIE_DATA:.*\\" end t)))) (org-update-checkbox-count) @@ -10124,7 +10557,12 @@ (progn (goto-char end) (org-update-parent-todo-statistics)) - (error "No data for statistics cookie")))) + (goto-char pos) + (beginning-of-line 1) + (while (re-search-forward + "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" + (point-at-eol) t) + (replace-match (if (match-end 2) "[100%]" "[0/0]") t t))))) (goto-char pos) (move-marker pos nil))))) @@ -10487,20 +10925,37 @@ When TIME is set, it should be an internal time specification, and the scheduling will use the corresponding date." (interactive "P") - (let ((old-date (org-entry-get nil "DEADLINE"))) + (let* ((old-date (org-entry-get nil "DEADLINE")) + (repeater (and old-date + (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date) + (match-string 1 old-date)))) (if remove (progn + (when (and old-date org-log-redeadline) + (org-add-log-setup 'deldeadline nil old-date 'findpos + org-log-redeadline)) (org-remove-timestamp-with-keyword org-deadline-string) (message "Item no longer has a deadline.")) - (if (org-get-repeat) - (error "Cannot change deadline on task with repeater, please do that by hand") - (org-add-planning-info 'deadline time 'closed) - (when (and old-date org-log-redeadline - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'redeadline nil old-date 'findpos - org-log-redeadline)) - (message "Deadline on %s" org-last-inserted-timestamp))))) + (org-add-planning-info 'deadline time 'closed) + (when (and old-date org-log-redeadline + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'redeadline nil old-date 'findpos + org-log-redeadline)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-deadline-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Deadline on %s" org-last-inserted-timestamp)))) (defun org-schedule (&optional remove time) "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. @@ -10508,20 +10963,37 @@ When TIME is set, it should be an internal time specification, and the scheduling will use the corresponding date." (interactive "P") - (let ((old-date (org-entry-get nil "SCHEDULED"))) + (let* ((old-date (org-entry-get nil "SCHEDULED")) + (repeater (and old-date + (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date) + (match-string 1 old-date)))) (if remove (progn + (when (and old-date org-log-reschedule) + (org-add-log-setup 'delschedule nil old-date 'findpos + org-log-reschedule)) (org-remove-timestamp-with-keyword org-scheduled-string) (message "Item is no longer scheduled.")) - (if (org-get-repeat) - (error "Cannot reschedule task with repeater, please do that by hand") - (org-add-planning-info 'scheduled time 'closed) - (when (and old-date org-log-reschedule - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'reschedule nil old-date 'findpos - org-log-reschedule)) - (message "Scheduled to %s" org-last-inserted-timestamp))))) + (org-add-planning-info 'scheduled time 'closed) + (when (and old-date org-log-reschedule + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'reschedule nil old-date 'findpos + org-log-reschedule)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-scheduled-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Scheduled to %s" org-last-inserted-timestamp)))) (defun org-get-scheduled-time (pom &optional inherit) "Get the scheduled time as a time tuple, of a format suitable @@ -10765,8 +11237,14 @@ (or org-log-note-state ""))) ((eq org-log-note-purpose 'reschedule) "rescheduling") + ((eq org-log-note-purpose 'delschedule) + "no longer scheduled") ((eq org-log-note-purpose 'redeadline) "changing deadline") + ((eq org-log-note-purpose 'deldeadline) + "removing deadline") + ((eq org-log-note-purpose 'refile) + "refiling") ((eq org-log-note-purpose 'note) "this entry") (t (error "This should not happen"))))) @@ -10970,6 +11448,9 @@ (org-flag-heading nil) (when siblings-p (org-show-siblings)))))))) +(defvar org-reveal-start-hook nil + "Hook run before revealing a location.") + (defun org-reveal (&optional siblings) "Show current entry, hierarchy above it, and the following headline. This can be used to show a consistent set of context around locations @@ -10978,12 +11459,20 @@ With optional argument SIBLINGS, on each level of the hierarchy all siblings are shown. This repairs the tree structure to what it would -look like when opened with hierarchical calls to `org-cycle'." - (interactive "P") +look like when opened with hierarchical calls to `org-cycle'. +With double optional argument `C-u C-u', go to the parent and show the +entire tree." + (interactive "P") + (run-hooks 'org-reveal-start-hook) (let ((org-show-hierarchy-above t) (org-show-following-heading t) (org-show-siblings (if siblings t org-show-siblings))) - (org-show-context nil))) + (org-show-context nil)) + (when (equal siblings '(16)) + (save-excursion + (when (org-up-heading-safe) + (org-show-subtree) + (run-hook-with-args 'org-cycle-hook 'subtree))))) (defun org-highlight-new-match (beg end) "Highlight from BEG to END and mark the highlight is an occur headline." @@ -11676,7 +12165,9 @@ ;; Get a new set of tags from the user (save-excursion (setq table (append org-tag-persistent-alist - (or org-tag-alist (org-get-buffer-tags))) + (or org-tag-alist (org-get-buffer-tags)) + (and org-complete-tags-always-offer-all-agenda-tags + (org-global-tags-completion-table (org-agenda-files)))) org-last-tags-completion-table table current-tags (org-split-string current ":") inherited-tags (nreverse @@ -11718,7 +12209,8 @@ (if (equal tags "") (setq rpl "") (goto-char (match-beginning 0)) - (setq c0 (current-column) p0 (point) + (setq c0 (current-column) p0 (if (equal (char-before) ?*) + (1+ (point)) (point)) c1 (max (1+ c0) (if (> org-tags-column 0) org-tags-column (- (- org-tags-column) (length tags)))) @@ -11821,6 +12313,7 @@ (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s) (org-overlay-display org-tags-overlay (concat prefix s))))) +(defvar org-last-tag-selection-key nil) (defun org-fast-tag-selection (current inherited table &optional todo-table) "Fast tag selection with single keys. CURRENT is the current list of tags in the headline, INHERITED is the @@ -11935,6 +12428,7 @@ (if (not groups) "no " "") (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) (setq c (let ((inhibit-quit t)) (read-char-exclusive))) + (setq org-last-tag-selection-key c) (cond ((= c ?\r) (throw 'exit t)) ((= c ?!) @@ -12158,7 +12652,7 @@ (defconst org-special-properties '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY" - "TIMESTAMP" "TIMESTAMP_IA") + "TIMESTAMP" "TIMESTAMP_IA" "BLOCKED") "The special properties valid in Org-mode. These are properties that are not defined in the property drawer, @@ -12170,7 +12664,7 @@ "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" - "CLOCK_MODELINE_TOTAL" "STYLE") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") "Some properties that are used by Org-mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -12178,7 +12672,7 @@ "Regular expression matching the first line of a property drawer.") (defconst org-property-end-re "^[ \t]*:END:[ \t]*$" - "Regular expression matching the first line of a property drawer.") + "Regular expression matching the last line of a property drawer.") (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" "Regular expression matching the first line of a property drawer.") @@ -12255,13 +12749,16 @@ (message "%s is now %s" prop val))) (defun org-at-property-p () - "Is the cursor in a property line?" - ;; FIXME: Does not check if we are actually in the drawer. - ;; FIXME: also returns true on any drawers..... - ;; This is used by C-c C-c for property action. + "Is cursor inside a property drawer?" (save-excursion (beginning-of-line 1) - (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")))) + (when (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")) + (let ((match (match-data)) ;; Keep match-data for use by calling + (p (point)) ;; procedures. + (range (unless (org-before-first-heading-p) + (org-get-property-block)))) + (prog1 (and range (<= (car range) p) (< p (cdr range))) + (set-match-data match)))))) (defun org-get-property-block (&optional beg end force) "Return the (beg . end) range of the body of the property drawer. @@ -12292,7 +12789,7 @@ (insert ":END:\n")) (cons beg end))))) -(defun org-entry-properties (&optional pom which) +(defun org-entry-properties (&optional pom which specific) "Get all properties of the entry at point-or-marker POM. This includes the TODO keyword, the tags, time strings for deadline, scheduled, and clocking, and any additional properties defined in the @@ -12300,11 +12797,15 @@ if the property key was used several times. POM may also be nil, in which case the current entry is used. If WHICH is nil or `all', get all properties. If WHICH is -`special' or `standard', only get that subclass." +`special' or `standard', only get that subclass. If WHICH +is a string only get exactly this property. Specific can be a string, the +specific property we are interested in. Specifying it can speed +things up because then unnecessary parsing is avoided." (setq which (or which 'all)) (org-with-point-at pom (let ((clockstr (substring org-clock-string 0 -1)) - (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY")) + (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED")) + (case-fold-search nil) beg end range props sum-props key value string clocksum) (save-excursion (when (condition-case nil @@ -12318,30 +12819,40 @@ (when (memq which '(all special)) ;; Get the special properties, like TODO and tags (goto-char beg) - (when (and (looking-at org-todo-line-regexp) (match-end 2)) + (when (and (or (not specific) (string= specific "TODO")) + (looking-at org-todo-line-regexp) (match-end 2)) (push (cons "TODO" (org-match-string-no-properties 2)) props)) - (when (looking-at org-priority-regexp) + (when (and (or (not specific) (string= specific "PRIORITY")) + (looking-at org-priority-regexp)) (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) - (when (and (setq value (org-get-tags-string)) + (when (and (or (not specific) (string= specific "TAGS")) + (setq value (org-get-tags-string)) (string-match "\\S-" value)) (push (cons "TAGS" value) props)) - (when (setq value (org-get-tags-at)) - (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) + (when (and (or (not specific) (string= specific "ALLTAGS")) + (setq value (org-get-tags-at))) + (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") + ":")) props)) - (while (re-search-forward org-maybe-keyword-time-regexp end t) - (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) - string (if (equal key clockstr) - (org-no-properties - (org-trim + (when (or (not specific) (string= specific "BLOCKED")) + (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props)) + (when (or (not specific) + (member specific org-all-time-keywords) + (member specific '("TIMESTAMP" "TIMESTAMP_IA"))) + (while (re-search-forward org-maybe-keyword-time-regexp end t) + (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) + string (if (equal key clockstr) + (org-no-properties + (org-trim (buffer-substring (match-beginning 3) (goto-char (point-at-eol))))) - (substring (org-match-string-no-properties 3) 1 -1))) - (unless key - (if (= (char-after (match-beginning 3)) ?\[) - (setq key "TIMESTAMP_IA") - (setq key "TIMESTAMP"))) - (when (or (equal key clockstr) (not (assoc key props))) - (push (cons key string) props))) + (substring (org-match-string-no-properties 3) 1 -1))) + (unless key + (if (= (char-after (match-beginning 3)) ?\[) + (setq key "TIMESTAMP_IA") + (setq key "TIMESTAMP"))) + (when (or (equal key clockstr) (not (assoc key props))) + (push (cons key string) props)))) ) @@ -12383,8 +12894,9 @@ t)) (org-entry-get-with-inheritance property) (if (member property org-special-properties) - ;; We need a special property. Use brute force, get all properties. - (cdr (assoc property (org-entry-properties nil 'special))) + ;; We need a special property. Use `org-entry-properties' to + ;; retrieve it, but specify the wanted property + (cdr (assoc property (org-entry-properties nil 'special property))) (let ((range (org-get-property-block))) (if (and range (goto-char (car range)) @@ -12507,6 +13019,11 @@ (cdr (assoc property org-global-properties)) (cdr (assoc property org-global-properties-fixed)))))) +(defvar org-property-changed-functions nil + "Hook called when the value of a property has changed. +Each hook function should accept two arguments, the name of the property +and the new value.") + (defun org-entry-put (pom property value) "Set PROPERTY to VALUE for entry at point-or-marker POM." (org-with-point-at pom @@ -12559,7 +13076,8 @@ (org-indent-line-function) (insert ":" property ":")) (and value (insert " " value)) - (org-indent-line-function))))))) + (org-indent-line-function))))) + (run-hook-with-args 'org-property-changed-functions property value))) (defun org-buffer-property-keys (&optional include-specials include-defaults include-columns) "Get all property keys in the current buffer. @@ -12679,16 +13197,17 @@ keys))) prop0))) (cur (org-entry-get nil prop)) + (prompt (concat prop " value" + (if (and cur (string-match "\\S-" cur)) + (concat " [" cur "]") "") ": ")) (allowed (org-property-get-allowed-values nil prop 'table)) (existing (mapcar 'list (org-property-values prop))) (val (if allowed - (org-completing-read "Value: " allowed nil 'req-match) + (org-completing-read prompt allowed nil + (not (get-text-property 0 'org-unrestricted + (caar allowed)))) (let (org-completion-use-ido org-completion-use-iswitchb) - (org-completing-read - (concat "Value " (if (and cur (string-match "\\S-" cur)) - (concat "[" cur "]") "") - ": ") - existing nil nil "" nil cur))))) + (org-completing-read prompt existing nil nil "" nil cur))))) (list prop (if (equal val "") cur val)))) (unless (equal (org-entry-get nil property) value) (org-entry-put nil property value))) @@ -12697,8 +13216,7 @@ "In the current entry, delete PROPERTY." (interactive (let* ((completion-ignore-case t) - (prop (org-icompleting-read - "Property: " (org-entry-properties nil 'standard)))) + (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard)))) (list prop))) (message "Property %s %s" property (if (org-entry-delete nil property) @@ -12740,6 +13258,15 @@ (error "No operator defined for property %s" prop)) (org-columns-compute prop))) +(defvar org-property-allowed-value-functions nil + "Hook for functions supplying allowed values for a specific property. +The functions must take a single argument, the name of the property, and +return a flat list of allowed values. If \":ETC\" is one of +the values, this means that these values are intended as defaults for +completion, but that other values should be allowed too. +The functions must return nil if they are not responsible for this +property.") + (defun org-property-get-allowed-values (pom property &optional table) "Get allowed values for the property PROPERTY. When TABLE is non-nil, return an alist that can directly be used for @@ -12755,9 +13282,10 @@ (push (char-to-string n) vals) (setq n (1- n))))) ((member property org-special-properties)) + ((setq vals (run-hook-with-args-until-success + 'org-property-allowed-value-functions property))) (t (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) - (when (and vals (string-match "\\S-" vals)) (setq vals (car (read-from-string (concat "(" vals ")")))) (setq vals (mapcar (lambda (x) @@ -12766,6 +13294,9 @@ ((symbolp x) (symbol-name x)) (t "???"))) vals))))) + (when (member ":ETC" vals) + (setq vals (remove ":ETC" vals)) + (org-add-props (car vals) '(org-unrestricted t))) (if table (mapcar 'list vals) vals))) (defun org-property-previous-allowed-value (&optional previous) @@ -12796,7 +13327,8 @@ (replace-match (concat " :" key ": " nval) t t) (org-indent-line-function) (beginning-of-line 1) - (skip-chars-forward " \t"))) + (skip-chars-forward " \t") + (run-hook-with-args 'org-property-changed-functions key nval))) (defun org-find-entry-with-id (ident) "Locate the entry that contains the ID property with exact value IDENT. @@ -13131,9 +13663,10 @@ (defun org-read-date-analyze (ans def defdecode) "Analyse the combined answer of the date prompt." ;; FIXME: cleanup and comment - (let (delta deltan deltaw deltadef year month day - hour minute second wday pm h2 m2 tl wday1 - iso-year iso-weekday iso-week iso-year iso-date futurep) + (let ((nowdecode (decode-time (current-time))) + delta deltan deltaw deltadef year month day + hour minute second wday pm h2 m2 tl wday1 + iso-year iso-weekday iso-week iso-year iso-date futurep kill-year) (setq org-read-date-analyze-futurep nil) (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) (setq ans "+0")) @@ -13148,22 +13681,38 @@ ;; If yes, store the info and postpone interpreting it until the rest ;; of the parsing is done (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans) - (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans)))) - iso-weekday (if (match-end 3) (string-to-number (match-string 3 ans))) + (setq iso-year (if (match-end 1) + (org-small-year-to-year + (string-to-number (match-string 1 ans)))) + iso-weekday (if (match-end 3) + (string-to-number (match-string 3 ans))) iso-week (string-to-number (match-string 2 ans))) (setq ans (replace-match "" t t ans))) - ;; Help matching ISO dates with single digit month ot day, like 2006-8-11. + ;; Help matching ISO dates with single digit month or day, like 2006-8-11. (when (string-match "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans) (setq year (if (match-end 2) (string-to-number (match-string 2 ans)) - (string-to-number (format-time-string "%Y"))) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) month (string-to-number (match-string 3 ans)) day (string-to-number (match-string 4 ans))) (if (< year 100) (setq year (+ 2000 year))) (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) t nil ans))) + ;; Help matching american dates, like 5/30 or 5/30/7 + (when (string-match + "^ *\\([0-3]?[0-9]\\)/\\([0-1]?[0-9]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) + (setq year (if (match-end 4) + (string-to-number (match-string 4 ans)) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) + month (string-to-number (match-string 1 ans)) + day (string-to-number (match-string 2 ans))) + (if (< year 100) (setq year (+ 2000 year))) + (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) + t nil ans))) ;; Help matching am/pm times, because `parse-time-string' does not do that. ;; If there is a time with am/pm, and *no* time without it, we convert ;; so that matching will be successful. @@ -13206,13 +13755,13 @@ day (or (nth 3 tl) (nth 3 defdecode)) month (or (nth 4 tl) (if (and org-read-date-prefer-future - (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) - (prog1 (1+ (nth 4 defdecode)) (setq futurep t)) + (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode))) + (prog1 (1+ (nth 4 nowdecode)) (setq futurep t)) (nth 4 defdecode))) - year (or (nth 5 tl) + year (or (and (not kill-year) (nth 5 tl)) (if (and org-read-date-prefer-future - (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) - (prog1 (1+ (nth 5 defdecode)) (setq futurep t)) + (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode))) + (prog1 (1+ (nth 5 nowdecode)) (setq futurep t)) (nth 5 defdecode))) hour (or (nth 2 tl) (nth 2 defdecode)) minute (or (nth 1 tl) (nth 1 defdecode)) @@ -13221,14 +13770,14 @@ (when (and (eq org-read-date-prefer-future 'time) (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl)) - (equal day (nth 3 defdecode)) - (equal month (nth 4 defdecode)) - (equal year (nth 5 defdecode)) + (equal day (nth 3 nowdecode)) + (equal month (nth 4 nowdecode)) + (equal year (nth 5 nowdecode)) (nth 2 tl) - (or (< (nth 2 tl) (nth 2 defdecode)) - (and (= (nth 2 tl) (nth 2 defdecode)) + (or (< (nth 2 tl) (nth 2 nowdecode)) + (and (= (nth 2 tl) (nth 2 nowdecode)) (nth 1 tl) - (< (nth 1 tl) (nth 1 defdecode))))) + (< (nth 1 tl) (nth 1 nowdecode))))) (setq day (1+ day) futurep t)) @@ -13236,6 +13785,7 @@ (cond (iso-week ;; There was an iso week + (require 'cal-iso) (setq futurep nil) (setq year (or iso-year year) day (or iso-weekday wday 1) @@ -13315,6 +13865,23 @@ (list delta "d" rel)) (list (* n (if (= dir ?-) -1 1)) what rel))))) +(defun org-order-calendar-date-args (arg1 arg2 arg3) + "Turn a user-specified date into the internal representation. +The internal representation needed by the calendar is (month day year). +This is a wrapper to handle the brain-dead convention in calendar that +user function argument order change dependent on argument order." + (if (boundp 'calendar-date-style) + (cond + ((eq calendar-date-style 'american) + (list arg1 arg2 arg3)) + ((eq calendar-date-style 'european) + (list arg2 arg1 arg3)) + ((eq calendar-date-style 'iso) + (list arg2 arg3 arg1))) + (if (org-bound-and-true-p european-calendar-style) + (list arg2 arg1 arg3) + (list arg1 arg2 arg3)))) + (defun org-eval-in-calendar (form &optional keepdate) "Eval FORM in the calendar window and return to current window. Also, store the cursor date in variable org-ans2." @@ -13342,7 +13909,7 @@ (defun org-insert-time-stamp (time &optional with-hm inactive pre post extra) "Insert a date stamp for the date given by the internal TIME. -WITH-HM means, use the stamp format that includes the time of the day. +WITH-HM means use the stamp format that includes the time of the day. INACTIVE means use square brackets instead of angular ones, so that the stamp will not contribute to the agenda. PRE and POST are optional strings to be inserted before and after the @@ -14161,7 +14728,7 @@ "Get the list of agenda files. Optional UNRESTRICTED means return the full list even if a restriction is currently in place. -When ARCHIVES is t, include all archive files hat are really being +When ARCHIVES is t, include all archive files that are really being used by the agenda files. If ARCHIVE is `ifmode', do this only if `org-agenda-archives-mode' is t." (let ((files @@ -14214,24 +14781,41 @@ (defun org-store-new-agenda-file-list (list) "Set new value for the agenda file list and save it correctly." (if (stringp org-agenda-files) - (let ((f org-agenda-files) b) - (while (setq b (find-buffer-visiting f)) (kill-buffer b)) - (with-temp-file f - (insert (mapconcat 'identity list "\n") "\n"))) + (let ((fe (org-read-agenda-file-list t)) b u) + (while (setq b (find-buffer-visiting org-agenda-files)) + (kill-buffer b)) + (with-temp-file org-agenda-files + (insert + (mapconcat + (lambda (f) ;; Keep un-expanded entries. + (if (setq u (assoc f fe)) + (cdr u) + f)) + list "\n") + "\n"))) (let ((org-mode-hook nil) (org-inhibit-startup t) (org-insert-mode-line-in-empty-file nil)) (setq org-agenda-files list) (customize-save-variable 'org-agenda-files org-agenda-files)))) -(defun org-read-agenda-file-list () - "Read the list of agenda files from a file." +(defun org-read-agenda-file-list (&optional pair-with-expansion) + "Read the list of agenda files from a file. +If PAIR-WITH-EXPANSION is t return pairs with un-expanded +filenames, used by `org-store-new-agenda-file-list' to write back +un-expanded file names." (when (file-directory-p org-agenda-files) (error "`org-agenda-files' cannot be a single directory")) (when (stringp org-agenda-files) (with-temp-buffer (insert-file-contents org-agenda-files) - (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))) - + (mapcar + (lambda (f) + (let ((e (expand-file-name (substitute-in-file-name f) + org-directory))) + (if pair-with-expansion + (cons e f) + e))) + (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))) ;;;###autoload (defun org-cycle-agenda-files () @@ -14279,7 +14863,7 @@ (defun org-remove-file (&optional file) "Remove current file from the list of files in variable `org-agenda-files'. These are the files which are being checked for agenda entries. -Optional argument FILE means, use this file instead of the current." +Optional argument FILE means use this file instead of the current." (interactive) (let* ((org-agenda-skip-unavailable-files nil) (file (or file buffer-file-name)) @@ -14381,6 +14965,8 @@ (add-text-properties (match-beginning 0) (org-end-of-subtree t) pc))) (set-buffer-modified-p bmp))))) + (setq org-todo-keywords-for-agenda + (org-uniquify org-todo-keywords-for-agenda)) (setq org-todo-keyword-alist-for-agenda (org-uniquify org-todo-keyword-alist-for-agenda) org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda)))) @@ -14476,6 +15062,15 @@ (goto-char pos) (if dd-on (cons "$$" m)))))) +(defun org-inside-latex-macro-p () + "Is point inside a LaTeX macro or its arguments?" + (save-match-data + (org-in-regexp + "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*"))) + +(defun test () + (interactive) + (message "%s" (org-inside-latex-macro-p))) (defun org-try-cdlatex-tab () "Check if it makes sense to execute `cdlatex-tab', and do it if yes. @@ -14584,6 +15179,8 @@ (opt org-format-latex-options) (matchers (plist-get opt :matchers)) (re-list org-latex-regexps) + (org-format-latex-header-extra + (plist-get (org-infile-export-plist) :latex-header-extra)) (cnt 0) txt hash link beg end re e checkdir executables-checked m n block linkfile movefile ov) @@ -14603,16 +15200,18 @@ 'org-latex-overlay)))) (setq txt (match-string n) beg (match-beginning n) end (match-end n) - cnt (1+ cnt) - link (concat block "[[file:" linkfile "]]" block)) + cnt (1+ cnt)) (let (print-length print-level) ; make sure full list is printed (setq hash (sha1 (prin1-to-string (list org-format-latex-header + org-format-latex-header-extra + org-export-latex-default-packages-alist org-export-latex-packages-alist org-format-latex-options forbuffer txt))) linkfile (format "%s_%s.png" prefix hash) movefile (format "%s_%s.png" absprefix hash))) + (setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir ; make sure the directory exists @@ -14650,7 +15249,9 @@ (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end) - (insert link)))))))) + (insert (org-add-props link + (list 'org-latex-src + (replace-regexp-in-string "\"" "" txt))))))))))) ;; This function borrows from Ganesh Swami's latex2png.el (defun org-create-formula-image (string tofile options buffer) @@ -14676,17 +15277,14 @@ (if (eq fg 'default) (setq fg (org-dvipng-color :foreground))) (if (eq bg 'default) (setq bg (org-dvipng-color :background))) (with-temp-file texfile - (insert org-format-latex-header - (if org-export-latex-packages-alist - (concat "\n" - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n")) - "") - "\n\\begin{document}\n" string "\n\\end{document}\n")) + (insert (org-splice-latex-header + org-format-latex-header + org-export-latex-default-packages-alist + org-export-latex-packages-alist + org-format-latex-header-extra)) + (insert "\n\\begin{document}\n" string "\n\\end{document}\n") + (require 'org-latex) + (org-export-latex-fix-inputenc)) (let ((dir default-directory)) (condition-case nil (progn @@ -14706,13 +15304,70 @@ dvifile) (error nil)) (if (not (file-exists-p pngfile)) - (progn (message "Failed to create png file from %s" texfile) nil) + (if org-format-latex-signal-error + (error "Failed to create png file from %s" texfile) + (message "Failed to create png file from %s" texfile) + nil) ;; Use the requested file name and clean up (copy-file pngfile tofile 'replace) (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do (delete-file (concat texfilebase e))) pngfile)))) +(defun org-splice-latex-header (tpl def-pkg pkg &optional extra) + "Fill a LaTeX header template TPL. +In the template, the following place holders will be recognized: + + [DEFAULT-PACKAGES] \\usepackage statements for DEF-PKG + [NO-DEFAULT-PACKAGES] do not include DEF-PKG + [PACKAGES] \\usepackage statements for PKG + [NO-PACKAGES] do not include PKG + [EXTRA] the string EXTRA + [NO-EXTRA] do not include EXTRA + +For backward compatibility, if both the positive and the negative place +holder is missing, the positive one (without the \"NO-\") will be +assumed to be present at the end of the template. +DEF-PKG and PKG are assumed to be alists of options/packagename lists. +EXTRA is a string." + (let (rpl (end "")) + (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not def-pkg)) + "" (org-latex-packages-to-string def-pkg t)) + tpl (replace-match rpl t t tpl)) + (if def-pkg (setq end (org-latex-packages-to-string def-pkg)))) + + (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not pkg)) + "" (org-latex-packages-to-string pkg t)) + tpl (replace-match rpl t t tpl)) + (if pkg (setq end (concat end "\n" (org-latex-packages-to-string pkg))))) + + (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not extra)) + "" (concat extra "\n")) + tpl (replace-match rpl t t tpl)) + (if (and extra (string-match "\\S-" extra)) + (setq end (concat end "\n" extra)))) + + (if (string-match "\\S-" end) + (concat tpl "\n" end) + tpl))) + +(defun org-latex-packages-to-string (pkg &optional newline) + "Turn an alist of packages into a string with the \\usepackage macros." + (setq pkg (mapconcat (lambda(p) + (cond + ((stringp p) p) + ((equal "" (car p)) + (format "\\usepackage{%s}" (cadr p))) + (t + (format "\\usepackage[%s]{%s}" + (car p) (cadr p))))) + pkg + "\n")) + (if newline (concat pkg "\n") pkg)) + (defun org-dvipng-color (attr) "Return an rgb color specification for dvipng." (apply 'format "rgb %s %s %s" @@ -14984,7 +15639,7 @@ "Show the available speed commands." (interactive) (if (not org-use-speed-commands) - (error "Speed commands are not activated, customize `org-use-speed-commands'") + (error "Speed commands are not activated, customize `org-use-speed-commands'.") (with-output-to-temp-buffer "*Help*" (princ "User-defined Speed commands\n===========================\n") (mapc 'org-print-speed-command org-speed-commands-user) @@ -15561,6 +16216,8 @@ `ffap' to visit the file at point." (interactive) (cond + ((org-at-table.el-p) + (org-edit-src-code)) ((org-at-table-p) (call-interactively 'org-table-edit-formulas)) ((save-excursion @@ -15601,9 +16258,6 @@ - If the cursor is a the beginning of a dynamic block, update it. -- If the cursor is inside a table created by the table.el package, - activate that table. - - If the current buffer is a remember buffer, close note and file it. A prefix argument of 1 files to the default location without further interaction. A prefix argument of 2 files to @@ -15630,7 +16284,8 @@ (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) - ((org-at-property-p) + ((or (looking-at org-property-start-re) + (org-at-property-p)) (call-interactively 'org-property-action)) ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp)) ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]") @@ -15638,10 +16293,7 @@ (call-interactively 'org-update-statistics-cookies)) ((org-on-heading-p) (call-interactively 'org-set-tags)) ((org-at-table.el-p) - (require 'table) - (beginning-of-line 1) - (re-search-forward "|" (save-excursion (end-of-line 2) (point))) - (call-interactively 'table-recognize-table)) + (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg @@ -15673,9 +16325,9 @@ (if (org-at-table-p) (org-call-with-arg 'org-table-recalculate (or arg t))))) (t -; (org-set-regexps-and-options) -; (org-restart-font-lock) - (let ((org-inhibit-startup t)) (org-mode-restart)) + (let ((org-inhibit-startup-visibility-stuff t) + (org-startup-align-all-tables nil)) + (org-save-outline-visibility 'use-markers (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (error "C-c C-c can do nothing useful at this location"))))) @@ -16098,7 +16750,9 @@ (not org-export-with-LaTeX-fragments)) (require 'org-exp)) :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) - org-export-with-LaTeX-fragments)]) + org-export-with-LaTeX-fragments)] + "--" + ["Template for BEAMER" org-beamer-settings-template t]) "--" ("MobileOrg" ["Push Files and Views" org-mobile-push t] @@ -16439,7 +17093,8 @@ (defun org-fill-template (template alist) "Find each %key of ALIST in TEMPLATE and replace it." - (let (entry key value) + (let ((case-fold-search nil) + entry key value) (setq alist (sort (copy-sequence alist) (lambda (a b) (< (length (car a)) (length (car b)))))) (while (setq entry (pop alist)) @@ -16663,6 +17318,17 @@ (throw 'exit t))) nil)))) +(defun org-in-regexps-block-p (start-re end-re) + "Returns t if the current point is between matches of START-RE and END-RE. +This will also return to if point is on one of the two matches." + (interactive) + (let ((p (point))) + (save-excursion + (and (or (org-at-regexp-p start-re) + (re-search-backward start-re nil t)) + (re-search-forward end-re nil t) + (>= (point) p))))) + (defun org-occur-in-agenda-files (regexp &optional nlines) "Call `multi-occur' with buffers for all agenda files." (interactive "sOrg-files matching: \np") @@ -16969,6 +17635,12 @@ t t)) (org-move-to-column column))) +(defvar org-adaptive-fill-regexp-backup adaptive-fill-regexp + "Variable to store copy of `adaptive-fill-regexp'. +Since `adaptive-fill-regexp' is set to never match, we need to +store a backup of its value before entering `org-mode' so that +the functionality can be provided as a fall-back.") + (defun org-set-autofill-regexps () (interactive) ;; In the paragraph separator we include headlines, because filling @@ -17004,8 +17676,11 @@ ;; and fixed-width regions are not wrapped. That function will pass ;; through to `fill-paragraph' when appropriate. (org-set-local 'fill-paragraph-function 'org-fill-paragraph) - ; Adaptive filling: To get full control, first make sure that + ;; Adaptive filling: To get full control, first make sure that ;; `adaptive-fill-regexp' never matches. Then install our own matcher. + (unless (local-variable-p 'adaptive-fill-regexp) + (org-set-local 'org-adaptive-fill-regexp-backup + adaptive-fill-regexp)) (org-set-local 'adaptive-fill-regexp "\000") (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) @@ -17034,8 +17709,11 @@ "Return a fill prefix for org-mode files. In particular, this makes sure hanging paragraphs for hand-formatted lists work correctly." - (cond ((looking-at "#[ \t]+") - (match-string 0)) + (cond + ;; Comment line + ((looking-at "#[ \t]+") + (match-string-no-properties 0)) + ;; Description list ((looking-at "[ \t]*\\([-*+] .*? :: \\)") (save-excursion (if (> (match-end 1) (+ (match-beginning 1) @@ -17043,11 +17721,14 @@ (goto-char (+ (match-beginning 1) 5)) (goto-char (match-end 0))) (make-string (current-column) ?\ ))) - ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)?") + ;; Ordered or unordered list + ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)") (save-excursion (goto-char (match-end 0)) (make-string (current-column) ?\ ))) - (t nil))) + ;; Other text + ((looking-at org-adaptive-fill-regexp-backup) + (match-string-no-properties 0)))) ;;; Other stuff. @@ -17388,6 +18069,15 @@ (defun org-at-heading-p (&optional ignored) (outline-on-heading-p t)) +(defun org-point-at-end-of-empty-headline () + "If point is at the end of an empty headline, return t, else nil. +If the heading only contains a TODO keyword, it is still still considered +empty." + (and (looking-at "[ \t]*$") + (save-excursion + (beginning-of-line 1) + (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp + "\\)?[ \t]*$"))))) (defun org-at-heading-or-item-p () (or (org-on-heading-p) (org-at-item-p))) @@ -17566,7 +18256,7 @@ (setq l (- (match-end 0) (match-beginning 0) 1)) (= l level) (not invisible-ok) - (org-invisible-p)) + (progn (backward-char 1) (org-invisible-p))) (if (< l level) (setq arg 1))) (setq arg (1- arg))) (beginning-of-line 1))) @@ -17848,4 +18538,3 @@ ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd ;;; org.el ends here - diff -r e56f669f17ce -r fe07c47cf7a7 lisp/pgg-parse.el --- a/lisp/pgg-parse.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/pgg-parse.el Thu May 13 15:13:52 2010 +0200 @@ -503,8 +503,8 @@ (defun pgg-parse-armor (string) (with-temp-buffer (buffer-disable-undo) - (if (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte nil)) + (unless (featurep 'xemacs) + (set-buffer-multibyte nil)) (insert string) (pgg-decode-armor-region (point-min)(point)))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/pgg.el --- a/lisp/pgg.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/pgg.el Thu May 13 15:13:52 2010 +0200 @@ -475,8 +475,8 @@ (if (null signature) nil (with-temp-buffer (buffer-disable-undo) - (if (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte nil)) + (unless (featurep 'xemacs) + (set-buffer-multibyte nil)) (insert-file-contents signature) (cdr (assq 2 (pgg-decode-armor-region (point-min)(point-max))))))) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/play/tetris.el --- a/lisp/play/tetris.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/play/tetris.el Thu May 13 15:13:52 2010 +0200 @@ -35,7 +35,7 @@ ;; ;;;;;;;;;;;;; customization variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defgroup tetris nil - "Play a game of tetris." + "Play a game of Tetris." :prefix "tetris-" :group 'games) @@ -61,10 +61,10 @@ (defcustom tetris-update-speed-function 'tetris-default-update-speed-function - "Function run whenever the Tetris score changes + "Function run whenever the Tetris score changes. Called with two arguments: (SHAPES ROWS) -SHAPES is the number of shapes which have been dropped -ROWS is the number of rows which have been completed +SHAPES is the number of shapes which have been dropped. +ROWS is the number of rows which have been completed. If the return value is a number, it is used as the timer period." :group 'tetris @@ -77,7 +77,7 @@ (defcustom tetris-tty-colors [nil "blue" "white" "yellow" "magenta" "cyan" "green" "red"] - "Vector of colors of the various shapes in text mode + "Vector of colors of the various shapes in text mode. Element 0 is ignored." :group 'tetris :type (let ((names `("Shape 1" "Shape 2" "Shape 3" @@ -97,7 +97,7 @@ (defcustom tetris-x-colors [nil [0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]] - "Vector of colors of the various shapes + "Vector of colors of the various shapes. Element 0 is ignored." :group 'tetris :type 'sexp) @@ -274,22 +274,22 @@ ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar tetris-mode-map - (make-sparse-keymap 'tetris-mode-map)) - -(define-key tetris-mode-map "n" 'tetris-start-game) -(define-key tetris-mode-map "q" 'tetris-end-game) -(define-key tetris-mode-map "p" 'tetris-pause-game) + (let ((map (make-sparse-keymap 'tetris-mode-map))) + (define-key map "n" 'tetris-start-game) + (define-key map "q" 'tetris-end-game) + (define-key map "p" 'tetris-pause-game) -(define-key tetris-mode-map " " 'tetris-move-bottom) -(define-key tetris-mode-map [left] 'tetris-move-left) -(define-key tetris-mode-map [right] 'tetris-move-right) -(define-key tetris-mode-map [up] 'tetris-rotate-prev) -(define-key tetris-mode-map [down] 'tetris-rotate-next) + (define-key map " " 'tetris-move-bottom) + (define-key map [left] 'tetris-move-left) + (define-key map [right] 'tetris-move-right) + (define-key map [up] 'tetris-rotate-prev) + (define-key map [down] 'tetris-rotate-next) + map)) (defvar tetris-null-map - (make-sparse-keymap 'tetris-null-map)) - -(define-key tetris-null-map "n" 'tetris-start-game) + (let ((map (make-sparse-keymap 'tetris-null-map))) + (define-key map "n" 'tetris-start-game) + map)) ;; ;;;;;;;;;;;;;;;; game functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -508,7 +508,7 @@ (tetris-shape-done))))) (defun tetris-move-bottom () - "Drops the shape to the bottom of the playing area" + "Drop the shape to the bottom of the playing area." (interactive) (if (not tetris-paused) (let ((hit nil)) @@ -521,7 +521,7 @@ (tetris-shape-done)))) (defun tetris-move-left () - "Moves the shape one square to the left" + "Move the shape one square to the left." (interactive) (unless (or (= tetris-pos-x 0) tetris-paused) @@ -532,7 +532,7 @@ (tetris-draw-shape))) (defun tetris-move-right () - "Moves the shape one square to the right" + "Move the shape one square to the right." (interactive) (unless (or (= (+ tetris-pos-x (tetris-shape-width)) tetris-width) @@ -544,7 +544,7 @@ (tetris-draw-shape))) (defun tetris-rotate-prev () - "Rotates the shape clockwise" + "Rotate the shape clockwise." (interactive) (if (not tetris-paused) (progn (tetris-erase-shape) @@ -554,7 +554,7 @@ (tetris-draw-shape)))) (defun tetris-rotate-next () - "Rotates the shape anticlockwise" + "Rotate the shape anticlockwise." (interactive) (if (not tetris-paused) (progn @@ -565,14 +565,14 @@ (tetris-draw-shape)))) (defun tetris-end-game () - "Terminates the current game" + "Terminate the current game." (interactive) (gamegrid-kill-timer) (use-local-map tetris-null-map) (gamegrid-add-score tetris-score-file tetris-score)) (defun tetris-start-game () - "Starts a new game of Tetris" + "Start a new game of Tetris." (interactive) (tetris-reset-game) (use-local-map tetris-mode-map) @@ -581,7 +581,7 @@ (gamegrid-start-timer period 'tetris-update-game))) (defun tetris-pause-game () - "Pauses (or resumes) the current game" + "Pause (or resume) the current game." (interactive) (setq tetris-paused (not tetris-paused)) (message (and tetris-paused "Game paused (press p to resume)"))) @@ -591,21 +591,13 @@ (put 'tetris-mode 'mode-class 'special) -(defun tetris-mode () - "A mode for playing Tetris. - -tetris-mode keybindings: - \\{tetris-mode-map} -" - (kill-all-local-variables) +(define-derived-mode tetris-mode nil "Tetris" + "A mode for playing Tetris." (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) (use-local-map tetris-null-map) - (setq major-mode 'tetris-mode) - (setq mode-name "Tetris") - (unless (featurep 'emacs) (setq mode-popup-menu '("Tetris Commands" @@ -617,12 +609,12 @@ ["Resume" tetris-pause-game (and (tetris-active-p) tetris-paused)]))) + (setq show-trailing-whitespace nil) + (setq gamegrid-use-glyphs tetris-use-glyphs) (setq gamegrid-use-color tetris-use-color) - (gamegrid-init (tetris-display-options)) - - (run-mode-hooks 'tetris-mode-hook)) + (gamegrid-init (tetris-display-options))) ;;;###autoload (defun tetris () @@ -645,6 +637,8 @@ " (interactive) + (select-window (or (get-buffer-window tetris-buffer-name) + (selected-window))) (switch-to-buffer tetris-buffer-name) (gamegrid-kill-timer) (tetris-mode) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/bug-reference.el --- a/lisp/progmodes/bug-reference.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/bug-reference.el Thu May 13 15:13:52 2010 +0200 @@ -48,10 +48,18 @@ 1. issue kind (bug, patch, rfe &c) 2. issue number. -There is no default setting for this, it must be set per file.") +There is no default setting for this, it must be set per file. +If you set it to a symbol in the file Local Variables section, +you need to add a `bug-reference-url-format' property to it: +\(put 'my-bug-reference-url-format 'bug-reference-url-format t) +so that it is considered safe, see `enable-local-variables'.") ;;;###autoload -(put 'bug-reference-url-format 'safe-local-variable 'stringp) +(put 'bug-reference-url-format 'safe-local-variable + (lambda (s) + (or (stringp s) + (and (symbolp s) + (get s 'bug-reference-url-format))))) (defconst bug-reference-bug-regexp "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)" diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/cc-cmds.el --- a/lisp/progmodes/cc-cmds.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/cc-cmds.el Thu May 13 15:13:52 2010 +0200 @@ -1501,6 +1501,11 @@ (interactive "p") (or arg (setq arg 1)) + (or (not (eq this-command 'c-beginning-of-defun)) + (eq last-command 'c-beginning-of-defun) + (and transient-mark-mode mark-active) + (push-mark)) + (c-save-buffer-state (beginning-of-defun-function end-of-defun-function (start (point)) @@ -1604,6 +1609,11 @@ (interactive "p") (or arg (setq arg 1)) + (or (not (eq this-command 'c-end-of-defun)) + (eq last-command 'c-end-of-defun) + (and transient-mark-mode mark-active) + (push-mark)) + (c-save-buffer-state (beginning-of-defun-function end-of-defun-function (start (point)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/cc-mode.el --- a/lisp/progmodes/cc-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/cc-mode.el Thu May 13 15:13:52 2010 +0200 @@ -818,8 +818,10 @@ (setq c-old-BOM (point)) (goto-char end) - (if (c-beginning-of-macro) - (c-end-of-macro)) + (when (c-beginning-of-macro) + (c-end-of-macro) + (or (eobp) (forward-char))) ; Over the terminating NL which may be marked + ; with a c-cpp-delimiter category property (setq c-old-EOM (point))) (defun c-neutralize-CPP-line (beg end) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/compile.el Thu May 13 15:13:52 2010 +0200 @@ -748,9 +748,9 @@ "If non-nil, automatically jump to the next error encountered.") (make-variable-buffer-local 'compilation-auto-jump-to-next) -(defvar buffer-modtime nil +(defvar compilation-buffer-modtime nil "The buffer modification time, for buffers not associated with files.") -(make-variable-buffer-local 'buffer-modtime) +(make-variable-buffer-local 'compilation-buffer-modtime) (defvar compilation-skip-to-next-location t "*If non-nil, skip multiple error messages for the same source location.") @@ -1265,7 +1265,8 @@ (set (make-local-variable 'compilation-auto-jump-to-next) t)) ;; Output a mode setter, for saving and later reloading this buffer. (insert "-*- mode: " name-of-mode - "; default-directory: " (prin1-to-string default-directory) + "; default-directory: " + (prin1-to-string (abbreviate-file-name default-directory)) " -*-\n" (format "%s started at %s\n\n" mode-name @@ -1587,7 +1588,7 @@ mode-name (or name-of-mode "Compilation")) (set (make-local-variable 'page-delimiter) compilation-page-delimiter) - (set (make-local-variable 'buffer-modtime) nil) + (set (make-local-variable 'compilation-buffer-modtime) nil) (compilation-setup) (setq buffer-read-only t) (run-mode-hooks 'compilation-mode-hook)) @@ -1803,7 +1804,7 @@ (unless comint-inhibit-carriage-motion (comint-carriage-motion (process-mark proc) (point))) (set-marker (process-mark proc) (point)) - (set (make-local-variable 'buffer-modtime) (current-time)) + (set (make-local-variable 'compilation-buffer-modtime) (current-time)) (run-hooks 'compilation-filter-hook)) (goto-char pos) (narrow-to-region min max) @@ -1977,7 +1978,7 @@ ;; There may be no timestamp info if the loc is a `fake-loc', ;; but we just checked that the file has been visited before! (equal (nth 4 loc) - (setq timestamp buffer-modtime))) + (setq timestamp compilation-buffer-modtime))) (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) (cadr (car (nth 2 loc)))) (save-restriction diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/cperl-mode.el --- a/lisp/progmodes/cperl-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/cperl-mode.el Thu May 13 15:13:52 2010 +0200 @@ -8980,6 +8980,18 @@ (substring v (match-beginning 1) (match-end 1))) "Version of IZ-supported CPerl package this file is based on.") +(defun cperl-mode-unload-function () + "Unload the Cperl mode library." + (let ((new-mode (if (eq (symbol-function 'perl-mode) 'cperl-mode) + 'fundamental-mode + 'perl-mode))) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (eq major-mode 'cperl-mode) + (funcall new-mode))))) + ;; continue standard unloading + nil) + (provide 'cperl-mode) ;; arch-tag: 42e5b19b-e187-4537-929f-1a7408980ce6 diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/etags.el --- a/lisp/progmodes/etags.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/etags.el Thu May 13 15:13:52 2010 +0200 @@ -423,9 +423,9 @@ (if (get-file-buffer file) ;; The file is already in a buffer. Check for the visited file ;; having changed since we last used it. - (let (win) + (progn (set-buffer (get-file-buffer file)) - (setq win (or verify-tags-table-function (tags-table-mode))) + (or verify-tags-table-function (tags-table-mode)) (if (or (verify-visited-file-modtime (current-buffer)) ;; Decide whether to revert the file. ;; revert-without-query can say to revert @@ -787,6 +787,30 @@ (let ((enable-recursive-minibuffers t)) (visit-tags-table-buffer)) (complete-with-action action (tags-completion-table) string pred)))))) + +;;;###autoload (defun tags-completion-at-point-function () +;;;###autoload (if (or tags-table-list tags-file-name) +;;;###autoload (progn +;;;###autoload (load "etags") +;;;###autoload (tags-completion-at-point-function)))) + +(defun tags-completion-at-point-function () + "Using tags, return a completion table for the text around point. +If no tags table is loaded, do nothing and return nil." + (when (or tags-table-list tags-file-name) + (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) + tags-case-fold-search + case-fold-search)) + (pattern (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default))) + beg) + (when pattern + (save-excursion + (search-backward pattern) ;FIXME: will fail if we're inside pattern. + (setq beg (point)) + (forward-char (length pattern)) + (list beg (point) (tags-lazy-completion-table))))))) (defun find-tag-tag (string) "Read a tag name, with defaulting and completion." @@ -2039,20 +2063,10 @@ (error "%s" (substitute-command-keys "No tags table loaded; try \\[visit-tags-table]"))) - (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) - tags-case-fold-search - case-fold-search)) - (pattern (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default))) - (comp-table (tags-lazy-completion-table)) - beg) - (or pattern - (error "Nothing to complete")) - (search-backward pattern) - (setq beg (point)) - (forward-char (length pattern)) - (completion-in-region beg (point) comp-table))) + (let ((comp-data (tags-completion-at-point-function))) + (if (null comp-data) + (error "Nothing to complete") + (apply 'completion-in-region comp-data)))) (dolist (x '("^No tags table in use; use .* to select one$" "^There is no default tag$" diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/fortran.el --- a/lisp/progmodes/fortran.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/fortran.el Thu May 13 15:13:52 2010 +0200 @@ -403,6 +403,28 @@ '("^ *\\([0-9]+\\)" . font-lock-constant-face))) "Medium level highlighting for Fortran mode.") +;; See bug#1385. Never really looked into _why_ this matters... +(defun fortran-match-and-skip-declaration (limit) + "Like `font-lock-match-c-style-declaration-item-and-skip-to-next'. +The only difference is, it returns t in a case when the default returns nil." + (when (looking-at "[ \n\t*]*\\(\\sw+\\)[ \t\n]*\\(((?\\)?") + (when (and (match-end 2) (> (- (match-end 2) (match-beginning 2)) 1)) + (let ((pos (point))) + (skip-chars-backward " \t\n") + (skip-syntax-backward "w") + (unless (looking-at "\\(\\sw+\\)[ \t\n]*\\sw+[ \t\n]*\\(((?\\)?") + (goto-char pos) + (looking-at "[ \n\t*]*\\(\\sw+\\)[ \t\n]*\\(((?\\)?")))) + (save-match-data + (condition-case nil + (save-restriction + (narrow-to-region (point-min) limit) + (goto-char (match-end 1)) + (while (not (looking-at "[ \t\n]*\\(\\(,\\)\\|;\\|\\'\\)")) + (goto-char (or (scan-sexps (point) 1) (point-max)))) + (goto-char (match-end 2))) + (error t))))) + (defvar fortran-font-lock-keywords-3 (append fortran-font-lock-keywords-1 @@ -412,7 +434,7 @@ ;; Type specifier. '(1 font-lock-type-face) ;; Declaration item (or just /.../ block name). - `(font-lock-match-c-style-declaration-item-and-skip-to-next + `(fortran-match-and-skip-declaration ;; Start after any *(...) expression. (condition-case nil (and (match-beginning ,(1+ (regexp-opt-depth diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/grep.el --- a/lisp/progmodes/grep.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/grep.el Thu May 13 15:13:52 2010 +0200 @@ -513,8 +513,8 @@ grep-find-template grep-find-use-xargs grep-highlight-matches)) (set setting - (or (cadr (assq setting host-defaults)) - (cadr (assq setting defaults))))) + (cadr (or (assq setting host-defaults) + (assq setting defaults))))) (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) (setq grep-use-null-device diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/idlwave.el --- a/lisp/progmodes/idlwave.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/idlwave.el Thu May 13 15:13:52 2010 +0200 @@ -1370,6 +1370,7 @@ not possible without parsing. Thus assignment statement become just the leftover unidentified statements containing an equal sign.") +;; FIXME: This var seems to only ever be set, but never actually used! (defvar idlwave-fill-function 'auto-fill-function "IDL mode auto fill function.") diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/js.el --- a/lisp/progmodes/js.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/js.el Thu May 13 15:13:52 2010 +0200 @@ -3327,6 +3327,13 @@ comment-start-skip "\\(//+\\|/\\*+\\)\\s *") (let ((c-buffer-is-cc-mode t)) + ;; FIXME: These are normally set by `c-basic-common-init'. Should + ;; we call it instead? (Bug#6071) + (make-local-variable 'paragraph-start) + (make-local-variable 'paragraph-separate) + (make-local-variable 'paragraph-ignore-fill-prefix) + (make-local-variable 'adaptive-fill-mode) + (make-local-variable 'adaptive-fill-regexp) (c-setup-paragraph-variables)) (set (make-local-variable 'syntax-begin-function) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/sql.el --- a/lisp/progmodes/sql.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/sql.el Thu May 13 15:13:52 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Alex Schroeder ;; Maintainer: Michael Mauger -;; Version: 2.0.2 +;; Version: 2.1 ;; Keywords: comm languages processes ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode @@ -103,83 +103,79 @@ ;; identifiers; ms (Microsoft SQLServer) also supports identifiers ;; enclosed within brackets []. -;; ChangeLog available on request. - ;;; Product Support: ;; To add support for additional SQL products the following steps ;; must be followed ("xyz" is the name of the product in the examples ;; below): -;; 1) Add the product to `sql-product' choice list. - -;; (const :tag "XyzDB" xyz) - -;; 2) Add an entry to the `sql-product-alist' list. - -;; (xyz -;; :font-lock sql-mode-xyz-font-lock-keywords -;; :sqli-login (user password server database) -;; :sqli-connect sql-connect-xyz -;; :sqli-prompt-regexp "^xyzdb> " -;; :sqli-prompt-length 7 -;; :sqli-input-sender nil -;; :syntax-alist ((?# . "w"))) - -;; 3) Add customizable values for the product interpreter and options. - -;; ;; Customization for XyzDB -;; -;; (defcustom sql-xyz-program "ixyz" -;; "*Command to start ixyz by XyzDB." +;; 1) Add the product to the list of known products. + +;; (sql-add-product 'xyz "XyzDB" +;; '(:free-software t)) + +;; 2) Define font lock settings. All ANSI keywords will be +;; highlighted automatically, so only product specific keywords +;; need to be defined here. + +;; (defvar my-sql-mode-xyz-font-lock-keywords +;; '(("\\b\\(red\\|orange\\|yellow\\)\\b" +;; . font-lock-keyword-face)) +;; "XyzDB SQL keywords used by font-lock.") + +;; (sql-set-product-feature 'xyz +;; :font-lock +;; 'my-sql-mode-xyz-font-lock-keywords) + +;; 3) Define any special syntax characters including comments and +;; identifier characters. + +;; (sql-set-product-feature 'xyz +;; :syntax-alist ((?# . "w"))) + +;; 4) Define the interactive command interpreter for the database +;; product. + +;; (defcustom my-sql-xyz-program "ixyz" +;; "Command to start ixyz by XyzDB." ;; :type 'file ;; :group 'SQL) ;; -;; (defcustom sql-xyz-options '("-X" "-Y" "-Z") -;; "*List of additional options for `sql-xyz-program'." +;; (sql-set-product-feature 'xyz +;; :sqli-program 'my-sql-xyz-program) +;; (sql-set-product-feature 'xyz +;; :prompt-regexp "^xyzdb> ") +;; (sql-set-product-feature 'xyz +;; :prompt-length 7) + +;; 5) Define login parameters and command line formatting. + +;; (defcustom my-sql-xyz-login-params '(user password server database) +;; "Login parameters to needed to connect to XyzDB." +;; :type '(repeat (choice +;; (const user) +;; (const password) +;; (const server) +;; (const database))) +;; :group 'SQL) +;; +;; (sql-set-product-feature 'xyz +;; :sqli-login 'my-sql-xyz-login-params) + +;; (defcustom my-sql-xyz-options '("-X" "-Y" "-Z") +;; "List of additional options for `sql-xyz-program'." ;; :type '(repeat string) ;; :group 'SQL) - -;; 4) Add an entry to SQL->Product submenu. - -;; ["XyzDB" sql-highlight-xyz-keywords -;; :style radio -;; :selected (eq sql-product 'xyz)] - -;; 5) Add the font-lock specifications. At a minimum, default to -;; using ANSI keywords. See sql-mode-oracle-font-lock-keywords for -;; a more complex example. - -;; (defvar sql-mode-xyz-font-lock-keywords nil -;; "XyzDB SQL keywords used by font-lock.") - -;; 6) Add a product highlighting function. - -;; (defun sql-highlight-xyz-keywords () -;; "Highlight XyzDB keywords." -;; (interactive) -;; (sql-set-product 'xyz)) - -;; 7) Add an autoloaded SQLi function. - -;; ;;;###autoload -;; (defun sql-xyz () -;; "Run ixyz by XyzDB as an inferior process." -;; (interactive) -;; (sql-product-interactive 'xyz)) - -;; 8) Add a connect function which formats the command line arguments -;; and starts the product interpreter in a comint buffer. See the -;; existing connect functions for examples of the types of -;; processing available. - -;; (defun sql-connect-xyz () -;; "Create comint buffer and connect to XyzDB using the login -;; parameters and command options." +;; +;; (sql-set-product-feature 'xyz +;; :sqli-options 'my-sql-xyz-options)) + +;; (defun my-sql-connect-xyz (product options) +;; "Connect ti XyzDB in a comint buffer." ;; ;; ;; Do something with `sql-user', `sql-password', ;; ;; `sql-database', and `sql-server'. -;; (let ((params sql-xyz-options)) +;; (let ((params options)) ;; (if (not (string= "" sql-server)) ;; (setq params (append (list "-S" sql-server) params))) ;; (if (not (string= "" sql-database)) @@ -188,25 +184,36 @@ ;; (setq params (append (list "-P" sql-password) params))) ;; (if (not (string= "" sql-user)) ;; (setq params (append (list "-U" sql-user) params))) -;; (set-buffer (apply 'make-comint "SQL" sql-xyz-program -;; nil params)))) - -;; 9) Save and compile sql.el. +;; (sql-connect product params))) +;; +;; (sql-set-product-feature 'xyz +;; :sqli-connect-func 'my-sql-connect-xyz) + +;; 6) Define a convienence function to invoke the SQL interpreter. + +;; (defun my-sql-xyz () +;; "Run ixyz by XyzDB as an inferior process." +;; (interactive) +;; (sql-product-interactive 'xyz)) ;;; To Do: -;; Add better hilight support for other brands; there is a bias towards -;; Oracle because that's what I use at work. Anybody else just send in -;; your lists of reserved words, keywords and builtin functions! As -;; long as I don't receive any feedback, everything is hilighted with -;; ANSI keywords only. I received the list of ANSI keywords from a -;; user; if you know of any changes, let me know. - -;; Add different hilighting levels. +;; Improve keyword highlighting for individual products. I have tried +;; to update those database that I use. Feel free to send me updates, +;; or direct me to the reference manuals for your favorite database. + +;; When there are no keywords defined, the ANSI keywords are +;; highlighted. ANSI keywords are highlighted even if the keyword is +;; not used for your current product. This should help identify +;; portability concerns. + +;; Add different highlighting levels. + +;; Add support for listing available tables or the columns in a table. ;;; Thanks to all the people who helped me out: -;; Alex Schroeder +;; Alex Schroeder -- the original author ;; Kai Blauberg ;; ;; Yair Friedman @@ -217,7 +224,7 @@ ;; Michael Mauger -- improved product support ;; Drew Adams -- Emacs 20 support ;; Harald Maier -- sql-send-string -;; Stefan Monnier -- font-lock corrections +;; Stefan Monnier -- font-lock corrections; code polish @@ -240,32 +247,43 @@ (defgroup SQL nil "Running a SQL interpreter from within Emacs buffers." :version "20.4" + :group 'languages :group 'processes) ;; These four variables will be used as defaults, if set. (defcustom sql-user "" - "*Default username." + "Default username." :type 'string :group 'SQL) +(put 'sql-user 'safe-local-variable 'stringp) (defcustom sql-password "" - "*Default password. + "Default password. Storing your password in a textfile such as ~/.emacs could be dangerous. Customizing your password will store it in your ~/.emacs file." :type 'string :group 'SQL) +(put 'sql-password 'risky-local-variable t) (defcustom sql-database "" - "*Default database." + "Default database." :type 'string :group 'SQL) +(put 'sql-database 'safe-local-variable 'stringp) (defcustom sql-server "" - "*Default server or host." + "Default server or host." :type 'string :group 'SQL) +(put 'sql-server 'safe-local-variable 'stringp) + +(defcustom sql-port nil + "Default server or host." + :type 'number + :group 'SQL) +(put 'sql-port 'safe-local-variable 'numberp) ;; SQL Product support @@ -276,108 +294,176 @@ '((ansi :name "ANSI" :font-lock sql-mode-ansi-font-lock-keywords) + (db2 :name "DB2" :font-lock sql-mode-db2-font-lock-keywords - :sqli-login nil - :sqli-connect sql-connect-db2 - :sqli-prompt-regexp "^db2 => " - :sqli-prompt-length 7) + :sqli-program sql-db2-program + :sqli-options sql-db2-options + :sqli-login sql-db2-login-params + :sqli-connect-func sql-connect-db2 + :prompt-regexp "^db2 => " + :prompt-length 7 + :input-filter sql-escape-newlines-filter) + (informix + :name "Informix" :font-lock sql-mode-informix-font-lock-keywords - :sqli-login (database) - :sqli-connect sql-connect-informix - :sqli-prompt-regexp "^SQL> " - :sqli-prompt-length 5) + :sqli-program sql-informix-program + :sqli-options sql-informix-options + :sqli-login sql-informix-login-params + :sqli-connect-func sql-connect-informix + :prompt-regexp "^> " + :prompt-length 2 + :syntax-alist ((?{ . "<") (?} . ">"))) + (ingres + :name "Ingres" :font-lock sql-mode-ingres-font-lock-keywords - :sqli-login (database) - :sqli-connect sql-connect-ingres - :sqli-prompt-regexp "^\* " - :sqli-prompt-length 2) + :sqli-program sql-ingres-program + :sqli-options sql-ingres-options + :sqli-login sql-ingres-login-params + :sqli-connect-func sql-connect-ingres + :prompt-regexp "^\* " + :prompt-length 2) + (interbase + :name "Interbase" :font-lock sql-mode-interbase-font-lock-keywords - :sqli-login (user password database) - :sqli-connect sql-connect-interbase - :sqli-prompt-regexp "^SQL> " - :sqli-prompt-length 5) + :sqli-program sql-interbase-program + :sqli-options sql-interbase-options + :sqli-login sql-interbase-login-params + :sqli-connect-func sql-connect-interbase + :prompt-regexp "^SQL> " + :prompt-length 5) + (linter + :name "Linter" :font-lock sql-mode-linter-font-lock-keywords - :sqli-login (user password database server) - :sqli-connect sql-connect-linter - :sqli-prompt-regexp "^SQL>" - :sqli-prompt-length 4) + :sqli-program sql-linter-program + :sqli-options sql-linter-options + :sqli-login sql-linter-login-params + :sqli-connect-func sql-connect-linter + :prompt-regexp "^SQL>" + :prompt-length 4) + (ms - :name "MS SQLServer" + :name "Microsoft" :font-lock sql-mode-ms-font-lock-keywords - :sqli-login (user password server database) - :sqli-connect sql-connect-ms - :sqli-prompt-regexp "^[0-9]*>" - :sqli-prompt-length 5 - :syntax-alist ((?@ . "w"))) + :sqli-program sql-ms-program + :sqli-options sql-ms-options + :sqli-login sql-ms-login-params + :sqli-connect-func sql-connect-ms + :prompt-regexp "^[0-9]*>" + :prompt-length 5 + :syntax-alist ((?@ . "w")) + :terminator ("^go" . "go")) + (mysql :name "MySQL" + :free-software t :font-lock sql-mode-mysql-font-lock-keywords - :sqli-login (user password database server) - :sqli-connect sql-connect-mysql - :sqli-prompt-regexp "^mysql> " - :sqli-prompt-length 6) + :sqli-program sql-mysql-program + :sqli-options sql-mysql-options + :sqli-login sql-mysql-login-params + :sqli-connect-func sql-connect-mysql + :prompt-regexp "^mysql> " + :prompt-length 6 + :input-filter sql-remove-tabs-filter) + (oracle + :name "Oracle" :font-lock sql-mode-oracle-font-lock-keywords - :sqli-login (user password database) - :sqli-connect sql-connect-oracle - :sqli-prompt-regexp "^SQL> " - :sqli-prompt-length 5 - :syntax-alist ((?$ . "w") (?# . "w"))) + :sqli-program sql-oracle-program + :sqli-options sql-oracle-options + :sqli-login sql-oracle-login-params + :sqli-connect-func sql-connect-oracle + :prompt-regexp "^SQL> " + :prompt-length 5 + :syntax-alist ((?$ . "w") (?# . "w")) + :terminator ("\\(^/\\|;\\)" . "/") + :input-filter sql-placeholders-filter) + (postgres + :name "Postgres" + :free-software t :font-lock sql-mode-postgres-font-lock-keywords - :sqli-login (user database server) - :sqli-connect sql-connect-postgres - :sqli-prompt-regexp "^.*[#>] *" - :sqli-prompt-length 5) + :sqli-program sql-postgres-program + :sqli-options sql-postgres-options + :sqli-login sql-postgres-login-params + :sqli-connect-func sql-connect-postgres + :prompt-regexp "^.*[#>] *" + :prompt-length 5 + :input-filter sql-remove-tabs-filter + :terminator ("\\(^[\\]g\\|;\\)" . ";")) + (solid + :name "Solid" :font-lock sql-mode-solid-font-lock-keywords - :sqli-login (user password server) - :sqli-connect sql-connect-solid - :sqli-prompt-regexp "^" - :sqli-prompt-length 0) + :sqli-program sql-solid-program + :sqli-options sql-solid-options + :sqli-login sql-solid-login-params + :sqli-connect-func sql-connect-solid + :prompt-regexp "^" + :prompt-length 0) + (sqlite :name "SQLite" + :free-software t :font-lock sql-mode-sqlite-font-lock-keywords - :sqli-login (database) - :sqli-connect sql-connect-sqlite - :sqli-prompt-regexp "^sqlite> " - :sqli-prompt-length 8) + :sqli-program sql-sqlite-program + :sqli-options sql-sqlite-options + :sqli-login sql-sqlite-login-params + :sqli-connect-func sql-connect-sqlite + :prompt-regexp "^sqlite> " + :prompt-length 8) + (sybase + :name "Sybase" :font-lock sql-mode-sybase-font-lock-keywords - :sqli-login (server user password database) - :sqli-connect sql-connect-sybase - :sqli-prompt-regexp "^SQL> " - :sqli-prompt-length 5 - :syntax-alist ((?@ . "w"))) + :sqli-program sql-sybase-program + :sqli-options sql-sybase-options + :sqli-login sql-sybase-login-params + :sqli-connect-func sql-connect-sybase + :prompt-regexp "^SQL> " + :prompt-length 5 + :syntax-alist ((?@ . "w")) + :terminator ("^go" . "go")) ) - "This variable contains a list of product features for each of the -SQL products handled by `sql-mode'. Without an entry in this list a -product will not be properly highlighted and will not support -`sql-interactive-mode'. + "An alist of product specific configuration settings. + +Without an entry in this list a product will not be properly +highlighted and will not support `sql-interactive-mode'. Each element in the list is in the following format: \(PRODUCT FEATURE VALUE ...) -where PRODUCT is the appropriate value of `sql-product'. The product -name is then followed by FEATURE-VALUE pairs. If a FEATURE is not -specified, its VALUE is treated as nil. FEATURE must be one of the -following: +where PRODUCT is the appropriate value of `sql-product'. The +product name is then followed by FEATURE-VALUE pairs. If a +FEATURE is not specified, its VALUE is treated as nil. FEATURE +may be any one of the following: + + :name string containing the displayable name of + the product. + + :free-software is the product Free (as in Freedom) software? :font-lock name of the variable containing the product specific font lock highlighting patterns. - :sqli-login a list of login parameters (i.e., user, - password, database and server) needed to - connect to the database. - - :sqli-connect the name of a function which accepts no + :sqli-program name of the variable containing the product + specific interactive program name. + + :sqli-options name of the variable containing the list + of product specific options. + + :sqli-login name of the variable containing the list of + login parameters (i.e., user, password, + database and server) needed to connect to + the database. + + :sqli-connect-func name of a function which accepts no parameters that will use the values of `sql-user', `sql-password', `sql-database' and `sql-server' to open a @@ -385,19 +471,45 @@ database. Do product specific configuration of comint in this function. - :sqli-prompt-regexp a regular expression string that matches + :prompt-regexp regular expression string that matches the prompt issued by the product - interpreter. (Not needed in 21.3+) - - :sqli-prompt-length the length of the prompt on the line.(Not - needed in 21.3+) - - :syntax-alist an alist of syntax table entries to enable - special character treatment by font-lock and - imenu. ") - + interpreter. + + :prompt-length length of the prompt on the line. + + :input-filter function which can filter strings sent to + the command interpreter. It is also used + by the `sql-send-string', + `sql-send-region', `sql-send-paragraph' + and `sql-send-buffer' functions. The + function is passed the string sent to the + command interpreter and must return the + filtered string. + + :terminator the terminator to be sent after a + `sql-send-string', `sql-send-region', + `sql-send-paragraph' and + `sql-send-buffer' command. May be the + literal string or a cons of a regexp to + match an existing terminator in the + string and the terminator to be used if + its absent. By default \";\". + + :syntax-alist alist of syntax table entries to enable + special character treatment by font-lock + and imenu. + +Other features can be stored but they will be ignored. However, +you can develop new functionality which is product independent by +using `sql-get-product-feature' to lookup the product specific +settings.") + +(defvar sql-indirect-features + '(:font-lock :sqli-program :sqli-options :sqli-login)) + +;;;###autoload (defcustom sql-product 'ansi - "*Select the SQL database product used so that buffers can be + "Select the SQL database product used so that buffers can be highlighted properly when you open them." :type `(choice ,@(mapcar (lambda (prod-info) @@ -407,8 +519,12 @@ ,(car prod-info))) sql-product-alist)) :group 'SQL) - -;; misc customization of sql.el behavior +(put 'sql-product 'safe-local-variable 'symbolp) + +(defvar sql-interactive-product nil + "Product under `sql-interactive-mode'.") + +;; misc customization of sql.el behaviour (defcustom sql-electric-stuff nil "Treat some input as electric. @@ -419,19 +535,49 @@ If set to nil, then you must use \\[comint-send-input] in order to send current input in the SQLi buffer to the process." :type '(choice (const :tag "Nothing" nil) - (const :tag "The semikolon `;'" semicolon) + (const :tag "The semicolon `;'" semicolon) (const :tag "The string `go' by itself" go)) :version "20.8" :group 'SQL) +(defcustom sql-send-terminator nil + "When non-nil, add a terminator to text sent to the SQL interpreter. + +When text is sent to the SQL interpreter (via `sql-send-string', +`sql-send-region', `sql-send-paragraph' or `sql-send-buffer'), a +command terminator can be automatically sent as well. The +terminator is not sent, if the string sent already ends with the +terminator. + +If this value is t, then the default command terminator for the +SQL interpreter is sent. If this value is a string, then the +string is sent. + +If the value is a cons cell of the form (PAT . TERM), then PAT is +a regexp used to match the terminator in the string and TERM is +the terminator to be sent. This form is useful if the SQL +interpreter has more than one way of submitting a SQL command. +The PAT regexp can match any of them, and TERM is the way we do +it automatically." + + :type '(choice (const :tag "No Terminator" nil) + (const :tag "Default Terminator" t) + (string :tag "Terminator String") + (cons :tag "Terminator Pattern and String" + (string :tag "Terminator Pattern") + (string :tag "Terminator String"))) + :version "22.2" + :group 'SQL) + (defcustom sql-pop-to-buffer-after-send-region nil - "*If t, pop to the buffer SQL statements are sent to. - -After a call to `sql-send-region' or `sql-send-buffer', -the window is split and the SQLi buffer is shown. If this -variable is not nil, that buffer's window will be selected -by calling `pop-to-buffer'. If this variable is nil, that -buffer is shown using `display-buffer'." + "When non-nil, pop to the buffer SQL statements are sent to. + +After a call to `sql-sent-string', `sql-send-region', +`sql-send-paragraph' or `sql-send-buffer', the window is split +and the SQLi buffer is shown. If this variable is not nil, that +buffer's window will be selected by calling `pop-to-buffer'. If +this variable is nil, that buffer is shown using +`display-buffer'." :type 'boolean :group 'SQL) @@ -445,19 +591,20 @@ ("Functions" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?function\\s-+\\(\\w+\\)" 3) ("Procedures" "^\\s-*\\(create\\s-+\\(\\w+\\s-+\\)*\\)?proc\\(edure\\)?\\s-+\\(\\w+\\)" 4) ("Packages" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*package\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3) + ("Types" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*type\\s-+\\(body\\s-+\\)?\\(\\w+\\)" 3) ("Indexes" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*index\\s-+\\(\\w+\\)" 2) ("Tables/Views" "^\\s-*create\\s-+\\(\\w+\\s-+\\)*\\(table\\|view\\)\\s-+\\(\\w+\\)" 3)) "Define interesting points in the SQL buffer for `imenu'. This is used to set `imenu-generic-expression' when SQL mode is -entered. Subsequent changes to sql-imenu-generic-expression will not -affect existing SQL buffers because imenu-generic-expression is a -local variable.") +entered. Subsequent changes to `sql-imenu-generic-expression' will +not affect existing SQL buffers because imenu-generic-expression is +a local variable.") ;; history file (defcustom sql-input-ring-file-name nil - "*If non-nil, name of the file to read/write input history. + "If non-nil, name of the file to read/write input history. You have to set this variable if you want the history of your commands saved from one Emacs session to the next. If this variable is set, @@ -474,7 +621,7 @@ :group 'SQL) (defcustom sql-input-ring-separator "\n--\n" - "*Separator between commands in the history file. + "Separator between commands in the history file. If set to \"\\n\", each line in the history file will be interpreted as one command. Multi-line commands are split into several commands when @@ -492,17 +639,17 @@ ;; The usual hooks (defcustom sql-interactive-mode-hook '() - "*Hook for customizing `sql-interactive-mode'." + "Hook for customizing `sql-interactive-mode'." :type 'hook :group 'SQL) (defcustom sql-mode-hook '() - "*Hook for customizing `sql-mode'." + "Hook for customizing `sql-mode'." :type 'hook :group 'SQL) (defcustom sql-set-sqli-hook '() - "*Hook for reacting to changes of `sql-buffer'. + "Hook for reacting to changes of `sql-buffer'. This is called by `sql-set-sqli-buffer' when the value of `sql-buffer' is changed." @@ -512,144 +659,220 @@ ;; Customization for Oracle (defcustom sql-oracle-program "sqlplus" - "*Command to start sqlplus by Oracle. + "Command to start sqlplus by Oracle. Starts `sql-interactive-mode' after doing some setup. -Under NT, \"sqlplus\" usually starts the sqlplus \"GUI\". In order to +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. - -The program can also specify a TCP connection. See `make-comint'." +will find the file in your Orant\\bin directory." :type 'file :group 'SQL) (defcustom sql-oracle-options nil - "*List of additional options for `sql-oracle-program'." + "List of additional options for `sql-oracle-program'." :type '(repeat string) :version "20.8" :group 'SQL) +(defcustom sql-oracle-login-params '(user password database) + "List of login parameters needed to connect to Oracle." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + +(defcustom sql-oracle-scan-on t + "Non-nil if placeholders should be replaced in Oracle SQLi. + +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 +prompts are not shown until after the text is entered. + +You will probably want to issue the following command in sqlplus +to be safe: + + SET SCAN OFF" + :type 'boolean + :group 'SQL) + ;; Customization for SQLite (defcustom sql-sqlite-program "sqlite" - "*Command to start SQLite. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start SQLite. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-sqlite-options nil - "*List of additional options for `sql-sqlite-program'. + "List of additional options for `sql-sqlite-program'." + :type '(repeat string) + :version "20.8" + :group 'SQL) + +(defcustom sql-sqlite-login-params '(database) + "List of login parameters needed to connect to SQLite." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + +;; Customization for MySql + +(defcustom sql-mysql-program "mysql" + "Command to start mysql by TcX. + +Starts `sql-interactive-mode' after doing some setup." + :type 'file + :group 'SQL) + +(defcustom sql-mysql-options nil + "List of additional options for `sql-mysql-program'. The following list of options is reported to make things work on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." :type '(repeat string) :version "20.8" :group 'SQL) -;; Customization for MySql - -(defcustom sql-mysql-program "mysql" - "*Command to start mysql by TcX. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." - :type 'file - :group 'SQL) - -(defcustom sql-mysql-options nil - "*List of additional options for `sql-mysql-program'. -The following list of options is reported to make things work -on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." - :type '(repeat string) - :version "20.8" +(defcustom sql-mysql-login-params '(user password database server) + "List of login parameters needed to connect to MySql." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database) + (const port))) + :version "24.1" :group 'SQL) ;; Customization for Solid (defcustom sql-solid-program "solsql" - "*Command to start SOLID SQL Editor. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start SOLID SQL Editor. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) +(defcustom sql-solid-login-params '(user password server) + "List of login parameters needed to connect to Solid." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for SyBase (defcustom sql-sybase-program "isql" - "*Command to start isql by SyBase. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start isql by SyBase. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-sybase-options nil - "*List of additional options for `sql-sybase-program'. + "List of additional options for `sql-sybase-program'. Some versions of isql might require the -n option in order to work." :type '(repeat string) :version "20.8" :group 'SQL) +(defcustom sql-sybase-login-params '(server user password database) + "List of login parameters needed to connect to Sybase." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Informix (defcustom sql-informix-program "dbaccess" - "*Command to start dbaccess by Informix. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start dbaccess by Informix. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) +(defcustom sql-informix-login-params '(database) + "List of login parameters needed to connect to Informix." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Ingres (defcustom sql-ingres-program "sql" - "*Command to start sql by Ingres. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start sql by Ingres. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) +(defcustom sql-ingres-login-params '(database) + "List of login parameters needed to connect to Ingres." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Microsoft (defcustom sql-ms-program "osql" - "*Command to start osql by Microsoft. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start osql by Microsoft. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-ms-options '("-w" "300" "-n") ;; -w is the linesize - "*List of additional options for `sql-ms-program'." + "List of additional options for `sql-ms-program'." :type '(repeat string) :version "22.1" :group 'SQL) +(defcustom sql-ms-login-params '(user password server database) + "List of login parameters needed to connect to Microsoft." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Postgres (defcustom sql-postgres-program "psql" "Command to start psql by Postgres. -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-postgres-options '("-P" "pager=off") - "*List of additional options for `sql-postgres-program'. + "List of additional options for `sql-postgres-program'. The default setting includes the -P option which breaks older versions of the psql client (such as version 6.5.3). The -P option is equivalent to the --pset option. If you want the psql to prompt you for a user @@ -660,55 +883,91 @@ :version "20.8" :group 'SQL) +(defcustom sql-postgres-login-params '(user database server) + "List of login parameters needed to connect to Postgres." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Interbase (defcustom sql-interbase-program "isql" - "*Command to start isql by Interbase. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start isql by Interbase. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-interbase-options nil - "*List of additional options for `sql-interbase-program'." + "List of additional options for `sql-interbase-program'." :type '(repeat string) :version "20.8" :group 'SQL) +(defcustom sql-interbase-login-params '(user password database) + "List of login parameters needed to connect to Interbase." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for DB2 (defcustom sql-db2-program "db2" - "*Command to start db2 by IBM. - -Starts `sql-interactive-mode' after doing some setup. - -The program can also specify a TCP connection. See `make-comint'." + "Command to start db2 by IBM. + +Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-db2-options nil - "*List of additional options for `sql-db2-program'." + "List of additional options for `sql-db2-program'." :type '(repeat string) :version "20.8" :group 'SQL) +(defcustom sql-db2-login-params nil + "List of login parameters needed to connect to DB2." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;; Customization for Linter (defcustom sql-linter-program "inl" - "*Command to start inl by RELEX. + "Command to start inl by RELEX. Starts `sql-interactive-mode' after doing some setup." :type 'file :group 'SQL) (defcustom sql-linter-options nil - "*List of additional options for `sql-linter-program'." + "List of additional options for `sql-linter-program'." :type '(repeat string) :version "21.3" :group 'SQL) +(defcustom sql-linter-login-params '(user password database server) + "Login parameters to needed to connect to Linter." + :type '(repeat (choice + (const user) + (const password) + (const server) + (const database))) + :version "24.1" + :group 'SQL) + ;;; Variables which do not need customization @@ -722,12 +981,15 @@ (defvar sql-server-history nil "History of servers used.") +(defvar sql-port-history nil + "History of ports used.") + ;; Passwords are not kept in a history. (defvar sql-buffer nil "Current SQLi buffer. -The global value of sql-buffer is the name of the latest SQLi buffer +The global value of `sql-buffer' is the name of the latest SQLi buffer created. Any SQL buffer created will make a local copy of this value. See `sql-interactive-mode' for more on multiple sessions. If you want to change the SQLi buffer a SQL mode sends its SQL strings to, change @@ -775,6 +1037,7 @@ (define-key map (kbd "C-c C-r") 'sql-send-region) (define-key map (kbd "C-c C-s") 'sql-send-string) (define-key map (kbd "C-c C-b") 'sql-send-buffer) + (define-key map (kbd "C-c C-i") 'sql-product-interactive) map) "Mode map used for `sql-mode'.") @@ -786,16 +1049,15 @@ `("SQL" ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer) (get-buffer-process sql-buffer))] - ["Send Region" sql-send-region (and (or (and (boundp 'mark-active); Emacs - mark-active) - (mark t)); XEmacs + ["Send Region" sql-send-region (and mark-active (buffer-live-p sql-buffer) (get-buffer-process sql-buffer))] ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer) (get-buffer-process sql-buffer))] - ["Send String" sql-send-string t] + ["Send String" sql-send-string (and (buffer-live-p sql-buffer) + (get-buffer-process sql-buffer))] ["--" nil nil] - ["Start SQLi session" sql-product-interactive (sql-product-feature :sqli-connect)] + ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-connect-func)] ["Show SQLi buffer" sql-show-sqli-buffer t] ["Set SQLi buffer" sql-set-sqli-buffer t] ["Pop to SQLi buffer after send" @@ -888,25 +1150,64 @@ statement. The format of variable should be a valid `font-lock-keywords' entry.") -(defmacro sql-keywords-re (&rest keywords) - "Compile-time generation of regexp matching any one of KEYWORDS." - `(eval-when-compile - (concat "\\b" - (regexp-opt ',keywords t) - "\\b"))) - -(defvar sql-mode-ansi-font-lock-keywords - (let ((ansi-funcs (sql-keywords-re -"abs" "avg" "bit_length" "cardinality" "cast" "char_length" -"character_length" "coalesce" "convert" "count" "current_date" -"current_path" "current_role" "current_time" "current_timestamp" -"current_user" "extract" "localtime" "localtimestamp" "lower" "max" -"min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user" -"substring" "sum" "system_user" "translate" "treat" "trim" "upper" -"user" -)) - - (ansi-non-reserved (sql-keywords-re +;; While there are international and American standards for SQL, they +;; are not followed closely, and most vendors offer significant +;; capabilities beyond those defined in the standard specifications. + +;; SQL mode provides support for hilighting based on the product. In +;; addition to hilighting the product keywords, any ANSI keywords not +;; used by the product are also hilighted. This will help identify +;; keywords that could be restricted in future versions of the product +;; or might be a problem if ported to another product. + +;; To reduce the complexity and size of the regular expressions +;; generated to match keywords, ANSI keywords are filtered out of +;; product keywords if they are equivalent. To do this, we define a +;; function `sql-font-lock-keywords-builder' that removes any keywords +;; that are matched by the ANSI patterns and results in the same face +;; being applied. For this to work properly, we must play some games +;; with the execution and compile time behavior. This code is a +;; little tricky but works properly. + +;; When defining the keywords for individual products you should +;; include all of the keywords that you want matched. The filtering +;; against the ANSI keywords will be automatic if you use the +;; `sql-font-lock-keywords-builder' function and follow the +;; implementation pattern used for the other products in this file. + +(eval-when-compile + (defvar sql-mode-ansi-font-lock-keywords) + (setq sql-mode-ansi-font-lock-keywords nil)) + +(eval-and-compile + (defun sql-font-lock-keywords-builder (face boundaries &rest keywords) + "Generation of regexp matching any one of KEYWORDS." + + (let ((bdy (or boundaries '("\\b" . "\\b"))) + kwd) + + ;; Remove keywords that are defined in ANSI + (setq kwd keywords) + (dolist (k keywords) + (catch 'next + (dolist (a sql-mode-ansi-font-lock-keywords) + (when (and (eq face (cdr a)) + (eq (string-match (car a) k 0) 0) + (eq (match-end 0) (length k))) + (setq kwd (delq k kwd)) + (throw 'next nil))))) + + ;; Create a properly formed font-lock-keywords item + (cons (concat (car bdy) + (regexp-opt kwd t) + (cdr bdy)) + face)))) + +(eval-when-compile + (setq sql-mode-ansi-font-lock-keywords + (list + ;; ANSI Non Reserved keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "ada" "asensitive" "assignment" "asymmetric" "atomic" "between" "bitvar" "called" "catalog_name" "chain" "character_set_catalog" "character_set_name" "character_set_schema" "checked" "class_origin" @@ -934,9 +1235,9 @@ "trigger_name" "trigger_schema" "type" "uncommitted" "unnamed" "user_defined_type_catalog" "user_defined_type_name" "user_defined_type_schema" -)) - - (ansi-reserved (sql-keywords-re +) + ;; ANSI Reserved keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "absolute" "action" "add" "admin" "after" "aggregate" "alias" "all" "allocate" "alter" "and" "any" "are" "as" "asc" "assertion" "at" "authorization" "before" "begin" "both" "breadth" "by" "call" @@ -972,31 +1273,86 @@ "trigger" "true" "under" "union" "unique" "unknown" "unnest" "update" "usage" "using" "value" "values" "variable" "view" "when" "whenever" "where" "with" "without" "work" "write" "year" -)) - - (ansi-types (sql-keywords-re +) + + ;; ANSI Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil +"abs" "avg" "bit_length" "cardinality" "cast" "char_length" +"character_length" "coalesce" "convert" "count" "current_date" +"current_path" "current_role" "current_time" "current_timestamp" +"current_user" "extract" "localtime" "localtimestamp" "lower" "max" +"min" "mod" "nullif" "octet_length" "overlay" "placing" "session_user" +"substring" "sum" "system_user" "translate" "treat" "trim" "upper" +"user" +) + ;; ANSI Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil "array" "binary" "bit" "blob" "boolean" "char" "character" "clob" "date" "dec" "decimal" "double" "float" "int" "integer" "interval" "large" "national" "nchar" "nclob" "numeric" "object" "precision" "real" "ref" "row" "scope" "smallint" "time" "timestamp" "varchar" "varying" "zone" -))) - - `((,ansi-non-reserved . font-lock-keyword-face) - (,ansi-reserved . font-lock-keyword-face) - (,ansi-funcs . font-lock-builtin-face) - (,ansi-types . font-lock-type-face))) - +)))) + +(defvar sql-mode-ansi-font-lock-keywords + (eval-when-compile sql-mode-ansi-font-lock-keywords) "ANSI SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-ansi-font-lock-keywords. You may want to -add functions and PL/SQL keywords.") +you define your own `sql-mode-ansi-font-lock-keywords'. You may want +to add functions and PL/SQL keywords.") (defvar sql-mode-oracle-font-lock-keywords - (let ((oracle-functions (sql-keywords-re + (eval-when-compile + (list + ;; Oracle SQL*Plus Commands + (cons + (concat + "^\\(?:\\(?:" (regexp-opt '( +"@" "@@" "accept" "append" "archive" "attribute" "break" +"btitle" "change" "clear" "column" "connect" "copy" "define" +"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" +"host" "input" "list" "password" "pause" "print" "prompt" "recover" +"remark" "repfooter" "repheader" "run" "save" "show" "shutdown" +"spool" "start" "startup" "store" "timing" "ttitle" "undefine" +"variable" "whenever" +) t) + + "\\)\\|" + "\\(?:compute\\s-+\\(?:avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|" + "\\(?:set\\s-+\\(" + + (regexp-opt + '("appi" "appinfo" "array" "arraysize" "auto" "autocommit" + "autop" "autoprint" "autorecovery" "autot" "autotrace" "blo" + "blockterminator" "buffer" "closecursor" "cmds" "cmdsep" + "colsep" "com" "compatibility" "con" "concat" "constraint" + "constraints" "copyc" "copycommit" "copytypecheck" "database" + "def" "define" "document" "echo" "editf" "editfile" "emb" + "embedded" "esc" "escape" "feed" "feedback" "flagger" "flu" + "flush" "hea" "heading" "heads" "headsep" "instance" "lin" + "linesize" "lobof" "loboffset" "logsource" "long" "longc" + "longchunksize" "maxdata" "newp" "newpage" "null" "num" + "numf" "numformat" "numwidth" "pages" "pagesize" "pau" + "pause" "recsep" "recsepchar" "role" "scan" "serveroutput" + "shift" "shiftinout" "show" "showmode" "space" "sqlbl" + "sqlblanklines" "sqlc" "sqlcase" "sqlco" "sqlcontinue" "sqln" + "sqlnumber" "sqlp" "sqlpluscompat" "sqlpluscompatibility" + "sqlpre" "sqlprefix" "sqlprompt" "sqlt" "sqlterminator" + "statement_id" "suf" "suffix" "tab" "term" "termout" "ti" + "time" "timi" "timing" "transaction" "trim" "trimout" "trims" + "trimspool" "truncate" "und" "underline" "ver" "verify" "wra" + "wrap")) "\\)\\)" + + "\\)\\b.*" + ) + 'font-lock-doc-face) + '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face) + + ;; Oracle Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "abs" "acos" "add_months" "ascii" "asciistr" "asin" "atan" "atan2" "avg" "bfilename" "bin_to_num" "bitand" "cast" "ceil" "chartorowid" "chr" "coalesce" "compose" "concat" "convert" "corr" "cos" "cosh" @@ -1027,9 +1383,9 @@ "userenv" "var_pop" "var_samp" "variance" "vsize" "width_bucket" "xml" "xmlagg" "xmlattribute" "xmlcolattval" "xmlconcat" "xmlelement" "xmlforest" "xmlsequence" "xmltransform" -)) - - (oracle-keywords (sql-keywords-re +) + ;; Oracle Keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "abort" "access" "accessed" "account" "activate" "add" "admin" "advise" "after" "agent" "aggregate" "all" "allocate" "allow" "alter" "always" "analyze" "ancillary" "and" "any" "apply" "archive" @@ -1115,22 +1471,29 @@ "use" "using" "validate" "validation" "value" "values" "variable" "varray" "version" "view" "wait" "when" "whenever" "where" "with" "without" "wnds" "wnps" "work" "write" "xmldata" "xmlschema" "xmltype" -)) - - (oracle-types (sql-keywords-re +) + ;; Oracle Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil "bfile" "blob" "byte" "char" "character" "clob" "date" "dec" "decimal" "double" "float" "int" "integer" "interval" "long" "national" "nchar" "nclob" "number" "numeric" "nvarchar2" "precision" "raw" "real" "rowid" "second" "smallint" "time" "timestamp" "urowid" "varchar" "varchar2" "varying" "year" "zone" -)) - - (plsql-functions (sql-keywords-re +) + + ;; Oracle PL/SQL Attributes + (sql-font-lock-keywords-builder 'font-lock-builtin-face '("" . "\\b") "%bulk_rowcount" "%found" "%isopen" "%notfound" "%rowcount" "%rowtype" -"%type" "extend" "prior" -)) - - (plsql-keywords (sql-keywords-re +"%type" +) + + ;; Oracle PL/SQL Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil +"extend" "prior" +) + + ;; Oracle PL/SQL Keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "autonomous_transaction" "bulk" "char_base" "collect" "constant" "cursor" "declare" "do" "elsif" "exception_init" "execute" "exit" "extends" "false" "fetch" "forall" "goto" "hour" "if" "interface" @@ -1138,14 +1501,16 @@ "separate" "serially_reusable" "sql" "sqlcode" "sqlerrm" "subtype" "the" "timezone_abbr" "timezone_hour" "timezone_minute" "timezone_region" "true" "varrying" "while" -)) - - (plsql-type (sql-keywords-re +) + + ;; Oracle PL/SQL Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil "binary_integer" "boolean" "naturaln" "pls_integer" "positive" "positiven" "record" "signtype" "string" -)) - - (plsql-warning (sql-keywords-re +) + + ;; Oracle PL/SQL Exceptions + (sql-font-lock-keywords-builder 'font-lock-warning-face nil "access_into_null" "case_not_found" "collection_is_null" "cursor_already_open" "dup_val_on_index" "invalid_cursor" "invalid_number" "login_denied" "no_data_found" "not_logged_on" @@ -1153,66 +1518,21 @@ "subscript_beyond_count" "subscript_outside_limit" "sys_invalid_rowid" "timeout_on_resource" "too_many_rows" "value_error" "zero_divide" "exception" "notfound" -)) - - (sqlplus-commands - (eval-when-compile (concat "^\\(\\(" - (regexp-opt '( -"@" "@@" "accept" "append" "archive" "attribute" "break" -"btitle" "change" "clear" "column" "connect" "copy" "define" -"del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" -"host" "input" "list" "password" "pause" "print" "prompt" "recover" -"remark" "repfooter" "repheader" "run" "save" "show" "shutdown" -"spool" "start" "startup" "store" "timing" "ttitle" "undefine" -"variable" "whenever" - -) t) - - "\\)\\|" - "\\(compute\\s-+\\(avg\\|cou\\|min\\|max\\|num\\|sum\\|std\\|var\\)\\)\\|" - "\\(set\\s-+\\(appi\\(nfo\\)?\\|array\\(size\\)?\\|" - "auto\\(commit\\)?\\|autop\\(rint\\)?\\|autorecovery\\|" - "autot\\(race\\)?\\|blo\\(ckterminator\\)?\\|cmds\\(ep\\)?\\|" - "colsep\\|com\\(patibility\\)?\\|con\\(cat\\)?\\|" - "copyc\\(ommit\\)?\\|copytypecheck\\|def\\(ine\\)?\\|" - "describe\\|echo\\|editf\\(ile\\)?\\|emb\\(edded\\)?\\|" - "esc\\(ape\\)?\\|feed\\(back\\)?\\|flagger\\|" - "flu\\(sh\\)?\\|hea\\(ding\\)?\\|heads\\(ep\\)?\\|" - "instance\\|lin\\(esize\\)?\\|lobof\\(fset\\)?\\|" - "logsource\\|long\\|longc\\(hunksize\\)?\\|mark\\(up\\)?\\|" - "newp\\(age\\)?\\|null\\|numf\\(ormat\\)?\\|" - "num\\(width\\)?\\|pages\\(ize\\)?\\|pau\\(se\\)?\\|" - "recsep\\|recsepchar\\|serverout\\(put\\)?\\|" - "shift\\(inout\\)?\\|show\\(mode\\)?\\|" - "sqlbl\\(anklines\\)?\\|sqlc\\(ase\\)?\\|" - "sqlco\\(ntinue\\)?\\|sqln\\(umber\\)?\\|" - "sqlpluscompat\\(ibility\\)?\\|sqlpre\\(fix\\)?\\|" - "sqlp\\(rompt\\)?\\|sqlt\\(erminator\\)?\\|" - "suf\\(fix\\)?\\|tab\\|term\\(out\\)?\\|ti\\(me\\)?\\|" - "timi\\(ng\\)?\\|trim\\(out\\)?\\|trims\\(pool\\)?\\|" - "und\\(erline\\)?\\|ver\\(ify\\)?\\|wra\\(p\\)?\\)\\)\\)" - "\\b.*$" - )))) - - `((,sqlplus-commands . font-lock-doc-face) - (,oracle-functions . font-lock-builtin-face) - (,oracle-keywords . font-lock-keyword-face) - (,oracle-types . font-lock-type-face) - (,plsql-functions . font-lock-builtin-face) - (,plsql-keywords . font-lock-keyword-face) - (,plsql-type . font-lock-type-face) - (,plsql-warning . font-lock-warning-face))) +))) "Oracle SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-oracle-font-lock-keywords. You may want +you define your own `sql-mode-oracle-font-lock-keywords'. You may want to add functions and PL/SQL keywords.") (defvar sql-mode-postgres-font-lock-keywords - (let ((pg-funcs (sql-keywords-re + (eval-when-compile + (list + ;; Postgres Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "abbrev" "abs" "acos" "age" "area" "ascii" "asin" "atab2" "atan" "atan2" "avg" "bit_length" "both" "broadcast" "btrim" "cbrt" "ceil" "center" "char_length" "chr" "coalesce" "col_description" "convert" @@ -1237,9 +1557,9 @@ "substring" "sum" "tan" "timeofday" "to_ascii" "to_char" "to_date" "to_hex" "to_number" "to_timestamp" "trailing" "translate" "trim" "trunc" "upper" "variance" "version" "width" -)) - - (pg-reserved (sql-keywords-re +) + ;; Postgres Reserved + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "abort" "access" "add" "after" "aggregate" "alignment" "all" "alter" "analyze" "and" "any" "as" "asc" "assignment" "authorization" "backward" "basetype" "before" "begin" "between" "binary" "by" "cache" @@ -1274,9 +1594,10 @@ "usage" "user" "using" "vacuum" "valid" "validator" "values" "variable" "verbose" "view" "volatile" "when" "where" "with" "without" "work" -)) - - (pg-types (sql-keywords-re +) + + ;; Postgres Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil "anyarray" "bigint" "bigserial" "bit" "boolean" "box" "bytea" "char" "character" "cidr" "circle" "cstring" "date" "decimal" "double" "float4" "float8" "inet" "int2" "int4" "int8" "integer" "internal" @@ -1287,19 +1608,18 @@ "timestamp" "varchar" "varying" "void" "zone" ))) - `((,pg-funcs . font-lock-builtin-face) - (,pg-reserved . font-lock-keyword-face) - (,pg-types . font-lock-type-face))) - "Postgres SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-postgres-font-lock-keywords.") +you define your own `sql-mode-postgres-font-lock-keywords'.") (defvar sql-mode-linter-font-lock-keywords - (let ((linter-keywords (sql-keywords-re + (eval-when-compile + (list + ;; Linter Keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "autocommit" "autoinc" "autorowid" "cancel" "cascade" "channel" "committed" "count" "countblob" "cross" "current" "data" "database" "datafile" "datafiles" "datesplit" "dba" "dbname" "default" "deferred" @@ -1324,9 +1644,10 @@ "trigger_info_size" "true" "trunc" "uncommitted" "unicode" "unknown" "unlimited" "unlisted" "user" "utf8" "value" "varying" "volumes" "wait" "windows_code" "workspace" "write" "xml" -)) - - (linter-reserved (sql-keywords-re +) + + ;; Linter Reserved + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "access" "action" "add" "address" "after" "all" "alter" "always" "and" "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit" "aud_obj_name_len" "backup" "base" "before" "between" "blobfile" @@ -1344,16 +1665,10 @@ "start" "stop" "sync" "synchronize" "synonym" "sysdate" "table" "then" "to" "union" "unique" "unlock" "until" "update" "using" "values" "view" "when" "where" "with" "without" -)) - - (linter-types (sql-keywords-re -"bigint" "bitmap" "blob" "boolean" "char" "character" "date" -"datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar" -"number" "numeric" "real" "smallint" "varbyte" "varchar" "byte" -"cursor" "long" -)) - - (linter-functions (sql-keywords-re +) + + ;; Linter Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "abs" "acos" "asin" "atan" "atan2" "avg" "ceil" "cos" "cosh" "divtime" "exp" "floor" "getbits" "getblob" "getbyte" "getlong" "getraw" "getstr" "gettext" "getword" "hextoraw" "lenblob" "length" "log" @@ -1364,13 +1679,16 @@ "to_gmtime" "to_localtime" "to_number" "trim" "upper" "decode" "substr" "substring" "chr" "dayname" "days" "greatest" "hex" "initcap" "instr" "least" "multime" "replace" "width" +) + + ;; Linter Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil +"bigint" "bitmap" "blob" "boolean" "char" "character" "date" +"datetime" "dec" "decimal" "double" "float" "int" "integer" "nchar" +"number" "numeric" "real" "smallint" "varbyte" "varchar" "byte" +"cursor" "long" ))) - `((,linter-keywords . font-lock-keyword-face) - (,linter-reserved . font-lock-keyword-face) - (,linter-functions . font-lock-builtin-face) - (,linter-types . font-lock-type-face))) - "Linter SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The @@ -1378,7 +1696,29 @@ function `regexp-opt'.") (defvar sql-mode-ms-font-lock-keywords - (let ((ms-reserved (sql-keywords-re + (eval-when-compile + (list + ;; MS isql/osql Commands + (cons + (concat + "^\\(?:\\(?:set\\s-+\\(?:" + (regexp-opt '( +"datefirst" "dateformat" "deadlock_priority" "lock_timeout" +"concat_null_yields_null" "cursor_close_on_commit" +"disable_def_cnst_chk" "fips_flagger" "identity_insert" "language" +"offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly" +"nocount" "noexec" "numeric_roundabort" "parseonly" +"query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults" +"ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding" +"ansi_warnings" "forceplan" "showplan_all" "showplan_text" +"statistics" "implicit_transactions" "remote_proc_transactions" +"transaction" "xact_abort" +) t) + "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$") + 'font-lock-doc-face) + + ;; MS Reserved + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "absolute" "add" "all" "alter" "and" "any" "as" "asc" "authorization" "avg" "backup" "begin" "between" "break" "browse" "bulk" "by" "cascade" "case" "check" "checkpoint" "close" "clustered" "coalesce" @@ -1411,19 +1751,10 @@ "updlock" "use" "user" "values" "view" "waitfor" "when" "where" "while" "with" "work" "writetext" "collate" "function" "openxml" "returns" -)) - - (ms-types (sql-keywords-re -"binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal" -"double" "float" "image" "int" "integer" "money" "national" "nchar" -"ntext" "numeric" "numeric" "nvarchar" "precision" "real" -"smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint" -"uniqueidentifier" "varbinary" "varchar" "varying" -)) - - (ms-vars "\\b@[a-zA-Z0-9_]*\\b") - - (ms-functions (sql-keywords-re +) + + ;; MS Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "@@connections" "@@cpu_busy" "@@cursor_rows" "@@datefirst" "@@dbts" "@@error" "@@fetch_status" "@@identity" "@@idle" "@@io_busy" "@@langid" "@@language" "@@lock_timeout" "@@max_connections" @@ -1452,37 +1783,26 @@ "suser_id" "suser_name" "suser_sid" "suser_sname" "system_user" "tan" "textptr" "textvalid" "typeproperty" "unicode" "upper" "user" "user_id" "user_name" "var" "varp" "year" -)) - - (ms-commands - (eval-when-compile - (concat "^\\(\\(set\\s-+\\(" - (regexp-opt '( -"datefirst" "dateformat" "deadlock_priority" "lock_timeout" -"concat_null_yields_null" "cursor_close_on_commit" -"disable_def_cnst_chk" "fips_flagger" "identity_insert" "language" -"offsets" "quoted_identifier" "arithabort" "arithignore" "fmtonly" -"nocount" "noexec" "numeric_roundabort" "parseonly" -"query_governor_cost_limit" "rowcount" "textsize" "ansi_defaults" -"ansi_null_dflt_off" "ansi_null_dflt_on" "ansi_nulls" "ansi_padding" -"ansi_warnings" "forceplan" "showplan_all" "showplan_text" -"statistics" "implicit_transactions" "remote_proc_transactions" -"transaction" "xact_abort" -) t) - "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$")))) - - `((,ms-commands . font-lock-doc-face) - (,ms-reserved . font-lock-keyword-face) - (,ms-functions . font-lock-builtin-face) - (,ms-vars . font-lock-variable-name-face) - (,ms-types . font-lock-type-face))) +) + + ;; MS Variables + '("\\b@[a-zA-Z0-9_]*\\b" . font-lock-variable-name-face) + + ;; MS Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil +"binary" "bit" "char" "character" "cursor" "datetime" "dec" "decimal" +"double" "float" "image" "int" "integer" "money" "national" "nchar" +"ntext" "numeric" "numeric" "nvarchar" "precision" "real" +"smalldatetime" "smallint" "smallmoney" "text" "timestamp" "tinyint" +"uniqueidentifier" "varbinary" "varchar" "varying" +))) "Microsoft SQLServer SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-ms-font-lock-keywords.") +you define your own `sql-mode-ms-font-lock-keywords'.") (defvar sql-mode-sybase-font-lock-keywords nil "Sybase SQL keywords used by font-lock. @@ -1490,7 +1810,7 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-sybase-font-lock-keywords.") +you define your own `sql-mode-sybase-font-lock-keywords'.") (defvar sql-mode-informix-font-lock-keywords nil "Informix SQL keywords used by font-lock. @@ -1498,7 +1818,7 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-informix-font-lock-keywords.") +you define your own `sql-mode-informix-font-lock-keywords'.") (defvar sql-mode-interbase-font-lock-keywords nil "Interbase SQL keywords used by font-lock. @@ -1506,7 +1826,7 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-interbase-font-lock-keywords.") +you define your own `sql-mode-interbase-font-lock-keywords'.") (defvar sql-mode-ingres-font-lock-keywords nil "Ingres SQL keywords used by font-lock. @@ -1514,7 +1834,7 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-interbase-font-lock-keywords.") +you define your own `sql-mode-interbase-font-lock-keywords'.") (defvar sql-mode-solid-font-lock-keywords nil "Solid SQL keywords used by font-lock. @@ -1522,10 +1842,13 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-solid-font-lock-keywords.") +you define your own `sql-mode-solid-font-lock-keywords'.") (defvar sql-mode-mysql-font-lock-keywords - (let ((mysql-funcs (sql-keywords-re + (eval-when-compile + (list + ;; MySQL Functions + (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "ascii" "avg" "bdmpolyfromtext" "bdmpolyfromwkb" "bdpolyfromtext" "bdpolyfromwkb" "benchmark" "bin" "bit_and" "bit_length" "bit_or" "bit_xor" "both" "cast" "char_length" "character_length" "coalesce" @@ -1548,9 +1871,10 @@ "release_lock" "repeat" "replace" "reverse" "rpad" "rtrim" "soundex" "space" "std" "stddev" "substring" "substring_index" "sum" "sysdate" "trailing" "trim" "ucase" "unix_timestamp" "upper" "user" "variance" -)) - - (mysql-keywords (sql-keywords-re +) + + ;; MySQL Keywords + (sql-font-lock-keywords-builder 'font-lock-keyword-face nil "action" "add" "after" "against" "all" "alter" "and" "as" "asc" "auto_increment" "avg_row_length" "bdb" "between" "by" "cascade" "case" "change" "character" "check" "checksum" "close" "collate" @@ -1576,9 +1900,10 @@ "then" "to" "transaction" "truncate" "type" "uncommitted" "union" "unique" "unlock" "update" "use" "using" "values" "when" "where" "with" "write" "xor" -)) - - (mysql-types (sql-keywords-re +) + + ;; MySQL Data Types + (sql-font-lock-keywords-builder 'font-lock-type-face nil "bigint" "binary" "bit" "blob" "bool" "boolean" "char" "curve" "date" "datetime" "dec" "decimal" "double" "enum" "fixed" "float" "geometry" "geometrycollection" "int" "integer" "line" "linearring" "linestring" @@ -1590,16 +1915,12 @@ "zerofill" ))) - `((,mysql-funcs . font-lock-builtin-face) - (,mysql-keywords . font-lock-keyword-face) - (,mysql-types . font-lock-type-face))) - "MySQL SQL keywords used by font-lock. This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-mysql-font-lock-keywords.") +you define your own `sql-mode-mysql-font-lock-keywords'.") (defvar sql-mode-sqlite-font-lock-keywords nil "SQLite SQL keywords used by font-lock. @@ -1607,7 +1928,7 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-sqlite-font-lock-keywords.") +you define your own `sql-mode-sqlite-font-lock-keywords'.") (defvar sql-mode-db2-font-lock-keywords nil "DB2 SQL keywords used by font-lock. @@ -1615,58 +1936,146 @@ This variable is used by `sql-mode' and `sql-interactive-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before -you define your own sql-mode-db2-font-lock-keywords.") +you define your own `sql-mode-db2-font-lock-keywords'.") (defvar sql-mode-font-lock-keywords nil "SQL keywords used by font-lock. Setting this variable directly no longer has any affect. Use `sql-product' and `sql-add-product-keywords' to control the -highlighting rules in sql-mode.") +highlighting rules in SQL mode.") ;;; SQL Product support functions -(defun sql-product-feature (feature &optional product) - "Lookup `feature' needed to support the current SQL product. - -See \[sql-product-alist] for a list of products and supported features." - (plist-get - (cdr (assoc (or product sql-product) - sql-product-alist)) - feature)) +(defun sql-add-product (product display &rest plist) + "Add support for a database product in `sql-mode'. + +Add PRODUCT to `sql-product-alist' which enables `sql-mode' to +properly support syntax highlighting and interactive interaction. +DISPLAY is the name of the SQL product that will appear in the +menu bar and in messages. PLIST initializes the product +configuration." + + ;; Don't do anything if the product is already supported + (if (assoc product sql-product-alist) + (message "Product `%s' is already defined" product) + + ;; Add product to the alist + (add-to-list 'sql-product-alist `((,product :name ,display . ,plist))) + ;; Add a menu item to the SQL->Product menu + (easy-menu-add-item sql-mode-menu '("Product") + ;; Each product is represented by a radio + ;; button with it's display name. + `[,display + (lambda () (interactive) (sql-set-product ',product)) + :style radio + :selected (eq sql-product ',product)] + ;; Maintain the product list in + ;; (case-insensitive) alphabetic order of the + ;; display names. Loop thru each keymap item + ;; looking for an item whose display name is + ;; after this product's name. + (let ((next-item) + (down-display (downcase display))) + (map-keymap (lambda (k b) + (when (and (not next-item) + (string-lessp down-display + (downcase (cadr b)))) + (setq next-item k))) + (easy-menu-get-map sql-mode-menu '("Product"))) + next-item)) + product)) + +(defun sql-del-product (product) + "Remove support for PRODUCT in `sql-mode'." + + ;; Remove the menu item based on the display name + (easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name)) + ;; Remove the product alist item + (setq sql-product-alist (assq-delete-all product sql-product-alist)) + nil) + +(defun sql-set-product-feature (product feature newvalue) + "Set FEATURE of database PRODUCT to NEWVALUE. + +The PRODUCT must be a symbol which identifies the database +product. The product must have already exist on the product +list. See `sql-add-product' to add new products. The FEATURE +argument must be a plist keyword accepted by +`sql-product-alist'." + + (let* ((p (assoc product sql-product-alist)) + (v (plist-get (cdr p) feature))) + (if p + (if (and + (member feature sql-indirect-features) + (symbolp v)) + (set v newvalue) + (setcdr p (plist-put (cdr p) feature newvalue))) + (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) + +(defun sql-get-product-feature (product feature &optional fallback) + "Lookup FEATURE associated with a SQL PRODUCT. + +If the FEATURE is nil for PRODUCT, and FALLBACK is specified, +then the FEATURE associated with the FALLBACK product is +returned. + +See `sql-product-alist' for a list of products and supported features." + (let* ((p (assoc product sql-product-alist)) + (v (plist-get (cdr p) feature))) + + (if p + ;; If no value and fallback, lookup feature for fallback + (if (and (not v) + fallback + (not (eq product fallback))) + (sql-get-product-feature fallback feature) + + (if (and + (member feature sql-indirect-features) + (symbolp v)) + (symbol-value v) + v)) + (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) (defun sql-product-font-lock (keywords-only imenu) - "Sets `font-lock-defaults' and `font-lock-keywords' based on -the product-specific keywords and syntax-alists defined in -`sql-product-alist'." + "Configures 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 +skipped. The IMENU flag indicates whether `imenu-mode' should +also be configured." + (let ;; Get the product-specific syntax-alist. ((syntax-alist (append - (sql-product-feature :syntax-alist) + (sql-get-product-feature sql-product :syntax-alist) '((?_ . "w") (?. . "w"))))) ;; Get the product-specific keywords. (setq sql-mode-font-lock-keywords (append (unless (eq sql-product 'ansi) - (eval (sql-product-feature :font-lock))) + (sql-get-product-feature sql-product :font-lock)) ;; Always highlight ANSI keywords - (eval (sql-product-feature :font-lock 'ansi)) + (sql-get-product-feature 'ansi :font-lock) ;; Fontify object names in CREATE, DROP and ALTER DDL ;; statements (list sql-mode-font-lock-object-name))) ;; Setup font-lock. Force re-parsing of `font-lock-defaults'. - (set (make-local-variable 'font-lock-set-defaults) nil) + (kill-local-variable 'font-lock-set-defaults) (setq font-lock-defaults (list 'sql-mode-font-lock-keywords keywords-only t syntax-alist)) ;; Force font lock to reinitialize if it is already on ;; Otherwise, we can wait until it can be started. (when (and (fboundp 'font-lock-mode) + (boundp 'font-lock-mode) font-lock-mode) (font-lock-mode-internal nil) (font-lock-mode-internal t)) @@ -1683,7 +2092,7 @@ ;; Setup imenu; it needs the same syntax-alist. (when imenu - (setq imenu-syntax-alist syntax-alist)))) + (setq imenu-syntax-alist syntax-alist)))) ;;;###autoload (defun sql-add-product-keywords (product keywords &optional append) @@ -1705,38 +2114,40 @@ adds a fontification pattern to fontify identifiers ending in `_t' as data types." - (let ((font-lock (sql-product-feature :font-lock product)) - old) - (setq old (eval font-lock)) - (set font-lock + (let* ((sql-indirect-features nil) + (font-lock-var (sql-get-product-feature product :font-lock)) + (old-val)) + + (setq old-val (symbol-value font-lock-var)) + (set font-lock-var (if (eq append 'set) keywords (if append - (append old keywords) - (append keywords old)))))) + (append old-val keywords) + (append keywords old-val)))))) ;;; Functions to switch highlighting (defun sql-highlight-product () - "Turns on the appropriate font highlighting for the SQL product -selected." + "Turns on the font highlighting for the SQL product selected." (when (derived-mode-p 'sql-mode) ;; Setup font-lock (sql-product-font-lock nil t) ;; Set the mode name to include the product. - (setq mode-name (concat "SQL[" (prin1-to-string sql-product) "]")))) + (setq mode-name (concat "SQL[" (or (sql-get-product-feature sql-product :name) + (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 "Enter SQL product: " + (list (completing-read "SQL product: " (mapcar (lambda (info) (symbol-name (car info))) sql-product-alist) - nil 'require-match))) + nil 'require-match + (or (and sql-product (symbol-name sql-product)) "ansi")))) (if (stringp product) (setq product (intern product))) (when (not (assoc product sql-product-alist)) (error "SQL product %s is not supported; treated as ANSI" product) @@ -1752,7 +2163,7 @@ (if (not (fboundp 'comint-line-beginning-position)) ;; comint-line-beginning-position is defined in Emacs 21 (defun comint-line-beginning-position () - "Returns the buffer position of the beginning of the line, after any prompt. + "Return the buffer position of the beginning of the line, after any prompt. The prompt is assumed to be any text at the beginning of the line matching the regular expression `comint-prompt-regexp', a buffer local variable." (save-excursion (comint-bol nil) (point)))) @@ -1788,6 +2199,30 @@ (newline)) (indent-according-to-mode)) +(defun sql-help-list-products (indent freep) + "Generate listing of products available for use under SQLi. + +List products with :free-softare attribute set to FREEP. Indent +each line with INDENT." + + (let (sqli-func doc) + (setq doc "") + (dolist (p sql-product-alist) + (setq sqli-func (intern (concat "sql-" (symbol-name (car p))))) + + (if (and (fboundp sqli-func) + (eq (sql-get-product-feature (car p) :free-software) freep)) + (setq doc + (concat doc + indent + (or (sql-get-product-feature (car p) :name) + (symbol-name (car p))) + ":\t" + "\\[" + (symbol-name sqli-func) + "]\n")))) + doc)) + ;;;###autoload (defun sql-help () "Show short help for the SQL modes. @@ -1797,24 +2232,17 @@ Use the following commands to start a specific SQL interpreter: - PostGres: \\[sql-postgres] - MySQL: \\[sql-mysql] - SQLite: \\[sql-sqlite] + \\\\FREE Other non-free SQL implementations are also supported: - Solid: \\[sql-solid] - Oracle: \\[sql-oracle] - Informix: \\[sql-informix] - Sybase: \\[sql-sybase] - Ingres: \\[sql-ingres] - Microsoft: \\[sql-ms] - DB2: \\[sql-db2] - Interbase: \\[sql-interbase] - Linter: \\[sql-linter] + \\\\NONFREE But we urge you to choose a free implementation instead of these. +You can also use \\[sql-product-interactive] to invoke the +interpreter for the current `sql-product'. + Once you have the SQLi buffer, you can enter SQL statements in the buffer. The output generated is appended to the buffer and a new prompt is generated. See the In/Out menu in the SQLi buffer for some functions @@ -1829,6 +2257,30 @@ buffer to the interactive SQL buffer (SQLi mode). The results are appended to the SQLi buffer without disturbing your SQL buffer." (interactive) + + ;; Insert references to loaded products into the help buffer string + (let ((doc (documentation 'sql-help t)) + changedp) + (setq changedp nil) + + ;; Insert FREE software list + (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) + (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) + t t doc 0) + changedp t)) + + ;; Insert non-FREE software list + (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) + (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) + t t doc 0) + changedp t)) + + ;; If we changed the help text, save the change so that the help + ;; sub-system will see it + (when changedp + (put 'sql-help 'function-documentation doc))) + + ;; Call help on this function (describe-function 'sql-help)) (defun sql-read-passwd (prompt &optional default) @@ -1844,12 +2296,13 @@ `sql-server-history' and `database-history'. Passwords are not stored in a history. -Parameter WHAT is a list of the arguments passed to this function. -The function asks for the username if WHAT contains symbol `user', for -the password if it contains symbol `password', for the server if it -contains symbol `server', and for the database if it contains symbol -`database'. The members of WHAT are processed in the order in which -they are provided. +Parameter WHAT is a list of tokens passed as arguments in the +function call. The function asks for the username if WHAT +contains the symbol `user', for the password if it contains the +symbol `password', for the server if it contains the symbol +`server', and for the database if it contains the symbol +`database'. The members of WHAT are processed in the order in +which they are provided. In order to ask the user for username, password and database, call the function like this: (sql-get-login 'user 'password 'database)." @@ -1859,22 +2312,27 @@ ((eq (car what) 'user) ; user (setq sql-user (read-from-minibuffer "User: " sql-user nil nil - sql-user-history))) + 'sql-user-history))) ((eq (car what) 'password) ; password (setq sql-password (sql-read-passwd "Password: " sql-password))) + ((eq (car what) 'server) ; server (setq sql-server (read-from-minibuffer "Server: " sql-server nil nil - sql-server-history))) + 'sql-server-history))) + ((eq (car what) 'port) ; port + (setq sql-port + (read-from-minibuffer "Port: " sql-port nil nil + 'sql-port-history))) ((eq (car what) 'database) ; database (setq sql-database (read-from-minibuffer "Database: " sql-database nil nil - sql-database-history)))) + 'sql-database-history)))) (setq what (cdr what)))) (defun sql-find-sqli-buffer () - "Return the current default SQLi buffer or nil. + "Returns the current default SQLi buffer or nil. In order to qualify, the SQLi buffer must be alive, be in `sql-interactive-mode' and have a process." (let ((default-buffer (default-value 'sql-buffer))) @@ -1958,7 +2416,7 @@ (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) (defun sql-make-alternate-buffer-name () - "Return a string that can be used to rename a SQLi buffer. + "Returns a string that can be used to rename a SQLi buffer. This is used to set `sql-alternate-buffer-name' within `sql-interactive-mode'." @@ -1974,7 +2432,7 @@ sql-database))) (defun sql-rename-buffer () - "Renames a SQLi buffer." + "Rename a SQLi buffer." (interactive) (rename-buffer (format "*SQL: %s*" sql-alternate-buffer-name) t)) @@ -1984,7 +2442,7 @@ (interactive) (let ((column)) (save-excursion - (setq column (buffer-substring + (setq column (buffer-substring-no-properties (progn (forward-char 1) (backward-sexp 1) (point)) (progn (forward-sexp 1) (point)))) (goto-char (point-max)) @@ -2007,69 +2465,98 @@ (insert column) (message "%s" column)))) -;; On NT, SQL*Plus for Oracle turns on full buffering for stdout if it -;; is not attached to a character device; therefore placeholder +;; On Windows, SQL*Plus for Oracle turns on full buffering for stdout +;; if it is not attached to a character device; therefore placeholder ;; replacement by SQL*Plus is fully buffered. The workaround lets ;; Emacs query for the placeholders. (defvar sql-placeholder-history nil "History of placeholder values used.") -(defun sql-query-placeholders-and-send (proc string) - "Send to PROC input STRING, maybe replacing placeholders. -Placeholders are words starting with and ampersand like &this. -This function is used for `comint-input-sender' if using `sql-oracle' on NT." - (while (string-match "&\\(\\sw+\\)" string) - (setq string (replace-match - (read-from-minibuffer - (format "Enter value for %s: " (match-string 1 string)) - nil nil nil sql-placeholder-history) - t t string))) - (comint-send-string proc string) - (if comint-input-sender-no-newline - (if (not (string-equal string "")) - (process-send-eof)) - (comint-send-string proc "\n"))) +(defun sql-placeholders-filter (string) + "Replace placeholders in STRING. +Placeholders are words starting with and ampersand like &this." + + (when sql-oracle-scan-on + (while (string-match "&\\(\\sw+\\)" string) + (setq string (replace-match + (read-from-minibuffer + (format "Enter value for %s: " (match-string 1 string)) + nil nil nil 'sql-placeholder-history) + t t string)))) + string) ;; Using DB2 interactively, newlines must be escaped with " \". ;; The space before the backslash is relevant. -(defun sql-escape-newlines-and-send (proc string) - "Send to PROC input STRING, escaping newlines if necessary. +(defun sql-escape-newlines-filter (string) + "Escapes 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) (setq mb (match-beginning 0) - me (match-end 0)) - (if (and (> mb 1) - (string-equal " \\" (substring string (- mb 2) mb))) - (setq result (concat result (substring string start me))) - (setq result (concat result (substring string start mb) " \\\n"))) - (setq start me)) - (setq result (concat result (substring string start))) - (comint-send-string proc result) - (if comint-input-sender-no-newline - (if (not (string-equal string "")) - (process-send-eof)) - (comint-send-string proc "\n")))) + me (match-end 0) + result (concat result + (substring string start mb) + (if (and (> mb 1) + (string-equal " \\" (substring string (- mb 2) mb))) + "" " \\\n")) + start me)) + (concat result (substring string start)))) +;;; Input sender for SQLi buffers + +(defun sql-input-sender (proc string) + "Sends STRING to PROC after applying filters." + + (let* ((product (with-current-buffer (process-buffer proc) sql-product)) + (filter (sql-get-product-feature product :input-filter))) + + ;; Send the string + (comint-simple-send proc (if filter (funcall filter string) string)))) + ;;; Sending the region to the SQLi buffer. +(defun sql-send-string (str) + "Send the string STR to the SQL process." + (interactive "sSQL Text: ") + + (let (comint-input-sender-no-newline proc) + (if (buffer-live-p sql-buffer) + (progn + ;; Ignore the hoping around... + (save-excursion + ;; Get the process + (setq proc (get-buffer-process sql-buffer)) + + ;; Set product context + (with-current-buffer sql-buffer + ;; Send the string + (sql-input-sender proc str) + + ;; Send a newline if there wasn't one on the end of the string + (unless (string-equal "\n" (substring str (1- (length str)))) + (comint-send-string proc "\n")) + + ;; Send a command terminator if we must + (if sql-send-terminator + (sql-send-magic-terminator sql-buffer str sql-send-terminator)) + + (message "Sent string to buffer %s." (buffer-name sql-buffer)))) + + ;; Display the sql buffer + (if sql-pop-to-buffer-after-send-region + (pop-to-buffer sql-buffer) + (display-buffer sql-buffer))) + + ;; We don't have no stinkin' sql + (message "No SQL process started.")))) + (defun sql-send-region (start end) "Send a region to the SQL process." (interactive "r") - (if (buffer-live-p sql-buffer) - (save-excursion - (comint-send-region sql-buffer start end) - (if (string-match "\n$" (buffer-substring start end)) - () - (comint-send-string sql-buffer "\n")) - (message "Sent string to buffer %s." (buffer-name sql-buffer)) - (if sql-pop-to-buffer-after-send-region - (pop-to-buffer sql-buffer) - (display-buffer sql-buffer))) - (message "No SQL process started."))) + (sql-send-string (buffer-substring-no-properties start end))) (defun sql-send-paragraph () "Send the current paragraph to the SQL process." @@ -2087,29 +2574,46 @@ (interactive) (sql-send-region (point-min) (point-max))) -(defun sql-send-string (str) - "Send a string to the SQL process." - (interactive "sSQL Text: ") - (if (buffer-live-p sql-buffer) - (save-excursion - (comint-send-string sql-buffer str) - (comint-send-string sql-buffer "\n") - (message "Sent string to buffer %s." (buffer-name sql-buffer)) - (if sql-pop-to-buffer-after-send-region - (pop-to-buffer sql-buffer) - (display-buffer sql-buffer))) - (message "No SQL process started."))) +(defun sql-send-magic-terminator (buf str terminator) + "Sends 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) + (setq terminator (sql-get-product-feature sql-product :terminator))) + + ;; If there is no terminator specified, use default ";" + (unless terminator + (setq terminator ";")) + + ;; Parse the setting into the pattern and the terminator string + (cond ((stringp terminator) + (setq pat (regexp-quote terminator) + term terminator)) + ((consp terminator) + (setq pat (car terminator) + term (cdr terminator))) + (t + nil)) + + ;; Check to see if the pattern is present in the str already sent + (unless (and pat term + (string-match (concat pat "\n?\\'") str)) + (comint-send-string buf (concat term "\n"))))) + +(defun sql-remove-tabs-filter (str) + "Replace tab characters with spaces." + (replace-regexp-in-string "\t" " " str nil t)) (defun sql-toggle-pop-to-buffer-after-send-region (&optional value) "Toggle `sql-pop-to-buffer-after-send-region'. If given the optional parameter VALUE, sets -sql-toggle-pop-to-buffer-after-send-region to VALUE." +`sql-toggle-pop-to-buffer-after-send-region' to VALUE." (interactive "P") (if value (setq sql-pop-to-buffer-after-send-region value) (setq sql-pop-to-buffer-after-send-region - (null sql-pop-to-buffer-after-send-region )))) + (null sql-pop-to-buffer-after-send-region)))) @@ -2187,8 +2691,8 @@ "Major mode to use a SQL interpreter interactively. Do not call this function by yourself. The environment must be -initialized by an entry function specific for the SQL interpreter. See -`sql-help' for a list of available entry functions. +initialized by an entry function specific for the SQL interpreter. +See `sql-help' for a list of available entry functions. \\[comint-send-input] after the end of the process' output sends the text from the end of process to the end of the current line. @@ -2252,24 +2756,29 @@ \(setq comint-output-filter-functions \(function (lambda (STR) (comint-show-output))))" (delay-mode-hooks (comint-mode)) + ;; Get the `sql-product' for this interactive session. (set (make-local-variable 'sql-product) (or sql-interactive-product sql-product)) + ;; Setup the mode. (setq major-mode 'sql-interactive-mode) - (setq mode-name (concat "SQLi[" (prin1-to-string sql-product) "]")) + (setq mode-name (concat "SQLi[" (or (sql-get-product-feature sql-product :name) + (symbol-name sql-product)) "]")) (use-local-map sql-interactive-mode-map) (if sql-interactive-mode-menu (easy-menu-add sql-interactive-mode-menu)) ; XEmacs (set-syntax-table sql-mode-syntax-table) (make-local-variable 'sql-mode-font-lock-keywords) (make-local-variable 'font-lock-defaults) + ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column ;; will have just one quote. Therefore syntactic hilighting is ;; disabled for interactive buffers. No imenu support. (sql-product-font-lock t nil) + ;; Enable commenting and uncommenting of the region. (make-local-variable 'comment-start) (setq comment-start "--") @@ -2284,16 +2793,19 @@ (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) ;; User stuff. Initialize before the hook. (set (make-local-variable 'sql-prompt-regexp) - (sql-product-feature :sqli-prompt-regexp)) + (sql-get-product-feature sql-product :prompt-regexp)) (set (make-local-variable 'sql-prompt-length) - (sql-product-feature :sqli-prompt-length)) + (sql-get-product-feature sql-product :prompt-length)) (make-local-variable 'sql-input-ring-separator) (make-local-variable 'sql-input-ring-file-name) - ;; Run hook. + (setq comint-process-echoes t) + ;; Run the mode hook (along with comint's hooks). (run-mode-hooks 'sql-interactive-mode-hook) ;; Set comint based on user overrides. (setq comint-prompt-regexp sql-prompt-regexp) (setq left-margin sql-prompt-length) + ;; Install input sender + (set (make-local-variable 'comint-input-sender) 'sql-input-sender) ;; People wanting a different history file for each ;; buffer/process/client/whatever can change separator and file-name ;; on the sql-interactive-mode-hook. @@ -2323,29 +2835,82 @@ ;;;###autoload (defun sql-product-interactive (&optional product) - "Run product interpreter as an inferior process. + "Run PRODUCT interpreter 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 `*SQL*'. \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" - (interactive) - (setq product (or product sql-product)) - (when (sql-product-feature :sqli-connect product) - (if (comint-check-proc "*SQL*") - (pop-to-buffer "*SQL*") - ;; Get credentials. - (apply 'sql-get-login (sql-product-feature :sqli-login product)) - ;; Connect to database. - (message "Login...") - (funcall (sql-product-feature :sqli-connect product)) - ;; Set SQLi mode. - (setq sql-interactive-product product) - (setq sql-buffer (current-buffer)) - (sql-interactive-mode) - ;; All done. - (message "Login...done") - (pop-to-buffer sql-buffer)))) + (interactive "P") + + (setq product + (cond + ((equal product '(4)) ; Universal arg, prompt for product + (intern (completing-read "SQL product: " + (mapcar (lambda (info) (symbol-name (car info))) + sql-product-alist) + nil 'require-match + (or (and sql-product (symbol-name sql-product)) "ansi")))) + ((symbolp product) product) ; Product specified + (t sql-product))) ; Default to sql-product + + (when (sql-get-product-feature product :sqli-connect-func) + (if (and sql-buffer + (buffer-live-p sql-buffer) + (comint-check-proc sql-buffer)) + (pop-to-buffer sql-buffer) + + ;; Is the current buffer in sql-mode and + ;; there is a buffer local setting of sql-buffer + (let* ((start-buffer + (and (derived-mode-p 'sql-mode) + (current-buffer))) + (start-sql-buffer + (and start-buffer + (let (found) + (dolist (var (buffer-local-variables)) + (and (consp var) + (eq (car var) 'sql-buffer) + (buffer-live-p (cdr var)) + (get-buffer-process (cdr var)) + (setq found (cdr var)))) + found))) + new-sqli-buffer) + + ;; Get credentials. + (apply 'sql-get-login (sql-get-product-feature product :sqli-login)) + + ;; Connect to database. + (message "Login...") + (funcall (sql-get-product-feature product :sqli-connect-func) + product + (sql-get-product-feature product :sqli-options)) + + ;; Set SQLi mode. + (setq sql-interactive-product product + new-sqli-buffer (current-buffer) + sql-buffer new-sqli-buffer) + (sql-interactive-mode) + + ;; Set `sql-buffer' in the start buffer + (when (and start-buffer (not start-sql-buffer)) + (with-current-buffer start-buffer + (setq sql-buffer new-sqli-buffer))) + + ;; All done. + (message "Login...done") + (pop-to-buffer sql-buffer))))) + +(defun sql-connect (product params) + "Set up a comint buffer to connect to the SQL processor. + +PRODUCT is the SQL product. PARAMS is a list of strings which are +passed as command line arguments." + (let ((program (sql-get-product-feature product :sqli-program))) + (set-buffer + (if params + (apply 'make-comint "SQL" program nil params) + (make-comint "SQL" program nil))))) ;;;###autoload (defun sql-oracle () @@ -2360,7 +2925,7 @@ defaults, if set. Additional command line parameters can be stored in the list `sql-oracle-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2374,27 +2939,23 @@ (interactive) (sql-product-interactive 'oracle)) -(defun sql-connect-oracle () - "Create comint buffer and connect to Oracle using the login -parameters and command options." +(defun sql-connect-oracle (product options) + "Create comint buffer and connect to Oracle." ;; Produce user/password@database construct. Password without user ;; is meaningless; database without user/password is meaningless, ;; because "@param" will ask sqlplus to interpret the script ;; "param". - (let ((parameter - (if (not (string= "" sql-user)) - (if (not (string= "" sql-password)) - (concat sql-user "/" sql-password) - sql-user)))) + (let ((parameter nil)) + (if (not (string= "" sql-user)) + (if (not (string= "" sql-password)) + (setq parameter (concat sql-user "/" sql-password)) + (setq parameter sql-user))) (if (and parameter (not (string= "" sql-database))) (setq parameter (concat parameter "@" sql-database))) - (setq parameter (if parameter - (nconc (list parameter) sql-oracle-options) - sql-oracle-options)) - (set-buffer (apply 'make-comint "SQL" sql-oracle-program nil parameter)) - ;; SQL*Plus is buffered on WindowsNT; this handles &placeholders. - (if (eq window-system 'w32) - (setq comint-input-sender 'sql-query-placeholders-and-send)))) + (if parameter + (setq parameter (nconc (list parameter) options)) + (setq parameter options)) + (sql-connect product parameter))) @@ -2411,7 +2972,7 @@ `sql-database' as defaults, if set. Additional command line parameters can be stored in the list `sql-sybase-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2425,12 +2986,11 @@ (interactive) (sql-product-interactive 'sybase)) -(defun sql-connect-sybase () - "Create comint buffer and connect to Sybase using the login -parameters and command options." +(defun sql-connect-sybase (product options) + "Create comint buffer and connect to Sybase." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (let ((params sql-sybase-options)) + (let ((params options)) (if (not (string= "" sql-server)) (setq params (append (list "-S" sql-server) params))) (if (not (string= "" sql-database)) @@ -2439,8 +2999,7 @@ (setq params (append (list "-P" sql-password) params))) (if (not (string= "" sql-user)) (setq params (append (list "-U" sql-user) params))) - (set-buffer (apply 'make-comint "SQL" sql-sybase-program - nil params)))) + (sql-connect product params))) @@ -2455,7 +3014,7 @@ Interpreter used comes from variable `sql-informix-program'. Login uses the variable `sql-database' as default, if set. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2469,13 +3028,15 @@ (interactive) (sql-product-interactive 'informix)) -(defun sql-connect-informix () - "Create comint buffer and connect to Informix using the login -parameters and command options." +(defun sql-connect-informix (product options) + "Create comint buffer and connect to Informix." ;; username and password are ignored. - (set-buffer (if (string= "" sql-database) - (make-comint "SQL" sql-informix-program nil) - (make-comint "SQL" sql-informix-program nil sql-database "-")))) + (let ((db (if (string= "" sql-database) + "-" + (if (string= "" sql-server) + sql-database + (concat sql-database "@" sql-server))))) + (sql-connect product (append `(,db "-") options)))) @@ -2494,7 +3055,7 @@ `sql-server' as defaults, if set. Additional command line parameters can be stored in the list `sql-sqlite-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2508,18 +3069,15 @@ (interactive) (sql-product-interactive 'sqlite)) -(defun sql-connect-sqlite () - "Create comint buffer and connect to SQLite using the login -parameters and command options." +(defun sql-connect-sqlite (product options) + "Create comint buffer and connect to SQLite." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. (let ((params)) (if (not (string= "" sql-database)) (setq params (append (list sql-database) params))) - (if (not (null sql-sqlite-options)) - (setq params (append sql-sqlite-options params))) - (set-buffer (apply 'make-comint "SQL" sql-sqlite-program - nil params)))) + (setq params (append options params)) + (sql-connect product params))) @@ -2538,7 +3096,7 @@ `sql-server' as defaults, if set. Additional command line parameters can be stored in the list `sql-mysql-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2552,9 +3110,8 @@ (interactive) (sql-product-interactive 'mysql)) -(defun sql-connect-mysql () - "Create comint buffer and connect to MySQL using the login -parameters and command options." +(defun sql-connect-mysql (product options) + "Create comint buffer and connect to MySQL." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. (let ((params)) @@ -2562,14 +3119,14 @@ (setq params (append (list sql-database) params))) (if (not (string= "" sql-server)) (setq params (append (list (concat "--host=" sql-server)) params))) + (if (not (and sql-port (numberp sql-port))) + (setq params (append (list (concat "--port=" (number-to-string sql-port))) params))) (if (not (string= "" sql-password)) (setq params (append (list (concat "--password=" sql-password)) params))) (if (not (string= "" sql-user)) (setq params (append (list (concat "--user=" sql-user)) params))) - (if (not (null sql-mysql-options)) - (setq params (append sql-mysql-options params))) - (set-buffer (apply 'make-comint "SQL" sql-mysql-program - nil params)))) + (setq params (append options params)) + (sql-connect product params))) @@ -2585,7 +3142,7 @@ the variables `sql-user', `sql-password', and `sql-server' as defaults, if set. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2599,20 +3156,18 @@ (interactive) (sql-product-interactive 'solid)) -(defun sql-connect-solid () - "Create comint buffer and connect to Solid using the login -parameters and command options." +(defun sql-connect-solid (product options) + "Create comint buffer and connect to Solid." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (let ((params)) + (let ((params options)) ;; It only makes sense if both username and password are there. (if (not (or (string= "" sql-user) (string= "" sql-password))) (setq params (append (list sql-user sql-password) params))) (if (not (string= "" sql-server)) (setq params (append (list sql-server) params))) - (set-buffer (apply 'make-comint "SQL" sql-solid-program - nil params)))) + (sql-connect product params))) @@ -2627,7 +3182,7 @@ Interpreter used comes from variable `sql-ingres-program'. Login uses the variable `sql-database' as default, if set. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2641,13 +3196,14 @@ (interactive) (sql-product-interactive 'ingres)) -(defun sql-connect-ingres () - "Create comint buffer and connect to Ingres using the login -parameters and command options." +(defun sql-connect-ingres (product options) + "Create comint buffer and connect to Ingres." ;; username and password are ignored. - (set-buffer (if (string= "" sql-database) - (make-comint "SQL" sql-ingres-program nil) - (make-comint "SQL" sql-ingres-program nil sql-database)))) + (sql-connect product + (append (if (string= "" sql-database) + nil + (list sql-database)) + options))) @@ -2664,7 +3220,7 @@ as defaults, if set. Additional command line parameters can be stored in the list `sql-ms-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2678,12 +3234,11 @@ (interactive) (sql-product-interactive 'ms)) -(defun sql-connect-ms () - "Create comint buffer and connect to Microsoft using the login -parameters and command options." +(defun sql-connect-ms (product options) + "Create comint buffer and connect to Microsoft SQL Server." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (let ((params sql-ms-options)) + (let ((params options)) (if (not (string= "" sql-server)) (setq params (append (list "-S" sql-server) params))) (if (not (string= "" sql-database)) @@ -2699,8 +3254,7 @@ ;; If -P is passed to ISQL as the last argument without a ;; password, it's considered null. (setq params (append params (list "-P"))))) - (set-buffer (apply 'make-comint "SQL" sql-ms-program - nil params)))) + (sql-connect product params))) @@ -2717,7 +3271,7 @@ Additional command line parameters can be stored in the list `sql-postgres-options'. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2736,23 +3290,21 @@ (interactive) (sql-product-interactive 'postgres)) -(defun sql-connect-postgres () - "Create comint buffer and connect to Postgres using the login -parameters and command options." +(defun sql-connect-postgres (product options) + "Create comint buffer and connect to Postgres." ;; username and password are ignored. Mark Stosberg suggest to add ;; the database at the end. Jason Beegan suggest using --pset and ;; pager=off instead of \\o|cat. The later was the solution by ;; Gregor Zych. Jason's suggestion is the default value for ;; sql-postgres-options. - (let ((params sql-postgres-options)) + (let ((params options)) (if (not (string= "" sql-database)) (setq params (append params (list sql-database)))) (if (not (string= "" sql-server)) (setq params (append (list "-h" sql-server) params))) (if (not (string= "" sql-user)) (setq params (append (list "-U" sql-user) params))) - (set-buffer (apply 'make-comint "SQL" sql-postgres-program - nil params)))) + (sql-connect product params))) @@ -2768,7 +3320,7 @@ uses the variables `sql-user', `sql-password', and `sql-database' as defaults, if set. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. To specify a coding system for converting non-ASCII characters @@ -2782,20 +3334,18 @@ (interactive) (sql-product-interactive 'interbase)) -(defun sql-connect-interbase () - "Create comint buffer and connect to Interbase using the login -parameters and command options." +(defun sql-connect-interbase (product options) + "Create comint buffer and connect to Interbase." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (let ((params sql-interbase-options)) + (let ((params options)) (if (not (string= "" sql-user)) (setq params (append (list "-u" sql-user) params))) (if (not (string= "" sql-password)) (setq params (append (list "-p" sql-password) params))) (if (not (string= "" sql-database)) (setq params (cons sql-database params))) ; add to the front! - (set-buffer (apply 'make-comint "SQL" sql-interbase-program - nil params)))) + (sql-connect product params))) @@ -2810,7 +3360,7 @@ Interpreter used comes from variable `sql-db2-program'. There is not automatic login. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. If you use \\[sql-accumulate-and-indent] to send multiline commands to @@ -2829,15 +3379,14 @@ (interactive) (sql-product-interactive 'db2)) -(defun sql-connect-db2 () - "Create comint buffer and connect to DB2 using the login -parameters and command options." +(defun sql-connect-db2 (product options) + "Create comint buffer and connect to DB2." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (set-buffer (apply 'make-comint "SQL" sql-db2-program - nil sql-db2-options)) - ;; Properly escape newlines when DB2 is interactive. - (setq comint-input-sender 'sql-escape-newlines-and-send)) + (sql-connect product options) +) +;; ;; Properly escape newlines when DB2 is interactive. +;; (setq comint-input-sender 'sql-escape-newlines-and-send)) ;;;###autoload (defun sql-linter () @@ -2850,7 +3399,7 @@ Interpreter used comes from variable `sql-linter-program' - usually `inl'. Login uses the variables `sql-user', `sql-password', `sql-database' and `sql-server' as defaults, if set. Additional command line parameters -can be stored in the list `sql-linter-options'. Run inl -h to get help on +can be stored in the list `sql-linter-options'. Run inl -h to get help on parameters. `sql-database' is used to set the LINTER_MBX environment variable for @@ -2859,19 +3408,20 @@ for this to work). If `sql-password' is an empty string, inl will use an empty password. -The buffer is put in sql-interactive-mode, giving commands for sending +The buffer is put in SQL interactive mode, giving commands for sending input. See `sql-interactive-mode'. \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" (interactive) (sql-product-interactive 'linter)) -(defun sql-connect-linter () - "Create comint buffer and connect to Linter using the login -parameters and command options." +(defun sql-connect-linter (product options) + "Create comint buffer and connect to Linter." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (let ((params sql-linter-options) (login nil) (old-mbx (getenv "LINTER_MBX"))) + (let ((params options) + (login nil) + (old-mbx (getenv "LINTER_MBX"))) (if (not (string= "" sql-user)) (setq login (concat sql-user "/" sql-password))) (setq params (append (list "-u" login) params)) @@ -2880,8 +3430,7 @@ (if (string= "" sql-database) (setenv "LINTER_MBX" nil) (setenv "LINTER_MBX" sql-database)) - (set-buffer (apply 'make-comint "SQL" sql-linter-program nil - params)) + (sql-connect product params) (setenv "LINTER_MBX" old-mbx))) @@ -2890,3 +3439,4 @@ ;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3 ;;; sql.el ends here + diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/verilog-mode.el --- a/lisp/progmodes/verilog-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/verilog-mode.el Thu May 13 15:13:52 2010 +0200 @@ -2611,7 +2611,7 @@ (if (or (looking-at verilog-disable-fork-re) (and (looking-at "fork") - (progn + (progn (setq here (point)) ;; sometimes a fork is just a fork (forward-word -1) (looking-at verilog-disable-fork-re)))) @@ -2670,7 +2670,8 @@ (forward-word 1)) (catch 'skip (if (eq nest 'yes) - (let ((depth 1)) + (let ((depth 1) + here) (while (verilog-re-search-forward reg nil 'move) (cond ((match-end md) ; a closer in regular expression, so we are climbing out @@ -2686,7 +2687,7 @@ ((if (or (looking-at verilog-disable-fork-re) (and (looking-at "fork") - (progn + (progn (forward-word -1) (looking-at verilog-disable-fork-re)))) (progn ;; it is a disable fork; another false alarm diff -r e56f669f17ce -r fe07c47cf7a7 lisp/progmodes/vhdl-mode.el --- a/lisp/progmodes/vhdl-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/progmodes/vhdl-mode.el Thu May 13 15:13:52 2010 +0200 @@ -199,21 +199,6 @@ "Customizations for modes." :group 'vhdl) -(defcustom vhdl-electric-mode t - "*Non-nil enables electrification (automatic template generation). -If nil, template generators can still be invoked through key bindings and -menu. Is indicated in the modeline by \"/e\" after the mode name and can be -toggled by `\\[vhdl-electric-mode]'." - :type 'boolean - :group 'vhdl-mode) - -(defcustom vhdl-stutter-mode t - "*Non-nil enables stuttering. -Is indicated in the modeline by \"/s\" after the mode name and can be toggled -by `\\[vhdl-stutter-mode]'." - :type 'boolean - :group 'vhdl-mode) - (defcustom vhdl-indent-tabs-mode nil "*Non-nil means indentation can insert tabs. Overrides local variable `indent-tabs-mode'." @@ -3466,13 +3451,11 @@ ("Mode" ["Electric Mode" (progn (customize-set-variable 'vhdl-electric-mode - (not vhdl-electric-mode)) - (vhdl-mode-line-update)) + (not vhdl-electric-mode))) :style toggle :selected vhdl-electric-mode :keys "C-c C-m C-e"] ["Stutter Mode" (progn (customize-set-variable 'vhdl-stutter-mode - (not vhdl-stutter-mode)) - (vhdl-mode-line-update)) + (not vhdl-stutter-mode))) :style toggle :selected vhdl-stutter-mode :keys "C-c C-m C-s"] ["Indent Tabs Mode" (progn (customize-set-variable 'vhdl-indent-tabs-mode @@ -4670,7 +4653,10 @@ (interactive) (kill-all-local-variables) (setq major-mode 'vhdl-mode) - (setq mode-name "VHDL") + (setq mode-name '("VHDL" + (vhdl-electric-mode "/" (vhdl-stutter-mode "/")) + (vhdl-electric-mode "e") + (vhdl-stutter-mode "s"))) ;; set maps and tables (use-local-map vhdl-mode-map) @@ -4737,7 +4723,6 @@ ;; miscellaneous (vhdl-ps-print-init) (vhdl-write-file-hooks-init) - (vhdl-mode-line-update) (message "VHDL Mode %s.%s" vhdl-version (if noninteractive "" " See menu for documentation and release notes.")) @@ -4757,8 +4742,7 @@ (vhdl-write-file-hooks-init) (vhdl-update-mode-menu) (vhdl-hideshow-init) - (run-hooks 'menu-bar-update-hook) - (vhdl-mode-line-update)) + (run-hooks 'menu-bar-update-hook)) (defun vhdl-write-file-hooks-init () "Add/remove hooks when buffer is saved." @@ -8055,31 +8039,15 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Enabling/disabling -(defun vhdl-mode-line-update () - "Update the modeline string for VHDL major mode." - (setq mode-name (concat "VHDL" - (and (or vhdl-electric-mode vhdl-stutter-mode) "/") - (and vhdl-electric-mode "e") - (and vhdl-stutter-mode "s"))) - (force-mode-line-update t)) - -(defun vhdl-electric-mode (arg) +(define-minor-mode vhdl-electric-mode "Toggle VHDL electric mode. Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." - (interactive "P") - (setq vhdl-electric-mode - (cond ((or (not arg) (zerop arg)) (not vhdl-electric-mode)) - ((> arg 0) t) (t nil))) - (vhdl-mode-line-update)) - -(defun vhdl-stutter-mode (arg) + :global t) + +(define-minor-mode vhdl-stutter-mode "Toggle VHDL stuttering mode. Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." - (interactive "P") - (setq vhdl-stutter-mode - (cond ((or (not arg) (zerop arg)) (not vhdl-stutter-mode)) - ((> arg 0) t) (t nil))) - (vhdl-mode-line-update)) + :global t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Stuttering @@ -12533,7 +12501,7 @@ (add-hook 'hs-minor-mode-hook 'hs-hide-all) (remove-hook 'hs-minor-mode-hook 'hs-hide-all)) (hs-minor-mode arg) - (vhdl-mode-line-update))) ; hack to update menu bar + (force-mode-line-update))) ; hack to update menu bar ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff -r e56f669f17ce -r fe07c47cf7a7 lisp/savehist.el --- a/lisp/savehist.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/savehist.el Thu May 13 15:13:52 2010 +0200 @@ -59,17 +59,6 @@ :version "22.1" :group 'minibuffer) -;;;###autoload -(defcustom savehist-mode nil - "Mode for automatic saving of minibuffer history. -Set this by calling the `savehist-mode' function or using the customize -interface." - :type 'boolean - :set (lambda (symbol value) (savehist-mode (or value 0))) - :initialize 'custom-initialize-default - :require 'savehist - :group 'savehist) - (defcustom savehist-save-minibuffer-history t "If non-nil, save all recorded minibuffer histories. If you want to save only specific histories, use `savehist-save-hook' to @@ -181,7 +170,7 @@ ;; Functions. ;;;###autoload -(defun savehist-mode (arg) +(define-minor-mode savehist-mode "Toggle savehist-mode. Positive ARG turns on `savehist-mode'. When on, savehist-mode causes minibuffer history to be saved periodically and when exiting Emacs. @@ -191,11 +180,7 @@ This mode should normally be turned on from your Emacs init file. Calling it at any other time replaces your current minibuffer histories, which is probably undesirable." - (interactive "P") - (setq savehist-mode - (if (null arg) - (not savehist-mode) - (> (prefix-numeric-value arg) 0))) + :global t (if (not savehist-mode) (savehist-uninstall) (when (and (not savehist-loaded) @@ -214,11 +199,7 @@ (setq savehist-mode nil) (savehist-uninstall) (signal (car errvar) (cdr errvar))))) - (savehist-install) - (run-hooks 'savehist-mode-hook)) - ;; Return the new setting. - savehist-mode) -(add-minor-mode 'savehist-mode "") + (savehist-install))) (defun savehist-load () "Load the variables stored in `savehist-file' and turn on `savehist-mode'. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/scroll-all.el --- a/lisp/scroll-all.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/scroll-all.el Thu May 13 15:13:52 2010 +0200 @@ -90,9 +90,9 @@ (call-interactively 'scroll-all-scroll-down-all)) ((eq this-command 'previous-line) (call-interactively 'scroll-all-scroll-up-all)) - ((eq this-command 'scroll-up) + ((memq this-command '(scroll-up scroll-up-command)) (call-interactively 'scroll-all-page-down-all)) - ((eq this-command 'scroll-down) + ((memq this-command '(scroll-down scroll-down-command)) (call-interactively 'scroll-all-page-up-all)) ((eq this-command 'beginning-of-buffer) (call-interactively 'scroll-all-beginning-of-buffer-all)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/scroll-bar.el --- a/lisp/scroll-bar.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/scroll-bar.el Thu May 13 15:13:52 2010 +0200 @@ -29,6 +29,7 @@ ;;; Code: (require 'mouse) +(eval-when-compile (require 'cl)) ;;;; Utilities. @@ -79,9 +80,6 @@ "Non-nil means `set-scroll-bar-mode' should really do something. This is nil while loading `scroll-bar.el', and t afterward.") -(defun set-scroll-bar-mode-1 (ignore value) - (set-scroll-bar-mode value)) - (defun set-scroll-bar-mode (value) "Set `scroll-bar-mode' to VALUE and put the new value into effect." (if scroll-bar-mode @@ -107,27 +105,23 @@ ;; The default value for :initialize would try to use :set ;; when processing the file in cus-dep.el. :initialize 'custom-initialize-default - :set 'set-scroll-bar-mode-1) + :set (lambda (sym val) (set-scroll-bar-mode val))) ;; We just set scroll-bar-mode, but that was the default. ;; If it is set again, that is for real. (setq scroll-bar-mode-explicit t) -(defun scroll-bar-mode (&optional flag) +(defun get-scroll-bar-mode () scroll-bar-mode) +(defsetf get-scroll-bar-mode set-scroll-bar-mode) +(define-minor-mode scroll-bar-mode "Toggle display of vertical scroll bars on all frames. This command applies to all frames that exist and frames to be created in the future. With a numeric argument, if the argument is positive turn on scroll bars; otherwise turn off scroll bars." - (interactive "P") - - ;; Tweedle the variable according to the argument. - (set-scroll-bar-mode (if (if (null flag) - (not scroll-bar-mode) - (setq flag (prefix-numeric-value flag)) - (or (not (numberp flag)) (> flag 0))) - (or previous-scroll-bar-mode - default-frame-scroll-bars)))) + :variable (eq (get-scroll-bar-mode) + (or previous-scroll-bar-mode + default-frame-scroll-bars))) (defun toggle-scroll-bar (arg) "Toggle whether or not the selected frame has vertical scroll bars. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/server.el --- a/lisp/server.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/server.el Thu May 13 15:13:52 2010 +0200 @@ -344,7 +344,8 @@ ;; for possible servers before doing anything, so it *should* be ours. (and (process-contact proc :server) (eq (process-status proc) 'closed) - (ignore-errors (delete-file (process-get proc :server-file)))) + (ignore-errors + (delete-file (process-get proc :server-file) t))) (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) (server-delete-client proc)) @@ -517,7 +518,9 @@ ;; Delete the socket files made by previous server invocations. (if (not (eq t (server-running-p server-name))) ;; Remove any leftover socket or authentication file - (ignore-errors (delete-file server-file)) + (ignore-errors + (let (delete-by-moving-to-trash) + (delete-file server-file))) (setq server-mode nil) ;; already set by the minor mode code (display-warning 'server @@ -600,7 +603,7 @@ server-auth-dir server-socket-dir)))) (condition-case nil - (progn + (let (delete-by-moving-to-trash) (delete-file file) (message "Connection file %S deleted" file)) (file-error diff -r e56f669f17ce -r fe07c47cf7a7 lisp/sha1.el --- a/lisp/sha1.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/sha1.el Thu May 13 15:13:52 2010 +0200 @@ -95,7 +95,7 @@ (setq prog sha1-program args nil)) (with-temp-buffer - (set-buffer-multibyte nil) + (unless (featurep 'xemacs) (set-buffer-multibyte nil)) (insert string) (apply (function call-process-region) (point-min) (point-max) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/simple.el --- a/lisp/simple.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/simple.el Thu May 13 15:13:52 2010 +0200 @@ -401,8 +401,7 @@ Other major modes are defined by comparison with this one." (interactive) (kill-all-local-variables) - (unless delay-mode-hooks - (run-hooks 'after-change-major-mode-hook))) + (run-mode-hooks 'fundamental-mode-hook)) ;; Special major modes to view specially formatted data rather than files. @@ -2689,6 +2688,60 @@ (reset-this-command-lengths) (restore-overriding-map)) +;; This function is here rather than in subr.el because it uses CL. +(defmacro with-wrapper-hook (var args &rest body) + "Run BODY wrapped with the VAR hook. +VAR is a special hook: its functions are called with a first argument +which is the \"original\" code (the BODY), so the hook function can wrap +the original function, or call it any number of times (including not calling +it at all). This is similar to an `around' advice. +VAR is normally a symbol (a variable) in which case it is treated like +a hook, with a buffer-local and a global part. But it can also be an +arbitrary expression. +ARGS is a list of variables which will be passed as additional arguments +to each function, after the initial argument, and which the first argument +expects to receive when called." + (declare (indent 2) (debug t)) + ;; We need those two gensyms because CL's lexical scoping is not available + ;; for function arguments :-( + (let ((funs (make-symbol "funs")) + (global (make-symbol "global")) + (argssym (make-symbol "args"))) + ;; Since the hook is a wrapper, the loop has to be done via + ;; recursion: a given hook function will call its parameter in order to + ;; continue looping. + `(labels ((runrestofhook (,funs ,global ,argssym) + ;; `funs' holds the functions left on the hook and `global' + ;; holds the functions left on the global part of the hook + ;; (in case the hook is local). + (lexical-let ((funs ,funs) + (global ,global)) + (if (consp funs) + (if (eq t (car funs)) + (runrestofhook + (append global (cdr funs)) nil ,argssym) + (apply (car funs) + (lambda (&rest ,argssym) + (runrestofhook (cdr funs) global ,argssym)) + ,argssym)) + ;; Once there are no more functions on the hook, run + ;; the original body. + (apply (lambda ,args ,@body) ,argssym))))) + (runrestofhook ,var + ;; The global part of the hook, if any. + ,(if (symbolp var) + `(if (local-variable-p ',var) + (default-value ',var))) + (list ,@args))))) + +(defvar filter-buffer-substring-functions nil + "Wrapper hook around `filter-buffer-substring'. +The functions on this special hook are called with 4 arguments: + NEXT-FUN BEG END DELETE +NEXT-FUN is a function of 3 arguments (BEG END DELETE) +that performs the default operation. The other 3 arguments are like +the ones passed to `filter-buffer-substring'.") + (defvar buffer-substring-filters nil "List of filter functions for `filter-buffer-substring'. Each function must accept a single argument, a string, and return @@ -2698,46 +2751,34 @@ return value of `filter-buffer-substring'. If this variable is nil, no filtering is performed.") - -(defun filter-buffer-substring (beg end &optional delete noprops) +(make-obsolete-variable 'buffer-substring-filters + 'filter-buffer-substring-functions "24.1") + +(defun filter-buffer-substring (beg end &optional delete) "Return the buffer substring between BEG and END, after filtering. -The buffer substring is passed through each of the filter -functions in `buffer-substring-filters', and the value from the -last filter function is returned. If `buffer-substring-filters' -is nil, the buffer substring is returned unaltered. +The filtering is performed by `filter-buffer-substring-functions'. If DELETE is non-nil, the text between BEG and END is deleted from the buffer. -If NOPROPS is non-nil, final string returned does not include -text properties, while the string passed to the filters still -includes text properties from the buffer text. - -Point is temporarily set to BEG before calling -`buffer-substring-filters', in case the functions need to know -where the text came from. - This function should be used instead of `buffer-substring', `buffer-substring-no-properties', or `delete-and-extract-region' when you want to allow filtering to take place. For example, -major or minor modes can use `buffer-substring-filters' to +major or minor modes can use `filter-buffer-substring-functions' to extract characters that are special to a buffer, and should not be copied into other buffers." - (cond - ((or delete buffer-substring-filters) - (save-excursion - (goto-char beg) - (let ((string (if delete (delete-and-extract-region beg end) - (buffer-substring beg end)))) - (dolist (filter buffer-substring-filters) - (setq string (funcall filter string))) - (if noprops - (set-text-properties 0 (length string) nil string)) - string))) - (noprops - (buffer-substring-no-properties beg end)) - (t - (buffer-substring beg end)))) + (with-wrapper-hook filter-buffer-substring-functions (beg end delete) + (cond + ((or delete buffer-substring-filters) + (save-excursion + (goto-char beg) + (let ((string (if delete (delete-and-extract-region beg end) + (buffer-substring beg end)))) + (dolist (filter buffer-substring-filters) + (setq string (funcall filter string))) + string))) + (t + (buffer-substring beg end))))) ;;;; Window system cut and paste hooks. @@ -4745,157 +4786,7 @@ (define-globalized-minor-mode global-visual-line-mode visual-line-mode turn-on-visual-line-mode :lighter " vl") - -;;; Scrolling commands. - -;;; Scrolling commands which does not signal errors at top/bottom -;;; of buffer at first key-press (instead moves to top/bottom -;;; of buffer). - -(defcustom scroll-error-top-bottom nil - "Move point to top/bottom of buffer before signalling a scrolling error. -A value of nil means just signal an error if no more scrolling possible. -A value of t means point moves to the beginning or the end of the buffer -\(depending on scrolling direction) when no more scrolling possible. -When point is already on that position, then signal an error." - :type 'boolean - :group 'scrolling - :version "24.1") - -(defun scroll-up-command (&optional arg) - "Scroll text of selected window upward ARG lines; or near full screen if no ARG. -If `scroll-error-top-bottom' is non-nil and `scroll-up' cannot -scroll window further, move cursor to the bottom line. -When point is already on that position, then signal an error. -A near full screen is `next-screen-context-lines' less than a full screen. -Negative ARG means scroll downward. -If ARG is the atom `-', scroll downward by nearly full screen." - (interactive "^P") - (cond - ((null scroll-error-top-bottom) - (scroll-up arg)) - ((eq arg '-) - (scroll-down-command nil)) - ((< (prefix-numeric-value arg) 0) - (scroll-down-command (- (prefix-numeric-value arg)))) - ((eobp) - (scroll-up arg)) ; signal error - (t - (condition-case nil - (scroll-up arg) - (end-of-buffer - (if arg - ;; When scrolling by ARG lines can't be done, - ;; move by ARG lines instead. - (forward-line arg) - ;; When ARG is nil for full-screen scrolling, - ;; move to the bottom of the buffer. - (goto-char (point-max)))))))) - -(put 'scroll-up-command 'isearch-scroll t) -(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-command) - -(defun scroll-down-command (&optional arg) - "Scroll text of selected window down ARG lines; or near full screen if no ARG. -If `scroll-error-top-bottom' is non-nil and `scroll-down' cannot -scroll window further, move cursor to the top line. -When point is already on that position, then signal an error. -A near full screen is `next-screen-context-lines' less than a full screen. -Negative ARG means scroll upward. -If ARG is the atom `-', scroll upward by nearly full screen." - (interactive "^P") - (cond - ((null scroll-error-top-bottom) - (scroll-down arg)) - ((eq arg '-) - (scroll-up-command nil)) - ((< (prefix-numeric-value arg) 0) - (scroll-up-command (- (prefix-numeric-value arg)))) - ((bobp) - (scroll-down arg)) ; signal error - (t - (condition-case nil - (scroll-down arg) - (beginning-of-buffer - (if arg - ;; When scrolling by ARG lines can't be done, - ;; move by ARG lines instead. - (forward-line (- arg)) - ;; When ARG is nil for full-screen scrolling, - ;; move to the top of the buffer. - (goto-char (point-min)))))))) - -(put 'scroll-down-command 'isearch-scroll t) -(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-command) - -;;; Scrolling commands which scroll a line instead of full screen. - -(defun scroll-up-line (&optional arg) - "Scroll text of selected window upward ARG lines; or one line if no ARG. -If ARG is omitted or nil, scroll upward by one line. -This is different from `scroll-up-command' that scrolls a full screen." - (interactive "p") - (scroll-up (or arg 1))) - -(put 'scroll-up-line 'isearch-scroll t) -(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-line) - -(defun scroll-down-line (&optional arg) - "Scroll text of selected window down ARG lines; or one line if no ARG. -If ARG is omitted or nil, scroll down by one line. -This is different from `scroll-down-command' that scrolls a full screen." - (interactive "p") - (scroll-down (or arg 1))) - -(put 'scroll-down-line 'isearch-scroll t) -(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-line) - - -(defun scroll-other-window-down (lines) - "Scroll the \"other window\" down. -For more details, see the documentation for `scroll-other-window'." - (interactive "P") - (scroll-other-window - ;; Just invert the argument's meaning. - ;; We can do that without knowing which window it will be. - (if (eq lines '-) nil - (if (null lines) '- - (- (prefix-numeric-value lines)))))) - -(defun beginning-of-buffer-other-window (arg) - "Move point to the beginning of the buffer in the other window. -Leave mark at previous position. -With arg N, put point N/10 of the way from the true beginning." - (interactive "P") - (let ((orig-window (selected-window)) - (window (other-window-for-scrolling))) - ;; We use unwind-protect rather than save-window-excursion - ;; because the latter would preserve the things we want to change. - (unwind-protect - (progn - (select-window window) - ;; Set point and mark in that window's buffer. - (with-no-warnings - (beginning-of-buffer arg)) - ;; Set point accordingly. - (recenter '(t))) - (select-window orig-window)))) - -(defun end-of-buffer-other-window (arg) - "Move point to the end of the buffer in the other window. -Leave mark at previous position. -With arg N, put point N/10 of the way from the true end." - (interactive "P") - ;; See beginning-of-buffer-other-window for comments. - (let ((orig-window (selected-window)) - (window (other-window-for-scrolling))) - (unwind-protect - (progn - (select-window window) - (with-no-warnings - (end-of-buffer arg)) - (recenter '(t))) - (select-window orig-window)))) + (defun transpose-chars (arg) "Interchange characters around point, moving forward one character. @@ -5258,7 +5149,7 @@ (put 'auto-fill-function 'safe-local-variable 'null) ;; FIXME: turn into a proper minor mode. ;; Add a global minor mode version of it. -(defun auto-fill-mode (&optional arg) +(define-minor-mode auto-fill-mode "Toggle Auto Fill mode. With ARG, turn Auto Fill mode on if and only if ARG is positive. In Auto Fill mode, inserting a space at a column beyond `current-fill-column' @@ -5266,14 +5157,7 @@ The value of `normal-auto-fill-function' specifies the function to use for `auto-fill-function' when turning Auto Fill mode on." - (interactive "P") - (prog1 (setq auto-fill-function - (if (if (null arg) - (not auto-fill-function) - (> (prefix-numeric-value arg) 0)) - normal-auto-fill-function - nil)) - (force-mode-line-update))) + :variable (eq auto-fill-function normal-auto-fill-function)) ;; This holds a document string used to document auto-fill-mode. (defun auto-fill-function () @@ -5372,7 +5256,7 @@ (defvar overwrite-mode-binary (purecopy " Bin Ovwrt") "The string displayed in the mode line when in binary overwrite mode.") -(defun overwrite-mode (arg) +(define-minor-mode overwrite-mode "Toggle overwrite mode. With prefix argument ARG, turn overwrite mode on if ARG is positive, otherwise turn it off. In overwrite mode, printing characters typed @@ -5381,14 +5265,9 @@ Before a tab, such characters insert until the tab is filled in. \\[quoted-insert] still inserts characters in overwrite mode; this is supposed to make it easier to insert characters when necessary." - (interactive "P") - (setq overwrite-mode - (if (if (null arg) (not overwrite-mode) - (> (prefix-numeric-value arg) 0)) - 'overwrite-mode-textual)) - (force-mode-line-update)) - -(defun binary-overwrite-mode (arg) + :variable (eq overwrite-mode 'overwrite-mode-textual)) + +(define-minor-mode binary-overwrite-mode "Toggle binary overwrite mode. With prefix argument ARG, turn binary overwrite mode on if ARG is positive, otherwise turn it off. In binary overwrite mode, printing @@ -5401,13 +5280,7 @@ Note that binary overwrite mode is not its own minor mode; it is a specialization of overwrite mode, entered by setting the `overwrite-mode' variable to `overwrite-mode-binary'." - (interactive "P") - (setq overwrite-mode - (if (if (null arg) - (not (eq overwrite-mode 'overwrite-mode-binary)) - (> (prefix-numeric-value arg) 0)) - 'overwrite-mode-binary)) - (force-mode-line-update)) + :variable (eq overwrite-mode 'overwrite-mode-binary)) (define-minor-mode line-number-mode "Toggle Line Number mode. @@ -5433,6 +5306,26 @@ otherwise turn it off. When Size Indication mode is enabled, the size of the accessible part of the buffer appears in the mode line." :global t :group 'mode-line) + +(define-minor-mode auto-save-mode + "Toggle auto-saving of contents of current buffer. +With prefix argument ARG, turn auto-saving on if positive, else off." + :variable ((and buffer-auto-save-file-name + ;; If auto-save is off because buffer has shrunk, + ;; then toggling should turn it on. + (>= buffer-saved-size 0)) + . (lambda (val) + (setq buffer-auto-save-file-name + (cond + ((null val) nil) + ((and buffer-file-name auto-save-visited-file-name + (not buffer-read-only)) + buffer-file-name) + (t (make-auto-save-file-name)))))) + ;; If -1 was stored here, to temporarily turn off saving, + ;; turn it back on. + (and (< buffer-saved-size 0) + (setq buffer-saved-size 0))) (defgroup paren-blinking nil "Blinking matching of parens and expressions." @@ -6547,7 +6440,7 @@ normal-erase-is-backspace) 1 0))))) -(defun normal-erase-is-backspace-mode (&optional arg) +(define-minor-mode normal-erase-is-backspace-mode "Toggle the Erase and Delete mode of the Backspace and Delete keys. With numeric ARG, turn the mode on if and only if ARG is positive. @@ -6577,13 +6470,10 @@ have both Backspace, Delete and F1 keys. See also `normal-erase-is-backspace'." - (interactive "P") - (let ((enabled (or (and arg (> (prefix-numeric-value arg) 0)) - (not (or arg - (eq 1 (terminal-parameter - nil 'normal-erase-is-backspace))))))) - (set-terminal-parameter nil 'normal-erase-is-backspace - (if enabled 1 0)) + :variable (eq (terminal-parameter + nil 'normal-erase-is-backspace) 1) + (let ((enabled (eq 1 (terminal-parameter + nil 'normal-erase-is-backspace)))) (cond ((or (memq window-system '(x w32 ns pc)) (memq system-type '(ms-dos windows-nt))) @@ -6619,7 +6509,6 @@ (keyboard-translate ?\C-h ?\C-h) (keyboard-translate ?\C-? ?\C-?)))) - (run-hooks 'normal-erase-is-backspace-hook) (if (called-interactively-p 'interactive) (message "Delete key deletes %s" (if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace)) @@ -6656,52 +6545,6 @@ was called." (lexical-let ((fun fun) (args1 args)) (lambda (&rest args2) (apply fun (append args1 args2))))) - -;; This function is here rather than in subr.el because it uses CL. -(defmacro with-wrapper-hook (var args &rest body) - "Run BODY wrapped with the VAR hook. -VAR is a special hook: its functions are called with a first argument -which is the \"original\" code (the BODY), so the hook function can wrap -the original function, or call it any number of times (including not calling -it at all). This is similar to an `around' advice. -VAR is normally a symbol (a variable) in which case it is treated like -a hook, with a buffer-local and a global part. But it can also be an -arbitrary expression. -ARGS is a list of variables which will be passed as additional arguments -to each function, after the initial argument, and which the first argument -expects to receive when called." - (declare (indent 2) (debug t)) - ;; We need those two gensyms because CL's lexical scoping is not available - ;; for function arguments :-( - (let ((funs (make-symbol "funs")) - (global (make-symbol "global")) - (argssym (make-symbol "args"))) - ;; Since the hook is a wrapper, the loop has to be done via - ;; recursion: a given hook function will call its parameter in order to - ;; continue looping. - `(labels ((runrestofhook (,funs ,global ,argssym) - ;; `funs' holds the functions left on the hook and `global' - ;; holds the functions left on the global part of the hook - ;; (in case the hook is local). - (lexical-let ((funs ,funs) - (global ,global)) - (if (consp funs) - (if (eq t (car funs)) - (runrestofhook - (append global (cdr funs)) nil ,argssym) - (apply (car funs) - (lambda (&rest ,argssym) - (runrestofhook (cdr funs) global ,argssym)) - ,argssym)) - ;; Once there are no more functions on the hook, run - ;; the original body. - (apply (lambda ,args ,@body) ,argssym))))) - (runrestofhook ,var - ;; The global part of the hook, if any. - ,(if (symbolp var) - `(if (local-variable-p ',var) - (default-value ',var))) - (list ,@args))))) ;; Minibuffer prompt stuff. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/subr.el --- a/lisp/subr.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/subr.el Thu May 13 15:13:52 2010 +0200 @@ -1055,7 +1055,6 @@ (make-obsolete-variable 'default-line-spacing 'line-spacing "23.2") (make-obsolete-variable 'default-abbrev-mode 'abbrev-mode "23.2") (make-obsolete-variable 'default-ctl-arrow 'ctl-arrow "23.2") -(make-obsolete-variable 'default-direction-reversed 'direction-reversed "23.2") (make-obsolete-variable 'default-truncate-lines 'truncate-lines "23.2") (make-obsolete-variable 'default-left-margin 'left-margin "23.2") (make-obsolete-variable 'default-tab-width 'tab-width "23.2") @@ -1478,8 +1477,7 @@ (let ((rest (cdr found))) (setcdr found nil) (nconc found (list (list toggle name)) rest)) - (setq minor-mode-alist (cons (list toggle name) - minor-mode-alist))))))) + (push (list toggle name) minor-mode-alist)))))) ;; Add the toggle to the minor-modes menu if requested. (when (get toggle :included) (define-key mode-line-mode-menu @@ -1508,8 +1506,7 @@ (let ((rest (cdr found))) (setcdr found nil) (nconc found (list (cons toggle keymap)) rest)) - (setq minor-mode-map-alist (cons (cons toggle keymap) - minor-mode-map-alist)))))))) + (push (cons toggle keymap) minor-mode-map-alist))))))) ;;; Load history diff -r e56f669f17ce -r fe07c47cf7a7 lisp/tar-mode.el --- a/lisp/tar-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/tar-mode.el Thu May 13 15:13:52 2010 +0200 @@ -137,7 +137,6 @@ (defvar tar-parse-info nil) (defvar tar-superior-buffer nil) (defvar tar-superior-descriptor nil) -(defvar tar-subfile-mode nil) (defvar tar-file-name-coding-system nil) (put 'tar-superior-buffer 'permanent-local t) @@ -672,29 +671,21 @@ (signal (car err) (cdr err))))) -(defun tar-subfile-mode (p) +(define-minor-mode tar-subfile-mode "Minor mode for editing an element of a tar-file. This mode arranges for \"saving\" this buffer to write the data into the tar-file buffer that it came from. The changes will actually appear on disk when you save the tar-file's buffer." - (interactive "P") + ;; Don't do this, because it is redundant and wastes mode line space. + ;; :lighter " TarFile" + nil nil nil (or (and (boundp 'tar-superior-buffer) tar-superior-buffer) (error "This buffer is not an element of a tar file")) - ;; Don't do this, because it is redundant and wastes mode line space. - ;; (or (assq 'tar-subfile-mode minor-mode-alist) - ;; (setq minor-mode-alist (append minor-mode-alist - ;; (list '(tar-subfile-mode " TarFile"))))) - (make-local-variable 'tar-subfile-mode) - (setq tar-subfile-mode - (if (null p) - (not tar-subfile-mode) - (> (prefix-numeric-value p) 0))) (cond (tar-subfile-mode (add-hook 'write-file-functions 'tar-subfile-save-buffer nil t) ;; turn off auto-save. (auto-save-mode -1) - (setq buffer-auto-save-file-name nil) - (run-hooks 'tar-subfile-mode-hook)) + (setq buffer-auto-save-file-name nil)) (t (remove-hook 'write-file-functions 'tar-subfile-save-buffer t)))) @@ -852,14 +843,12 @@ (set (make-local-variable 'tar-superior-descriptor) descriptor) (setq buffer-read-only read-only-p) (tar-subfile-mode 1))) - (if view-p - (view-buffer - buffer (and just-created 'kill-buffer-if-not-modified)) - (if (eq other-window-p 'display) - (display-buffer buffer) - (if other-window-p - (switch-to-buffer-other-window buffer) - (switch-to-buffer buffer))))))) + (cond + (view-p + (view-buffer buffer (and just-created 'kill-buffer-if-not-modified))) + ((eq other-window-p 'display) (display-buffer buffer)) + (other-window-p (switch-to-buffer-other-window buffer)) + (t (switch-to-buffer buffer)))))) (defun tar-extract-other-window () diff -r e56f669f17ce -r fe07c47cf7a7 lisp/term/tvi970.el --- a/lisp/term/tvi970.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/term/tvi970.el Thu May 13 15:13:52 2010 +0200 @@ -28,6 +28,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + (defvar tvi970-terminal-map (let ((map (make-sparse-keymap))) @@ -102,7 +104,7 @@ ;; Should keypad numbers send ordinary digits or distinct escape sequences? -(defun tvi970-set-keypad-mode (&optional arg) +(define-minor-mode tvi970-set-keypad-mode "Set the current mode of the TVI 970 numeric keypad. In ``numeric keypad mode'', the number keys on the keypad act as ordinary digits. In ``alternate keypad mode'', the keys send distinct @@ -111,12 +113,9 @@ With no argument, toggle between the two possible modes. With a positive argument, select alternate keypad mode. With a negative argument, select numeric keypad mode." - (interactive "P") - (let ((newval (if (null arg) - (not (terminal-parameter nil 'tvi970-keypad-numeric)) - (> (prefix-numeric-value arg) 0)))) - (set-terminal-parameter nil 'tvi970-keypad-numeric newval) - (send-string-to-terminal (if newval "\e=" "\e>")))) + :variable (terminal-parameter nil 'tvi970-keypad-numeric) + (send-string-to-terminal + (if (terminal-parameter nil 'tvi970-keypad-numeric) "\e=" "\e>"))) ;; arch-tag: c1334cf0-1462-41c3-a963-c077d175f8f0 ;;; tvi970.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/term/vt100.el --- a/lisp/term/vt100.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/term/vt100.el Thu May 13 15:13:52 2010 +0200 @@ -41,19 +41,13 @@ (tty-run-terminal-initialization (selected-frame) "lk201")) ;;; Controlling the screen width. -(defvar vt100-wide-mode (= (frame-width) 132) - "t if vt100 is in 132-column mode.") - -(defun vt100-wide-mode (&optional arg) +(define-minor-mode vt100-wide-mode "Toggle 132/80 column mode for vt100s. With positive argument, switch to 132-column mode. With negative argument, switch to 80-column mode." - (interactive "P") - (setq vt100-wide-mode - (if (null arg) (not vt100-wide-mode) - (> (prefix-numeric-value arg) 0))) - (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l")) - (set-frame-width terminal-frame (if vt100-wide-mode 132 80))) + :global t :initial-value (= (frame-width) 132) + (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l")) + (set-frame-width terminal-frame (if vt100-wide-mode 132 80))) ;; arch-tag: 9ff41f24-a7c9-4dee-9cf2-fbaa951eb840 ;;; vt100.el ends here diff -r e56f669f17ce -r fe07c47cf7a7 lisp/textmodes/css-mode.el --- a/lisp/textmodes/css-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/textmodes/css-mode.el Thu May 13 15:13:52 2010 +0200 @@ -212,6 +212,8 @@ (defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)")) (defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)")) (defconst css-ident-re (concat css-nmstart-re css-nmchar-re "*")) +(defconst css-proprietary-nmstart-re ;; Vendor-specific properties. + "[-_]\\(?:ms\\|moz\\|o\\|webkit\\|khtml\\)-") (defconst css-name-re (concat css-nmchar-re "+")) (defface css-selector '((t :inherit font-lock-function-name-face)) @@ -220,6 +222,8 @@ (defface css-property '((t :inherit font-lock-variable-name-face)) "Face to use for properties." :group 'css) +(defface css-proprietary-property '((t :inherit (css-property italic))) + "Face to use for vendor-specific properties.") (defvar css-font-lock-keywords `(("!\\s-*important" . font-lock-builtin-face) @@ -251,8 +255,11 @@ ;; No face. nil))) ;; Properties. Again, we don't limit ourselves to css-property-ids. - (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" css-ident-re "\\)\\s-*:") - (1 'css-property)))) + (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" + "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|" + css-nmstart-re "\\)" css-nmchar-re "*" + "\\)\\s-*:") + (1 (if (match-end 2) 'css-proprietary-property 'css-property))))) (defvar css-font-lock-defaults '(css-font-lock-keywords nil t)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/textmodes/dns-mode.el --- a/lisp/textmodes/dns-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/textmodes/dns-mode.el Thu May 13 15:13:52 2010 +0200 @@ -151,6 +151,7 @@ (easy-menu-add dns-mode-menu dns-mode-map)) ;;;###autoload (defalias 'zone-mode 'dns-mode) +;;;###autoload (add-to-list 'auto-mode-alist (purecopy '("\\.zone\\'" . zone-mode))) ;; Tools. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/textmodes/ispell.el --- a/lisp/textmodes/ispell.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/textmodes/ispell.el Thu May 13 15:13:52 2010 +0200 @@ -1334,6 +1334,9 @@ (defvar ispell-process-directory nil "The directory where `ispell-process' was started.") +(defvar ispell-process-buffer-name nil + "The buffer where `ispell-process' was started.") + (defvar ispell-filter nil "Output filter from piped calls to Ispell.") @@ -2614,9 +2617,11 @@ "Check status of Ispell process and start if necessary." (if (and ispell-process (eq (ispell-process-status) 'run) - ;; If we're using a personal dictionary, ensure - ;; we're in the same default directory! - (or (not ispell-personal-dictionary) + ;; Unless we are using an explicit personal dictionary, + ;; ensure we're in the same default directory! + ;; Restart check for personal dictionary is done in + ;; `ispell-internal-change-dictionary', called from `ispell-buffer-local-dict' + (or (or ispell-local-pdict ispell-personal-dictionary) (equal ispell-process-directory default-directory))) (setq ispell-filter nil ispell-filter-continue nil) ;; may need to restart to select new personal dictionary. @@ -2628,7 +2633,8 @@ ispell-process-directory default-directory ispell-process (ispell-start-process) ispell-filter nil - ispell-filter-continue nil) + ispell-filter-continue nil + ispell-process-buffer-name (buffer-name)) (if ispell-async-processp (set-process-filter ispell-process 'ispell-filter)) ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs @@ -2689,10 +2695,16 @@ (kill-buffer ispell-session-buffer) (setq ispell-output-buffer nil ispell-session-buffer nil)) + (setq ispell-process-buffer-name nil) (setq ispell-process nil) (message "Ispell process killed") nil)) +;; Kill ispell process when killing its associated buffer +(add-hook 'kill-buffer-hook + '(lambda () + (if (equal ispell-process-buffer-name (buffer-name)) + (ispell-kill-ispell t)))) ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should ;;; call ispell-init-process rather than wait for a spell checking command? diff -r e56f669f17ce -r fe07c47cf7a7 lisp/textmodes/reftex.el --- a/lisp/textmodes/reftex.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/textmodes/reftex.el Thu May 13 15:13:52 2010 +0200 @@ -305,10 +305,6 @@ (defconst reftex-version "RefTeX version 4.31" "Version string for RefTeX.") -(defvar reftex-mode nil - "Determines if RefTeX mode is active.") -(make-variable-buffer-local 'reftex-mode) - (defvar reftex-mode-map (make-sparse-keymap) "Keymap for RefTeX mode.") @@ -504,8 +500,10 @@ "Turn on RefTeX mode." (reftex-mode t)) +(put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode))) +(put 'reftex-mode :menu-tag "RefTeX Mode") ;;;###autoload -(defun reftex-mode (&optional arg) +(define-minor-mode reftex-mode "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX. \\A Table of Contents of the entire (multifile) document with browsing @@ -535,11 +533,7 @@ on the menu bar. ------------------------------------------------------------------------------" - - (interactive "P") - (setq reftex-mode (not (or (and (null arg) reftex-mode) - (<= (prefix-numeric-value arg) 0)))) - + :lighter " Ref" :keymap reftex-mode-map (if reftex-mode (progn ;; Mode was turned on @@ -565,24 +559,10 @@ (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) - (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) - - (run-hooks 'reftex-mode-hook)) + (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib)) ;; Mode was turned off (easy-menu-remove reftex-mode-menu))) -(if (fboundp 'add-minor-mode) - ;; Use it so that we get the extras - (progn - (put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode))) - (put 'reftex-mode :menu-tag "RefTeX Mode") - (add-minor-mode 'reftex-mode " Ref" reftex-mode-map)) - ;; The standard way - (unless (assoc 'reftex-mode minor-mode-alist) - (push '(reftex-mode " Ref") minor-mode-alist)) - (unless (assoc 'reftex-mode minor-mode-map-alist) - (push (cons 'reftex-mode reftex-mode-map) minor-mode-map-alist))) - (defvar reftex-docstruct-symbol) (defun reftex-kill-buffer-hook () "Save RefTeX's parse file for this buffer if the information has changed." @@ -625,11 +605,11 @@ ;;; ;;; Multibuffer Variables ;;; -;;; Technical notes: These work as follows: We keep just one list -;;; of labels for each master file - this can save a lot of memory. -;;; `reftex-master-index-list' is an alist which connects the true file name -;;; of each master file with the symbols holding the information on that -;;; document. Each buffer has local variables which point to these symbols. +;; Technical notes: These work as follows: We keep just one list +;; of labels for each master file - this can save a lot of memory. +;; `reftex-master-index-list' is an alist which connects the true file name +;; of each master file with the symbols holding the information on that +;; document. Each buffer has local variables which point to these symbols. ;; List of variables which handle the multifile stuff. ;; This list is used to tie, untie, and reset these symbols. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/textmodes/tex-mode.el --- a/lisp/textmodes/tex-mode.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/textmodes/tex-mode.el Thu May 13 15:13:52 2010 +0200 @@ -1060,7 +1060,7 @@ "\\>\\|\\\\[a-z]*" (regexp-opt '("space" "skip" "page") t) "\\>\\)")) (setq paragraph-separate - (concat "[\f]\\|[ \t]*\\($\\|" + (concat "[\f%]\\|[ \t]*\\($\\|" "\\\\[][]\\|" "\\\\" (regexp-opt (append (mapcar 'car latex-section-alist) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/tmm.el --- a/lisp/tmm.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/tmm.el Thu May 13 15:13:52 2010 +0200 @@ -262,9 +262,6 @@ (condition-case nil (require 'mouse) (error nil)) - (condition-case nil - (x-popup-menu nil choice) ; Get the shortcuts - (error nil)) (tmm-prompt choice)) ;; We just handled a menu keymap and found a command. (choice @@ -445,7 +442,7 @@ `x-popup-menu' argument (when IN-X-MENU is not-nil). This function adds the element only if it is not already present. It uses the free variable `tmm-table-undef' to keep undefined keys." - (let (km str cache plist filter visible enable (event (car elt))) + (let (km str plist filter visible enable (event (car elt))) (setq elt (cdr elt)) (if (eq elt 'undefined) (setq tmm-table-undef (cons (cons event nil) tmm-table-undef)) @@ -468,11 +465,7 @@ (and (symbolp (cdr-safe (cdr-safe elt))) (fboundp (cdr-safe (cdr-safe elt))))) (setq km (cddr elt)) - (and (stringp (car elt)) (setq str (car elt))) - (and str - (stringp (cdr-safe (cadr elt))) ; keyseq cache - (setq cache (cdr (cadr elt))) - cache (setq str (concat str cache)))) + (and (stringp (car elt)) (setq str (car elt)))) ((eq (car-safe elt) 'menu-item) ;; (menu-item TITLE COMMAND KEY ...) @@ -489,13 +482,7 @@ (setq km (and (eval visible) km))) (setq enable (plist-get plist :enable)) (if enable - (setq km (if (eval enable) km 'ignore))) - (and str - (consp (nth 3 elt)) - (stringp (cdr (nth 3 elt))) ; keyseq cache - (setq cache (cdr (nth 3 elt))) - cache - (setq str (concat str cache)))) + (setq km (if (eval enable) km 'ignore)))) ((if (listp (cdr-safe (cdr-safe (cdr-safe elt)))) (or (keymapp (cdr-safe (cdr-safe (cdr-safe elt)))) @@ -504,16 +491,25 @@ (fboundp (cdr-safe (cdr-safe (cdr-safe elt)))))) ; New style of easy-menu (setq km (cdr (cddr elt))) - (and (stringp (car elt)) (setq str (car elt))) - (and str - (stringp (cdr-safe (car (cddr elt)))) ; keyseq cache - (setq cache (cdr (car (cdr (cdr elt))))) - cache (setq str (concat str cache)))) + (and (stringp (car elt)) (setq str (car elt)))) ((stringp event) ; x-popup or x-popup element (if (or in-x-menu (stringp (car-safe elt))) (setq str event event nil km elt) - (setq str event event nil km (cons 'keymap elt)))))) + (setq str event event nil km (cons 'keymap elt))))) + (unless (eq km 'ignore) + (let ((binding (where-is-internal km nil t))) + (when binding + (setq binding (key-description binding)) + ;; Try to align the keybindings. + (let ((colwidth (min 30 (- (/ (window-width) 2) 10)))) + (setq str + (concat str + (make-string (max 2 (- colwidth + (string-width str) + (string-width binding))) + ?\s) + binding))))))) (and km (stringp km) (setq str km)) ;; Verify that the command is enabled; ;; if not, don't mention it. diff -r e56f669f17ce -r fe07c47cf7a7 lisp/tool-bar.el --- a/lisp/tool-bar.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/tool-bar.el Thu May 13 15:13:52 2010 +0200 @@ -232,6 +232,7 @@ submap key) ;; We'll pick up the last valid entry in the list of keys if ;; there's more than one. + ;; FIXME: Aren't they *all* "valid"?? --Stef (dolist (k keys) ;; We're looking for a binding of the command in a submap of ;; the menu bar map, so the key sequence must be two or more @@ -267,7 +268,7 @@ ;; People say it's bad to have EXIT on the tool bar, since users ;; might inadvertently click that button. ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit") - (tool-bar-add-item-from-menu 'find-file "new") + (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File") (tool-bar-add-item-from-menu 'menu-find-file-existing "open") (tool-bar-add-item-from-menu 'dired "diropen") (tool-bar-add-item-from-menu 'kill-this-buffer "close") @@ -294,14 +295,15 @@ "paste" nil :visible '(not (eq 'special (get major-mode 'mode-class)))) - (tool-bar-add-item-from-menu 'nonincremental-search-forward "search") + (tool-bar-add-item-from-menu 'nonincremental-search-forward "search" + nil :label "Search") ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell") ;; There's no icon appropriate for News and we need a command rather ;; than a lambda for Read Mail. ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose") - (tool-bar-add-item-from-menu 'print-buffer "print") + (tool-bar-add-item-from-menu 'print-buffer "print" nil :label "Print") ;; tool-bar-add-item-from-menu itself operates on ;; (default-value 'tool-bar-map), but when we don't use that function, diff -r e56f669f17ce -r fe07c47cf7a7 lisp/type-break.el --- a/lisp/type-break.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/type-break.el Thu May 13 15:13:52 2010 +0200 @@ -152,13 +152,6 @@ :type 'sexp :group 'type-break) -(defcustom type-break-query-mode t - "Non-nil means ask whether or not to prompt user for breaks. -If so, call the function specified in the value of the variable -`type-break-query-function' to do the asking." - :type 'boolean - :group 'type-break) - (defcustom type-break-query-function 'yes-or-no-p "Function to use for making query for a typing break. It should take a string as an argument, the prompt. @@ -245,14 +238,6 @@ ;; Mode line frobs -(defcustom type-break-mode-line-message-mode nil - "Non-nil means put type-break related messages in the mode line. -Otherwise, messages typically go in the echo area. - -See also `type-break-mode-line-format' and its members." - :type 'boolean - :group 'type-break) - (defvar type-break-mode-line-format '(type-break-mode-line-message-mode ("" @@ -447,7 +432,7 @@ (message "Type Break mode is disabled"))))) type-break-mode) -(defun type-break-mode-line-message-mode (&optional prefix) +(define-minor-mode type-break-mode-line-message-mode "Enable or disable warnings in the mode line about typing breaks. A negative PREFIX argument disables this mode. @@ -462,16 +447,9 @@ `global-mode-string' `type-break-mode-line-break-message' `type-break-mode-line-warning'" - (interactive "P") - (setq type-break-mode-line-message-mode - (>= (prefix-numeric-value prefix) 0)) - (and (called-interactively-p 'interactive) - (if type-break-mode-line-message-mode - (message "type-break-mode-line-message-mode is enabled") - (message "type-break-mode-line-message-mode is disabled"))) - type-break-mode-line-message-mode) + :global t) -(defun type-break-query-mode (&optional prefix) +(define-minor-mode type-break-query-mode "Enable or disable warnings in the mode line about typing breaks. When enabled, the user is periodically queried about whether to take a @@ -483,14 +461,7 @@ The user may also enable or disable this mode simply by setting the variable of the same name." - (interactive "P") - (setq type-break-query-mode - (>= (prefix-numeric-value prefix) 0)) - (and (called-interactively-p 'interactive) - (if type-break-query-mode - (message "type-break-query-mode is enabled") - (message "type-break-query-mode is disabled"))) - type-break-query-mode) + :global t) ;;; session file functions diff -r e56f669f17ce -r fe07c47cf7a7 lisp/url/ChangeLog --- a/lisp/url/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lisp/url/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,11 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-03 Stefan Monnier + + * url-dired.el (url-dired-minor-mode): Use define-minor-mode. + 2010-03-24 Teodor Zlatanov * url-http.el (url-http-parse-headers): Fix wrong variable name. @@ -58,8 +66,8 @@ 2009-09-12 Chong Yidong * url-methods.el (url-scheme--registering-proxy): New variable. - (url-scheme-register-proxy, url-scheme-get-property): Avoid - calling url-scheme-register-proxy in an infloop (Bug#4191). + (url-scheme-register-proxy, url-scheme-get-property): + Avoid calling url-scheme-register-proxy in an infloop (Bug#4191). 2009-08-22 Glenn Morris diff -r e56f669f17ce -r fe07c47cf7a7 lisp/url/url-dired.el --- a/lisp/url/url-dired.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/url/url-dired.el Thu May 13 15:13:52 2010 +0200 @@ -31,11 +31,6 @@ map) "Keymap used when browsing directories.") -(defvar url-dired-minor-mode nil - "Whether we are in url-dired-minor-mode.") - -(make-variable-buffer-local 'url-dired-minor-mode) - (defun url-dired-find-file () "In dired, visit the file or directory named on this line." (interactive) @@ -48,39 +43,9 @@ (mouse-set-point event) (url-dired-find-file)) -(defun url-dired-minor-mode (&optional arg) +(define-minor-mode url-dired-minor-mode "Minor mode for directory browsing." - (interactive "P") - (cond - ((null arg) - (setq url-dired-minor-mode (not url-dired-minor-mode))) - ((equal 0 arg) - (setq url-dired-minor-mode nil)) - (t - (setq url-dired-minor-mode t)))) - -(if (not (fboundp 'add-minor-mode)) - (defun add-minor-mode (toggle name &optional keymap after toggle-fun) - "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'. -TOGGLE is a symbol which is used as the variable which toggle the minor mode, -NAME is the name that should appear in the modeline (it should be a string -beginning with a space), KEYMAP is a keymap to make active when the minor -mode is active, and AFTER is the toggling symbol used for another minor -mode. If AFTER is non-nil, then it is used to position the new mode in the -minor-mode alists. TOGGLE-FUN specifies an interactive function that -is called to toggle the mode on and off; this affects what appens when -button2 is pressed on the mode, and when button3 is pressed somewhere -in the list of modes. If TOGGLE-FUN is nil and TOGGLE names an -interactive function, TOGGLE is used as the toggle function. - -Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)" - (if (not (assq toggle minor-mode-alist)) - (setq minor-mode-alist (cons (list toggle name) minor-mode-alist))) - (if (and keymap (not (assq toggle minor-mode-map-alist))) - (setq minor-mode-map-alist (cons (cons toggle keymap) - minor-mode-map-alist))))) - -(add-minor-mode 'url-dired-minor-mode " URL" url-dired-minor-mode-map) + :lighter " URL" :keymap url-dired-minor-mode-map) (defun url-find-file-dired (dir) "\"Edit\" directory DIR, but with additional URL-friendly bindings." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc-bzr.el --- a/lisp/vc-bzr.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc-bzr.el Thu May 13 15:13:52 2010 +0200 @@ -451,11 +451,16 @@ "Unregister FILE from bzr." (vc-bzr-command "remove" nil 0 file "--keep")) -(defun vc-bzr-checkin (files rev comment &optional extra-args) +(declare-function log-edit-extract-headers "log-edit" (headers string)) + +(defun vc-bzr-checkin (files rev comment) "Check FILE in to bzr with log message COMMENT. REV non-nil gets an error." (if rev (error "Can't check in a specific revision with bzr")) - (apply 'vc-bzr-command "commit" nil 0 files (append (list "-m" comment) extra-args))) + (apply 'vc-bzr-command "commit" nil 0 + files (cons "-m" (log-edit-extract-headers '(("Author" . "--author") + ("Fixes" . "--fixes")) + comment)))) (defun vc-bzr-find-revision (file rev buffer) "Fetch revision REV of file FILE and put it into BUFFER." @@ -552,23 +557,6 @@ (goto-char (point-min))) found))) -(declare-function log-edit-mode "log-edit" ()) -(defvar log-edit-extra-flags) -(defvar log-edit-before-checkin-process) - -(define-derived-mode vc-bzr-log-edit-mode log-edit-mode "Bzr-Log-Edit" - "Mode for editing Bzr commit logs. -If a line like: -Author: NAME -is present in the log, it is removed, and ---author NAME -is passed to the bzr commit command. Similarly with Fixes: and --fixes." - (set (make-local-variable 'log-edit-extra-flags) nil) - (set (make-local-variable 'log-edit-before-checkin-process) - '(("^\\(Author\\|Fixes\\):[ \t]+\\(.*\\)[ \t]*$" . - (list (format "--%s" (downcase (match-string 1))) - (match-string 2)))))) - (defun vc-bzr-diff (files &optional rev1 rev2 buffer) "VC bzr backend for diff." ;; `bzr diff' exits with code 1 if diff is non-empty. @@ -899,10 +887,10 @@ (defun vc-bzr-shelve-show (name) "Show the contents of shelve NAME." (interactive "sShelve name: ") - (vc-setup-buffer "*vc-bzr-shelve*") + (vc-setup-buffer "*vc-diff*") ;; FIXME: how can you show the contents of a shelf? - (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 'async nil "--preview" name) - (set-buffer "*vc-bzr-shelve*") + (vc-bzr-command "unshelve" "*vc-diff*" 'async nil "--preview" name) + (set-buffer "*vc-diff*") (diff-mode) (setq buffer-read-only t) (pop-to-buffer (current-buffer))) @@ -910,13 +898,13 @@ (defun vc-bzr-shelve-apply (name) "Apply shelve NAME and remove it afterwards." (interactive "sApply (and remove) shelf: ") - (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name) + (vc-bzr-command "unshelve" nil 0 nil "--apply" name) (vc-resynch-buffer (vc-bzr-root default-directory) t t)) (defun vc-bzr-shelve-apply-and-keep (name) "Apply shelve NAME and keep it afterwards." (interactive "sApply (and keep) shelf: ") - (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep" name) + (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep" name) (vc-resynch-buffer (vc-bzr-root default-directory) t t)) (defun vc-bzr-shelve-snapshot () @@ -927,7 +915,7 @@ (concat (format-time-string "Snapshot on %Y-%m-%d" ct) (format-time-string " at %H:%M" ct)))) - (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep") + (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep") (vc-resynch-buffer (vc-bzr-root default-directory) t t)) (defun vc-bzr-shelve-list () @@ -983,6 +971,19 @@ (setq loglines (buffer-substring-no-properties start (point-max)))))) vc-bzr-revisions)) +(defun vc-bzr-conflicted-files (dir) + (let ((default-directory (vc-bzr-root dir)) + (files ())) + (with-temp-buffer + (vc-bzr-command "status" t 0 default-directory) + (goto-char (point-min)) + (when (re-search-forward "^conflicts:\n" nil t) + (while (looking-at " \\(?:Text conflict in \\(.*\\)\\|.*\\)\n") + (if (match-end 1) + (push (expand-file-name (match-string 1)) files)) + (goto-char (match-end 0))))) + files)) + ;;; Revision completion (eval-and-compile diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc-dir.el --- a/lisp/vc-dir.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc-dir.el Thu May 13 15:13:52 2010 +0200 @@ -301,7 +301,8 @@ map vc-dir-mode-map) (tool-bar-local-item "bookmark_add" 'vc-dir-toggle-mark 'vc-dir-toggle-mark map - :help "Toggle mark on current item") + :help "Toggle mark on current item" + :label "Toggle Mark") (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow" map vc-dir-mode-map :rtl "right-arrow") @@ -313,11 +314,14 @@ (tool-bar-local-item-from-menu 'revert-buffer "refresh" map vc-dir-mode-map) (tool-bar-local-item-from-menu 'nonincremental-search-forward - "search" map) + "search" map nil + :label "Search") (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp - "search-replace" map vc-dir-mode-map) + "search-replace" map vc-dir-mode-map + :label "Replace") (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel" - map vc-dir-mode-map) + map vc-dir-mode-map + :label "Cancel") (tool-bar-local-item-from-menu 'quit-window "exit" map vc-dir-mode-map) map)) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc-dispatcher.el --- a/lisp/vc-dispatcher.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc-dispatcher.el Thu May 13 15:13:52 2010 +0200 @@ -141,7 +141,6 @@ (defvar vc-log-operation nil) (defvar vc-log-after-operation-hook nil) (defvar vc-log-fileset) -(defvar vc-log-extra) ;; In a log entry buffer, this is a local variable ;; that points to the buffer for which it was made @@ -521,17 +520,20 @@ (with-current-buffer vc-parent-buffer default-directory)) (log-edit 'vc-finish-logentry nil - `((log-edit-listfun . (lambda () ',fileset)) + `((log-edit-listfun . (lambda () + ;; FIXME: Should expand the list + ;; for directories. + (mapcar 'file-relative-name + ',fileset))) (log-edit-diff-function . (lambda () (vc-diff nil)))) nil mode) (set (make-local-variable 'vc-log-fileset) fileset) - (make-local-variable 'vc-log-extra) (set-buffer-modified-p nil) (setq buffer-file-name nil)) -(defun vc-start-logentry (files extra comment initial-contents msg logbuf mode action &optional after-hook) - "Accept a comment for an operation on FILES with extra data EXTRA. +(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook) + "Accept a comment for an operation on FILES. If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the action on close to ACTION. If COMMENT is a string and INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial @@ -561,7 +563,6 @@ (when after-hook (setq vc-log-after-operation-hook after-hook)) (setq vc-log-operation action) - (setq vc-log-extra extra) (when comment (erase-buffer) (when (stringp comment) (insert comment))) @@ -570,10 +571,8 @@ (vc-finish-logentry (eq comment t))))) (declare-function vc-dir-move-to-goal-column "vc-dir" ()) -;; vc-finish-logentry is called from a log-edit buffer (see above). -(declare-function log-view-process-buffer "log-edit" ()) -(defvar log-edit-extra-flags) - +;; vc-finish-logentry is typically called from a log-edit buffer (see +;; vc-start-logentry). (defun vc-finish-logentry (&optional nocomment) "Complete the operation implied by the current log entry. Use the contents of the current buffer as a check-in or registration @@ -590,26 +589,21 @@ (unless vc-log-operation (error "No log operation is pending")) - (log-view-process-buffer) - ;; save the parameters held in buffer-local variables (let ((logbuf (current-buffer)) (log-operation vc-log-operation) + ;; FIXME: When coming from VC-Dir, we should check that the + ;; set of selected files is still equal to vc-log-fileset, + ;; to avoid surprises. (log-fileset vc-log-fileset) - (log-extra vc-log-extra) (log-entry (buffer-string)) - (extra-flags log-edit-extra-flags) - (after-hook vc-log-after-operation-hook) - (tmp-vc-parent-buffer vc-parent-buffer)) + (after-hook vc-log-after-operation-hook)) (pop-to-buffer vc-parent-buffer) ;; OK, do it to it (save-excursion (funcall log-operation log-fileset - log-extra - log-entry - extra-flags - )) + log-entry)) ;; Remove checkin window (after the checkin so that if that fails ;; we don't zap the log buffer and the typing therein). ;; -- IMO this should be replaced with quit-window @@ -617,9 +611,11 @@ (delete-windows-on logbuf (selected-frame)) ;; Kill buffer and delete any other dedicated windows/frames. (kill-buffer logbuf)) - (logbuf (pop-to-buffer logbuf) - (bury-buffer) - (pop-to-buffer tmp-vc-parent-buffer))) + (logbuf + (with-selected-window (or (get-buffer-window logbuf 0) + (selected-window)) + (with-current-buffer logbuf + (bury-buffer))))) ;; Now make sure we see the expanded headers (when log-fileset (mapc diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc-git.el --- a/lisp/vc-git.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc-git.el Thu May 13 15:13:52 2010 +0200 @@ -118,7 +118,7 @@ :version "23.1" :group 'vc) -(defvar git-commits-coding-system 'utf-8 +(defvar vc-git-commits-coding-system 'utf-8 "Default coding system for git commits.") ;;; BACKEND PROPERTIES @@ -420,6 +420,7 @@ (vc-git-command (current-buffer) 'async files "ls-files" "-z" "-o" "-i" "--directory" "--no-empty-directory" "--exclude-standard" "--")) + ;; --relative added in Git 1.5.5. (diff-index (vc-git-command (current-buffer) 'async files "diff-index" "--relative" "-z" "-M" "HEAD" "--"))) @@ -547,11 +548,15 @@ (defun vc-git-unregister (file) (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) +(declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-git-checkin (files rev comment &optional extra-args) - (let ((coding-system-for-write git-commits-coding-system)) +(defun vc-git-checkin (files rev comment) + (let ((coding-system-for-write vc-git-commits-coding-system)) (apply 'vc-git-command nil 0 files - (nconc (list "commit" "-m" comment) extra-args (list "--only" "--"))))) + (nconc (list "commit" "-m") + (log-edit-extract-headers '(("Author" . "--author")) + comment) + (list "--only" "--"))))) (defun vc-git-find-revision (file rev buffer) (let* (process-file-side-effects @@ -578,8 +583,10 @@ ;;; HISTORY FUNCTIONS (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) - "Get change log associated with FILES." - (let ((coding-system-for-read git-commits-coding-system)) + "Get change log associated with FILES. +Note that using SHORTLOG requires at least Git version 1.5.6, +for the --graph option." + (let ((coding-system-for-read vc-git-commits-coding-system)) ;; `vc-do-command' creates the buffer, but we need it before running ;; the command. (vc-setup-buffer buffer) @@ -790,21 +797,6 @@ (progn (forward-line 1) (1- (point))))))))) (or (vc-git-symbolic-commit next-rev) next-rev))) -(declare-function log-edit-mode "log-edit" ()) -(defvar log-edit-extra-flags) -(defvar log-edit-before-checkin-process) - -(define-derived-mode vc-git-log-edit-mode log-edit-mode "Git-log-edit" - "Mode for editing Git commit logs. -If a line like: -Author: NAME -is present in the log, it is removed, and ---author=NAME -is passed to the git commit command." - (set (make-local-variable 'log-edit-extra-flags) nil) - (set (make-local-variable 'log-edit-before-checkin-process) - '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--author" (match-string 1)))))) - (defun vc-git-delete-file (file) (vc-git-command nil 0 file "rm" "-f" "--")) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc-hg.el --- a/lisp/vc-hg.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc-hg.el Thu May 13 15:13:52 2010 +0200 @@ -168,12 +168,13 @@ (condition-case nil ;; Ignore all errors. (let ((process-environment - ;; Avoid localization of messages so we can parse the output. - (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") process-environment))) - - (process-file - "hg" nil t nil - "status" "-A" (file-relative-name file))) + ;; Avoid localization of messages so we + ;; can parse the output. + (append (list "TERM=dumb" "LANGUAGE=C" "HGRCPATH=") + process-environment))) + (process-file + "hg" nil t nil + "status" "-A" (file-relative-name file))) ;; Some problem happened. E.g. We can't find an `hg' ;; executable. (error nil))))))) @@ -196,24 +197,40 @@ (let* ((status nil) (default-directory (file-name-directory file)) + ;; Avoid localization of messages so we can parse the output. + (avoid-local-env (append (list "TERM=dumb" "LANGUAGE=C" "HGRCPATH=") + process-environment)) (out (with-output-to-string (with-current-buffer standard-output (setq status (condition-case nil - (let ((process-environment - ;; Avoid localization of messages so we can parse the output. - (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") - process-environment))) + (let ((process-environment avoid-local-env)) ;; Ignore all errors. (process-file "hg" nil t nil - "parent" "--template" "{rev}" (file-relative-name file))) + "parents" "--template" "{rev}" (file-relative-name file))) ;; Some problem happened. E.g. We can't find an `hg' ;; executable. (error nil))))))) - (when (eq 0 status) out))) + (if (eq 0 status) + out + ;; Check if the file is in the 'added state, the above hg + ;; command does not distinguish between 'added and 'unregistered. + (setq status + (condition-case nil + (let ((process-environment avoid-local-env)) + (process-file + "hg" nil nil nil + ;; We use "log" here, if there's a faster command + ;; that returns true for an 'added file and false + ;; for an 'unregistered one, we could use that. + "log" "-l1" (file-relative-name file))) + ;; Some problem happened. E.g. We can't find an `hg' + ;; executable. + (error nil))) + (when (eq 0 status) "0")))) ;;; History functions @@ -280,20 +297,7 @@ ("^tag: +\\([^ ]+\\)$" (1 'highlight)) ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) -(declare-function log-edit-mode "log-edit" ()) -(defvar log-edit-extra-flags) -(defvar log-edit-before-checkin-process) - -(define-derived-mode vc-hg-log-edit-mode log-edit-mode "Hg-log-edit" - "Mode for editing Hg commit logs. -If a line like: -Author: NAME -is present in the log, it is removed, and ---author NAME -is passed to the hg commit command." - (set (make-local-variable 'log-edit-extra-flags) nil) - (set (make-local-variable 'log-edit-before-checkin-process) - '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--user" (match-string 1)))))) +(declare-function log-edit-extract-headers "log-edit" (headers string)) (defun vc-hg-diff (files &optional oldvers newvers buffer) "Get a difference report using hg between two revisions of FILES." @@ -356,7 +360,8 @@ (if (match-beginning 3) (match-string-no-properties 1) (cons (match-string-no-properties 1) - (expand-file-name (match-string-no-properties 4))))))) + (expand-file-name (match-string-no-properties 4) + (vc-hg-root default-directory))))))) (defun vc-hg-previous-revision (file rev) (let ((newrev (1- (string-to-number rev)))) @@ -417,11 +422,15 @@ ;; "Unregister FILE from hg." ;; (vc-hg-command nil nil file "remove")) -(defun vc-hg-checkin (files rev comment &optional extra-args) +(declare-function log-edit-extract-headers "log-edit" (headers string)) + +(defun vc-hg-checkin (files rev comment) "Hg-specific version of `vc-backend-checkin'. REV is ignored." (apply 'vc-hg-command nil 0 files - (nconc (list "commit" "-m" comment) extra-args))) + (nconc (list "commit" "-m") + (log-edit-extract-headers '(("Author" . "--user")) + comment)))) (defun vc-hg-find-revision (file rev buffer) (let ((coding-system-for-read 'binary) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/vc.el --- a/lisp/vc.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/vc.el Thu May 13 15:13:52 2010 +0200 @@ -268,15 +268,12 @@ ;; Unregister FILE from this backend. This is only needed if this ;; backend may be used as a "more local" backend for temporary editing. ;; -;; * checkin (files rev comment &optional extra-args) +;; * checkin (files rev comment) ;; -;; Commit changes in FILES to this backend. If REV is non-nil, that -;; should become the new revision number (not all backends do -;; anything with it). COMMENT is used as a check-in comment. The -;; implementation should pass the value of vc-checkin-switches to -;; the backend command. (Note: in older versions of VC, this -;; command took a single file argument and not a list.) -;; EXTRA-ARGS should be passed to the backend command. +;; Commit changes in FILES to this backend. REV is a historical artifact +;; and should be ignored. COMMENT is used as a check-in comment. +;; The implementation should pass the value of vc-checkin-switches to +;; the backend command. ;; ;; * find-revision (file rev buffer) ;; @@ -548,6 +545,12 @@ ;; makes it possible to provide menu entries for functionality that ;; is specific to a backend and which does not map to any of the VC ;; generic concepts. +;; +;; - conflicted-files (dir) +;; +;; Return the list of files where conflict resolution is needed in +;; the project that contains DIR. +;; FIXME: what should it do with non-text conflicts? ;;; Todo: @@ -1054,8 +1057,7 @@ (state (nth 3 vc-fileset)) ;; The backend should check that the checkout-model is consistent ;; among all the `files'. - (model (nth 4 vc-fileset)) - revision) + (model (nth 4 vc-fileset))) ;; Do the right thing (cond @@ -1070,11 +1072,13 @@ (cond (verbose ;; go to a different revision - (setq revision (read-string "Branch, revision, or backend to move to: ")) - (let ((revision-downcase (downcase revision))) + (let* ((revision + (read-string "Branch, revision, or backend to move to: ")) + (revision-downcase (downcase revision))) (if (member revision-downcase - (mapcar (lambda (arg) (downcase (symbol-name arg))) vc-handled-backends)) + (mapcar (lambda (arg) (downcase (symbol-name arg))) + vc-handled-backends)) (let ((vsym (intern-soft revision-downcase))) (dolist (file files) (vc-transfer-file file vsym))) (dolist (file files) @@ -1119,8 +1123,8 @@ (message "No files remain to be committed") (if (not verbose) (vc-checkin ready-for-commit backend) - (setq revision (read-string "New revision or backend: ")) - (let ((revision-downcase (downcase revision))) + (let* ((revision (read-string "New revision or backend: ")) + (revision-downcase (downcase revision))) (if (member revision-downcase (mapcar (lambda (arg) (downcase (symbol-name arg))) @@ -1365,7 +1369,7 @@ (defun vc-checkin (files backend &optional rev comment initial-contents) "Check in FILES. The optional argument REV may be a string specifying the new revision -level (if nil increment the current level). COMMENT is a comment +level (strongly deprecated). COMMENT is a comment string; if omitted, a buffer is popped up to accept a comment. If INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents of the log entry buffer. @@ -1379,28 +1383,30 @@ (lexical-let ((backend backend)) (vc-start-logentry - files rev comment initial-contents + files comment initial-contents "Enter a change comment." "*VC-log*" (lambda () (vc-call-backend backend 'log-edit-mode)) - (lambda (files rev comment extra-flags) - (message "Checking in %s..." (vc-delistify files)) - ;; "This log message intentionally left almost blank". - ;; RCS 5.7 gripes about white-space-only comments too. - (or (and comment (string-match "[^\t\n ]" comment)) - (setq comment "*** empty log message ***")) - (with-vc-properties - files - ;; We used to change buffers to get local value of vc-checkin-switches, - ;; but 'the' local buffer is not a well-defined concept for filesets. - (progn - (vc-call-backend backend 'checkin files rev comment extra-flags) - (mapc 'vc-delete-automatic-version-backups files)) - `((vc-state . up-to-date) - (vc-checkout-time . ,(nth 5 (file-attributes file))) - (vc-working-revision . nil))) - (message "Checking in %s...done" (vc-delistify files))) + (lexical-let ((rev rev)) + (lambda (files comment) + (message "Checking in %s..." (vc-delistify files)) + ;; "This log message intentionally left almost blank". + ;; RCS 5.7 gripes about white-space-only comments too. + (or (and comment (string-match "[^\t\n ]" comment)) + (setq comment "*** empty log message ***")) + (with-vc-properties + files + ;; We used to change buffers to get local value of + ;; vc-checkin-switches, but 'the' local buffer is + ;; not a well-defined concept for filesets. + (progn + (vc-call-backend backend 'checkin files rev comment) + (mapc 'vc-delete-automatic-version-backups files)) + `((vc-state . up-to-date) + (vc-checkout-time . ,(nth 5 (file-attributes file))) + (vc-working-revision . nil))) + (message "Checking in %s...done" (vc-delistify files)))) 'vc-checkin-hook))) ;;; Additional entry points for examining version histories @@ -1772,13 +1778,14 @@ ;; case the more general operation ever becomes meaningful. (let ((backend (vc-responsible-backend (car files)))) (vc-start-logentry - files rev oldcomment t + files oldcomment t "Enter a replacement change comment." "*VC-log*" (lambda () (vc-call-backend backend 'log-edit-mode)) - (lambda (files rev comment ignored) - (vc-call-backend backend - 'modify-change-comment files rev comment))))) + (lexical-let ((rev rev)) + (lambda (files comment) + (vc-call-backend backend + 'modify-change-comment files rev comment)))))) ;;;###autoload (defun vc-merge () @@ -1839,6 +1846,31 @@ ;;;###autoload (defalias 'vc-resolve-conflicts 'smerge-ediff) +;; TODO: This is OK but maybe we could integrate it better. +;; E.g. it could be run semi-automatically (via a prompt?) when saving a file +;; that was conflicted (i.e. upon mark-resolved). +;; FIXME: should we add an "other-window" version? Or maybe we should +;; hook it inside find-file so it automatically works for +;; find-file-other-window as well. E.g. find-file could use a new +;; `default-next-file' variable for its default file (M-n), and +;; we could then set it upon mark-resolve, so C-x C-s C-x C-f M-n would +;; automatically offer the next conflicted file. +(defun vc-find-conflicted-file () + "Visit the next conflicted file in the current project." + (interactive) + (let* ((backend (or (if buffer-file-name (vc-backend buffer-file-name)) + (vc-responsible-backend default-directory) + (error "No VC backend"))) + (files (vc-call-backend backend + 'conflicted-files default-directory))) + ;; Don't try and visit the current file. + (if (equal (car files) buffer-file-name) (pop files)) + (if (null files) + (message "No more conflicted files") + (find-file (pop files)) + (message "%s more conflicted files after this one" + (if files (length files) "No"))))) + ;; Named-configuration entry points (defun vc-tag-precondition (dir) diff -r e56f669f17ce -r fe07c47cf7a7 lisp/view.el --- a/lisp/view.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/view.el Thu May 13 15:13:52 2010 +0200 @@ -161,14 +161,6 @@ "Overlay used to display where a search operation found its match. This is local in each buffer, once it is used.") (make-variable-buffer-local 'view-overlay) - -(unless (assq 'view-mode minor-mode-alist) - (setq minor-mode-alist - (cons (list 'view-mode - (propertize " View" - 'local-map mode-line-minor-mode-keymap - 'help-echo "mouse-3: minor mode menu")) - minor-mode-alist))) ;; Define keymap inside defvar to make it easier to load changes. ;; Some redundant "less"-like key bindings below have been commented out. @@ -230,10 +222,6 @@ (define-key map "?" 'describe-mode) ; Maybe do as less instead? See above. (define-key map "h" 'describe-mode) map)) - -(or (assq 'view-mode minor-mode-map-alist) - (setq minor-mode-map-alist - (cons (cons 'view-mode view-mode-map) minor-mode-map-alist))) ;;; Commands that enter or exit view mode. @@ -262,13 +250,7 @@ (unless (file-exists-p file) (error "%s does not exist" file)) (let ((had-a-buf (get-file-buffer file)) (buffer (find-file-noselect file))) - (if (eq (with-current-buffer buffer - (get major-mode 'mode-class)) - 'special) - (progn - (switch-to-buffer buffer) - (message "Not using View mode because the major mode is special")) - (view-buffer buffer (and (not had-a-buf) 'kill-buffer-if-not-modified))))) + (view-buffer buffer (and (not had-a-buf) 'kill-buffer-if-not-modified)))) ;;;###autoload (defun view-file-other-window (file) @@ -334,10 +316,16 @@ Exiting View mode will then discard the user's edits. Setting EXIT-ACTION to `kill-buffer-if-not-modified' avoids this." (interactive "bView buffer: ") - (let ((undo-window (list (window-buffer) (window-start) (window-point)))) - (switch-to-buffer buffer) - (view-mode-enter (cons (selected-window) (cons nil undo-window)) - exit-action))) + (if (eq (with-current-buffer buffer + (get major-mode 'mode-class)) + 'special) + (progn + (switch-to-buffer buffer) + (message "Not using View mode because the major mode is special")) + (let ((undo-window (list (window-buffer) (window-start) (window-point)))) + (switch-to-buffer buffer) + (view-mode-enter (cons (selected-window) (cons nil undo-window)) + exit-action)))) ;;;###autoload (defun view-buffer-other-window (buffer &optional not-return exit-action) @@ -393,7 +381,7 @@ exit-action))) ;;;###autoload -(defun view-mode (&optional arg) +(define-minor-mode view-mode ;; In the following documentation string we have to use some explicit key ;; bindings instead of using the \\[] construction. The reason for this ;; is that most commands have more than one key binding. @@ -473,11 +461,8 @@ then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to that buffer. Entry to view-mode runs the normal hook `view-mode-hook'." - (interactive "P") - (unless (and arg ; Do nothing if already OK. - (if (> (prefix-numeric-value arg) 0) view-mode (not view-mode))) - (if view-mode (view-mode-disable) - (view-mode-enable)))) + :lighter " View" :keymap view-mode-map + (if view-mode (view-mode-enable) (view-mode-disable))) (defun view-mode-enable () "Turn on View mode." diff -r e56f669f17ce -r fe07c47cf7a7 lisp/window.el --- a/lisp/window.el Wed May 12 14:32:06 2010 +0200 +++ b/lisp/window.el Thu May 13 15:13:52 2010 +0200 @@ -1617,6 +1617,7 @@ (kill-buffer buffer) (bury-buffer buffer)))) + (defvar recenter-last-op nil "Indicates the last recenter operation performed. Possible values: `top', `middle', `bottom', integer or float numbers.") @@ -1709,6 +1710,154 @@ (define-key global-map [?\M-r] 'move-to-window-line-top-bottom) +;;; Scrolling commands. + +;;; Scrolling commands which does not signal errors at top/bottom +;;; of buffer at first key-press (instead moves to top/bottom +;;; of buffer). + +(defcustom scroll-error-top-bottom nil + "Move point to top/bottom of buffer before signalling a scrolling error. +A value of nil means just signal an error if no more scrolling possible. +A value of t means point moves to the beginning or the end of the buffer +\(depending on scrolling direction) when no more scrolling possible. +When point is already on that position, then signal an error." + :type 'boolean + :group 'scrolling + :version "24.1") + +(defun scroll-up-command (&optional arg) + "Scroll text of selected window upward ARG lines; or near full screen if no ARG. +If `scroll-error-top-bottom' is non-nil and `scroll-up' cannot +scroll window further, move cursor to the bottom line. +When point is already on that position, then signal an error. +A near full screen is `next-screen-context-lines' less than a full screen. +Negative ARG means scroll downward. +If ARG is the atom `-', scroll downward by nearly full screen." + (interactive "^P") + (cond + ((null scroll-error-top-bottom) + (scroll-up arg)) + ((eq arg '-) + (scroll-down-command nil)) + ((< (prefix-numeric-value arg) 0) + (scroll-down-command (- (prefix-numeric-value arg)))) + ((eobp) + (scroll-up arg)) ; signal error + (t + (condition-case nil + (scroll-up arg) + (end-of-buffer + (if arg + ;; When scrolling by ARG lines can't be done, + ;; move by ARG lines instead. + (forward-line arg) + ;; When ARG is nil for full-screen scrolling, + ;; move to the bottom of the buffer. + (goto-char (point-max)))))))) + +(put 'scroll-up-command 'scroll-command t) + +(defun scroll-down-command (&optional arg) + "Scroll text of selected window down ARG lines; or near full screen if no ARG. +If `scroll-error-top-bottom' is non-nil and `scroll-down' cannot +scroll window further, move cursor to the top line. +When point is already on that position, then signal an error. +A near full screen is `next-screen-context-lines' less than a full screen. +Negative ARG means scroll upward. +If ARG is the atom `-', scroll upward by nearly full screen." + (interactive "^P") + (cond + ((null scroll-error-top-bottom) + (scroll-down arg)) + ((eq arg '-) + (scroll-up-command nil)) + ((< (prefix-numeric-value arg) 0) + (scroll-up-command (- (prefix-numeric-value arg)))) + ((bobp) + (scroll-down arg)) ; signal error + (t + (condition-case nil + (scroll-down arg) + (beginning-of-buffer + (if arg + ;; When scrolling by ARG lines can't be done, + ;; move by ARG lines instead. + (forward-line (- arg)) + ;; When ARG is nil for full-screen scrolling, + ;; move to the top of the buffer. + (goto-char (point-min)))))))) + +(put 'scroll-down-command 'scroll-command t) + +;;; Scrolling commands which scroll a line instead of full screen. + +(defun scroll-up-line (&optional arg) + "Scroll text of selected window upward ARG lines; or one line if no ARG. +If ARG is omitted or nil, scroll upward by one line. +This is different from `scroll-up-command' that scrolls a full screen." + (interactive "p") + (scroll-up (or arg 1))) + +(put 'scroll-up-line 'scroll-command t) + +(defun scroll-down-line (&optional arg) + "Scroll text of selected window down ARG lines; or one line if no ARG. +If ARG is omitted or nil, scroll down by one line. +This is different from `scroll-down-command' that scrolls a full screen." + (interactive "p") + (scroll-down (or arg 1))) + +(put 'scroll-down-line 'scroll-command t) + + +(defun scroll-other-window-down (lines) + "Scroll the \"other window\" down. +For more details, see the documentation for `scroll-other-window'." + (interactive "P") + (scroll-other-window + ;; Just invert the argument's meaning. + ;; We can do that without knowing which window it will be. + (if (eq lines '-) nil + (if (null lines) '- + (- (prefix-numeric-value lines)))))) + +(defun beginning-of-buffer-other-window (arg) + "Move point to the beginning of the buffer in the other window. +Leave mark at previous position. +With arg N, put point N/10 of the way from the true beginning." + (interactive "P") + (let ((orig-window (selected-window)) + (window (other-window-for-scrolling))) + ;; We use unwind-protect rather than save-window-excursion + ;; because the latter would preserve the things we want to change. + (unwind-protect + (progn + (select-window window) + ;; Set point and mark in that window's buffer. + (with-no-warnings + (beginning-of-buffer arg)) + ;; Set point accordingly. + (recenter '(t))) + (select-window orig-window)))) + +(defun end-of-buffer-other-window (arg) + "Move point to the end of the buffer in the other window. +Leave mark at previous position. +With arg N, put point N/10 of the way from the true end." + (interactive "P") + ;; See beginning-of-buffer-other-window for comments. + (let ((orig-window (selected-window)) + (window (other-window-for-scrolling))) + (unwind-protect + (progn + (select-window window) + (with-no-warnings + (end-of-buffer arg)) + (recenter '(t))) + (select-window orig-window)))) + + (defvar mouse-autoselect-window-timer nil "Timer used by delayed window autoselection.") diff -r e56f669f17ce -r fe07c47cf7a7 lwlib/ChangeLog --- a/lwlib/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/lwlib/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,65 @@ +2010-05-08 Jan Djärv + + * xlwmenu.c (XlwMenuDestroy): Remove XtDestroyWidget on subwidgets + (Bug #6127). + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-06 Glenn Morris + + * Makefile.in (CPP, LN_S, TOP, LN): Remove unused variables. + +2010-05-04 Glenn Morris + + * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE): + Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ instead of + @c_switch_system@, @c_switch_machine@. + +2010-04-27 Dan Nicolaescu + + * Makefile.in (C_SWITCH_X_SYSTEM): Define using autoconf. + +2010-04-21 Jan Djärv + + * xlwmenu.c (expose_cb): + * lwlib-Xaw.c (fill_xft_data): Declarations before code. + +2010-04-17 Jan Djärv + + * xlwmenu.c: Include Shell.h, remove duplicate declaration of + XlwMenuRedisplay. + (display_menu_item): Replace ws->window with ws->pixmap, remove + call to XftDrawRect. + (display_menu): Remove this and that argument. + Remove just_compute_this_one_p. Fill pixmap at start and copy it to + window at end. + (expose_cb): New function. + (make_windows_if_needed): Replace XCreateWindow with XtCreatePopup. + Add eventhandler for expose to expose_cb. Remove creation of xft_draw. + (create_pixmap_for_menu): New function. + (remap_menubar): Pop down menus that aren't the same as in old_stack. + Set width, heigh, x, y on widget with XtVaSetValues. + Call create_pixmap_for_menu. + Replace XUnmapWindow with XtPopdown. + Remowe two last parameters to display_menu. + (map_event_to_widget_value, XlwMenuRedisplay, Key, Select) + (pop_up_menu): Remowe two last parameters to display_menu. + (XlwMenuRealize): Call create_pixmap_for_menu, set w and pixmap. + Remove call to XftDrawCreate. + (XlwMenuDestroy): Free pixmap. Call XtDestroyWidget instead of + XDestroyWindow. + (handle_motion_event): Only call handle_single_motion_event once. + (set_window_type): New function. + (make_windows_if_needed, XlwMenuRealize): Call set_window_type. + + * xlwmenuP.h (window_state): Add pixmap and w. + +2010-04-16 YAMAMOTO Mitsuharu + + * xlwmenu.c (facename_changed): Put function in #ifdef HAVE_XFT. + 2010-04-11 Dan Nicolaescu * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE) diff -r e56f669f17ce -r fe07c47cf7a7 lwlib/Makefile.in --- a/lwlib/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/lwlib/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,6 @@ # Copyright (C) 1992, 1993 Lucid, Inc. -# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +# 2009, 2010 Free Software Foundation, Inc. # # This file is part of the Lucid Widget Library. # @@ -26,32 +26,27 @@ srcdir=@srcdir@ VPATH=@srcdir@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ -C_SWITCH_SYSTEM=@c_switch_system@ -C_SWITCH_MACHINE=@c_switch_machine@ +C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@ +C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ +C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ CC=@CC@ CFLAGS=@CFLAGS@ -CPP=@CPP@ CPPFLAGS=@CPPFLAGS@ -LN_S=@LN_S@ RANLIB=@RANLIB@ # See below--@X_TOOLKIT_TYPE@ is used below. USE_X_TOOLKIT=@X_TOOLKIT_TYPE@ - TOP = . - - AR = ar cq +AR = ar cq +RM = rm -f - LN = ln -s - RM = rm -f - - LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o - MOTIF_OBJS = lwlib-Xm.o +LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o +MOTIF_OBJS = lwlib-Xm.o TOOLKIT_DEFINES = - TOOLKIT_OBJS = $(@X_TOOLKIT_TYPE@_OBJS) +TOOLKIT_OBJS = $(@X_TOOLKIT_TYPE@_OBJS) - OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o +OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o # ../src is needed to find config.h. ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ diff -r e56f669f17ce -r fe07c47cf7a7 lwlib/lwlib-Xaw.c --- a/lwlib/lwlib-Xaw.c Wed May 12 14:32:06 2010 +0200 +++ b/lwlib/lwlib-Xaw.c Thu May 13 15:13:52 2010 +0200 @@ -150,12 +150,12 @@ static void fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font) { - data->widget = widget; - data->xft_font = font; Pixel bg, fg; XColor colors[2]; int screen = XScreenNumberOfScreen (XtScreen (widget)); + data->widget = widget; + data->xft_font = font; XtVaGetValues (widget, XtNbackground, &bg, XtNforeground, &fg, diff -r e56f669f17ce -r fe07c47cf7a7 lwlib/xlwmenu.c --- a/lwlib/xlwmenu.c Wed May 12 14:32:06 2010 +0200 +++ b/lwlib/xlwmenu.c Thu May 13 15:13:52 2010 +0200 @@ -44,6 +44,7 @@ #include #include #include +#include #include "xlwmenuP.h" #ifdef emacs @@ -186,7 +187,6 @@ static Boolean XlwMenuSetValues(); static void XlwMenuRealize(); -static void XlwMenuRedisplay(); static void XlwMenuResize(); static void XlwMenuInitialize(); static void XlwMenuRedisplay(); @@ -1067,13 +1067,13 @@ if (separator_p) { - draw_separator (mw, ws->window, x, y, width, separator); + draw_separator (mw, ws->pixmap, x, y, width, separator); } else { int x_offset = x + h_spacing + shadow; char* display_string = resource_widget_value (mw, val); - draw_shadow_rectangle (mw, ws->window, x, y, width, height, True, + draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, True, False); /* Deal with centering a menu title. */ @@ -1092,9 +1092,6 @@ if (ws->xft_draw) { int draw_y = y + v_spacing + shadow; - XftDrawRect (ws->xft_draw, &mw->menu.xft_bg, - x_offset, draw_y, - ws->width, font_height); XftDrawStringUtf8 (ws->xft_draw, xftfg, mw->menu.xft_font, x_offset, draw_y + font_ascent, @@ -1105,13 +1102,13 @@ #endif #ifdef HAVE_X_I18N if (mw->menu.fontSet) - XmbDrawString (XtDisplay (mw), ws->window, mw->menu.fontSet, + XmbDrawString (XtDisplay (mw), ws->pixmap, mw->menu.fontSet, text_gc, x_offset, y + v_spacing + shadow + font_ascent, display_string, strlen (display_string)); else #endif - XDrawString (XtDisplay (mw), ws->window, + XDrawString (XtDisplay (mw), ws->pixmap, text_gc, x_offset, y + v_spacing + shadow + font_ascent, display_string, strlen (display_string)); @@ -1119,16 +1116,16 @@ if (!horizontal_p) { if (val->button_type == BUTTON_TYPE_TOGGLE) - draw_toggle (mw, ws->window, x, y + v_spacing + shadow, + draw_toggle (mw, ws->pixmap, x, y + v_spacing + shadow, val->selected); else if (val->button_type == BUTTON_TYPE_RADIO) - draw_radio (mw, ws->window, x, y + v_spacing + shadow, + draw_radio (mw, ws->pixmap, x, y + v_spacing + shadow, val->selected); if (val->contents) { int a_w = arrow_width (mw); - draw_arrow (mw, ws->window, deco_gc, + draw_arrow (mw, ws->pixmap, deco_gc, x + width - a_w - mw->menu.horizontal_spacing - mw->menu.shadow_thickness, @@ -1154,7 +1151,7 @@ #endif #ifdef HAVE_X_I18N if (mw->menu.fontSet) - XmbDrawString (XtDisplay (mw), ws->window, + XmbDrawString (XtDisplay (mw), ws->pixmap, mw->menu.fontSet, text_gc, x + label_width + mw->menu.arrow_spacing, @@ -1162,7 +1159,7 @@ val->key, strlen (val->key)); else #endif - XDrawString (XtDisplay (mw), ws->window, + XDrawString (XtDisplay (mw), ws->pixmap, text_gc, x + label_width + mw->menu.arrow_spacing, y + v_spacing + shadow + font_ascent, @@ -1171,17 +1168,17 @@ } else { - XDrawRectangle (XtDisplay (mw), ws->window, + XDrawRectangle (XtDisplay (mw), ws->pixmap, mw->menu.background_gc, x + shadow, y + shadow, label_width + h_spacing - 1, font_height + 2 * v_spacing - 1); - draw_shadow_rectangle (mw, ws->window, x, y, width, height, + draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, True, False); } if (highlighted_p) - draw_shadow_rectangle (mw, ws->window, x, y, width, height, False, + draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, False, False); } } @@ -1191,16 +1188,13 @@ } static void -display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return, - this, that) +display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return) XlwMenuWidget mw; int level; Boolean just_compute_p; XPoint* highlighted_pos; XPoint* hit; widget_value** hit_return; - widget_value* this; - widget_value* that; { widget_value* val; widget_value* following_item; @@ -1208,9 +1202,6 @@ XPoint where; int horizontal_p = mw->menu.horizontal && (level == 0); int highlighted_p; - int just_compute_this_one_p; - /* This is set nonzero if the element containing HIGHLIGHTED_POS - is disabled, so that we do not return any subsequent element either. */ int no_return = 0; enum menu_separator separator; @@ -1229,6 +1220,11 @@ where.y = 0; ws = &mw->menu.windows [level]; + + if (!just_compute_p) + XFillRectangle (XtDisplay (mw), ws->pixmap, mw->menu.background_gc, + 0, 0, ws->width, ws->height); + for (val = mw->menu.old_stack [level]->contents; val; val = val->next) { highlighted_p = val == following_item; @@ -1240,11 +1236,8 @@ highlighted_pos->y = where.y; } - just_compute_this_one_p = - just_compute_p || ((this || that) && val != this && val != that); - display_menu_item (mw, val, ws, &where, highlighted_p, horizontal_p, - just_compute_this_one_p); + just_compute_p); if (highlighted_p && highlighted_pos) { @@ -1282,8 +1275,12 @@ } if (!just_compute_p) - draw_shadow_rectangle (mw, ws->window, 0, 0, ws->width, ws->height, - False, False); + { + draw_shadow_rectangle (mw, ws->pixmap, 0, 0, ws->width, ws->height, + False, False); + XCopyArea (XtDisplay (mw), ws->pixmap, ws->window, + mw->menu.foreground_gc, 0, 0, ws->width, ws->height, 0, 0); + } } /* Motion code */ @@ -1302,15 +1299,45 @@ } static void +expose_cb (Widget widget, + XtPointer closure, + XEvent* event, + Boolean* continue_to_dispatch) +{ + XlwMenuWidget mw = (XlwMenuWidget) closure; + int i; + + *continue_to_dispatch = False; + for (i = 0; i < mw->menu.windows_length; ++i) + if (mw->menu.windows [i].w == widget) break; + if (i < mw->menu.windows_length && i < mw->menu.old_depth) + display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL); +} + +static void +set_window_type (Widget w, XlwMenuWidget mw) +{ + int popup_menu_p = mw->menu.top_depth == 1; + Atom type = XInternAtom (XtDisplay (w), + popup_menu_p + ? "_NET_WM_WINDOW_TYPE_POPUP_MENU" + : "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", + False); + + XChangeProperty (XtDisplay (w), XtWindow (w), + XInternAtom (XtDisplay (w), "_NET_WM_WINDOW_TYPE", False), + XA_ATOM, 32, PropModeReplace, + (unsigned char *)&type, 1); +} + + +static void make_windows_if_needed (mw, n) XlwMenuWidget mw; int n; { int i; int start_at; - XSetWindowAttributes xswa; - int mask; - Window root = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw))); window_state* windows; #ifdef HAVE_XFT int screen = XScreenNumberOfScreen (mw->core.screen); @@ -1319,17 +1346,6 @@ if (mw->menu.windows_length >= n) return; - xswa.save_under = True; - xswa.override_redirect = True; - xswa.background_pixel = mw->core.background_pixel; - xswa.border_pixel = mw->core.border_pixel; - xswa.event_mask = - ExposureMask | PointerMotionMask | PointerMotionHintMask - | ButtonReleaseMask | ButtonPressMask; - xswa.cursor = mw->menu.cursor_shape; - mask = CWSaveUnder | CWOverrideRedirect | CWBackPixel | CWBorderPixel - | CWEventMask | CWCursor; - if (!mw->menu.windows) { mw->menu.windows = @@ -1349,24 +1365,31 @@ for (i = start_at; i < n; i++) { + Arg av[10]; + int ac = 0; windows [i].x = 0; windows [i].y = 0; windows [i].width = 1; windows [i].height = 1; windows [i].max_rest_width = 0; - windows [i].window = - XCreateWindow (XtDisplay (mw), root, 0, 0, 1, 1, - 0, 0, CopyFromParent, CopyFromParent, mask, &xswa); + XtSetArg (av[ac], XtNwidth, 1); ++ac; + XtSetArg (av[ac], XtNheight, 1); ++ac; + XtSetArg (av[ac], XtNsaveUnder, True); ++ac; + XtSetArg (av[ac], XtNbackground, mw->core.background_pixel); ++ac; + XtSetArg (av[ac], XtNborderColor, mw->core.border_pixel); ++ac; + XtSetArg (av[ac], XtNborderWidth, mw->core.border_width); ++ac; + XtSetArg (av[ac], XtNcursor, mw->menu.cursor_shape); ++ac; + windows [i].w = + XtCreatePopupShell ("sub", overrideShellWidgetClass, + (Widget) mw, av, ac); + XtRealizeWidget (windows [i].w); + XtAddEventHandler (windows [i].w, ExposureMask, False, expose_cb, mw); + windows [i].window = XtWindow (windows [i].w); + windows [i].pixmap = None; #ifdef HAVE_XFT - if (mw->menu.xft_font) - mw->menu.windows [i].xft_draw - = XftDrawCreate (XtDisplay (mw), - windows [i].window, - DefaultVisual (XtDisplay (mw), screen), - mw->core.colormap); - else - mw->menu.windows [i].xft_draw = 0; + windows [i].xft_draw = 0; #endif + set_window_type (windows [i].w, mw); } } @@ -1445,6 +1468,33 @@ } } +static void +create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) +{ + if (ws->pixmap != None) + { + XFreePixmap (XtDisplay (ws->w), ws->pixmap); + ws->pixmap = None; + } + ws->pixmap = XCreatePixmap (XtDisplay (ws->w), ws->window, + ws->width, ws->height, + DefaultDepthOfScreen (XtScreen (ws->w))); +#ifdef HAVE_XFT + if (ws->xft_draw) + XftDrawDestroy (ws->xft_draw); + if (mw->menu.xft_font) + { + int screen = XScreenNumberOfScreen (mw->core.screen); + ws->xft_draw = XftDrawCreate (XtDisplay (ws->w), + ws->pixmap, + DefaultVisual (XtDisplay (ws->w), screen), + mw->core.colormap); + } + else + ws->xft_draw = 0; +#endif +} + /* Updates old_stack from new_stack and redisplays. */ static void remap_menubar (mw) @@ -1490,14 +1540,17 @@ /* updates old_state from new_state. It has to be done now because display_menu (called below) uses the old_stack to know what to display. */ for (i = last_same + 1; i < new_depth; i++) - old_stack [i] = new_stack [i]; + { + XtPopdown (mw->menu.windows [i].w); + old_stack [i] = new_stack [i]; + } mw->menu.old_depth = new_depth; /* refresh the last selection */ selection_position.x = 0; selection_position.y = 0; display_menu (mw, last_same, new_selection == old_selection, - &selection_position, NULL, NULL, old_selection, new_selection); + &selection_position, NULL, NULL); /* Now place the new menus. */ for (i = last_same + 1; i < new_depth && new_stack[i]->contents; i++) @@ -1524,17 +1577,17 @@ fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1); - XClearWindow (XtDisplay (mw), ws->window); - XMoveResizeWindow (XtDisplay (mw), ws->window, ws->x, ws->y, - ws->width, ws->height); - XMapRaised (XtDisplay (mw), ws->window); - display_menu (mw, i, False, &selection_position, NULL, NULL, NULL, NULL); + XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height, + XtNx, ws->x, XtNy, ws->y, NULL); + create_pixmap_for_menu (ws, mw); + XtPopup (ws->w, XtGrabNone); + display_menu (mw, i, False, &selection_position, NULL, NULL); } /* unmap the menus that popped down */ for (i = new_depth - 1; i < old_depth; i++) if (i >= new_depth || (i > 0 && !new_stack[i]->contents)) - XUnmapWindow (XtDisplay (mw), windows[i].window); + XtPopdown (windows[i].w); } static Boolean @@ -1575,7 +1628,7 @@ if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos)) { inside = 1; - display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL); + display_menu (mw, i, True, NULL, &relative_pos, val); if (*val) { @@ -1954,6 +2007,7 @@ mw->menu.windows [0].width = 0; mw->menu.windows [0].height = 0; mw->menu.windows [0].max_rest_width = 0; + mw->menu.windows [0].pixmap = None; #ifdef HAVE_XFT mw->menu.windows [0].xft_draw = 0; #endif @@ -1996,22 +2050,20 @@ x_uncatch_errors (); #endif + mw->menu.windows [0].w = w; mw->menu.windows [0].window = XtWindow (w); mw->menu.windows [0].x = w->core.x; mw->menu.windows [0].y = w->core.y; mw->menu.windows [0].width = w->core.width; mw->menu.windows [0].height = w->core.height; + set_window_type (mw->menu.windows [0].w, mw); + create_pixmap_for_menu (&mw->menu.windows [0], mw); + #ifdef HAVE_XFT if (mw->menu.xft_font) { XColor colors[3]; - int screen = XScreenNumberOfScreen (mw->core.screen); - mw->menu.windows [0].xft_draw - = XftDrawCreate (XtDisplay (w), - mw->menu.windows [0].window, - DefaultVisual (XtDisplay (w), screen), - mw->core.colormap); colors[0].pixel = mw->menu.xft_fg.pixel = mw->menu.foreground; colors[1].pixel = mw->menu.xft_bg.pixel = mw->core.background_pixel; colors[2].pixel = mw->menu.xft_disabled_fg.pixel @@ -2030,8 +2082,6 @@ mw->menu.xft_disabled_fg.color.green = colors[2].green; mw->menu.xft_disabled_fg.color.blue = colors[2].blue; } - else - mw->menu.windows [0].xft_draw = 0; #endif } @@ -2055,8 +2105,7 @@ submenu_destroyed = 0; } - for (i = 0; i < mw->menu.old_depth; i++) - display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL); + display_menu (mw, 0, False, NULL, NULL, NULL); } @@ -2121,10 +2170,13 @@ XftFontClose (XtDisplay (mw), mw->menu.xft_font); #endif + if (mw->menu.windows [0].pixmap != None) + XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap); /* start from 1 because the one in slot 0 is w->core.window */ for (i = 1; i < mw->menu.windows_length; i++) { - XDestroyWindow (XtDisplay (mw), mw->menu.windows [i].window); + if (mw->menu.windows [i].pixmap != None) + XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap); #ifdef HAVE_XFT if (mw->menu.windows [i].xft_draw) XftDrawDestroy (mw->menu.windows [i].xft_draw); @@ -2135,15 +2187,17 @@ XtFree ((char *) mw->menu.windows); } +#ifdef HAVE_XFT static int facename_changed (XlwMenuWidget newmw, XlwMenuWidget oldmw) { - /* This will fore a new XftFont even if the same sting is set. + /* This will fore a new XftFont even if the same string is set. This is good, as rendering parameters may have changed and we just want to do a redisplay. */ return newmw->menu.faceName != oldmw->menu.faceName; } +#endif static Boolean XlwMenuSetValues (current, request, new) @@ -2248,13 +2302,14 @@ /* Don't allow the popup menu to resize itself. */ mw->core.width = mw->menu.windows [0].width; mw->core.height = mw->menu.windows [0].height; - mw->core.parent->core.width = mw->core.width ; - mw->core.parent->core.height = mw->core.height ; + mw->core.parent->core.width = mw->core.width; + mw->core.parent->core.height = mw->core.height; } else { mw->menu.windows [0].width = mw->core.width; mw->menu.windows [0].height = mw->core.height; + create_pixmap_for_menu (&mw->menu.windows [0], mw); } } @@ -2285,8 +2340,7 @@ int x = ev->x_root; int y = ev->y_root; int state = ev->state; - - handle_single_motion_event (mw, ev); + XMotionEvent oldev = *ev; /* allow motion events to be generated again */ if (ev->is_hint @@ -2298,6 +2352,8 @@ && ev->state == state && (ev->x_root != x || ev->y_root != y)) handle_single_motion_event (mw, ev); + else + handle_single_motion_event (mw, &oldev); } static void @@ -2607,7 +2663,7 @@ else { XtRemoveGrab ((Widget) mw); - display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL); + display_menu (mw, 0, False, NULL, NULL, NULL); } } @@ -2648,7 +2704,7 @@ else { XtRemoveGrab ((Widget) mw); - display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL); + display_menu (mw, 0, False, NULL, NULL, NULL); } } @@ -2699,7 +2755,7 @@ XtConfigureWidget (XtParent ((Widget)mw), x, y, w, h, XtParent ((Widget)mw)->core.border_width); XtPopup (XtParent ((Widget)mw), XtGrabExclusive); - display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL); + display_menu (mw, 0, False, NULL, NULL, NULL); mw->menu.windows [0].x = x + borderwidth; mw->menu.windows [0].y = y + borderwidth; mw->menu.top_depth = 1; /* Popup menus don't have a bar so top is 1 */ diff -r e56f669f17ce -r fe07c47cf7a7 lwlib/xlwmenuP.h --- a/lwlib/xlwmenuP.h Wed May 12 14:32:06 2010 +0200 +++ b/lwlib/xlwmenuP.h Thu May 13 15:13:52 2010 +0200 @@ -32,7 +32,9 @@ /* Elements in the stack arrays. */ typedef struct _window_state { + Widget w; Window window; + Pixmap pixmap; Position x; Position y; Dimension width; diff -r e56f669f17ce -r fe07c47cf7a7 make-dist --- a/make-dist Wed May 12 14:32:06 2010 +0200 +++ b/make-dist Thu May 13 15:13:52 2010 +0200 @@ -469,8 +469,7 @@ echo "Making links to \`src/m'" (cd src/m - # We call files for miscellaneous input (to linker etc) .inp. - ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m) + ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m) echo "Making links to \`src/s'" (cd src/s @@ -538,7 +537,7 @@ echo "Making links to \`msdos'" (cd msdos ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos - ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos + ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos cd ../${tempdir}/msdos rm -f =*) diff -r e56f669f17ce -r fe07c47cf7a7 msdos/ChangeLog --- a/msdos/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/msdos/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,53 @@ +2010-05-12 Glenn Morris + + * sed3v2.inp (INSTALLABLES): No more @LIB_SRC_EXTRA_INSTALLABLES@. + + * sed1v2.inp (LIB_GCC): Edit to -Lgcc. + +2010-05-11 Glenn Morris + + * sed1x.inp (LIBS_SYSTEM): Edit to -lxext -lsys. + * sed3x.inp: New file. + +2010-05-10 Glenn Morris + + * sed1v2.inp, sed3v2.inp (LIBS_SYSTEM): Edit to empty. + + * sed3v2.inp (BLESSMAIL_TARGET): Edit to need-blessmail. + +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-08 Glenn Morris + + * sed1v2.inp (LIBS_TERMCAP): Edit to empty. + (TERMCAP_OBJ): Edit to tparam.o. + +2010-05-07 Eli Zaretskii + + Fix breakage due to autoconfiscation of Makefile.in files. + + * sed3v2.inp (C_SWITCH_MACHINE): Edit to empty. + + * sed1v2.inp (@LIB_MATH@): Edit to -lm. + (C_SWITCH_MACHINE, C_SWITCH_SYSTEM, LD_SWITCH_SYSTEM_TEMACS) + (LD_SWITCH_X_SITE_AUX, LD_SWITCH_X_SITE_AUX_RPATH) + (LD_SWITCH_SYSTEM, LD_SWITCH_SYSTEM_EXTRA, LIBTIFF, LIBJPEG) + (LIBPNG, LIBGIF, LIBXPM, XFT_LIBS, DBUS_CFLAGS, DBUS_LIBS) + (DBUS_OBJ, GCONF_CFLAGS, GCONF_LIBS, GTK_OBJ, LIBXMU, LIBXSM) + (LIBXTR6, XOBJ, TOOLKIT_LIBW, WIDGET_OBJ, CYGWIN_OBJ, NS_OBJ) + (NS_SUPPORT, LIBSELINUX_LIBS, START_FILES): Edit to empty. + (XMENU_OBJ): Edit to xmenu.o. + (FONT_OBJ): Edit to value used for X on Unix. + (PRE_ALLOC_OBJ): Edit to lastfile.o. + (POST_ALLOC_OBJ): Edit to $(vmlimitobj). + (@unexec@): Edit to unexec.o. + +2010-05-06 Glenn Morris + + * sed1v2.inp, sed5x.inp: Remove LN_S, unused. + 2010-04-01 Eli Zaretskii Remove support for DJGPP v1.x. diff -r e56f669f17ce -r fe07c47cf7a7 msdos/sed1v2.inp --- a/msdos/sed1v2.inp Wed May 12 14:32:06 2010 +0200 +++ b/msdos/sed1v2.inp Thu May 13 15:13:52 2010 +0200 @@ -2,8 +2,8 @@ # Configuration script for src/Makefile under DJGPP v2.x # ---------------------------------------------------------------------- # -# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 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. # @@ -38,19 +38,58 @@ /^CPPFLAGS *=/s/@[^@\n]*@// /^LDFLAGS *=/s/@[^@\n]*@// /^LIBS *=/s/@[^@\n]*@// +s/@LIB_MATH@/-lm/ /^LIBES *=/,/^ *$/ { s/@[^@\n]*@//g } /^LIBOBJS *=/s/@[^@\n]*@/getloadavg.o/ -/^GETLOADAVG_LIBS *=/s/@[^@\n]*@// +/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// +/^C_SWITCH_SYSTEM *=/s/@C_SWITCH_SYSTEM@// +/^LD_SWITCH_SYSTEM_TEMACS *=/s/@LD_SWITCH_SYSTEM_TEMACS@// +/^LD_SWITCH_X_SITE_AUX *=/s/@LD_SWITCH_X_SITE_AUX@// +/^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@// +/^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@// +/^LIB_GCC *=/s/@LIB_GCC@/-Lgcc/ +/^LIBTIFF *=/s/@LIBTIFF@// +/^LIBJPEG *=/s/@LIBJPEG@// +/^LIBPNG *=/s/@LIBPNG@// +/^LIBGIF *=/s/@LIBGIF@// +/^LIBXPM *=/s/@LIBXPM@// +/^XFT_LIBS *=/s/@XFT_LIBS@// +/^DBUS_CFLAGS *=/s/@DBUS_CFLAGS@// +/^DBUS_LIBS *=/s/@DBUS_LIBS@// +/^DBUS_OBJ *=/s/@DBUS_OBJ@// +/^GCONF_CFLAGS *=/s/@GCONF_CFLAGS@// +/^GCONF_LIBS *=/s/@GCONF_LIBS@// +/^GTK_OBJ *=/s/@GTK_OBJ@// +/^LIBS_TERMCAP *=/s/@LIBS_TERMCAP@// +/^TERMCAP_OBJ *=/s/@TERMCAP_OBJ@/tparam.o/ +/^LIBXMU *=/s/@LIBXMU@// +/^LIBXSM *=/s/@LIBXSM@// +/^LIBXTR6 *=/s/@LIBXTR6@// +/^XOBJ *=/s/@XOBJ@// +/^TOOLKIT_LIBW *=/s/@TOOLKIT_LIBW@// /^LIBSOUND *=/s/@LIBSOUND@// /^CFLAGS_SOUND *=/s/@CFLAGS_SOUND@// /^RSVG_LIBS *=/s/@RSVG_LIBS@// /^RSVG_CFLAGS *=/s/@RSVG_CFLAGS@// +/^WIDGET_OBJ *=/s/@WIDGET_OBJ@// +/^CYGWIN_OBJ *=/s/@CYGWIN_OBJ@// +/^NS_OBJ *=/s/@NS_OBJ@// +/^NS_SUPPORT *=/s/@NS_SUPPORT@// +/^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 ftfont.o xftfont.o ftxfont.o/ /^EXEEXT *=/s/@EXEEXT@/.exe/ +/^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/ +/^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/ +s/@unexec@/unexec.o/g /^version *=/s/@[^@\n]*@// -/^LN_S *=/s/@[^@\n]*@/ln -s/ /^M_FILE *=/s!@[^@\n]*@!m/intel386.h! /^S_FILE *=/s!@[^@\n]*@!s/msdos.h! /^@SET_MAKE@$/s/@SET_MAKE@// diff -r e56f669f17ce -r fe07c47cf7a7 msdos/sed1x.inp --- a/msdos/sed1x.inp Wed May 12 14:32:06 2010 +0200 +++ b/msdos/sed1x.inp Thu May 13 15:13:52 2010 +0200 @@ -5,6 +5,7 @@ s!^ @true *$! @rem! s/DOC/DOC-X/g #/^LIBXMENU *=/s!= *!= ../oldxmenu/! +/^LIBS_SYSTEM *=/s!= *!= -lxext -lsys! /^temacs *:/s!OLDXMENU!LIBXMENU! # arch-tag: 3e8a78f2-3dec-44f3-81f6-3785a562da19 diff -r e56f669f17ce -r fe07c47cf7a7 msdos/sed3v2.inp --- a/msdos/sed3v2.inp Wed May 12 14:32:06 2010 +0200 +++ b/msdos/sed3v2.inp Thu May 13 15:13:52 2010 +0200 @@ -26,6 +26,7 @@ /^libdir *=/s!=.*$!=/emacs/bin! /^srcdir=/s!srcdir=@srcdir@!srcdir := $(subst \\,/,$(shell command.com /c cd))! /^VPATH *=/s!=.*$!=.! +/^BLESSMAIL_TARGET *=/s!@BLESSMAIL_TARGET@!need-blessmail! /^KRB4LIB *=/s/@[^@\n]*@//g /^DESLIB *=/s/@[^@\n]*@//g /^KRB5LIB *=/s/@[^@\n]*@//g @@ -34,15 +35,16 @@ /^LIBHESIOD *=/s/@[^@\n]*@//g /^LIBRESOLV *=/s/@[^@\n]*@//g /^LIBS_MAIL *=/s/@[^@\n]*@//g +/^LIBS_SYSTEM *=/s/@[^@\n]*@//g /^CFLAGS *=/s!=.*$!=-O2 -g! /^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS! +/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// /^LOADLIBES *=/s!=.*$!=! /^ALLOCA *=/s!@ALLOCA@!! /^EXEEXT *=/s!@EXEEXT@!! /^GETOPT_H *=/s!@GETOPT_H@!getopt.h! /^GETOPTOBJS *=/s!@GETOPTOBJS@!getopt.o getopt1.o! /^INSTALLABLES/s/emacsclient *// -/^INSTALLABLES/s/ @LIB_SRC_EXTRA_INSTALLABLES@// s!^ \./! ! /^UTILITIES=/s/ wakeup// /^UTILITIES=/s/ movemail// diff -r e56f669f17ce -r fe07c47cf7a7 msdos/sed3x.inp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/msdos/sed3x.inp Thu May 13 15:13:52 2010 +0200 @@ -0,0 +1,5 @@ +# -sed3x.inp------------------------------------------------------------ +# Extra configuration script for lib-src/makefile for DesqView/X +# ---------------------------------------------------------------------- +/^LIBS_SYSTEM *=/s!= *!= -lxext -lsys! + diff -r e56f669f17ce -r fe07c47cf7a7 msdos/sed5x.inp --- a/msdos/sed5x.inp Wed May 12 14:32:06 2010 +0200 +++ b/msdos/sed5x.inp Thu May 13 15:13:52 2010 +0200 @@ -2,8 +2,8 @@ # Configuration script for oldxmenu/makefile for DesqView/X # ---------------------------------------------------------------------- # -# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +# 2009, 2010 Free Software Foundation, Inc. # # This file is part of GNU Emacs. # @@ -22,7 +22,6 @@ /^CC *=/s/@[^@\n]*@/gcc/ /^CPP *=/s/@[^@\n]*@/gcc -e/ /^CFLAGS *=/s/@[^@\n]*@/-O2 -g/ -/^LN_S *=/s/@[^@\n]*@/ln -s/ s/|| true// # arch-tag: 612a79be-2a02-4cb0-8dec-779aac0a2f4f diff -r e56f669f17ce -r fe07c47cf7a7 nextstep/ChangeLog --- a/nextstep/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/nextstep/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,7 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-03-10 Chong Yidong * Branch for 23.2. diff -r e56f669f17ce -r fe07c47cf7a7 nt/ChangeLog --- a/nt/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/nt/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,15 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-04 Glenn Morris + + * config.nt (LD_SWITCH_X_SITE_AUX): Remove. + +2010-04-20 Lewis Perin (tiny change) + + * emacs.manifest: Add trustInfo section to Windows manifest. + 2010-03-10 Chong Yidong * Branch for 23.2. @@ -47,8 +59,8 @@ 2009-01-26 Jason Rumney - * emacsclient.rc, emacs.rc: Swap name and description. Remove - Windows versions. + * emacsclient.rc, emacs.rc: Swap name and description. + Remove Windows versions. 2009-01-15 Jason Rumney @@ -100,7 +112,7 @@ * config.nt (HAVE_FACES): Remove, unused. 2008-06-26 Juanma Barranquero - Eli Zaretskii + Eli Zaretskii * nmake.defs (FONT_CFLAGS): * gmake.defs (FONT_CFLAGS): Remove. @@ -116,7 +128,7 @@ * config.nt: Remove reference to UNEXEC_SRC. 2008-06-23 Juanma Barranquero - Eli Zaretskii + Eli Zaretskii * gmake.defs (DEBUG_FLAG, DEBUG_LINK) [!NODEBUG]: Don't hardcode -gstabs+, use DEBUG_INFO. diff -r e56f669f17ce -r fe07c47cf7a7 nt/config.nt --- a/nt/config.nt Wed May 12 14:32:06 2010 +0200 +++ b/nt/config.nt Thu May 13 15:13:52 2010 +0200 @@ -325,10 +325,6 @@ something similar. */ #undef LD_SWITCH_X_SITE -/* Define LD_SWITCH_X_SITE_AUX with an -R option - in case it's needed (for Solaris, for example). */ -#undef LD_SWITCH_X_SITE_AUX - /* Define C_SWITCH_X_SITE to contain any special flags your compiler may need to deal with X Windows. For instance, if you've defined HAVE_X_WINDOWS above and your X include files aren't in a place diff -r e56f669f17ce -r fe07c47cf7a7 nt/emacs.manifest --- a/nt/emacs.manifest Wed May 12 14:32:06 2010 +0200 +++ b/nt/emacs.manifest Thu May 13 15:13:52 2010 +0200 @@ -8,4 +8,14 @@ language="*"/> - \ No newline at end of file + + GNU Emacs + + + + + + + + diff -r e56f669f17ce -r fe07c47cf7a7 oldXMenu/ChangeLog --- a/oldXMenu/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/oldXMenu/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,29 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + +2010-05-06 Glenn Morris + + * Makefile.in (RANLIB): Let configure set it. + (libXMenu11.a): Configure sets RANLIB = : on systems without it. + + * Makefile.in (CPP, LN_S, AS, LD, MV, LS, LINTOPTS, LINTLIBFLAG, MAKE) + (STD_DEFINES, CDEBUGFLAGS, RM_CMD): Remove unused variables. + +2010-05-04 Glenn Morris + + * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE): + Use @C_SWITCH_SYSTEM@, @C_SWITCH_MACHINE@ rather than + @c_switch_system@, @c_switch_machine@. + +2010-04-27 Dan Nicolaescu + + * Makefile.in (C_SWITCH_X_SYSTEM): Define using autoconf. + +2010-04-23 Dan Nicolaescu + + * Makefile.in (ALL_CFLAGS): Remove C_SWITCH_X_MACHINE, unused. + 2010-04-11 Dan Nicolaescu * Makefile.in (C_SWITCH_SYSTEM, C_SWITCH_MACHINE) diff -r e56f669f17ce -r fe07c47cf7a7 oldXMenu/Makefile.in --- a/oldXMenu/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/oldXMenu/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -15,8 +15,8 @@ ## without express or implied warranty. -## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -## Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +## 2010 Free Software Foundation, Inc. ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ ## To the best of our knowledge, this code was originally based on the ## X11 oldXMenu Makefile, which was automatically generated from the -## X11 oldXMenu Imakefile. There was no explicit copyright information +## X11 oldXMenu Imakefile. There was no explicit copyright information ## in the Imakefile, therefore we have added the same MIT license as ## used by the rest of the oldXMenu code. @@ -46,30 +46,18 @@ srcdir=@srcdir@ VPATH=@srcdir@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ -C_SWITCH_SYSTEM=@c_switch_system@ -C_SWITCH_MACHINE=@c_switch_machine@ +C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@ +C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ +C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ EXTRA=insque.o CC=@CC@ CFLAGS=@CFLAGS@ -CPP=@CPP@ -LN_S=@LN_S@ - AS = as - LD = ld - TAGS = etags - RM = rm -f - MV = mv - RANLIB = ranlib +TAGS = etags +RM = rm -f +RANLIB = @RANLIB@ # Solaris 2.1 ar doesn't accept the 'l' option. - AR = ar cq - LS = ls - LINTOPTS = -axz - LINTLIBFLAG = -C - MAKE = make - STD_DEFINES = - CDEBUGFLAGS = -O - RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ - tags TAGS make.log +AR = ar cq OBJS = Activate.o \ AddPane.o \ @@ -99,7 +87,7 @@ all:: libXMenu11.a ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ - $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) $(C_SWITCH_X_MACHINE) \ + $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) \ $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \ -I../src -I${srcdir} -I${srcdir}/../src @@ -109,11 +97,7 @@ libXMenu11.a: $(OBJS) $(EXTRA) $(RM) $@ $(AR) $@ $(OBJS) $(EXTRA) - @echo Do not be alarmed if the following ranlib command - @echo fails due to the absence of a ranlib program on your system. - -$(RANLIB) $@ || true -#If running ranlib fails, probably there is none. -#That's ok. So don't stop the build. + $(RANLIB) $@ Activate.o: Activate.c XMenuInt.h XMenu.h X10.h AddPane.o: AddPane.c XMenuInt.h XMenu.h X10.h diff -r e56f669f17ce -r fe07c47cf7a7 src/.gdbinit --- a/src/.gdbinit Wed May 12 14:32:06 2010 +0200 +++ b/src/.gdbinit Thu May 13 15:13:52 2010 +0200 @@ -21,6 +21,8 @@ # Force loading of symbols, enough to give us gdb_valbits etc. set main +# With some compilers, we need this to give us struct Lisp_Symbol etc.: +set Fmake_symbol # Find lwlib source files too. dir ../lwlib @@ -889,6 +891,19 @@ This command assumes that $ is an Emacs Lisp char-table value. end +define xsubchartable + xgetptr $ + print (struct Lisp_Sub_Char_Table *) $ptr + xgetint $->depth + set $depth = $int + xgetint $->min_char + printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int +end +document xsubchartable +Print the address of the sub-char-table $, its depth and min-char. +This command assumes that $ is an Emacs Lisp sub-char-table value. +end + define xboolvector xgetptr $ print (struct Lisp_Bool_Vector *) $ptr diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog --- a/src/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,1037 @@ +2010-05-12 Glenn Morris + + * Makefile.in (YMF_PASS_LDFLAGS, LD, LINKER): Simplify the logic. + (LINKER_WAS_SPECIFIED): Remove. + + * Makefile.in (LIB_GCC): Set using configure, not cpp. + (GNULIB_VAR) [!ORDINARY_LINK]: Always set to $LIB_GCC. + * m/arm.h (LIB_GCC) [GNU_LINUX]: + * s/cygwin.h (LIB_GCC): + * s/freebsd.h (LIB_GCC): + * s/gnu-linux.h (LIB_GCC): + * s/msdos.h (LIB_GCC): + * s/netbsd.h (LIB_GCC): + Move to configure. + +2010-05-11 Karel Klic + + * ftfont.c: Fix incorrect parentheses of #if condition for + definining M17N_FLT_USE_NEW_FEATURE. + +2010-05-11 Glenn Morris + + * Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset. + * s/msdos.h (MSDOS_LIBS_SYSTEM): Remove. + +2010-05-10 Eli Zaretskii + + * 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. + +2010-05-10 Glenn Morris + + * Makefile.in (LIBS_SYSTEM): Set using configure, not cpp. + (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM. + (LIBES): Use LIBS_SYSTEM as a variable. + * s/msdos.h (LIBS_SYSTEM): Rename to MSDOS_LIBS_SYSTEM. Always define. + * s/aix4-2.h (LIBS_SYSTEM): + * s/freebsd.h (LIBS_SYSTEM): + * s/hpux10-20.h (LIBS_SYSTEM): + * s/sol2-6.h (LIBS_SYSTEM): + * s/unixware.h (LIBS_SYSTEM): + Move to configure. + + * s/aix4-2.h (MAIL_USE_LOCKF): + * s/bsd-common.h (MAIL_USE_FLOCK): + * s/darwin.h (MAIL_USE_FLOCK): + * s/gnu-linux.h (MAIL_USE_FLOCK): + * s/irix6-5.h (MAIL_USE_FLOCK): + * s/template.h (MAIL_USE_FLOCK): + Move to configure. + +2010-05-08 Chong Yidong + + * Version 23.2 released. + +2010-05-08 Andreas Schwab + + * composite.c (autocmp_chars): Save point as marker before calling + auto-composition-function (Bug#5984). + + * lisp.h (restore_point_unwind): Add prototype. + + * fileio.c (restore_point_unwind): Remove static attribute. + +2010-05-08 Kenichi Handa + + * ftfont.c (M17N_FLT_USE_NEW_FEATURE): Define it if we can use the + new feature of libotf and m17n-flt. + (ftfont_check_otf) [M17N_FLT_USE_NEW_FEATURE]: + Call OTF_check_features even if no specific feature is given. + (PACK_OTF_TAG) [M17N_FLT_USE_NEW_FEATURE]: New macro. + (ftfont_drive_otf) [M17N_FLT_USE_NEW_FEATURE]: Handle the case + that OUT is NULL. Use OTF_drive_gsub_with_log and + OTF_drive_gpos_with_log instead of OTF_drive_gsub and + OTF_drive_gpos. + (ftfont_try_otf) [M17N_FLT_USE_NEW_FEATURE]: New function. + (ftfont_shape_by_flt) [M17N_FLT_USE_NEW_FEATURE]: + Setup mflt_enable_new_feature and mflt_try_otf. + +2010-05-08 Jan Djärv + + * xsettings.c (Ftool_bar_get_system_style): Correct comment. + + * gtkutil.c (xg_pack_tool_bar): Change show_all to show for handle + box and toolbar (Bug #6139). + (xg_create_tool_bar): Remove comment (Bug #6139). + (xg_make_tool_item): Remove gtk_widget_show_all (Bug #6139). + (xg_show_toolbar_item): Add gtk_widget_show for weventbox (Bug #6139). + +2010-05-08 Juanma Barranquero + + * makefile.w32-in ($(BLD)/eval.$(O), $(BLD)/w32fns.$(O)): + Update dependencies. + +2010-05-08 Eli Zaretskii + + * fringe.c (update_window_fringes): Set up truncation bitmaps for + R2L lines. + +2010-05-08 Glenn Morris + + * Makefile.in (THIS_IS_MAKEFILE): Remove, unused. + + * Makefile.in (LIBS_TERMCAP): Set with configure, not cpp. + (TERMCAP_OBJ): New, set by configure, replacing termcapobj. + (termcapobj): Replace with TERMCAP_OBJ. + (otherobj): Use $TERMCAP_OBJ instead of $termcapobj. + (LIBES): Use LIBS_TERMCAP as a variable. + + * s/freebsd.h (osreldate.h): No longer include, since this file + does not use __FreeBSD_version any more. + + * s/aix4-2.h (TERMINFO): + * s/cygwin.h (TERMINFO): + * s/darwin.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: + * s/freebsd.h (TERMINFO, LIBS_TERMCAP): + * s/gnu-linux.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: + * s/gnu.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]: + * s/hpux10-20.h (TERMINFO, LIBS_TERMCAP): + * s/irix6-5.h (TERMINFO): + * s/netbsd.h (LIBS_TERMCAP): + * s/openbsd.h (TERMINFO, LIBS_TERMCAP): + * s/sol2-6.h (LIBS_TERMCAP) [!TERMINFO]: + * s/usg5-4.h (TERMINFO): + Move to configure. + +2010-05-07 Stefan Monnier + + * eval.c (unbind_to): Don't unbind a local binding into the global + binding when the local binding disappeared. Inversely, don't unbind + a global binding into a newly created local binding. + * data.c (set_internal): Make its `buf' arg into a `where' arg so we + can specify the frame to use, when applicable. Adjust callers. + +2010-05-07 Vincent Belaïche + Stefan Monnier + + * floatfns.c (Fisnan, Fcopysign, Ffrexp, Fldexp): New functions. + +2010-05-07 Eli Zaretskii + + * w32fns.c: Include w32.h. + (Fw32_shell_execute): Decode the error message before passing it + to `error'. (Bug#6126) + + * msdos.c (dos_set_window_size): + * w16select.c (Fx_selection_exists_p): Use `Fsymbol_value (foo)' + instead of `XSYMBOL (foo)->value'. + +2010-05-07 Eli Zaretskii + + Fix the MS-DOS build, broken by autoconfiscation. + + * Makefile.in: Don't use Make-style comments past the "start of + cpp stuff" line. + (MSDOS_OBJ): Remove xmenu.o (it is now defined by XMENU_OBJ). + + * s/msdos.h (UNEXEC): Don't define (@unexec@ in Makefile.in is + edited directly by msdos/sed1v2.inp). + +2010-05-07 Glenn Morris + + * Makefile.in (LD_SWITCH_SYSTEM): Set with configure, not cpp. + (LD_SWITCH_SYSTEM_EXTRA): New variable, set by configure. + (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM and $LD_SWITCH_SYSTEM_EXTRA, + move out of cpp section. + * s/freebsd.h (LD_SWITCH_SYSTEM): + * s/gnu-linux.h (LD_SWITCH_SYSTEM): + * s/netbsd.h (LD_SWITCH_SYSTEM): + * s/openbsd.h (LD_SWITCH_SYSTEM): Move to configure.in. + +2010-05-07 Dan Nicolaescu + + Define LIB_STANDARD and START_FILES using autoconf. + * s/usg5-4.h (LIB_STANDARD): + * s/netbsd.h (START_FILES): + * s/irix6-5.h (LIB_STANDARD): + * s/hpux10-20.h (LIB_STANDARD, START_FILES): + * s/gnu-linux.h (START_FILES, LIB_STANDARD): + * s/freebsd.h (START_FILES): + * s/darwin.h (START_FILES): + * s/cygwin.h (START_FILES): + * s/aix4-2.h (LIB_STANDARD): + * m/ibmrs6000.h (START_FILES): Remove, move logic to configure.in. + * Makefile.in (STARTFILES): Rename to START_FILES, define using + autoconf, not cpp. + +2010-05-06 Dan Nicolaescu + + Remove NEED_BSDTTY and NEED_UNISTD_H. + * s/hpux10-20.h (NEED_BSDTTY): Remove. + * s/aix4-2.h (NEED_UNISTD_H): Remove. + * systty.h: Simplify conditionals for including , + and . + + * emacs.c (main): Remove NO_DIR_LIBRARY conditional, unused. + + * Makefile.in (STARTFILES): Conditionally define to make the usage clear. + * s/gnu.h (START_FILES): Remove empty definition. + +2010-05-06 Jan Djärv + + * xterm.c (x_draw_image_relief): Move declaration of extra to beginning. + +2010-05-06 Glenn Morris + + * Makefile.in (CPP, LN_S): Remove unused variables. + +2010-05-05 Stefan Monnier + + * syntax.c (Fchar_syntax): Check the arg is a character (bug#6080). + +2010-05-05 Lawrence Mitchell + + * m/sparc.h: Fix typo in earlier change. + +2010-05-04 Stefan Monnier + + Misc tweaks. + * eval.c (Fdefvaralias): Remove unintended nested if. + (internal_condition_case_2, internal_condition_case_n): Use ANSI type. + +2010-05-04 Bernhard Herzog (tiny change) + + * xsmfns.c (smc_save_yourself_CB): strlen(client_id) => strlen(cwd). + +2010-05-04 Dan Nicolaescu + + Remove BSD_PGRPS. + * s/bsd-common.h (BSD_PGRPS): Remove undef. + * s/gnu-linux.h (BSD_PGRPS): Remove. + * term.c (dissociate_if_controlling_tty): + * sysdep.c (narrow_foreground_group, widen_foreground_group) + (init_sys_modes, reset_sys_modes): + * emacs.c (main): + * callproc.c (Fcall_process, child_setup): Remove code depending + on BSD_PGRPS. + + Remove POSIX_SIGNALS. + * s/usg5-4.h (POSIX_SIGNALS): + * s/netbsd.h (POSIX_SIGNALS): + * s/msdos.h (POSIX_SIGNALS): + * s/ms-w32.h (POSIX_SIGNALS): + * s/hpux11.h (POSIX_SIGNALS): + * s/gnu.h (POSIX_SIGNALS): + * s/gnu-linux.h (POSIX_SIGNALS): + * s/freebsd.h (POSIX_SIGNALS): + * s/darwin.h (POSIX_SIGNALS): + * s/cygwin.h (POSIX_SIGNALS): + * s/aix4-2.h (POSIX_SIGNALS): Remove definition. + * s/unixware.h: + * s/sol2-6.h: Remove comments on POSIX_SIGNALS. + * process.c (create_process): + * syssignal.h: + * sysdep.c (wait_for_termination, init_signals): + * process.c (create_process): + * msdos.c: POSIX_SIGNALS is always defined on all platforms, + remove all code that assumes the contrary. + +2010-05-04 Glenn Morris + + * s/gnu-linux.h (LD_SWITCH_SYSTEM): Use LD_SWITCH_X_SITE_AUX as a shell + variable. + * s/netbsd.h (LD_SWITCH_SYSTEM_tmp): Remove. + (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH. + * s/openbsd.h (LD_SWITCH_SYSTEM_tmp): Remove. + (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH instead of + LD_SWITCH_SYSTEM_tmp. + * Makefile.in (LD_SWITCH_X_SITE_AUX, LD_SWITCH_X_SITE_AUX_RPATH): + New variables, set by configure. + + * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in. + * s/darwin.h (HEADERPAD_EXTRA, LIBS_NSGUI): Remove. + (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in. + * Makefile.in (LD_SWITCH_SYSTEM_TEMACS): New variable, set by configure. + (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM_TEMACS. + + * s/aix4-2.h (C_SWITCH_SYSTEM): + * m/alpha.h (C_SWITCH_MACHINE): + Move to configure.in. + * Makefile.in (C_SWITCH_MACHINE, C_SWITCH_SYSTEM): + New variables, set by configure. + (ALL_CFLAGS): Use $C_SWITCH_MACHINE and $C_SWITCH_SYSTEM in place of + $c_switch_machine and $c_switch_system. + +2010-05-04 Dan Nicolaescu + + * s/hpux10-20.h (LIB_STANDARD): New definition. + * Makefile.in (ORDINARY_LINK): Remove setting LIB_STANDARD based + on it, not used anymore. + +2010-05-03 Chong Yidong + + * eval.c (internal_condition_case_n): Rename from + internal_condition_case_2. + (internal_condition_case_2): New function. + + * xdisp.c (safe_call): Use internal_condition_case_n. + + * fileio.c (Fdelete_file, internal_delete_file): New arg FORCE. + (internal_delete_file, Frename_file): Callers changed. + + * buffer.c (Fkill_buffer): + * callproc.c (delete_temp_file): Callers changed (Bug#6070). + + * lisp.h: Update prototypes. + +2010-05-03 Glenn Morris + + * Makefile.in (LIBX_EXTRA, LIBX_BASE): New variables. + (LIBXT_OTHER, LIBX_OTHER): New, set by configure. + (LIBXT): Set with configure, not cpp. + (LIBX): Remove. + (LIBES): Replace $LIBX with $LIBX_BASE and $LIBX_OTHER. + +2010-05-02 Dan Nicolaescu + + * m/amdx86-64.h (START_FILES, LIB_STANDARD): Remove. + The FreeBSD is not needed, the default works, Solaris version is + not needed, and the remaining case is not supported by configure. + +2010-05-02 Jan Djärv + + * xsmfns.c (CHDIR_OPT): New define. + (smc_save_yourself_CB): Add CHDIR_OPT to options to use when + restarting emacs. + + * xterm.c (x_connection_closed): Call Fkill_emacs instead of + shut_down_emacs. + + * emacs.c (USAGE1): Mention --chdir. + (main): Handle --chdir. + (standard_args): Add --chdir. + (fatal_error_signal): Call Fkill_emacs for SIGTERM and SIGHUP (Bug + #5552). + +2010-05-01 Dan Nicolaescu + + Remove LD_SWITCH_MACHINE. + * Makefile.in (LD_SWITCH_MACHINE): Remove definition, unused. + (TEMACS_LDFLAGS): Do not use LD_SWITCH_MACHINE. + + Clean up IRIX code. + * m/iris4d.h (TERMINFO, FIRST_PTY_LETTER): Move definitions ... + * s/irix6-5.h (TERMINFO, FIRST_PTY_LETTER): ... here. + + Clean up AIX code. + * m/ibmrs6000.inp: Remove file, unused. + * m/ibmrs6000.h (IBMR2AIX): Remove, unused. + (LD_SWITCH_MACHINE): Rename to LD_SWITCH_SYSTEM_TEMACS, and move + definition ... + * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): ... here. + + * sysdep.c (child_setup_tty, init_sys_modes): Remove !IBMR2AIX code, + unused. + +2010-05-01 Eli Zaretskii + + Emulate POSIX_SIGNALS on MS-Windows. + + * s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK) + (SIG_SETMASK, SIG_UNBLOCK): Define. + + * sysdep.c (sys_signal) [WINDOWSNT]: #ifdef away. + (wait_for_termination) [WINDOWSNT]: Move MS-Windows specific code + from non-POSIX_SIGNALS section to POSIX_SIGNALS section. + + * w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask): + New stubs. + + Miscellaneous fixes of bidi display. + + * xdisp.c (find_row_end): New function, refactored from display_line. + (display_line): Use it. + (extend_face_to_end_of_line): In almost-filled rows, extend only + if the row is R2L and not continued. + (display_line): Fix prepending of truncation glyphs to R2L rows. + Preserve overlay and string info in row->end. + (insert_left_trunc_glyphs): Support addition of left truncation + glyphs to R2L rows. + (set_cursor_from_row): Don't place cursor on the vertical border + glyph between adjacent windows. Fix a crash when a display string + is continued to the next line. Don't return zero if cursor was + found by `cursor' property of a display string. + (try_cursor_movement): Don't assume that row->end == (row+1)->start, + test for that explicitly. + +2010-05-01 Glenn Morris + + * Makefile.in (gmallocobj, rallocobj, vmlimitobj): Initialize to null, + for clarity. + (OTHER_OBJ): Remove. + (PRE_ALLOC_OBJ, POST_ALLOC_OBJ): New, set by configure. + (otherobj): Use PRE_ALLOC_OBJ, POST_ALLOC_OBJ rather than OTHER_OBJ. + +2010-05-01 Karel Klíč + + * fileio.c (Ffile_selinux_context): Context functions may return null. + +2010-04-30 Dan Nicolaescu + + * s/gnu.h (POSIX_SIGNALS, START_FILES): New definitions. + +2010-04-30 Glenn Morris + + * Makefile.in (vmlimitobj) [!SYSTEM_MALLOC]: New variable. (Bug#6065) + (OTHER_OBJ): Define as a separate variable, for clarity. + +2010-04-30 Jan Djärv + + * xsettings.c: include limits.h and update file comment. + +2010-04-30 Glenn Morris + + * Makefile.in (OLDXMENU, LIBXMENU) [HAVE_MENUS]: + Set with configure, not cpp. + (LIBW): Remove, replace with $TOOLKIT_LIBW. + + * Makefile.in (mallocobj): Remove. + (otherobj): Simplify using @OTHER_OBJ@. + + * Makefile.in (dispnew.o, frame.o, fringe.o, font.o, fontset.o) + (keyboard.o, window.o, xdisp.o, xfaces.o, menu.o): + Don't bother making nsgui.h dependency platform-specific. + + * Makefile.in (nsfns.o): Remove duplicate nsgui.h dependency. + +2010-04-29 Stefan Monnier + + * process.c (read_process_output, exec_sentinel): Don't burp if the + sentinel/filter kills the current buffer (bug#6060). + + Fix wrong-docstring problem introduced with hash-consing. (Bug#6008) + * eval.c (Fautoload): Set doc to a unique number rather than to 0. + Remove unused var `args'. + * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove. + (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers. + * doc.c (store_function_docstring): Use XSETCAR. + +2010-04-28 Glenn Morris + + * Makefile.in (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT): New variables. + (WINDOW_SUPPORT) [HAVE_WINDOW_SYSTEM]: Use them. + + * Makefile.in (CYGWIN_OBJ): Set with configure, not cpp. + + * Makefile.in (GPM_MOUSE_SUPPORT): New, set by configure. + (MOUSE_SUPPORT) [!HAVE_MOUSE]: Use $GPM_MOUSE_SUPPORT. + + * Makefile.in (FONT_OBJ): New, set by configure. + (FONT_DRIVERS): Use $FONT_OBJ. + + * Makefile.in (LIBXMU): Set with configure, not cpp. + * s/aix4-2.h (LIBXMU): + * s/hpux10-20.h (LIBXMU): + Remove definition, now set in configure. + + * Makefile.in (NS_OBJ, NS_SUPPORT): Set with configure, not cpp. + + * m/amdx86-64.h [i386]: Move this test to configure.in. + +2010-04-27 Glenn Morris + + * Makefile.in (LIBXTR6): Set with configure, not cpp. + * s/unixware.h (NEED_LIBW): Remove definition. + + * Makefile.in (LUCID_LIBW, MOTIF_LIBW): Remove, replacing by... + (TOOLKIT_LIBW): New, set by configure. + (@X_TOOLKIT_TYPE@): No longer define it. + + * Makefile.in (LIBXP): Remove, since included in MOTIF_LIBW. + (MOTIF_LIBW): Set with configure, not cpp. + * s/aix4-2.h (LIB_MOTIF): + * s/gnu-linux.h (LIB_MOTIF): + * s/unixware.h (LIB_MOTIF): Move to configure.in. + +2010-04-27 Dan Nicolaescu + + Reduce CPP usage. + * Makefile.in (LIB_X11_LIB): Remove, inline in the only user. + (obj): Use autoconf for unexec instead of cpp. + (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove + definitions and undefs. Inline definitions in the only user. + (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf. + +2010-04-27 Glenn Morris + + * m/amdx86-64.h (START_FILES, LIB_STANDARD): Change the logic around, + since the defaults (set by the system file) are fine in most cases. + [GNU_LINUX, __OpenBSD__, __NetBSD__, __APPLE__]: Remove sections. + * m/ibms390x.h (START_FILES, LIB_STANDARD): + * m/macppc.h (START_FILES, LIB_STANDARD) [GNU_LINUX]: + * m/sparc.h (START_FILES, LIB_STANDARD) [__linux__]: + Remove definitions, since they are set correctly in s/gnu-linux.h. + * s/freebsd.h (START_FILES, LIB_STANDARD): + * s/gnu-linux.h (START_FILES, LIB_STANDARD): + * s/hpux10-20.h (START_FILES): + * s/netbsd.h (START_FILES, LIB_STANDARD, START_FILES_1, END_FILES_1): + Use $CRT_DIR in place of fixed /usr/lib, /lib directories. + + * Makefile.in (LIBXP, LUCID_LIBW, WIDGET_OBJ): Set via configure. + (MOTIF_LIBW): Use $LIBXP. + (otherobj): Use $WIDGET_OBJ. + +2010-04-26 Dan Nicolaescu + + * Makefile.in (LIBS_MACHINE): Remove, unused. + + Use autoconf instead of cpp for LIB_MATH. + * s/darwin.h (LIB_MATH): Do not define here, move to configure. + * s/cygwin.h (LIB_MATH): Likewise. + * Makefile.in (LIB_MATH): Do not define with cpp. + (LIBES): Use autoconf for LIB_MATH. + +2010-04-26 Kenichi Handa + + * composite.c (Ffind_composition_internal): Fix the return value + for an automatic composition. + +2010-04-25 Dan Nicolaescu + + Remove all NO_ARG_ARRAY uses. + * fns.c (concat2, concat3, nconc2): + * eval.c (apply1, call1, call2, call3, call4, call5, call6) + (call7): Remove NO_ARG_ARRAY usage, assume it's always true. + * m/xtensa.h (NO_ARG_ARRAY): + * m/template.h (NO_ARG_ARRAY): + * m/sparc.h (NO_ARG_ARRAY): + * m/sh3.h (NO_ARG_ARRAY): + * m/mips.h (NO_ARG_ARRAY): + * m/macppc.h (NO_ARG_ARRAY): + * m/iris4d.h (NO_ARG_ARRAY): + * m/intel386.h (NO_ARG_ARRAY): + * m/ibms390x.h (NO_ARG_ARRAY): + * m/ibms390.h (NO_ARG_ARRAY): + * m/ibmrs6000.h (NO_ARG_ARRAY): + * m/ia64.h (NO_ARG_ARRAY): + * m/hp800.h (NO_ARG_ARRAY): + * m/arm.h (NO_ARG_ARRAY): + * m/amdx86-64.h (NO_ARG_ARRAY): + * m/alpha.h (NO_ARG_ARRAY): Remove definition. + +2010-04-25 Eli Zaretskii + + * xdisp.c (display_line): Don't assume 2nd call to + get_next_display_element cannot return zero. (Bug#6030) + (iterate_out_of_display_property): New function, body from pop_it. + (pop_it): Use it. + +2010-04-24 Glenn Morris + + * m/amdx86-64.h (START_FILES, LIB_STANDARD) [__OpenBSD__]: + For clarity, revert to using fixed /usr/lib rather than $CRT_DIR. + (START_FILES, LIB_STANDARD) [__FreeBSD__]: Merge into the generic case, + since CRT_DIR defaults to /usr/lib. Suggested by Dan Nicolaescu. + +2010-04-24 Eli Zaretskii + + * xdisp.c (display_line): Use `reseat' instead of `reseat_1', and + use `get_next_display_element' and `set_iterator_to_next' to + advance to the next character, when looking for the character that + begins the next row. + + * .gdbinit: Add a "set Fmake_symbol" line to force GDB to load the + definition of "struct Lisp_Symbol". + +2010-04-24 Glenn Morris + + * Makefile.in (CRT_DIR): New variable, set by configure. + * m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD): + Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655) + +2010-04-23 Dan Nicolaescu + + * Makefile.in: Remove C_SWITCH_X_MACHINE, unused. + + * s/cygwin.h (LIBS_DEBUG): Remove, unused. + + Remove redundant flags. + * s/freebsd.h (C_SWITCH_SYSTEM): + * s/hpux10-20.h (C_SWITCH_X_SYSTEM, LD_SWITCH_X_DEFAULT): + * s/netbsd.h (C_SWITCH_SYSTEM): + * s/openbsd.h (LD_SWITCH_X_DEFAULT): Remove, configure takes care + of these. + + Simplify m/intel386.h. + * m/intel386.h (CRT0_DUMMIES): Remove, inline value in the only + user: ecrt0.c. + (SOLARIS2): Remove LOAD_AVE_TYPE, LOAD_AVE_CVT, LIBS_MACHINE, unused. + (USG5_4): Move LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE definitions to + the only user: s/unixware.h. + * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition + from m/intel386.h. + * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions + moved here from m/intel386.h. + + * m/mips.h: Remove #if 0 code. + +2010-04-23 Eli Zaretskii + + Fix display of composed characters from L2R scripts in bidi buffers. + * xdisp.c (set_iterator_to_next, next_element_from_composition): + After advancing IT past the composition, resync the bidi iterator + with IT's position. (Bug#5977) + +2010-04-23 Dan Nicolaescu + + * Makefile.in (LD_SWITCH_MACHINE_TEMACS): Remove, unused. + (TEMACS_LDFLAGS): Don't use LD_SWITCH_SYSTEM_TEMACS. + +2010-04-23 Stefan Monnier + + * gtkutil.c: Include xsettings.h for Ftool_bar_get_system_style. + +2010-04-23 Eli Zaretskii + + Support `display' text properties and overlay strings in bidi buffers. + * xdisp.c (pop_it): When the stack is popped after displaying + from a string, bidi-iterate to exit from the text portion covered + by the `display' property or overlay. (Bug#5988, bug#5920) + +2010-04-23 Dan Nicolaescu + + * m/macppc.h (LD_SWITCH_SYSTEM_TEMACS): Remove #undef. + (LD_SWITCH_MACHINE_TEMACS): Remove, configure sets nocombreloc. + + * s/netbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure sets nocombreloc. + * s/openbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove. + + Simplify STARTFILES definition. + * s/hpux10-20.h (START_FILES): Explicitly define here instead of + relying on Makefile.in to define it. + * s/cygwin.h (START_FILES): Likewise. + * Makefile.in (STARTFILES): Remove conditional code, not needed anymore. + + Clean up Solaris code. + * s/sol2-6.h (LD_SWITCH_SYSTEM_TEMACS, C_SWITCH_X_SYSTEM) + (LIB_MOTIF): Remove, configure takes care of this. + (NOT_USING_MOTIF): Remove, unused. + * xrdb.c: Remove #if 0-ed #include. + (SYSV): Remove conditional for old SysV. + * sysdep.c (closedir): Remove conditional code for Solaris, + Solaris has closedir. + +2010-04-22 Jan Djärv + + * xsettings.c (read_and_apply_settings): Check if current_font is + NULL before strcmp (Bug#6001). + +2010-04-21 Dan Nicolaescu + + Clean up HP-UX files. + * m/hp800.h (NO_REMAP, VIRT_ADDR_VARIES, DATA_SEG_BITS) + (DATA_START, TEXT_START, LOAD_AVE_TYPE, LOAD_AVE_CVT) + (LDAV_SYMBOL, index, rindex): Move definitions only used in HP-UX ... + * s/hpux10-20.h: ... to the only user, here. + +2010-04-21 Eli Zaretskii + + * bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't + use buffer-local values of paragraph-start and paragraph-separate. + : Rename from + fallback_paragraph_start_re and fallback_paragraph_separate_re. + (Bug#5992) + +2010-04-21 Jan Djärv + + * xsettings.c: Qmonospace_font_name, Qtool_bar_style and + current_tool_bar_style are new. + (store_config_changed_event): Rename from store_font_changed_event. + (XSETTINGS_TOOL_BAR_STYLE): New define. + (SEEN_FONT, SEEN_TB_STYLE): New enum values. + (struct xsettings): Add font and tb_style, set xft stuff inside #ifdef + HAVE_XFT. + (something_changedCB): store_font_changed_event is now + store_config_changed_event + (parse_settings): Rename from parse_xft_settings. Read + non-xft xsettings outside #ifdef HAVE_XFT. + (read_settings): Renamed from read_xft_settings. + (apply_xft_settings): Take current settings as parameter. Do not + call read_(xft)_settings. + (read_and_apply_settings): New function. + (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call + read_and_apply_settings if there are settings to be read. + (init_xsettings): Renamed from init_xfd_settings. + Call read_and_apply_settings unconditionally. + (xsettings_initialize): Call init_xsettings. + (Ftool_bar_get_system_style): New function. + (syms_of_xsettings): Define Qmonospace_font_name and + Qtool_bar_style. Initialize current_tool_bar_style to nil. + defsubr Stool_bar_get_system_style. Fprovide on + dynamic-setting. + Move misplaced HAVE_GCONF + + * xsettings.h (Ftool_bar_get_system_style): Declare. + + * xdisp.c: Vtool_bar_style, tool_bar_max_label_size, + Qtext, Qboth, Qboth_horiz are new. + (syms_of_xdisp): Intern Qtext, Qboth, Qboth_horiz, DEFVAR + Vtool_bar_style, tool_bar_max_label_size. + + * lisp.h: Extern declare Qtext, Qboth, Qboth_horiz. + + * keyboard.c: QClabel is new. + (parse_tool_bar_item): Take out QClabel from tool bar items. + Try to construct a label if ther is no QClabel. + (syms_of_keyboard): Intern :label as QClabel. + + * dispextern.h (tool_bar_item_idx): TOOL_BAR_ITEM_LABEL is new. + (Vtool_bar_style, tool_bar_max_label_size, DEFAULT_TOOL_BAR_LABEL_SIZE): + New. + + * Makefile.in (SOME_MACHINE_LISP): font-setting.el renamed to + dynamic-setting.el. + + * gtkutil.c (xg_tool_bar_menu_proxy): Handle label in tool bar item. + (xg_make_tool_item, xg_show_toolbar_item): New function. + (update_frame_tool_bar): Take label from TOOL_BAR_ITEM_LABEL. + Call xg_make_tool_item to make a tool bar item. + Call xg_show_toolbar_item. Use wtoolbar instead of x->toolbar_widget. + + * xterm.c (x_draw_image_relief): Take Vtool_bar_button_margin + into account for toolbars. + +2010-04-21 Jan Djärv + + * data.c (make_blv): Declarations before code (Bug#5993). + +2010-04-21 Glenn Morris + + * Makefile.in (DBUS_OBJ, GTK_OBJ, XMENU_OBJ, XOBJ): + Define using autoconf, not cpp. + (LIBXSM): New variable, set by autoconf. + (LIBXT): Use $LIBXSM. + +2010-04-21 Dan Nicolaescu + + Remove NOMULTIPLEJOBS, unused. + * s/template.h (NOMULTIPLEJOBS): + * s/msdos.h (NOMULTIPLEJOBS): Remove, unused. + + Simplify LD_SWITCH_SYSTEM_TEMACS usage. + * s/freebsd.h (LD_SWITCH_SYSTEM_TEMACS): + * s/gnu-linux.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure + detects -znocombreloc and passes it to the linker + * s/hpux10-20.h (LD_SWITCH_SYSTEM_TEMACS): Remove, empty. + +2010-04-21 Glenn Morris + + * Makefile.in (LIBSELINUX_LIBS): Move out of #ifdef. + +2010-04-21 Karel Klíč + + * Makefile.in (LIBSELINUX_LIBS): New. + (LIBES): Add $LIBSELINUX_LIBS. + * eval.c, lisp.h (call7): New function. + * fileio.c [HAVE_LIBSELINUX]: Include selinux headers. + (Ffile_selinux_context, Fset_file_selinux_context): + New functions. + (Fcopy_file): New parameter preserve-selinux-context. + (Frename_file): Preserve selinux context when renaming by copy-file. + +2010-04-21 Juanma Barranquero + Eli Zaretskii + + Don't depend on cm.c or termcap.c on Windows, use stubs. + * makefile.w32-in (OBJ1): Remove cm.$(O) and termcap.$(O). + ($(BLD)/cm.$(O), $(BLD)/termcap.$(O)): Remove. + * w32console.c (current_tty, cost): New vars; lifted from cm.c. + (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear) + (sys_tputs, sys_tgetstr): New stubs. + * s/ms-w32.h (chcheckmagic, cmcostinit, cmgoto, cmputc, Wcm_clear) + (tputs, tgetstr): New; define to sys_*. + +2010-04-20 Juanma Barranquero + + * buffer.c (syms_of_buffer) : Doc fix. + +2010-04-20 Stefan Monnier + + * data.c (Fmake_variable_buffer_local, Fmake_local_variable): + Just signal a warning rather than an error when inside a let. + (Fmake_variable_frame_local): Add the same test. + + * font.c (syms_of_font): Make the style table vars read-only. + + * buffer.h (struct buffer): Remove unused var `direction_reversed'. + * buffer.c (init_buffer_once, syms_of_buffer): Remove its initialization. + + * bidi.c (bidi_initialize): Simplify fallback_paragraph_*_re init. + +2010-04-20 Eli Zaretskii + + Fix R2L paragraph display on TTY. + + * xdisp.c (unproduce_glyphs): New function. + (display_line): Use it when produced glyphs are discarded from R2L + glyph rows. + (append_composite_glyph): In R2L rows, prepend the glyph rather + than appending it. + + * term.c (append_composite_glyph): In R2L rows, prepend the glyph + rather than append it. Set up the resolved_level and bidi_type + attributes of the appended glyph. + (produce_special_glyphs): Mirror the backslash continuation + character in R2L lines. + + Implement display of R2L paragraphs in GUI sessions. + + * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for + append_stretch_glyph. + (set_cursor_from_row) : Remove unused variable. Fix + off-by-one error in computing x at end of text in the row. + (append_stretch_glyph): In reversed row, prepend the glyph rather + than append it. Set resolved_level and bidi_type of the glyph. + (extend_face_to_end_of_line): If the row is reversed, prepend a + stretch glyph whose width is such that the rightmost glyph will be + drawn at the right margin of the window. Fix off-by-one error on + TTY frames in testing whether a line needs face extension. Fix + face extension at ZV. If this is the last glyph row, use + DEFAULT_FACE_ID, to avoid painting the rest of the window with the + region face. + (set_cursor_from_row, display_line): Use + MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of + row->continuation_lines_width. + (next_element_from_buffer): Don't call bidi_paragraph_init if we + are at ZV. Fixes a crash when reseated to ZV by + try_window_reusing_current_matrix. + (display_and_set_cursor, erase_phys_cursor): Handle negative HPOS, + which happens with R2L glyph rows. Fixes a crash when inserting a + character at end of an R2L line. + (set_cursor_from_row): Don't be fooled by truncated rows: don't + treat them as having zero-width characters. Improve comments. + Don't reverse pos_before and pos_after for reversed glyph rows. + Set cursor.x to negative value when the cursor might be on the + left fringe. + (IT_OVERFLOW_NEWLINE_INTO_FRINGE): For R2L lines, consider the + left fringe, not the right one. + (notice_overwritten_cursor, draw_phys_cursor_glyph) + (erase_phys_cursor): For reversed cursor_row, support cursor on + the left fringe. + + * fringe.c (update_window_fringes): For R2L rows, swap the bitmaps + of continuation indicators on the fringes. + (draw_fringe_bitmap): For reversed glyph rows, allow cursor on the + left fringe. + + * w32term.c (w32_draw_window_cursor): For reversed glyph rows, + draw cursor on the left fringe. + + * xterm.c (x_draw_window_cursor): For reversed glyph rows, draw + cursor on the left fringe. + + * dispnew.c (update_text_area): Handle reversed desired rows when + the cursor is on the left fringe. + (set_window_cursor_after_update): Limit cursor's hpos by -1 from + below, not by 0, for when the cursor is on the left fringe. + +2010-04-20 Jan Djärv + + * gtkutil.c (xg_event_is_for_scrollbar): Check if grabbed + widget is a scrollbar. + +2010-04-20 Kenichi Handa + + * charset.c (char_charset): Consider Vcharset_non_preferred_head + only when the arg CHARSET_LIST is nil. + +2010-04-20 Stefan Monnier + + Make variable forwarding explicit rather the using special values. + Basically, this makes the structure of buffer-local values and object + forwarding explicit in the type of Lisp_Symbols rather than use + special Lisp_Objects for that. This tends to lead to slightly more + verbose code, but is more C-like, simpler, and makes it easier to make + sure we handled all cases, among other things by letting the compiler + help us check it. + * lisp.h (enum Lisp_Misc_Type, union Lisp_Misc): + Removing forwarding objects. + (enum Lisp_Fwd_Type, enum symbol_redirect, union Lisp_Fwd): New types. + (struct Lisp_Symbol): Make the various forms of variable-forwarding + explicit rather than hiding them inside Lisp_Object "values". + (XFWDTYPE): New macro. + (XINTFWD, XBOOLFWD, XOBJFWD, XKBOARD_OBJFWD): Redefine. + (XBUFFER_LOCAL_VALUE): Remove. + (SYMBOL_VAL, SYMBOL_ALIAS, SYMBOL_BLV, SYMBOL_FWD, SET_SYMBOL_VAL) + (SET_SYMBOL_ALIAS, SET_SYMBOL_BLV, SET_SYMBOL_FWD): New macros. + (SYMBOL_VALUE, SET_SYMBOL_VALUE): Remove. + (struct Lisp_Intfwd, struct Lisp_Boolfwd, struct Lisp_Objfwd) + (struct Lisp_Buffer_Objfwd, struct Lisp_Kboard_Objfwd): + Remove the Lisp_Misc_* header. + (struct Lisp_Buffer_Local_Value): Redefine. + (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): New macros. + (struct Lisp_Misc_Any): Add filler to get the right size. + (struct Lisp_Free): Use struct Lisp_Misc_Any rather than struct + Lisp_Intfwd. + (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT) + (DEFVAR_KBOARD): Allocate a forwarding object. + * data.c (do_blv_forwarding, store_blv_forwarding): New macros. + (let_shadows_global_binding_p): New function. + (union Lisp_Val_Fwd): New type. + (make_blv): New function. + (swap_in_symval_forwarding, indirect_variable, do_symval_forwarding) + (store_symval_forwarding, swap_in_global_binding, Fboundp) + (swap_in_symval_forwarding, find_symbol_value, Fset) + (let_shadows_buffer_binding_p, set_internal, default_value) + (Fset_default, Fmake_variable_buffer_local, Fmake_local_variable) + (Fkill_local_variable, Fmake_variable_frame_local) + (Flocal_variable_p, Flocal_variable_if_set_p) + (Fvariable_binding_locus): + * xdisp.c (select_frame_for_redisplay): + * lread.c (Fintern, Funintern, init_obarray, defvar_int) + (defvar_bool, defvar_lisp_nopro, defvar_lisp, defvar_kboard): + * frame.c (store_frame_param): + * eval.c (Fdefvaralias, Fuser_variable_p, specbind, unbind_to): + * bytecode.c (Fbyte_code) : Adapt to the new symbol + value structure. + * buffer.c (PER_BUFFER_SYMBOL): Move from buffer.h. + (clone_per_buffer_values): Only adjust markers into the current buffer. + (reset_buffer_local_variables): PER_BUFFER_IDX is never -2. + (Fbuffer_local_value, set_buffer_internal_1) + (swap_out_buffer_local_variables): + Adapt to the new symbol value structure. + (DEFVAR_PER_BUFFER): Allocate a Lisp_Buffer_Objfwd object. + (defvar_per_buffer): Take a new arg for the fwd object. + (buffer_lisp_local_variables): Return a proper alist (different fix + for bug#4138). + * alloc.c (Fmake_symbol): Use SET_SYMBOL_VAL. + (Fgarbage_collect): Don't handle buffer_defaults specially. + (mark_object): Handle new symbol value structure rather than the old + special Lisp_Misc_* objects. + (gc_sweep) : Free also the buffer-local-value objects. + * term.c (set_tty_color_mode): + * bidi.c (bidi_initialize): Don't access the ->value field directly. + * buffer.h (PER_BUFFER_VAR_OFFSET): Don't bother with + a buffer_local_flags. + * print.c (print_object): Get rid of impossible forwarding objects. + +2010-04-19 Eli Zaretskii + + * bidi.c (bidi_get_type, bidi_get_category) + (bidi_at_paragraph_end, bidi_resolve_weak, bidi_resolve_neutral) + (bidi_type_of_next_char, bidi_level_of_next_char): + Declare static. Use `INLINE' rather than `inline'. + +2010-04-19 Juanma Barranquero + + * dired.c (Ffile_attributes): Fix typo in docstring. + +2010-04-19 Adrian Robert + + * nsmenu.m (EmacsDialog-runDialogAt:): Declare ret as + NSInteger (Bug#5811). + +2010-04-19 YAMAMOTO Mitsuharu + + * s/darwin.h (PTY_ITERATION, PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF) + (PTY_OPEN): New defines. Use openpty (Bug#726, Bug#5819). + +2010-04-19 YAMAMOTO Mitsuharu + + * frame.h (FRAME_LINE_TO_PIXEL_Y): Add missing parenthesis. + +2010-04-19 Chong Yidong + + * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for + terminal frames (Bug#5837). + +2010-04-19 Eli Zaretskii + + * .gdbinit (xsubchartable): New command. + +2010-04-19 Eli Zaretskii + + * xdisp.c (display_line): Don't write beyond the last glyph row in + the desired matrix. Fixes a crash in "emacs -nw" (bug#5972), see + http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00075.html + and + http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00213.html + +2010-04-18 Stefan Monnier + + * alloc.c (Fpurecopy): Hash-cons if requested. + (syms_of_alloc): Update purify-flag docstring. + +2010-04-18 Jan Djärv + + * gtkutil.c (xg_set_geometry): Set size in geometry string also. + (x_wm_set_size_hint): Set USER_POS in hint_flags (Bug#5968). + +2010-04-17 Eli Zaretskii + + Fix a crash when an NSM character is inserted at BEGV. + + * bidi.c (bidi_init_it): Fix initialization of bidi_it->prev. + (bidi_resolve_weak): Don't use prev.type_after_w1 if it is + NEUTRAL_B or UNKNOWN_BT. + +2010-04-16 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Don't consider possibility of + other rows with cursor unless they are different from this row and + this row is part of a continued line. (Bug#5943) + +2010-04-16 Dan Nicolaescu + + * s/freebsd.h: Restore osreldate.h include. + Suggested by Naohiro Aota. + +2010-04-16 Jan Djärv + + * xmenu.c (apply_systemfont_to_menu): *childs was incorrectly used. + +2010-04-16 Ken Brown (tiny change) + + * s/cygwin.h: Avoid linking against static libgcc. + +2010-04-15 Juri Linkov + + * window.c: Add Qscroll_command. + Remove Vscroll_preserve_screen_position_commands. + (window_scroll_pixel_based, window_scroll_line_based): Check the + `scroll-command' property on the last command instead of searching + the last command in Vscroll_preserve_screen_position_commands. + (syms_of_window): Initialize and staticpro `Qscroll_command'. + Put Qscroll_command property on Qscroll_up and Qscroll_down. + (scroll-preserve-screen-position): Doc fix. + (Vscroll_preserve_screen_position_commands): Remove variable. + +2010-04-15 Dan Nicolaescu + + * xdisp.c (message): Do not use NO_ARG_ARRAY. + 2010-04-14 Dan Nicolaescu Reduce cpp use in Makefile.in. @@ -62,7 +1096,8 @@ 2010-04-12 Dan Nicolaescu - * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): Undefine. + * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): + Undefine. 2010-04-11 Dan Nicolaescu @@ -136,10 +1171,10 @@ (parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that in current_font. (init_gconf): Read value of SYSTEM_FONT and save it in current_font. - (Ffont_get_system_normal_font, xsettings_get_system_normal_font): New - functions. - (syms_of_xsettings): Initialize current_font. defsubr - Sfont_get_system_normal_font. + (Ffont_get_system_normal_font, xsettings_get_system_normal_font): + New functions. + (syms_of_xsettings): Initialize current_font. + defsubr Sfont_get_system_normal_font. * xsettings.h (Ffont_get_system_normal_font, xsettings_get_system_normal_font): Declare. @@ -284,6 +1319,11 @@ (gif_load): Put GIF extension data to the property `Qextension_data'. +2010-04-05 Chong Yidong + + * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for + terminal frames (Bug#5837). + 2010-03-31 Chong Yidong * nsfns.m (ns_set_doc_edited): Remove unused arg OLDVAL. @@ -2761,7 +3801,7 @@ * xterm.h: Rename x_non_menubar_window_to_frame to x_menubar_window_to_frame. - * xterm.c: Remove declarations also in xterm.h + * xterm.c: Remove declarations also in xterm.h. (XTmouse_position): Do not return valid positions for clicks in the menubar and the toolbar for Gtk+. @@ -3321,7 +4361,7 @@ 2009-07-04 Eli Zaretskii Emulation of `getloadavg' on MS-Windows. - * w32.c: Include float.h + * w32.c: Include float.h. (g_b_init_get_native_system_info, g_b_init_get_system_times) (GetNativeSystemInfo_Proc, GetSystemTimes_Proc): Declare. (get_native_system_info, get_system_times): New functions. @@ -7913,7 +8953,7 @@ : Reflow docstrings. 2008-08-04 Adrian Robert - Ken Raeburn + Ken Raeburn Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes. @@ -8978,7 +10018,7 @@ batch-compiling for bootstrap). 2008-07-15 Chris Hall (tiny change) - YAMAMOTO Mitsuharu + YAMAMOTO Mitsuharu (make_initial_frame): Call init_frame_faces(f) in CANNOT_DUMP case -- fix crash due to different init order. @@ -9267,7 +10307,7 @@ 2008-07-10 Dan Nicolaescu * fileio.c: - * sysdep.c + * sysdep.c: * systty.h: * m/ibmrs6000.h: * m/iris4d.h: @@ -9596,7 +10636,7 @@ (USG_SHARED_LIBRARIES): Remove duplicate definition. 2008-06-26 Juanma Barranquero - Eli Zaretskii + Eli Zaretskii * makefile.w32-in (LOCAL_FLAGS): Don't include WINDOWSNT, DOS_NT and _UCHAR_T. @@ -9844,7 +10884,7 @@ the property of LFACE_FONT of LFACE (if any). 2008-06-21 Seiji Zenitani - Ryo Yoshitake + Ryo Yoshitake * xterm.c (x_set_frame_alpha): Add x_catch_errors for bug#437. @@ -10940,7 +11980,7 @@ * xterm.c (x_set_frame_alpha): Move declarations before statements. 2008-05-21 Seiji Zenitani - Ryo Yoshitake + Ryo Yoshitake * frame.c (Qalpha): Add a new frame parameter `alpha'. (Vframe_alpha_lower_limit): New variable. diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.1 --- a/src/ChangeLog.1 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.1 Thu May 13 15:13:52 2010 +0200 @@ -1187,7 +1187,7 @@ prompt. (various): Pass window being displayed as arg to vmotion. (various): Compute starting-hpos arg to compute_motion - using minibuf_prompt_width if in minibuf starting at top. + using minibuf_prompt_width if in minibuf starting at top. * window.c (Fdisplay_buffer & callers): Take second arg, non-nil means do not use selected window @@ -1645,8 +1645,8 @@ Use signal, not sigset, since we simulate signal on all system versions when nec. - * buffer.c (syms_of_buffer, init_buffer_once, - reset_buffer_local_variables): + * buffer.c (syms_of_buffer, init_buffer_once) + (reset_buffer_local_variables): Define default-abbrev-mode, and init new buffers' abbrev-mode from it. Move definition of abbrev-mode here from abbrev.c. @@ -2861,7 +2861,7 @@ * keymap.c, callint.c, minibuf.c, fns.c, commands.h: Rename MinbufLocalMap to Vminibuffer_local_map, etc. Rename minibuf-local-{,-ns,-completion,must-match}map, - and DefLispVar them (document even!). + and DefLispVar them (document even!). => New lisp variables minibuffer-local-map, minibuffer-local-ns-map, minibuffer-local-completion-map, minibuffer-local-must-match-map. diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.2 --- a/src/ChangeLog.2 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.2 Thu May 13 15:13:52 2010 +0200 @@ -984,7 +984,7 @@ 1988-01-06 Richard Stallman (rms@frosted-flakes) * s-hpux.h: Don't define nomultiplejobs, LDAV_SYMBOL, LIBS_DEBUG - or BROKEN_FIONREAD. + or BROKEN_FIONREAD. * m-hp9000s300.h: Define those four. * s-hpux.h: Define BSTRING, and define bcopy, etc., as macros. @@ -2817,7 +2817,7 @@ 1986-11-26 Richard M. Stallman (rms@prep) * sysdep.c (get_system_name): - Eliminate internal static var in USG case. + Eliminate internal static var in USG case. * lisp.h: New case testing and conversion macros UPPERCASEP, LOWERCASEP, NOCASEP, UPCASE, DOWNCASE. @@ -3852,7 +3852,7 @@ (so now (let ((case-fold-search t))) doesn't force buffer-localness) However, setting a binding will still make it buffer-local. (ie (let ((case-fold-search t)) (setq case-fold-search t)) - will cause case-fold-search be buffer-local even outside the let) + will cause case-fold-search be buffer-local even outside the let) * xfns.c: Preserve studlycaps: "Gnuemacs" => "GNU Emacs" @@ -4452,16 +4452,16 @@ * search.c (Freplace_match): Delete unused some_multiletter_word init. * alloc.c (gc_sweep): Delete unused next initializers. * fns.c (concat): After error on non-int elt for string, - do store the new value from the error handler. + do store the new value from the error handler. * lread.c (read1): Comment out unused end =. * lread.c (read_list): Delete unused tail =. * data.c (Fmake_variable_buffer_local): - If value type is Lisp_Some_Buffer_Local_Value, - change it to Lisp_Buffer_Local_Value permanently. + If value type is Lisp_Some_Buffer_Local_Value, + change it to Lisp_Buffer_Local_Value permanently. * undo.c (record_block): Delete unused cp =. - Don't bother reallocing if n = 0 after first batch. + Don't bother reallocing if n = 0 after first batch. * fileio.c (Fverify_visited_file_modtime): - If CHECK_BUFFER changes buf, use the changed value. + If CHECK_BUFFER changes buf, use the changed value. 1986-07-07 Richard M. Stallman (rms@prep) diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.3 --- a/src/ChangeLog.3 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.3 Thu May 13 15:13:52 2010 +0200 @@ -14197,7 +14197,7 @@ 1989-12-14 Joseph Arceneaux (jla@spiff) * xfns.c: New variable Vx_no_window_manager. - (Fx_track_pointer): If bufp < 0, abort. + (Fx_track_pointer): If bufp < 0, abort. * xterm.c (XTread_socket): When leaving window, set x_mouse_x and x_mouse_y to -1. diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.4 --- a/src/ChangeLog.4 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.4 Thu May 13 15:13:52 2010 +0200 @@ -4329,7 +4329,7 @@ 1993-11-01 Richard Stallman (rms@mole.gnu.ai.mit.edu) - * s/sunos4-1-3.h (HAVE_TERMIOS): Defined. + * s/sunos4-1-3.h (HAVE_TERMIOS): Define. 1993-10-25 Brian J. Fox (bfox@albert.gnu.ai.mit.edu) @@ -4411,7 +4411,7 @@ * keyboard.c (read_key_sequence): Don't declare first_event; it is no longer used. Change "#if 0" for first_event reading to - "#if defined (GOBBLE_FIRST_EVENT)". + "#if defined (GOBBLE_FIRST_EVENT)". 1993-10-03 Brian J. Fox (bfox@ai.mit.edu) @@ -4426,9 +4426,9 @@ * Makefile.in: File removed. It is now generated by ../configure. - * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end. This - change to ymakefile was mysteriously lost. Were any others lost - too? + * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end. + This change to ymakefile was mysteriously lost. + Were any others lost too? 1993-10-02 Brian J. Fox (bfox@ai.mit.edu) @@ -4461,8 +4461,7 @@ 1993-09-24 Brian J. Fox (bfox@ai.mit.edu) - * textprop.c (validate_plist): Add declaration for `list' - argument. + * textprop.c (validate_plist): Add declaration for `list' argument. * frame.c (Fhandle_switch_frame): Doc fix. @@ -4501,7 +4500,7 @@ * doc.c (Fsubstitute_command_keys): Pass new arg. * abbrev.c (Funexpand_abbrev, Fexpand_abbrev): Pass new arg. - * s/aix3-2.h (AIX3_2): Defined. + * s/aix3-2.h (AIX3_2): Define. * m/ibmrs6000.h (LIBS_MACHINE): Include -lrts, -liconv only if AIX3_2. * xterm.h (HAVE_X11R4): If AIX, do not define HAVE_X11R4. @@ -4703,13 +4702,13 @@ * xfns.c (XScreenNumberOfScreen): New function. - * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Defined. + * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Define. * m/iris4d.h (START_FILES, LIB_STANDARD): Don't define if USG5_4. (DEFAULT_ENTRY_ADDRESS): Likewise. (UNEXEC): Use unexelfsgi.o if USG5_4. - * s/irix5-0.h (C_SWITCH_MACHINE): Deleted. + * s/irix5-0.h (C_SWITCH_MACHINE): Delete. 1993-08-13 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr) @@ -4809,7 +4808,7 @@ * m/dpx2.h (HAVE_TCATTR): Macro #defined. (HAVE_CLOSEDIR): #undef to allow use of closedir in sysdep.c. - (SIGTSTP): Commented #undef to allow use of ^Z in shell-mode. + (SIGTSTP): Comment #undef to allow use of ^Z in shell-mode. (SIGNALS_VIA_CHARACTERS): #defined. 1993-08-09 Paul Eggert (eggert@twinsun.com) @@ -4849,10 +4848,10 @@ and calculate position properly. * s/bsd4-2.h, s/bsd4-3.h, s/umax.h, s/rtu.h, s/dgux.h (HAVE_VFORK): - Defined. + Define. * ymakefile (alloc.o): Don't use DEBUG_MOLE. - (DEBUG_MOLE): Deleted. + (DEBUG_MOLE): Delete. * gnu-hp300: File deleted. * .gdbinit: Don't put -q in args. @@ -4878,7 +4877,7 @@ (main): Call init_buffer, init_callproc and init_cmdargs before init_lread. (syms_of_emacs): Install the function, and protect the variable. - * lisp.h (Vinvocation_directory): Declared. + * lisp.h (Vinvocation_directory): Declare. * lread.c (init_lread): Normally put Vinvocation_directory at end of Vload_path, if not present already. diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.5 --- a/src/ChangeLog.5 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.5 Thu May 13 15:13:52 2010 +0200 @@ -6107,7 +6107,7 @@ * fileio.c (Fmake_symbolic_link, Ffile_accessible_directory_p, Finsert_file_contents, auto_save_error, Fwrite_region): Likewise. (Fcopy_file, build_annotations, Fdo_auto_save): Delete unused - variables. + variables. 1994-08-23 Richard Stallman diff -r e56f669f17ce -r fe07c47cf7a7 src/ChangeLog.9 --- a/src/ChangeLog.9 Wed May 12 14:32:06 2010 +0200 +++ b/src/ChangeLog.9 Thu May 13 15:13:52 2010 +0200 @@ -3913,7 +3913,7 @@ 2001-01-05 Gerd Moellmann * sysdep.c: Don't prototype srandom; it takes an unsigned argument - on some systems, and an unsigned long on others, like FreeBSD 4.1. + on some systems, and an unsigned long on others, like FreeBSD 4.1. 2001-01-04 Gerd Moellmann @@ -5161,9 +5161,9 @@ `vertical-line', `mode-line' and `header-line' events. * xdisp.c (try_window_id): Avoid starting to display in the middle - of a character, a TAB for instance. This is easier than to set - up the iterator exactly, and it's not a frequent case, so the - additional effort wouldn't really pay off. + of a character, a TAB for instance. This is easier than to set + up the iterator exactly, and it's not a frequent case, so the + additional effort wouldn't really pay off. 2000-11-26 Andrew Choi @@ -5196,9 +5196,9 @@ 2000-11-24 Gerd Moellmann * xdisp.c (init_from_display_pos): If POS says we're already after - an overlay string ending at POS, make sure to pop the iterator - because it will be in front of that overlay string. When POS is - ZV, we've thereby also ``processed'' overlay strings at ZV. + an overlay string ending at POS, make sure to pop the iterator + because it will be in front of that overlay string. When POS is + ZV, we've thereby also ``processed'' overlay strings at ZV. * xfaces.c (lface_from_face_name): Function comment fix. diff -r e56f669f17ce -r fe07c47cf7a7 src/Makefile.in --- a/src/Makefile.in Wed May 12 14:32:06 2010 +0200 +++ b/src/Makefile.in Thu May 13 15:13:52 2010 +0200 @@ -1,8 +1,8 @@ # Makefile for GNU Emacs. # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. # This file is part of GNU Emacs. @@ -38,11 +38,9 @@ abs_builddir = @abs_builddir@ VPATH = $(srcdir) CC = @CC@ -CPP = @CPP@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ -LN_S = @LN_S@ EXEEXT = @EXEEXT@ version = @version@ # Substitute an assignment for the MAKE variable, because @@ -69,43 +67,120 @@ OTHER_FILES = @OTHER_FILES@ +CRT_DIR=@CRT_DIR@ + +## Machine-specific CFLAGS. +C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ +## System-specific CFLAGS. +C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ +## This holds any special options for linking temacs only (ie, not +## used by configure). Not used elsewhere because it sometimes +## contains options that have to do with using Emacs's crt0, +## which are only good with temacs. +LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@ +## Next two must come before LD_SWITCH_SYSTEM. +## If needed, a -R option that says where to find X windows at run time. +LD_SWITCH_X_SITE_AUX=@LD_SWITCH_X_SITE_AUX@ +## As above, but using -rpath instead. +LD_SWITCH_X_SITE_AUX_RPATH=@LD_SWITCH_X_SITE_AUX_RPATH@ +## System-specific LDFLAGS. +LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@ +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) + +## Some systems define this to request special libraries. +LIBS_SYSTEM=@LIBS_SYSTEM@ + +## Where to find libgcc.a, if using gcc and necessary. +LIB_GCC=@LIB_GCC@ + LIBTIFF=@LIBTIFF@ LIBJPEG=@LIBJPEG@ LIBPNG=@LIBPNG@ LIBGIF=@LIBGIF@ LIBXPM=@LIBXPM@ XFT_LIBS=@XFT_LIBS@ - -C_SWITCH_SYSTEM=@c_switch_system@ -C_SWITCH_MACHINE=@c_switch_machine@ - -C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ +LIBX_EXTRA=$(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) -lX11 $(XFT_LIBS) DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ +DBUS_OBJ = @DBUS_OBJ@ GCONF_CFLAGS = @GCONF_CFLAGS@ GCONF_LIBS = @GCONF_LIBS@ +GTK_OBJ=@GTK_OBJ@ + +## -ltermcap, or -lncurses, or -lcurses, or "". +LIBS_TERMCAP=@LIBS_TERMCAP@ +## terminfo.o if TERMINFO, else tparam.o. +TERMCAP_OBJ=@TERMCAP_OBJ@ + +LIBXMU=@LIBXMU@ + +LIBXSM=@LIBXSM@ + +LIBXTR6=@LIBXTR6@ + +## $(LIBXMU) -lXt $(LIBXTR6) -lXext if USE_X_TOOLKIT, else $(LIBXSM). +## Only used if HAVE_X_WINDOWS. +LIBXT_OTHER=@LIBXT_OTHER@ + +XMENU_OBJ=@XMENU_OBJ@ +XOBJ=@XOBJ@ + +TOOLKIT_LIBW=@TOOLKIT_LIBW@ + LIBSOUND= @LIBSOUND@ CFLAGS_SOUND= @CFLAGS_SOUND@ RSVG_LIBS= @RSVG_LIBS@ RSVG_CFLAGS= @RSVG_CFLAGS@ +IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ +IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ + + +## widget.o if USE_X_TOOLKIT, otherwise empty. +WIDGET_OBJ=@WIDGET_OBJ@ + +## sheap.o if CYGWIN, otherwise empty. +CYGWIN_OBJ=@CYGWIN_OBJ@ + +NS_OBJ=@NS_OBJ@ +NS_SUPPORT=@NS_SUPPORT@ + +## Only used if HAVE_X_WINDOWS and HAVE_WINDOW_SYSTEM. +FONT_OBJ=@FONT_OBJ@ + +## ${lispsource}mouse.elc if HAVE_GPM, otherwise empty. +## Not used if HAVE_MOUSE. +GPM_MOUSE_SUPPORT=@GPM_MOUSE_SUPPORT@ + +BASE_WINDOW_SUPPORT=${lispsource}fringe.elc ${lispsource}image.elc \ + ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ + ${lispsource}tool-bar.elc ${lispsource}mwheel.elc + +X_WINDOW_SUPPORT=${lispsource}x-dnd.elc ${lispsource}term/common-win.elc \ + ${lispsource}term/x-win.elc ${lispsource}dynamic-setting.elc + +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ + INTERVALS_H = dispextern.h intervals.h composite.h GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ RUN_TEMACS = `/bin/pwd`/temacs +START_FILES = @START_FILES@ + # ========================== start of cpp stuff ======================= /* From here on, comments must be done in C syntax. */ /* just to be sure the sh is used */ SHELL=/bin/sh -#define THIS_IS_MAKEFILE #define NOT_C_CODE #include "config.h" @@ -113,11 +188,6 @@ DEPFLAGS = -MMD -MF deps/$*.d #endif -/* Undefine until the user can be moved in the non-cpp section. */ -#undef C_SWITCH_SYSTEM -#undef C_SWITCH_MACHINE -#undef C_SWITCH_X_SITE - /* Do not let the file name mktime.c get messed up. */ #ifdef mktime #undef mktime @@ -136,101 +206,11 @@ do not let it interfere with this file. */ #undef register -/* Some machines do not find the standard C libraries in the usual place. */ -#ifndef ORDINARY_LINK -#ifndef LIB_STANDARD -#define LIB_STANDARD -lc -#endif -#else -#ifndef LIB_STANDARD -#define LIB_STANDARD -#endif -#endif - -/* Under GNUstep, putting libc on the link line causes problems. */ -#ifdef NS_IMPL_GNUSTEP -#undef LIB_STANDARD -#define LIB_STANDARD -#endif - -/* Some s/SYSTEM.h files define this to request special libraries. */ -#ifndef LIBS_SYSTEM -#define LIBS_SYSTEM -#endif - -/* Some m/MACHINE.h files define this to request special libraries. */ -#ifndef LIBS_MACHINE -#define LIBS_MACHINE -#endif - -#ifndef LIB_MATH -# define LIB_MATH -lm -#endif /* LIB_MATH */ - -/* Some s/SYSTEM.h files define this to request special switches in ld. */ -#ifndef LD_SWITCH_SYSTEM -#if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF))) -#define LD_SWITCH_SYSTEM -X -#else /* (defined (BSD_SYSTEM) && !defined (COFF)) */ -#define LD_SWITCH_SYSTEM -#endif /* (defined (BSD_SYSTEM) && !defined (COFF)) */ -#endif /* LD_SWITCH_SYSTEM */ - -/* This holds special options for linking temacs - that should be used for linking anything else. */ -#ifndef LD_SWITCH_SYSTEM_TEMACS -#define LD_SWITCH_SYSTEM_TEMACS -#endif - -/* Some m/MACHINE.h files define this to request special switches in ld. */ -#ifndef LD_SWITCH_MACHINE -#define LD_SWITCH_MACHINE -#endif - -/* This holds special options for linking temacs - that should be used for linking anything else. */ -#ifndef LD_SWITCH_MACHINE_TEMACS -#define LD_SWITCH_MACHINE_TEMACS -#endif - -/* These macros are for switches specifically related to X Windows. */ -#ifndef C_SWITCH_X_MACHINE -#define C_SWITCH_X_MACHINE -#endif - -#ifndef C_SWITCH_X_SYSTEM -#define C_SWITCH_X_SYSTEM -#endif - +/* This macro is for switches specifically related to X Windows. */ #ifndef LD_SWITCH_X_SITE #define LD_SWITCH_X_SITE #endif -#ifndef LD_SWITCH_X_DEFAULT -#define LD_SWITCH_X_DEFAULT -#endif - -#ifndef ORDINARY_LINK - -#ifndef START_FILES -#ifdef NO_REMAP -#define START_FILES pre-crt0.o /lib/crt0.o -#else /* ! defined (NO_REMAP) */ -#define START_FILES ecrt0.o -#endif /* ! defined (NO_REMAP) */ -#endif /* START_FILES */ -STARTFILES = START_FILES - -#else /* ORDINARY_LINK */ - -/* config.h might want to force START_FILES anyway */ -#ifdef START_FILES -STARTFILES = START_FILES -#endif /* START_FILES */ - -#endif /* not ORDINARY_LINK */ - - #ifdef NS_IMPL_GNUSTEP /* Pull in stuff from GNUstep-make. */ FOUNDATION_LIB=gnu @@ -240,10 +220,6 @@ shared=no #endif -#ifdef HAVE_DBUS -DBUS_OBJ = dbusbind.o -#endif - /* 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 @@ -255,13 +231,10 @@ -DHAVE_CONFIG_H is needed for some other files to take advantage of the information in ``config.h''. */ -#undef C_SWITCH_MACHINE -#undef C_SWITCH_SYSTEM -#undef C_SWITCH_X_SITE - -/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM +/* C_SWITCH_X_SITE must come before C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} +/* MYCPPFLAGS only referenced in etc/DEBUG. */ +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} @C_SWITCH_X_SITE@ @C_SWITCH_X_SYSTEM@ ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@ .SUFFIXES: .m @@ -276,117 +249,38 @@ #endif $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< -#ifndef LIB_X11_LIB -#define LIB_X11_LIB -lX11 -#endif - #ifdef HAVE_X_WINDOWS -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 - +/* This test needs to say in cpp for the time being, since s/msdos.h + defines HAVE_MENUS, and does not use the configure script. */ #ifdef HAVE_MENUS - -#ifdef USE_GTK -GTK_OBJ= gtkutil.o -#endif - -/* 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. */ -#ifdef HAVE_X11 -#ifdef USE_X_TOOLKIT -OLDXMENU=${lwlibdir}liblw.a -LIBXMENU= $(OLDXMENU) -#else /* not USE_X_TOOLKIT */ -OLDXMENU= ${oldXMenudir}libXMenu11.a -LIBXMENU= $(OLDXMENU) -#endif /* not USE_X_TOOLKIT */ -#else /* not HAVE_X11 */ -LIBXMENU= -lXMenu -#endif /* not HAVE_X11 */ - +OLDXMENU=@OLDXMENU@ +LIBXMENU=@LIBXMENU@ #else /* not HAVE_MENUS */ - -/* Otherwise, do not worry about the menu library at all. */ +OLDXMENU= LIBXMENU= #endif /* not HAVE_MENUS */ -#ifdef USE_X_TOOLKIT -# define @X_TOOLKIT_TYPE@ -# if HAVE_XAW3D -LUCID_LIBW= -lXaw3d -# else -LUCID_LIBW= -lXaw -# endif -# if defined (HAVE_MOTIF_2_1) && defined (HAVE_LIBXP) -# define LIB_MOTIF_EXTRA -lXp -# else -# define LIB_MOTIF_EXTRA -# endif -# ifdef LIB_MOTIF -MOTIF_LIBW= LIB_MOTIF LIB_MOTIF_EXTRA -# else -MOTIF_LIBW= -lXm LIB_MOTIF_EXTRA -# endif -LIBW=$(@X_TOOLKIT_TYPE@_LIBW) - -#ifdef HAVE_X11XTR6 -#ifdef NEED_LIBW -LIBXTR6 = -lSM -lICE -lw -#else -LIBXTR6 = -lSM -lICE -#endif -#endif - -#ifndef LIBXMU -#define LIBXMU -lXmu -#endif - -LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext - -#else /* not USE_X_TOOLKIT */ - -#ifdef USE_GTK -LIBW=@GTK_LIBS@ -OLDXMENU= -LIBXMENU= -#endif /* USE_GTK */ - -#ifdef HAVE_X_SM -LIBXT=$(LIBW) -lSM -lICE -#else -LIBXT=$(LIBW) -#endif -#endif /* not USE_X_TOOLKIT */ - -#ifdef HAVE_X11 -/* LD_SWITCH_X_DEFAULT comes after everything else that specifies - options for where to find X libraries, but before those libraries. */ -X11_LDFLAGS = LD_SWITCH_X_SITE LD_SWITCH_X_DEFAULT -LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) $(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) LIB_X11_LIB $(XFT_LIBS) -#else /* not HAVE_X11 */ -LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -#endif /* not HAVE_X11 */ +LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER) +LIBX_BASE=$(LIBXMENU) LD_SWITCH_X_SITE +LIBX_OTHER=@LIBX_OTHER@ #endif /* not HAVE_X_WINDOWS */ -LIBSOUND= @LIBSOUND@ -CFLAGS_SOUND= @CFLAGS_SOUND@ -RSVG_LIBS= @RSVG_LIBS@ -RSVG_CFLAGS= @RSVG_CFLAGS@ +/* 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 + redefined LD to something odd, like "gcc". + (The YMF prefix is a holdover from the old name "ymakefile".) */ +#define YMF_PASS_LDFLAGS(flags) flags -IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ -IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ -#ifndef ORDINARY_LINK -/* Fix linking if compiled with GCC. */ -#ifdef __GNUC__ +#ifdef ORDINARY_LINK +LD = $(CC) -#ifdef LINKER -#define LINKER_WAS_SPECIFIED -#endif +#else /* not ORDINARY_LINK */ +GNULIB_VAR = $(LIB_GCC) +/* Fix linking if compiled with GCC. */ +#if defined (__GNUC__) && ! defined (LINKER) /* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure places that are difficult to figure out at make time. Fortunately, these same versions allow you to pass arbitrary flags on to the @@ -395,90 +289,42 @@ Well, it is not quite perfect. The "-nostdlib" keeps GCC from searching for libraries in its internal directories, so we have to ask GCC explicitly where to find libgcc.a. */ - -#ifndef LINKER #define LINKER $(CC) -nostdlib -#endif - -#ifndef LIB_GCC -/* Ask GCC where to find libgcc.a. */ -#define LIB_GCC `$(CC) -print-libgcc-file-name` -#endif /* not LIB_GCC */ - -GNULIB_VAR = LIB_GCC +/* GCC passes any argument prefixed with -Xlinker directly to the linker. + See prefix-args.c for an explanation of why we do not do this with the + shell''s ``for'' construct. Note that sane people do not have '.' in + their paths, so we must use ./prefix-args. */ +#undef YMF_PASS_LDFLAGS +#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` +#endif /* defined (__GNUC__) && ! defined (LINKER) */ -#ifndef LINKER_WAS_SPECIFIED -/* GCC passes any argument prefixed with -Xlinker directly to the - linker. See prefix-args.c for an explanation of why we do not do - this with the shell''s ``for'' construct. - Note that some people do not have '.' in their paths, so we must - use ./prefix-args. */ -#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` -#else -#define YMF_PASS_LDFLAGS(flags) flags -#endif - -#else /* not __GNUC__ */ -GNULIB_VAR = - -#endif /* not __GNUC__ */ -#endif /* not ORDINARY_LINK */ - -#ifdef ORDINARY_LINK -LD = $(CC) -#else #ifdef LINKER LD=LINKER #else /* not LINKER */ LD=ld #endif /* not LINKER */ + #endif /* not ORDINARY_LINK */ -/* Flags to pass to LD only for temacs. */ -/* Do not split this line with a backslash. That can cause trouble with - some cpps. */ -TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS - -/* 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 - redefined LD to something odd, like "gcc". - (The YMF prefix is a holdover from the old name "ymakefile".) - */ -#ifndef YMF_PASS_LDFLAGS -#define YMF_PASS_LDFLAGS(flags) flags -#endif #ifdef MSDOS #ifdef HAVE_X_WINDOWS -MSDOS_OBJ = dosfns.o msdos.o xmenu.o +MSDOS_OBJ = dosfns.o msdos.o #else -MSDOS_OBJ = dosfns.o msdos.o w16select.o xmenu.o termcap.o +MSDOS_OBJ = dosfns.o msdos.o w16select.o termcap.o #endif #endif -#ifdef CYGWIN -CYGWIN_OBJ = sheap.o -#endif - #ifdef HAVE_NS ns_appdir=@ns_appdir@/ ns_appbindir=@ns_appbindir@/ ns_appresdir=@ns_appresdir@/ ns_appsrc=@ns_appsrc@ -/* Object files for NeXTstep */ -NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ - fontset.o fringe.o image.o #endif /* HAVE_NS */ #ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_X_WINDOWS -#if defined (HAVE_XFT) -FONT_DRIVERS = xfont.o ftfont.o xftfont.o ftxfont.o -#elif defined (HAVE_FREETYPE) -FONT_DRIVERS = xfont.o ftfont.o ftxfont.o -#else /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */ -FONT_DRIVERS = xfont.o -#endif /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */ +FONT_DRIVERS=$(FONT_OBJ) #endif /* HAVE_X_WINDOWS */ #endif /* HAVE_WINDOW_SYSTEM */ @@ -493,7 +339,7 @@ cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ alloc.o data.o doc.o editfns.o callint.o \ eval.o floatfns.o fns.o font.o print.o lread.o \ - syntax.o UNEXEC bytecode.o \ + syntax.o @unexec@ bytecode.o \ process.o callproc.o \ region-cache.o sound.o atimer.o \ doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ @@ -509,24 +355,10 @@ w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS) - -#ifdef TERMINFO -/* Used to be -ltermcap here. If your machine needs that, - define LIBS_TERMCAP in the m/MACHINE.h file. */ -#ifndef LIBS_TERMCAP -#define LIBS_TERMCAP -lcurses -#endif /* LIBS_TERMCAP */ -termcapobj = terminfo.o -#else /* ! defined (TERMINFO) */ -#ifndef LIBS_TERMCAP -#define LIBS_TERMCAP -#endif /* LIBS_TERMCAP */ -termcapobj = tparam.o -#endif /* ! defined (TERMINFO) */ - - +gmallocobj = +rallocobj = +vmlimitobj = #ifndef SYSTEM_MALLOC - #ifndef DOUG_LEA_MALLOC gmallocobj = gmalloc.o #endif @@ -535,36 +367,23 @@ rallocobj = ralloc.o #endif -mallocobj = $(gmallocobj) $(rallocobj) vm-limit.o - -#endif /* SYSTEM_MALLOC */ - +vmlimitobj = vm-limit.o +#endif /* !SYSTEM_MALLOC */ -#ifdef USE_X_TOOLKIT -widgetobj= widget.o -#else /* not USE_X_TOOLKIT */ -widgetobj= -#endif /* not USE_X_TOOLKIT */ - +/* Empty on Cygwin, lastfile.o elsewhere. */ +PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@ +/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere. */ +POST_ALLOC_OBJ=@POST_ALLOC_OBJ@ -/* define otherobj as list of object files that make-docfile - should not be told about. */ -#ifdef CYGWIN -/* Cygwin differs because of its unexec(). */ -otherobj= $(termcapobj) $(gmallocobj) $(rallocobj) lastfile.o vm-limit.o $(widgetobj) $(LIBOBJS) -#else -otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS) -#endif +/* 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) #ifdef HAVE_MOUSE #define MOUSE_SUPPORT ${lispsource}mouse.elc \ ${lispsource}select.elc ${lispsource}scroll-bar.elc #else -#ifdef HAVE_GPM -#define MOUSE_SUPPORT ${lispsource}mouse.elc -#else -#define MOUSE_SUPPORT -#endif +#define MOUSE_SUPPORT $(GPM_MOUSE_SUPPORT) #endif #ifdef MSDOS @@ -578,15 +397,9 @@ #ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_X_WINDOWS -#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ - ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ - ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc \ - ${lispsource}term/common-win.elc ${lispsource}term/x-win.elc \ - ${lispsource}font-setting.elc +#define WINDOW_SUPPORT $(BASE_WINDOW_SUPPORT) $(X_WINDOW_SUPPORT) #else -#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ - ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ - ${lispsource}tool-bar.elc ${lispsource}mwheel.elc +#define WINDOW_SUPPORT $(BASE_WINDOW_SUPPORT) #endif #else #define WINDOW_SUPPORT @@ -607,13 +420,6 @@ #define TOOLTIP_SUPPORT #endif -#ifdef HAVE_NS -#define NS_SUPPORT ${lispsource}emacs-lisp/easymenu.elc \ - ${lispsource}term/ns-win.elc -#else -#define NS_SUPPORT -#endif - /* 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 it semi-mechanically from loadup.el this way. @@ -714,7 +520,7 @@ MSDOS_SUPPORT \ WINNT_SUPPORT \ WINDOW_SUPPORT \ - NS_SUPPORT \ + ${NS_SUPPORT} \ ${lispsource}widget.elc \ ${lispsource}window.elc \ ${lispsource}version.el @@ -817,7 +623,7 @@ ../lisp/tooltip.elc ../lisp/image.elc \ ../lisp/fringe.elc ../lisp/dnd.elc \ ../lisp/mwheel.elc ../lisp/tool-bar.elc \ - ../lisp/x-dnd.elc ../lisp/font-setting.elc \ + ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \ ../lisp/international/ccl.elc \ ../lisp/international/fontset.elc \ ../lisp/mouse.elc \ @@ -832,11 +638,11 @@ duplicated symbols. If the standard libraries were compiled with GCC, we might need gnulib again after them. */ -LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ - @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ - $(GETLOADAVG_LIBS) ${GCONF_LIBS} \ +LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ + $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ $(LIBS_SYSTEM) \ + $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \ - $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR) + $(GNULIB_VAR) @LIB_MATH@ @LIB_STANDARD@ $(GNULIB_VAR) all: emacs${EXEEXT} $(OTHER_FILES) @@ -877,7 +683,8 @@ buildobj.h: Makefile echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h -temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} +/* 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 \ @@ -885,13 +692,10 @@ ${obj} ${otherobj} ${LIBES} #else $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ - -o temacs ${STARTFILES} ${obj} ${otherobj} \ + -o temacs ${START_FILES} ${obj} ${otherobj} \ ${LIBES} #endif -/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE - often contain options that have to do with using Emacs''s crt0, - which are only good with temacs. */ prefix-args${EXEEXT}: prefix-args.o $(config_h) $(CC) $(LDFLAGS) prefix-args.o -o prefix-args @@ -906,19 +710,12 @@ /* Supply an ordering for parallel make. */ ../src/$(OLDXMENU): ${OLDXMENU} -/* Encode the values of these two macros in Make variables, - so we can use $(...) to substitute their values within "...". */ -C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE -C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM - #ifdef USE_X_TOOLKIT $(OLDXMENU): really-lwlib really-lwlib: cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ - CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ - "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \ - "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" + CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' @true /* make -t should not create really-lwlib. */ .PHONY: really-lwlib #else /* not USE_X_TOOLKIT */ @@ -926,9 +723,7 @@ really-oldXMenu: cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ - CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ - "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \ - "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" + CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' @true /* make -t should not create really-oldXMenu. */ .PHONY: really-oldXMenu #endif /* not USE_X_TOOLKIT */ @@ -958,6 +753,14 @@ #ifndef AUTO_DEPEND +/* FIXME some of these dependencies are platform-specific. +Eg callproc.c only depends on w32.h for WINDOWSNT builds. +One way to fix this would be to replace w32.h (etc) by $(W32_H), +a variable set by configure. Does not seem worth the trouble. + +nsgui.h: In fact, every .o file depends directly or indirectly on +dispextern.h and hence nsgui.h under NS. But the ones that actually +use stuff there are more limited. */ atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \ $(config_h) bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h $(config_h) @@ -993,7 +796,7 @@ coding.h regex.h systime.h blockinput.h atimer.h composite.h dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ window.h buffer.h termchar.h termopts.h termhooks.h cm.h \ - disptab.h indent.h $(INTERVALS_H) \ + disptab.h indent.h $(INTERVALS_H) nsgui.h \ xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \ syssignal.h lisp.h $(config_h) doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \ @@ -1014,18 +817,19 @@ filemode.o: filemode.c $(config_h) frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h \ - msdos.h dosfns.h dispextern.h w32term.h termchar.h coding.h composite.h \ - lisp.h $(config_h) termhooks.h ccl.h -fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h \ + msdos.h dosfns.h dispextern.h w32term.h nsgui.h termchar.h coding.h \ + composite.h lisp.h $(config_h) termhooks.h ccl.h +fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \ blockinput.h atimer.h systime.h lisp.h $(config_h) font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \ - font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h + font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h nsgui.h ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \ lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \ ccl.h ftfont.h fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \ charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \ - blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) window.h xterm.h + blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) nsgui.h \ + window.h xterm.h getloadavg.o: getloadavg.c $(config_h) gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \ blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \ @@ -1041,7 +845,7 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \ - xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h coding.h \ + xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \ lisp.h $(config_h) keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \ @@ -1062,7 +866,7 @@ termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h) nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ - dispextern.h nsgui.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ + dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h) nsimage.o: nsimage.m nsterm.h lisp.h $(config_h) @@ -1120,16 +924,16 @@ window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \ disptab.h keyboard.h msdos.h coding.h termhooks.h \ keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \ - xterm.h w32term.h nsterm.h lisp.h $(config_h) + xterm.h w32term.h nsterm.h nsgui.h lisp.h $(config_h) xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \ - coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \ - charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h xterm.h \ - w32term.h nsterm.h msdos.h composite.h fontset.h ccl.h \ + coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \ + charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h \ + xterm.h w32term.h nsterm.h nsgui.h msdos.h composite.h fontset.h ccl.h \ blockinput.h atimer.h systime.h keymap.h font.h xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \ window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \ systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \ - $(INTERVALS_H) termchar.h termhooks.h font.h lisp.h $(config_h) + $(INTERVALS_H) nsgui.h termchar.h termhooks.h font.h lisp.h $(config_h) xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \ @@ -1142,7 +946,7 @@ font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \ dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \ - lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h + lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h nsgui.h xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \ charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \ systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \ @@ -1200,12 +1004,6 @@ select which of these should be compiled. */ #ifdef HAVE_NS -/* In fact, every .o file depends directly or indirectly on dispextern.h - and hence nsgui.h under NS. But the ones that actually use stuff there - are more limited. */ -dispnew.o font.o fontset.o frame.o fringe.o image.o keyboard.o menu.o \ - window.o xdisp.o xfaces.o: nsgui.h - ${ns_appdir}: ${ns_appsrc} rm -fr ${ns_appdir} mkdir -p ${ns_appdir} @@ -1331,6 +1129,6 @@ cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe} #ifdef AUTO_DEPEND -ALLOBJS=$(STARTFILES) ${obj} ${otherobj} prefix-args.o +ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o -include $(ALLOBJS:%.o=deps/%.d) #endif diff -r e56f669f17ce -r fe07c47cf7a7 src/alloc.c --- a/src/alloc.c Wed May 12 14:32:06 2010 +0200 +++ b/src/alloc.c Thu May 13 15:13:52 2010 +0200 @@ -1365,7 +1365,7 @@ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init (&alloc_mutex, &attr); #else /* !DOUG_LEA_MALLOC */ - /* Some systems such as Solaris 2.6 doesn't have a recursive mutex, + /* Some systems such as Solaris 2.6 don't have a recursive mutex, and the bundled gmalloc.c doesn't require it. */ pthread_mutex_init (&alloc_mutex, NULL); #endif /* !DOUG_LEA_MALLOC */ @@ -3193,13 +3193,13 @@ p = XSYMBOL (val); p->xname = name; p->plist = Qnil; - p->value = Qunbound; + p->redirect = SYMBOL_PLAINVAL; + SET_SYMBOL_VAL (p, Qunbound); p->function = Qunbound; p->next = NULL; p->gcmarkbit = 0; p->interned = SYMBOL_UNINTERNED; p->constant = 0; - p->indirect_variable = 0; consing_since_gc += sizeof (struct Lisp_Symbol); symbols_consed++; return val; @@ -4893,14 +4893,21 @@ if (PURE_POINTER_P (XPNTR (obj))) return obj; + if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ + { + Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil); + if (!NILP (tmp)) + return tmp; + } + if (CONSP (obj)) - return pure_cons (XCAR (obj), XCDR (obj)); + obj = pure_cons (XCAR (obj), XCDR (obj)); else if (FLOATP (obj)) - return make_pure_float (XFLOAT_DATA (obj)); + obj = make_pure_float (XFLOAT_DATA (obj)); else if (STRINGP (obj)) - return make_pure_string (SDATA (obj), SCHARS (obj), - SBYTES (obj), - STRING_MULTIBYTE (obj)); + obj = make_pure_string (SDATA (obj), SCHARS (obj), + SBYTES (obj), + STRING_MULTIBYTE (obj)); else if (COMPILEDP (obj) || VECTORP (obj)) { register struct Lisp_Vector *vec; @@ -4920,10 +4927,15 @@ } else XSETVECTOR (obj, vec); - return obj; } else if (MARKERP (obj)) error ("Attempt to copy a marker to pure storage"); + else + /* Not purified, don't hash-cons. */ + return obj; + + if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ + Fputhash (obj, obj, Vpurify_flag); return obj; } @@ -5569,17 +5581,42 @@ break; CHECK_ALLOCATED_AND_LIVE (live_symbol_p); ptr->gcmarkbit = 1; - mark_object (ptr->value); mark_object (ptr->function); mark_object (ptr->plist); - + switch (ptr->redirect) + { + case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break; + case SYMBOL_VARALIAS: + { + Lisp_Object tem; + XSETSYMBOL (tem, SYMBOL_ALIAS (ptr)); + mark_object (tem); + break; + } + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (ptr); + /* If the value is forwarded to a buffer or keyboard field, + these are marked when we see the corresponding object. + And if it's forwarded to a C variable, either it's not + a Lisp_Object var, or it's staticpro'd already. */ + mark_object (blv->where); + mark_object (blv->valcell); + mark_object (blv->defcell); + break; + } + case SYMBOL_FORWARDED: + /* If the value is forwarded to a buffer or keyboard field, + these are marked when we see the corresponding object. + And if it's forwarded to a C variable, either it's not + a Lisp_Object var, or it's staticpro'd already. */ + break; + default: abort (); + } if (!PURE_POINTER_P (XSTRING (ptr->xname))) MARK_STRING (XSTRING (ptr->xname)); MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname)); - /* Note that we do not mark the obarray of the symbol. - It is safe not to do so because nothing accesses that - slot except to check whether it is nil. */ ptr = ptr->next; if (ptr) { @@ -5598,22 +5635,6 @@ switch (XMISCTYPE (obj)) { - case Lisp_Misc_Buffer_Local_Value: - { - register struct Lisp_Buffer_Local_Value *ptr - = XBUFFER_LOCAL_VALUE (obj); - /* If the cdr is nil, avoid recursion for the car. */ - if (EQ (ptr->cdr, Qnil)) - { - obj = ptr->realvalue; - goto loop; - } - mark_object (ptr->realvalue); - mark_object (ptr->buffer); - mark_object (ptr->frame); - obj = ptr->cdr; - goto loop; - } case Lisp_Misc_Marker: /* DO NOT mark thru the marker's chain. @@ -5621,17 +5642,6 @@ instead, markers are removed from the chain when freed by gc. */ break; - case Lisp_Misc_Intfwd: - case Lisp_Misc_Boolfwd: - case Lisp_Misc_Objfwd: - case Lisp_Misc_Buffer_Objfwd: - case Lisp_Misc_Kboard_Objfwd: - /* Don't bother with Lisp_Buffer_Objfwd, - since all markable slots in current buffer marked anyway. */ - /* Don't need to do Lisp_Objfwd, since the places they point - are protected with staticpro. */ - break; - case Lisp_Misc_Save_Value: #if GC_MARK_STACK { @@ -6036,6 +6046,8 @@ if (!sym->gcmarkbit && !pure_p) { + if (sym->redirect == SYMBOL_LOCALIZED) + xfree (SYMBOL_BLV (sym)); sym->next = symbol_free_list; symbol_free_list = sym; #if GC_MARK_STACK @@ -6371,7 +6383,9 @@ DEFVAR_LISP ("purify-flag", &Vpurify_flag, doc: /* Non-nil means loading Lisp code in order to dump an executable. -This means that certain objects should be allocated in shared (pure) space. */); +This means that certain objects should be allocated in shared (pure) space. +It can also be set to a hash-table, in which case this table is used to +do hash-consing of the objects allocated to pure space. */); DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages, doc: /* Non-nil means display messages at start and end of garbage collection. */); diff -r e56f669f17ce -r fe07c47cf7a7 src/bidi.c --- a/src/bidi.c Wed May 12 14:32:06 2010 +0200 +++ b/src/bidi.c Thu May 13 15:13:52 2010 +0200 @@ -23,7 +23,8 @@ as per UAX#9, a part of the Unicode Standard. Unlike the reference and most other implementations, this one is - designed to be called once for every character in the buffer. + 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 is called, it finds the next character in the visual order, and @@ -34,6 +35,11 @@ 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 + bidi_mirror_char. The first determines the base direction of a + paragraph, while the second returns the mirrored version of its + argument character. + If you want to understand the code, you will have to read it together with the relevant portions of UAX#9. The comments include references to UAX#9 rules, for that very reason. @@ -96,7 +102,7 @@ int bidi_ignore_explicit_marks_for_paragraph_level = 1; -static Lisp_Object fallback_paragraph_start_re, fallback_paragraph_separate_re; +static Lisp_Object paragraph_start_re, paragraph_separate_re; static Lisp_Object Qparagraph_start, Qparagraph_separate; static void @@ -393,26 +399,24 @@ bidi_type[i].to ? bidi_type[i].to : bidi_type[i].from, make_number (bidi_type[i].type)); - fallback_paragraph_start_re = - XSYMBOL (Fintern_soft (build_string ("paragraph-start"), Qnil))->value; - if (!STRINGP (fallback_paragraph_start_re)) - fallback_paragraph_start_re = build_string ("\f\\|[ \t]*$"); - staticpro (&fallback_paragraph_start_re); Qparagraph_start = intern ("paragraph-start"); staticpro (&Qparagraph_start); - fallback_paragraph_separate_re = - XSYMBOL (Fintern_soft (build_string ("paragraph-separate"), Qnil))->value; - if (!STRINGP (fallback_paragraph_separate_re)) - fallback_paragraph_separate_re = build_string ("[ \t\f]*$"); - staticpro (&fallback_paragraph_separate_re); + paragraph_start_re = Fsymbol_value (Qparagraph_start); + if (!STRINGP (paragraph_start_re)) + paragraph_start_re = build_string ("\f\\|[ \t]*$"); + staticpro (¶graph_start_re); Qparagraph_separate = intern ("paragraph-separate"); staticpro (&Qparagraph_separate); + paragraph_separate_re = Fsymbol_value (Qparagraph_separate); + if (!STRINGP (paragraph_separate_re)) + paragraph_separate_re = build_string ("[ \t\f]*$"); + staticpro (¶graph_separate_re); bidi_initialized = 1; } /* Return the bidi type of a character CH, subject to the current directional OVERRIDE. */ -bidi_type_t +static INLINE bidi_type_t bidi_get_type (int ch, bidi_dir_t override) { bidi_type_t default_type; @@ -463,7 +467,7 @@ } /* Given a bidi TYPE of a character, return its category. */ -bidi_category_t +static INLINE bidi_category_t bidi_get_category (bidi_type_t type) { switch (type) @@ -520,7 +524,7 @@ /* Copy the bidi iterator from FROM to TO. To save cycles, this only copies the part of the level stack that is actually in use. */ -static inline void +static INLINE void bidi_copy_it (struct bidi_it *to, struct bidi_it *from) { int i; @@ -540,14 +544,14 @@ static int bidi_cache_idx; static int bidi_cache_last_idx; -static inline void +static INLINE void bidi_cache_reset (void) { bidi_cache_idx = 0; bidi_cache_last_idx = -1; } -static inline void +static INLINE void bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) { int current_scan_dir = bidi_it->scan_dir; @@ -564,7 +568,7 @@ level less or equal to LEVEL. if LEVEL is -1, disregard the resolved levels in cached states. DIR, if non-zero, means search in that direction from the last cache hit. */ -static inline int +static INLINE int bidi_cache_search (int charpos, int level, int dir) { int i, i_start; @@ -655,7 +659,7 @@ return -1; } -static inline void +static INLINE void bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) { int idx; @@ -710,7 +714,7 @@ bidi_cache_idx = idx + 1; } -static inline bidi_type_t +static INLINE bidi_type_t bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it) { int i = bidi_cache_search (charpos, level, bidi_it->scan_dir); @@ -730,7 +734,7 @@ return UNKNOWN_BT; } -static inline int +static INLINE int bidi_peek_at_next_level (struct bidi_it *bidi_it) { if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1) @@ -743,19 +747,16 @@ following the buffer position, -1 if position is at the beginning of a new paragraph, or -2 if position is neither at beginning nor at end of a paragraph. */ -EMACS_INT +static EMACS_INT bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) { - Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate, - Fcurrent_buffer ()); - Lisp_Object start_re = Fbuffer_local_value (Qparagraph_start, - Fcurrent_buffer ()); + /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value? */ + Lisp_Object sep_re; + Lisp_Object start_re; EMACS_INT val; - if (!STRINGP (sep_re)) - sep_re = fallback_paragraph_separate_re; - if (!STRINGP (start_re)) - start_re = fallback_paragraph_start_re; + sep_re = paragraph_separate_re; + start_re = paragraph_start_re; val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); if (val < 0) @@ -773,7 +774,7 @@ embedding levels on either side of the run boundary. Also, update the saved info about previously seen characters, since that info is generally valid for a single level run. */ -static inline void +static INLINE void bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) { int higher_level = level_before > level_after ? level_before : level_after; @@ -824,11 +825,9 @@ static EMACS_INT bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte) { - Lisp_Object re = Fbuffer_local_value (Qparagraph_start, Fcurrent_buffer ()); + Lisp_Object re = paragraph_start_re; EMACS_INT limit = ZV, limit_byte = ZV_BYTE; - if (!STRINGP (re)) - re = fallback_paragraph_start_re; while (pos_byte > BEGV_BYTE && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) { @@ -873,7 +872,6 @@ int ch, ch_len; EMACS_INT pos; bidi_type_t type; - EMACS_INT sep_len; /* If we are inside a paragraph separator, we are just waiting for the separator to be exhausted; use the previous paragraph @@ -954,7 +952,7 @@ /* Do whatever UAX#9 clause X8 says should be done at paragraph's end. */ -static inline void +static INLINE void bidi_set_paragraph_end (struct bidi_it *bidi_it) { bidi_it->invalid_levels = 0; @@ -976,10 +974,11 @@ bidi_it->new_paragraph = 1; bidi_it->separator_limit = -1; bidi_it->type = NEUTRAL_B; - bidi_it->type_after_w1 = UNKNOWN_BT; - bidi_it->orig_type = UNKNOWN_BT; + bidi_it->type_after_w1 = NEUTRAL_B; + bidi_it->orig_type = NEUTRAL_B; bidi_it->prev_was_pdf = 0; - bidi_it->prev.type = bidi_it->prev.type_after_w1 = UNKNOWN_BT; + bidi_it->prev.type = bidi_it->prev.type_after_w1 = + bidi_it->prev.orig_type = UNKNOWN_BT; bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = bidi_it->last_strong.orig_type = UNKNOWN_BT; bidi_it->next_for_neutral.charpos = -1; @@ -995,7 +994,7 @@ /* Push the current embedding level and override status; reset the current level to LEVEL and the current override status to OVERRIDE. */ -static inline void +static INLINE void bidi_push_embedding_level (struct bidi_it *bidi_it, int level, bidi_dir_t override) { @@ -1008,7 +1007,7 @@ /* Pop the embedding level and directional override status from the stack, and return the new level. */ -static inline int +static INLINE int bidi_pop_embedding_level (struct bidi_it *bidi_it) { /* UAX#9 says to ignore invalid PDFs. */ @@ -1018,7 +1017,7 @@ } /* Record in SAVED_INFO the information about the current character. */ -static inline void +static INLINE void bidi_remember_char (struct bidi_saved_info *saved_info, struct bidi_it *bidi_it) { @@ -1034,7 +1033,7 @@ /* Resolve the type of a neutral character according to the type of surrounding strong text and the current embedding level. */ -static inline bidi_type_t +static INLINE bidi_type_t bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) { /* N1: European and Arabic numbers are treated as though they were R. */ @@ -1051,7 +1050,7 @@ return STRONG_R; } -static inline int +static INLINE int bidi_explicit_dir_char (int c) { /* FIXME: this should be replaced with a lookup table with suitable @@ -1301,7 +1300,7 @@ /* Advance in the buffer, resolve weak types and return the type of the next character after weak type resolution. */ -bidi_type_t +static bidi_type_t bidi_resolve_weak (struct bidi_it *bidi_it) { bidi_type_t type; @@ -1353,7 +1352,9 @@ current level run, and thus not relevant to this NSM. This is why NSM gets the type_after_w1 of the previous character. */ - if (bidi_it->prev.type != UNKNOWN_BT) + if (bidi_it->prev.type_after_w1 != UNKNOWN_BT + /* if type_after_w1 is NEUTRAL_B, this NSM is at sor */ + && bidi_it->prev.type_after_w1 != NEUTRAL_B) type = bidi_it->prev.type_after_w1; else if (bidi_it->sor == R2L) type = STRONG_R; @@ -1490,7 +1491,7 @@ return type; } -bidi_type_t +static bidi_type_t bidi_resolve_neutral (struct bidi_it *bidi_it) { int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; @@ -1614,7 +1615,7 @@ /* Given an iterator state in BIDI_IT, advance one character position in the buffer to the next character (in the logical order), resolve the bidi type of that next character, and return that type. */ -bidi_type_t +static bidi_type_t bidi_type_of_next_char (struct bidi_it *bidi_it) { bidi_type_t type; @@ -1640,7 +1641,7 @@ the buffer to the next character (in the logical order), resolve the embedding and implicit levels of that next character, and return the resulting level. */ -int +static int bidi_level_of_next_char (struct bidi_it *bidi_it) { bidi_type_t type; diff -r e56f669f17ce -r fe07c47cf7a7 src/buffer.c --- a/src/buffer.c Wed May 12 14:32:06 2010 +0200 +++ b/src/buffer.c Thu May 13 15:13:52 2010 +0200 @@ -78,9 +78,6 @@ be a DEFVAR_PER_BUFFER for the slot, there is no default value for it; and the corresponding slot in buffer_defaults is not used. - If a slot is -2, then there is no DEFVAR_PER_BUFFER for it, - but there is a default value which is copied into each buffer. - If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is zero, that is a bug */ @@ -94,6 +91,12 @@ /* A Lisp_Object pointer to the above, used for staticpro */ static Lisp_Object Vbuffer_local_symbols; +/* Return the symbol of the per-buffer variable at offset OFFSET in + the buffer structure. */ + +#define PER_BUFFER_SYMBOL(OFFSET) \ + (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols)) + /* Flags indicating which built-in buffer-local variables are permanent locals. */ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; @@ -507,7 +510,7 @@ continue; obj = PER_BUFFER_VALUE (from, offset); - if (MARKERP (obj)) + if (MARKERP (obj) && XMARKER (obj)->buffer == from) { struct Lisp_Marker *m = XMARKER (obj); obj = Fmake_marker (); @@ -770,9 +773,7 @@ { Lisp_Object tmp, prop, last = Qnil; for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) - if (CONSP (XCAR (tmp)) - && SYMBOLP (XCAR (XCAR (tmp))) - && !NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) + if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) { /* If permanent-local, keep it. */ last = tmp; @@ -822,9 +823,7 @@ int idx = PER_BUFFER_IDX (offset); if ((idx > 0 && (permanent_too - || buffer_permanent_local_flags[idx] == 0)) - /* Is -2 used anywhere? */ - || idx == -2) + || buffer_permanent_local_flags[idx] == 0))) PER_BUFFER_VALUE (b, offset) = PER_BUFFER_DEFAULT (offset); } } @@ -938,59 +937,49 @@ CHECK_SYMBOL (variable); CHECK_BUFFER (buffer); buf = XBUFFER (buffer); - - sym = indirect_variable (XSYMBOL (variable)); - XSETSYMBOL (variable, sym); - - /* Look in local_var_list */ - result = Fassoc (variable, buf->local_var_alist); - if (NILP (result)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - int offset, idx; - int found = 0; - - /* Look in special slots */ - /* buffer-local Lisp variables start at `undo_list', - tho only the ones from `name' on are GC'd normally. */ - for (offset = PER_BUFFER_VAR_OFFSET (undo_list); - offset < sizeof (struct buffer); - /* sizeof EMACS_INT == sizeof Lisp_Object */ - offset += (sizeof (EMACS_INT))) - { - idx = PER_BUFFER_IDX (offset); - if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) - && SYMBOLP (PER_BUFFER_SYMBOL (offset)) - && EQ (PER_BUFFER_SYMBOL (offset), variable)) - { - result = PER_BUFFER_VALUE (buf, offset); - found = 1; - break; - } - } - - if (!found) - result = Fdefault_value (variable); - } - else - { - Lisp_Object valcontents; - Lisp_Object current_alist_element; - - /* What binding is loaded right now? */ - valcontents = sym->value; - current_alist_element - = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); - - /* The value of the currently loaded binding is not - stored in it, but rather in the realvalue slot. - Store that value into the binding it belongs to - in case that is the one we are about to use. */ - - Fsetcdr (current_alist_element, - do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); - - /* Now get the (perhaps updated) value out of the binding. */ - result = XCDR (result); + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break; + case SYMBOL_LOCALIZED: + { /* Look in local_var_alist. */ + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ + result = Fassoc (variable, buf->local_var_alist); + if (!NILP (result)) + { + if (blv->fwd) + { /* What binding is loaded right now? */ + Lisp_Object current_alist_element = blv->valcell; + + /* The value of the currently loaded binding is not + stored in it, but rather in the realvalue slot. + Store that value into the binding it belongs to + in case that is the one we are about to use. */ + + XSETCDR (current_alist_element, + do_symval_forwarding (blv->fwd)); + } + /* Now get the (perhaps updated) value out of the binding. */ + result = XCDR (result); + } + else + result = Fdefault_value (variable); + break; + } + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *fwd = SYMBOL_FWD (sym); + if (BUFFER_OBJFWDP (fwd)) + result = PER_BUFFER_VALUE (buf, XBUFFER_OBJFWD (fwd)->offset); + else + result = Fdefault_value (variable); + break; + } + default: abort (); } if (!EQ (result, Qunbound)) @@ -1025,12 +1014,7 @@ if (buf != current_buffer) val = XCDR (elt); - /* If symbol is unbound, put just the symbol in the list. */ - if (EQ (val, Qunbound)) - result = Fcons (XCAR (elt), result); - /* Otherwise, put (symbol . value) in the list. */ - else - result = Fcons (Fcons (XCAR (elt), val), result); + result = Fcons (Fcons (XCAR (elt), val), result); } return result; @@ -1563,7 +1547,7 @@ Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); if (! NILP (tem)) - internal_delete_file (b->auto_save_file_name); + internal_delete_file (b->auto_save_file_name, Qt); } if (b->base_buffer) @@ -1862,8 +1846,7 @@ register struct buffer *b; { register struct buffer *old_buf; - register Lisp_Object tail, valcontents; - Lisp_Object tem; + register Lisp_Object tail; #ifdef USE_MMAP_FOR_BUFFERS if (b->text->beg == NULL) @@ -1935,34 +1918,21 @@ /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ - for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) + do { - if (CONSP (XCAR (tail)) - && SYMBOLP (XCAR (XCAR (tail))) - && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))), - (BUFFER_LOCAL_VALUEP (valcontents))) - && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, - (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) - /* Just reference the variable to cause it to become set for - this buffer. */ - Fsymbol_value (XCAR (XCAR (tail))); + for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) + { + Lisp_Object var = XCAR (XCAR (tail)); + struct Lisp_Symbol *sym = XSYMBOL (var); + if (sym->redirect == SYMBOL_LOCALIZED /* Just to be sure. */ + && SYMBOL_BLV (sym)->fwd) + /* Just reference the variable + to cause it to become set for this buffer. */ + Fsymbol_value (var); + } } - /* Do the same with any others that were local to the previous buffer */ - - if (old_buf) - for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) - { - if (CONSP (tail) - && SYMBOLP (XCAR (XCAR (tail))) - && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))), - (BUFFER_LOCAL_VALUEP (valcontents))) - && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, - (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) - /* Just reference the variable to cause it to become set for - this buffer. */ - Fsymbol_value (XCAR (XCAR (tail))); - } + while (b != old_buf && (b = old_buf, b)); } /* Switch to buffer B temporarily for redisplay purposes. @@ -2677,23 +2647,22 @@ swap_out_buffer_local_variables (b) struct buffer *b; { - Lisp_Object oalist, alist, sym, buffer; + Lisp_Object oalist, alist, buffer; XSETBUFFER (buffer, b); oalist = b->local_var_alist; for (alist = oalist; CONSP (alist); alist = XCDR (alist)) { - if (CONSP (XCAR (alist)) - && (sym = XCAR (XCAR (alist)), SYMBOLP (sym)) - /* Need not do anything if some other buffer's binding is - now encached. */ - && EQ (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer, - buffer)) + Lisp_Object sym = XCAR (XCAR (alist)); + eassert (XSYMBOL (sym)->redirect == SYMBOL_LOCALIZED); + /* Need not do anything if some other buffer's binding is + now encached. */ + if (EQ (SYMBOL_BLV (XSYMBOL (sym))->where, buffer)) { /* Symbol is set up for this buffer's old local value: swap it out! */ - swap_in_global_binding (sym); + swap_in_global_binding (XSYMBOL (sym)); } } } @@ -5162,7 +5131,9 @@ /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ reset_buffer (&buffer_defaults); + eassert (EQ (buffer_defaults.name, make_number (0))); reset_buffer_local_variables (&buffer_defaults, 1); + eassert (EQ (buffer_local_symbols.name, make_number (0))); reset_buffer (&buffer_local_symbols); reset_buffer_local_variables (&buffer_local_symbols, 1); /* Prevent GC from getting confused. */ @@ -5204,7 +5175,6 @@ buffer_defaults.word_wrap = Qnil; buffer_defaults.ctl_arrow = Qt; buffer_defaults.bidi_display_reordering = Qnil; - buffer_defaults.direction_reversed = Qnil; buffer_defaults.bidi_paragraph_direction = Qnil; buffer_defaults.cursor_type = Qt; buffer_defaults.extra_line_spacing = Qnil; @@ -5291,7 +5261,6 @@ XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; - XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx; XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); /* Make this one a permanent local. */ @@ -5421,33 +5390,41 @@ in the buffer that is current now. */ /* TYPE is nil for a general Lisp variable. - An integer specifies a type; then only LIsp values + An integer specifies a type; then only Lisp values with that type code are allowed (except that nil is allowed too). - LNAME is the LIsp-level variable name. + LNAME is the Lisp-level variable name. VNAME is the name of the buffer slot. DOC is a dummy where you write the doc string as a comment. */ -#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ - defvar_per_buffer (lname, vname, type, 0) +#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ + do { \ + static struct Lisp_Buffer_Objfwd bo_fwd; \ + defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \ + } while (0) static void -defvar_per_buffer (namestring, address, type, doc) +defvar_per_buffer (bo_fwd, namestring, address, type, doc) + struct Lisp_Buffer_Objfwd *bo_fwd; char *namestring; Lisp_Object *address; Lisp_Object type; char *doc; { - Lisp_Object sym, val; + struct Lisp_Symbol *sym; int offset; - sym = intern (namestring); - val = allocate_misc (); + sym = XSYMBOL (intern (namestring)); offset = (char *)address - (char *)current_buffer; - XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; - XBUFFER_OBJFWD (val)->offset = offset; - XBUFFER_OBJFWD (val)->slottype = type; - SET_SYMBOL_VALUE (sym, val); - PER_BUFFER_SYMBOL (offset) = sym; + bo_fwd->type = Lisp_Fwd_Buffer_Obj; + bo_fwd->offset = offset; + bo_fwd->slottype = type; + sym->redirect = SYMBOL_FORWARDED; + { + /* I tried to do the job without a cast, but it seems impossible. + union Lisp_Fwd *fwd; &(fwd->u_buffer_objfwd) = bo_fwd; */ + SET_SYMBOL_FWD (sym, (union Lisp_Fwd *)bo_fwd); + } + XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym); if (PER_BUFFER_IDX (offset) == 0) /* Did a DEFVAR_PER_BUFFER without initializing the corresponding @@ -5805,25 +5782,19 @@ This variable is never applied to a way of decoding a file while reading it. */); - DEFVAR_PER_BUFFER ("direction-reversed", - ¤t_buffer->direction_reversed, Qnil, - doc: /* Non-nil means set beginning of lines at the right edge of the window. -See also the variable `bidi-display-reordering'. */); - DEFVAR_PER_BUFFER ("bidi-display-reordering", ¤t_buffer->bidi_display_reordering, Qnil, - doc: /* Non-nil means reorder bidirectional text for display in the visual order. -See also the variable `direction-reversed'. */); + doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); DEFVAR_PER_BUFFER ("bidi-paragraph-direction", ¤t_buffer->bidi_paragraph_direction, Qnil, doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. - + If this is nil (the default), the direction of each paragraph is determined by the first strong directional character of its text. The values of `right-to-left' and `left-to-right' override that. Any other value is treated as nil. - + This variable has no effect unless the buffer's value of \`bidi-display-reordering' is non-nil. */); diff -r e56f669f17ce -r fe07c47cf7a7 src/buffer.h --- a/src/buffer.h Wed May 12 14:32:06 2010 +0200 +++ b/src/buffer.h Thu May 13 15:13:52 2010 +0200 @@ -107,6 +107,11 @@ #define BUF_BEG(buf) (BEG) #define BUF_BEG_BYTE(buf) (BEG_BYTE) +/* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: + on indirect (or base) buffers, that value is only correct if that buffer + is the current_buffer, or if the buffer's text hasn't been modified (via + an indirect buffer) since it was last current. */ + /* Position of beginning of accessible range of buffer. */ #define BUF_BEGV(buf) ((buf)->begv) #define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) @@ -313,7 +318,7 @@ - (ptr - (current_buffer)->text->beg <= (unsigned) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \ + BEG_BYTE) -/* Return character at position POS. */ +/* Return character at byte position POS. */ #define FETCH_CHAR(pos) \ (!NILP (current_buffer->enable_multibyte_characters) \ @@ -327,7 +332,7 @@ /* Variables used locally in FETCH_MULTIBYTE_CHAR. */ extern unsigned char *_fetch_multibyte_char_p; -/* Return character code of multi-byte form at position POS. If POS +/* Return character code of multi-byte form at byte position POS. If POS doesn't point the head of valid multi-byte form, only the byte at POS is returned. No range checking. */ @@ -336,7 +341,7 @@ + (pos) + BEG_ADDR - BEG_BYTE), \ STRING_CHAR (_fetch_multibyte_char_p)) -/* Return character at position POS. If the current buffer is unibyte +/* Return character at byte position POS. If the current buffer is unibyte and the character is not ASCII, make the returning character multibyte. */ @@ -447,7 +452,10 @@ /* The markers that refer to this buffer. This is actually a single marker --- successive elements in its marker `chain' - are the other markers referring to this buffer. */ + are the other markers referring to this buffer. + This is a singly linked unordered list, which means that it's + very cheap to add a marker to the list and it's also very cheap + to move a marker within a buffer. */ struct Lisp_Marker *markers; /* Usually 0. Temporarily set to 1 in decode_coding_gap to @@ -671,9 +679,6 @@ /* Non-nil means reorder bidirectional text for display in the visual order. */ Lisp_Object bidi_display_reordering; - /* Non-nil means set beginning of lines at the right edge of - windows. */ - Lisp_Object direction_reversed; /* If non-nil, specifies which direction of text to force in all the paragraphs of the buffer. Nil means determine paragraph direction dynamically for each paragraph. */ @@ -843,6 +848,7 @@ be a Lisp-level local variable for the slot, it has no default value, and the corresponding slot in buffer_defaults is not used. */ + extern struct buffer buffer_local_flags; /* For each buffer slot, this points to the Lisp symbol name @@ -948,7 +954,7 @@ from the start of a buffer structure. */ #define PER_BUFFER_VAR_OFFSET(VAR) \ - ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags) + ((char *) &((struct buffer *)0)->VAR - (char *) ((struct buffer *)0)) /* Return the index of buffer-local variable VAR. Each per-buffer variable has an index > 0 associated with it, except when it always @@ -1013,11 +1019,5 @@ #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) -/* Return the symbol of the per-buffer variable at offset OFFSET in - the buffer structure. */ - -#define PER_BUFFER_SYMBOL(OFFSET) \ - (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols)) - /* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/bytecode.c --- a/src/bytecode.c Wed May 12 14:32:06 2010 +0200 +++ b/src/bytecode.c Thu May 13 15:13:52 2010 +0200 @@ -505,8 +505,9 @@ v1 = vectorp[op]; if (SYMBOLP (v1)) { - v2 = SYMBOL_VALUE (v1); - if (MISCP (v2) || EQ (v2, Qunbound)) + if (XSYMBOL (v1)->redirect != SYMBOL_PLAINVAL + || (v2 = SYMBOL_VAL (XSYMBOL (v1)), + EQ (v2, Qunbound))) { BEFORE_POTENTIAL_GC (); v2 = Fsymbol_value (v1); @@ -597,14 +598,13 @@ /* Inline the most common case. */ if (SYMBOLP (sym) && !EQ (val, Qunbound) - && !XSYMBOL (sym)->indirect_variable - && !SYMBOL_CONSTANT_P (sym) - && !MISCP (XSYMBOL (sym)->value)) - XSYMBOL (sym)->value = val; + && !XSYMBOL (sym)->redirect + && !SYMBOL_CONSTANT_P (sym)) + XSYMBOL (sym)->val.value = val; else { BEFORE_POTENTIAL_GC (); - set_internal (sym, val, current_buffer, 0); + set_internal (sym, val, Qnil, 0); AFTER_POTENTIAL_GC (); } } diff -r e56f669f17ce -r fe07c47cf7a7 src/callproc.c --- a/src/callproc.c Wed May 12 14:32:06 2010 +0200 +++ b/src/callproc.c Thu May 13 15:13:52 2010 +0200 @@ -91,7 +91,7 @@ #endif #ifdef HAVE_SETPGID -#if !defined (USG) || defined (BSD_PGRPS) +#if !defined (USG) #undef setpgrp #define setpgrp setpgid #endif @@ -581,7 +581,7 @@ #ifdef HAVE_SETSID setsid (); #endif -#if defined (USG) && !defined (BSD_PGRPS) +#if defined (USG) setpgrp (); #else setpgrp (pid, pid); @@ -856,7 +856,7 @@ /* Suppress jka-compr handling, etc. */ int count = SPECPDL_INDEX (); specbind (intern ("file-name-handler-alist"), Qnil); - internal_delete_file (name); + internal_delete_file (name, Qt); unbind_to (count, Qnil); return Qnil; } @@ -1251,7 +1251,7 @@ #endif /* not MSDOS */ #endif /* not WINDOWSNT */ -#if defined(USG) && !defined(BSD_PGRPS) +#if defined(USG) #ifndef SETPGRP_RELEASES_CTTY setpgrp (); /* No arguments but equivalent in this case */ #endif diff -r e56f669f17ce -r fe07c47cf7a7 src/character.h --- a/src/character.h Wed May 12 14:32:06 2010 +0200 +++ b/src/character.h Thu May 13 15:13:52 2010 +0200 @@ -296,7 +296,7 @@ /* If P is after LIMIT, advance P to the previous character boundary. Assumes that P is already at a character boundary of the same - mulitbyte form whose beginning address is LIMIT. */ + multibyte form whose beginning address is LIMIT. */ #define PREV_CHAR_BOUNDARY(p, limit) \ do { \ diff -r e56f669f17ce -r fe07c47cf7a7 src/charset.c --- a/src/charset.c Wed May 12 14:32:06 2010 +0200 +++ b/src/charset.c Thu May 13 15:13:52 2010 +0200 @@ -2082,8 +2082,9 @@ return charset; } charset_list = XCDR (charset_list); - if (c <= MAX_UNICODE_CHAR - && EQ (charset_list, Vcharset_non_preferred_head)) + if (! maybe_null + && c <= MAX_UNICODE_CHAR + && EQ (charset_list, Vcharset_non_preferred_head)) return CHARSET_FROM_ID (charset_unicode); } return (maybe_null ? NULL diff -r e56f669f17ce -r fe07c47cf7a7 src/coding.c --- a/src/coding.c Wed May 12 14:32:06 2010 +0200 +++ b/src/coding.c Thu May 13 15:13:52 2010 +0200 @@ -6408,7 +6408,7 @@ { /* We didn't find an 8-bit code. We may have found a null-byte, but it's very - rare that a binary file confirm to + rare that a binary file conforms to ISO-2022. */ src = src_end; coding->head_ascii = src - coding->source; diff -r e56f669f17ce -r fe07c47cf7a7 src/composite.c --- a/src/composite.c Wed May 12 14:32:06 2010 +0200 +++ b/src/composite.c Thu May 13 15:13:52 2010 +0200 @@ -74,8 +74,8 @@ composition rules to tell how to compose (2N+2)th element with the previously composed 2N glyphs. - COMPONENTS-VEC -- Vector of integers. In relative composition, the - elements are characters to be composed. In rule-base + COMPONENTS-VEC -- Vector of integers. In a relative composition, + the elements are the characters to be composed. In a rule-base composition, the elements are characters or encoded composition rules. @@ -95,13 +95,13 @@ get_composition_id checks the validity of `composition' property, and, if valid, assigns a new ID, registers the information in composition_hash_table and composition_table, and changes the form - of the property value. If the property is invalid, return -1 - without changing the property value. + of the property value. If the property is invalid, + get_composition_id returns -1 without changing the property value. - We use two tables to keep information about composition; + We use two tables to keep the information about composition; composition_hash_table and composition_table. - The former is a hash table in which keys are COMPONENTS-VECs and + The former is a hash table whose keys are COMPONENTS-VECs and values are the corresponding COMPOSITION-IDs. This hash table is weak, but as each key (COMPONENTS-VEC) is also kept as a value of the `composition' property, it won't be collected as garbage until all @@ -162,8 +162,8 @@ Lisp_Object Qauto_composition_function; Lisp_Object Vcomposition_function_table; -/* Maxinum number of characters to lookback to check - auto-composition. */ +/* Maximum number of characters to look back for + auto-compositions. */ #define MAX_AUTO_COMPOSITION_LOOKBACK 3 EXFUN (Fremove_list_of_text_properties, 4); @@ -990,6 +990,14 @@ { Lisp_Object args[6]; + /* Save point as marker before calling out to lisp. */ + if (NILP (string)) + { + Lisp_Object m = Fmake_marker (); + set_marker_both (m, Qnil, pt, pt_byte); + record_unwind_protect (restore_point_unwind, m); + } + args[0] = Vauto_composition_function; args[1] = AREF (elt, 2); args[2] = pos; @@ -998,8 +1006,10 @@ args[5] = string; gstring = safe_call (6, args); } - if (NILP (string)) - TEMP_SET_PT_BOTH (pt, pt_byte); + else if (NILP (string)) + { + TEMP_SET_PT_BOTH (pt, pt_byte); + } return unbind_to (count, gstring); } } @@ -1011,7 +1021,7 @@ /* Update cmp_it->stop_pos to the next position after CHARPOS (and BYTEPOS) where character composition may happen. If BYTEPOS is - negative, compoute it. If it is a static composition, set + negative, compute it. If it is a static composition, set cmp_it->ch to -1. Otherwise, set cmp_it->ch to the character that triggers a automatic composition. */ @@ -1241,7 +1251,7 @@ unsigned char *p; }; -/* Update the members of POSTION to the next character boundary. */ +/* Update the members of POSITION to the next character boundary. */ #define FORWARD_CHAR(POSITION, STOP) \ do { \ (POSITION).pos++; \ @@ -1257,7 +1267,7 @@ } \ } while (0) -/* Update the members of POSTION to the previous character boundary. */ +/* Update the members of POSITION to the previous character boundary. */ #define BACKWARD_CHAR(POSITION, STOP) \ do { \ if ((POSITION).pos == STOP) \ @@ -1429,7 +1439,7 @@ } if (need_adjustment) { - /* As we have called Lisp, there's a possibilily that + /* As we have called Lisp, there's a possibility that buffer/string is relocated. */ if (NILP (string)) cur.p = BYTE_POS_ADDR (cur.pos_byte); @@ -1674,7 +1684,7 @@ if (find_automatic_composition (from, to, &s, &e, &gstring, string) && (e <= XINT (pos) ? e > end : s < start)) - return list3 (make_number (start), make_number (end), gstring); + return list3 (make_number (s), make_number (e), gstring); } if (!COMPOSITION_VALID_P (start, end, prop)) return Fcons (make_number (start), Fcons (make_number (end), diff -r e56f669f17ce -r fe07c47cf7a7 src/config.in --- a/src/config.in Wed May 12 14:32:06 2010 +0200 +++ b/src/config.in Thu May 13 15:13:52 2010 +0200 @@ -135,8 +135,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_COM_ERR_H -/* Define to 1 if you have /usr/lib/crti.o. */ -#undef HAVE_CRTIN +/* Define to 1 if you have the `copysign' function. */ +#undef HAVE_COPYSIGN /* Define to 1 if using D-Bus. */ #undef HAVE_DBUS @@ -294,6 +294,9 @@ /* Define to 1 if netdb.h declares h_errno. */ #undef HAVE_H_ERRNO +/* Define to 1 if using imagemagick. */ +#undef HAVE_IMAGEMAGICK + /* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX @@ -303,6 +306,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `isnan' function. */ +#undef HAVE_ISNAN + /* Define to 1 if you have the jpeg library (-ljpeg). */ #undef HAVE_JPEG @@ -318,10 +324,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_KERBEROS_KRB_H -/* Define to 1 if `e_text' is a member of `krb5_error'. */ +/* Define to 1 if `e_text' is member of `krb5_error'. */ #undef HAVE_KRB5_ERROR_E_TEXT -/* Define to 1 if `text' is a member of `krb5_error'. */ +/* Define to 1 if `text' is member of `krb5_error'. */ #undef HAVE_KRB5_ERROR_TEXT /* Define to 1 if you have the header file. */ @@ -333,9 +339,6 @@ /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET -/* Define to 1 if the directory /usr/lib64 exists. */ -#undef HAVE_LIB64_DIR - /* Define to 1 if you have the `com_err' library (-lcom_err). */ #undef HAVE_LIBCOM_ERR @@ -399,15 +402,15 @@ /* Define to 1 if you have the resolv library (-lresolv). */ #undef HAVE_LIBRESOLV +/* Define to 1 if using SELinux. */ +#undef HAVE_LIBSELINUX + /* Define to 1 if you have the `Xext' library (-lXext). */ #undef HAVE_LIBXEXT /* Define to 1 if you have the `Xmu' library (-lXmu). */ #undef HAVE_LIBXMU -/* Define to 1 if you have the Xp library (-lXp). */ -#undef HAVE_LIBXP - /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -488,9 +491,6 @@ /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP -/* Define to 1 if you have Motif 2.1 or newer. */ -#undef HAVE_MOTIF_2_1 - /* Define to 1 if you have the `mremap' function. */ #undef HAVE_MREMAP @@ -615,25 +615,25 @@ /* Define to 1 if you have the `strsignal' function. */ #undef HAVE_STRSIGNAL -/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ +/* Define to 1 if `ifr_addr' is member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_ADDR -/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ +/* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_BROADADDR -/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ +/* Define to 1 if `ifr_flags' is member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_FLAGS -/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ +/* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_HWADDR -/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ +/* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_NETMASK -/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ +/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ #undef HAVE_STRUCT_NLIST_N_UN_N_NAME -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ +/* Define to 1 if `tm_zone' is member of `struct tm'. */ #undef HAVE_STRUCT_TM_TM_ZONE /* Define to 1 if `struct utimbuf' is declared by . */ @@ -813,10 +813,6 @@ its own, you might want to add "-L/..." or something similar. */ #undef LD_SWITCH_X_SITE -/* Define LD_SWITCH_X_SITE_AUX with an -R option in case it's needed (for - Solaris, for example). */ -#undef LD_SWITCH_X_SITE_AUX - /* Define to 1 if localtime caches TZ. */ #undef LOCALTIME_CACHE @@ -826,6 +822,12 @@ /* Define to unlink, rather than empty, mail spool after reading. */ #undef MAIL_UNLINK_SPOOL +/* Define if the mailer uses flock to interlock the mail spool. */ +#undef MAIL_USE_FLOCK + +/* Define if the mailer uses lockf to interlock the mail spool. */ +#undef MAIL_USE_LOCKF + /* Define to support MMDF mailboxes in movemail. */ #undef MAIL_USE_MMDF @@ -860,9 +862,6 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -897,6 +896,9 @@ /* Process async input synchronously. */ #undef SYNC_INPUT +/* Define to 1 if you use terminfo instead of termcap. */ +#undef TERMINFO + /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME @@ -910,9 +912,6 @@ . */ #undef UMAX4_3 -/* Define to the unexec source file name. */ -#undef UNEXEC_SRC - /* Define to 1 if using GTK. */ #undef USE_GTK @@ -1078,9 +1077,6 @@ parallel this exactly since GNUstep is multi-OS. */ #ifdef HAVE_NS # ifdef NS_IMPL_GNUSTEP -/* See also .m.o rule in Makefile.in */ -/* FIXME: are all these flags really needed? Document here why. */ -# define C_SWITCH_X_SYSTEM -D_REENTRANT -fPIC -fno-strict-aliasing /* GNUstep needs a bit more pure memory. Of the existing knobs, SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ # define SYSTEM_PURESIZE_EXTRA 30000 diff -r e56f669f17ce -r fe07c47cf7a7 src/data.c --- a/src/data.c Wed May 12 14:32:06 2010 +0200 +++ b/src/data.c Thu May 13 15:13:52 2010 +0200 @@ -91,7 +91,7 @@ Lisp_Object Qinteractive_form; -static Lisp_Object swap_in_symval_forwarding P_ ((Lisp_Object, Lisp_Object)); +static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum; @@ -582,12 +582,35 @@ register Lisp_Object symbol; { Lisp_Object valcontents; + struct Lisp_Symbol *sym; CHECK_SYMBOL (symbol); - - valcontents = SYMBOL_VALUE (symbol); - - if (BUFFER_LOCAL_VALUEP (valcontents)) - valcontents = swap_in_symval_forwarding (symbol, valcontents); + sym = XSYMBOL (symbol); + + start: + switch (sym->redirect) + { + case SYMBOL_PLAINVAL: valcontents = SYMBOL_VAL (sym); break; + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + if (blv->fwd) + /* In set_internal, we un-forward vars when their value is + set to Qunbound. */ + return Qt; + else + { + swap_in_symval_forwarding (sym, blv); + valcontents = BLV_VALUE (blv); + } + break; + } + case SYMBOL_FORWARDED: + /* In set_internal, we un-forward vars when their value is + set to Qunbound. */ + return Qt; + default: abort (); + } return (EQ (valcontents, Qunbound) ? Qnil : Qt); } @@ -824,14 +847,14 @@ hare = tortoise = symbol; - while (hare->indirect_variable) + while (hare->redirect == SYMBOL_VARALIAS) { - hare = XSYMBOL (hare->value); - if (!hare->indirect_variable) + hare = SYMBOL_ALIAS (hare); + if (hare->redirect != SYMBOL_VARALIAS) break; - hare = XSYMBOL (hare->value); - tortoise = XSYMBOL (tortoise->value); + hare = SYMBOL_ALIAS (hare); + tortoise = SYMBOL_ALIAS (tortoise); if (hare == tortoise) { @@ -865,44 +888,46 @@ This does not handle buffer-local variables; use swap_in_symval_forwarding for that. */ +#define do_blv_forwarding(blv) \ + ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) + Lisp_Object do_symval_forwarding (valcontents) - register Lisp_Object valcontents; + register union Lisp_Fwd *valcontents; { register Lisp_Object val; - if (MISCP (valcontents)) - switch (XMISCTYPE (valcontents)) - { - case Lisp_Misc_Intfwd: - XSETINT (val, *XINTFWD (valcontents)->intvar); - return val; - - case Lisp_Misc_Boolfwd: - return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); - - case Lisp_Misc_Objfwd: - return *XOBJFWD (valcontents)->objvar; - - case Lisp_Misc_Buffer_Objfwd: - return PER_BUFFER_VALUE (current_buffer, - XBUFFER_OBJFWD (valcontents)->offset); - - case Lisp_Misc_Kboard_Objfwd: - /* We used to simply use current_kboard here, but from Lisp - code, it's value is often unexpected. It seems nicer to - allow constructions like this to work as intuitively expected: - - (with-selected-frame frame - (define-key local-function-map "\eOP" [f1])) - - On the other hand, this affects the semantics of - last-command and real-last-command, and people may rely on - that. I took a quick look at the Lisp codebase, and I - don't think anything will break. --lorentey */ - return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset - + (char *)FRAME_KBOARD (SELECTED_FRAME ())); - } - return valcontents; + switch (XFWDTYPE (valcontents)) + { + case Lisp_Fwd_Int: + XSETINT (val, *XINTFWD (valcontents)->intvar); + return val; + + case Lisp_Fwd_Bool: + return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); + + case Lisp_Fwd_Obj: + return *XOBJFWD (valcontents)->objvar; + + case Lisp_Fwd_Buffer_Obj: + return PER_BUFFER_VALUE (current_buffer, + XBUFFER_OBJFWD (valcontents)->offset); + + case Lisp_Fwd_Kboard_Obj: + /* We used to simply use current_kboard here, but from Lisp + code, it's value is often unexpected. It seems nicer to + allow constructions like this to work as intuitively expected: + + (with-selected-frame frame + (define-key local-function-map "\eOP" [f1])) + + On the other hand, this affects the semantics of + last-command and real-last-command, and people may rely on + that. I took a quick look at the Lisp codebase, and I + don't think anything will break. --lorentey */ + return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset + + (char *)FRAME_KBOARD (SELECTED_FRAME ())); + default: abort (); + } } /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell @@ -913,102 +938,93 @@ BUF non-zero means set the value in buffer BUF instead of the current buffer. This only plays a role for per-buffer variables. */ -void -store_symval_forwarding (symbol, valcontents, newval, buf) - Lisp_Object symbol; - register Lisp_Object valcontents, newval; +#define store_blv_forwarding(blv, newval, buf) \ + do { \ + if ((blv)->forwarded) \ + store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \ + else \ + SET_BLV_VALUE (blv, newval); \ + } while (0) + +static void +store_symval_forwarding (/* symbol, */ valcontents, newval, buf) + /* struct Lisp_Symbol *symbol; */ + union Lisp_Fwd *valcontents; + register Lisp_Object newval; struct buffer *buf; { - switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) + switch (XFWDTYPE (valcontents)) { - case Lisp_Misc: - switch (XMISCTYPE (valcontents)) + case Lisp_Fwd_Int: + CHECK_NUMBER (newval); + *XINTFWD (valcontents)->intvar = XINT (newval); + break; + + case Lisp_Fwd_Bool: + *XBOOLFWD (valcontents)->boolvar = !NILP (newval); + break; + + case Lisp_Fwd_Obj: + *XOBJFWD (valcontents)->objvar = newval; + + /* If this variable is a default for something stored + in the buffer itself, such as default-fill-column, + find the buffers that don't have local values for it + and update them. */ + if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults + && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1)) { - case Lisp_Misc_Intfwd: - CHECK_NUMBER (newval); - *XINTFWD (valcontents)->intvar = XINT (newval); - /* This can never happen since intvar points to an EMACS_INT - which is at least large enough to hold a Lisp_Object. - if (*XINTFWD (valcontents)->intvar != XINT (newval)) - error ("Value out of range for variable `%s'", - SDATA (SYMBOL_NAME (symbol))); */ - break; - - case Lisp_Misc_Boolfwd: - *XBOOLFWD (valcontents)->boolvar = !NILP (newval); - break; - - case Lisp_Misc_Objfwd: - *XOBJFWD (valcontents)->objvar = newval; - - /* If this variable is a default for something stored - in the buffer itself, such as default-fill-column, - find the buffers that don't have local values for it - and update them. */ - if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults - && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1)) + int offset = ((char *) XOBJFWD (valcontents)->objvar + - (char *) &buffer_defaults); + int idx = PER_BUFFER_IDX (offset); + + Lisp_Object tail; + + if (idx <= 0) + break; + + for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { - int offset = ((char *) XOBJFWD (valcontents)->objvar - - (char *) &buffer_defaults); - int idx = PER_BUFFER_IDX (offset); - - Lisp_Object tail; - - if (idx <= 0) - break; - - for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object buf; - struct buffer *b; - - buf = Fcdr (XCAR (tail)); - if (!BUFFERP (buf)) continue; - b = XBUFFER (buf); - - if (! PER_BUFFER_VALUE_P (b, idx)) - PER_BUFFER_VALUE (b, offset) = newval; - } + Lisp_Object buf; + struct buffer *b; + + buf = Fcdr (XCAR (tail)); + if (!BUFFERP (buf)) continue; + b = XBUFFER (buf); + + if (! PER_BUFFER_VALUE_P (b, idx)) + PER_BUFFER_VALUE (b, offset) = newval; } - break; - - case Lisp_Misc_Buffer_Objfwd: - { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; - - if (!(NILP (type) || NILP (newval) - || (XINT (type) == LISP_INT_TAG - ? INTEGERP (newval) - : XTYPE (newval) == XINT (type)))) - buffer_slot_type_mismatch (newval, XINT (type)); - - if (buf == NULL) - buf = current_buffer; - PER_BUFFER_VALUE (buf, offset) = newval; - } - break; - - case Lisp_Misc_Kboard_Objfwd: - { - char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ()); - char *p = base + XKBOARD_OBJFWD (valcontents)->offset; - *(Lisp_Object *) p = newval; - } - break; - - default: - goto def; } break; + case Lisp_Fwd_Buffer_Obj: + { + int offset = XBUFFER_OBJFWD (valcontents)->offset; + Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; + + if (!(NILP (type) || NILP (newval) + || (XINT (type) == LISP_INT_TAG + ? INTEGERP (newval) + : XTYPE (newval) == XINT (type)))) + buffer_slot_type_mismatch (newval, XINT (type)); + + if (buf == NULL) + buf = current_buffer; + PER_BUFFER_VALUE (buf, offset) = newval; + } + break; + + case Lisp_Fwd_Kboard_Obj: + { + char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ()); + char *p = base + XKBOARD_OBJFWD (valcontents)->offset; + *(Lisp_Object *) p = newval; + } + break; + default: - def: - valcontents = SYMBOL_VALUE (symbol); - if (BUFFER_LOCAL_VALUEP (valcontents)) - XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval; - else - SET_SYMBOL_VALUE (symbol, newval); + abort (); /* goto def; */ } } @@ -1017,25 +1033,22 @@ void swap_in_global_binding (symbol) - Lisp_Object symbol; + struct Lisp_Symbol *symbol; { - Lisp_Object valcontents = SYMBOL_VALUE (symbol); - struct Lisp_Buffer_Local_Value *blv = XBUFFER_LOCAL_VALUE (valcontents); - Lisp_Object cdr = blv->cdr; + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol); /* Unload the previously loaded binding. */ - Fsetcdr (XCAR (cdr), - do_symval_forwarding (blv->realvalue)); + if (blv->fwd) + SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); /* Select the global binding in the symbol. */ - XSETCAR (cdr, cdr); - store_symval_forwarding (symbol, blv->realvalue, XCDR (cdr), NULL); + blv->valcell = blv->defcell; + if (blv->fwd) + store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); /* Indicate that the global binding is set up now. */ - blv->frame = Qnil; - blv->buffer = Qnil; - blv->found_for_frame = 0; - blv->found_for_buffer = 0; + blv->where = Qnil; + SET_BLV_FOUND (blv, 0); } /* Set up the buffer-local symbol SYMBOL for validity in the current buffer. @@ -1045,55 +1058,50 @@ Return the value forwarded one step past the buffer-local stage. This could be another forwarding pointer. */ -static Lisp_Object -swap_in_symval_forwarding (symbol, valcontents) - Lisp_Object symbol, valcontents; +static void +swap_in_symval_forwarding (symbol, blv) + struct Lisp_Symbol *symbol; + struct Lisp_Buffer_Local_Value *blv; { register Lisp_Object tem1; - tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; + eassert (blv == SYMBOL_BLV (symbol)); + + tem1 = blv->where; if (NILP (tem1) - || current_buffer != XBUFFER (tem1) - || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame - && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) + || (blv->frame_local + ? !EQ (selected_frame, tem1) + : current_buffer != XBUFFER (tem1))) { - struct Lisp_Symbol *sym = XSYMBOL (symbol); - if (sym->indirect_variable) - { - sym = indirect_variable (sym); - XSETSYMBOL (symbol, sym); - } /* Unload the previously loaded binding. */ - tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); - Fsetcdr (tem1, - do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); + tem1 = blv->valcell; + if (blv->fwd) + SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); /* Choose the new binding. */ - tem1 = assq_no_quit (symbol, current_buffer->local_var_alist); - XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; - if (NILP (tem1)) - { - if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) - tem1 = assq_no_quit (symbol, XFRAME (selected_frame)->param_alist); - if (! NILP (tem1)) - XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1; - else - tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr; - } - else - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1; + { + Lisp_Object var; + XSETSYMBOL (var, symbol); + if (blv->frame_local) + { + tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); + blv->where = selected_frame; + } + else + { + tem1 = assq_no_quit (var, current_buffer->local_var_alist); + XSETBUFFER (blv->where, current_buffer); + } + } + if (!(blv->found = !NILP (tem1))) + tem1 = blv->defcell; /* Load the new binding. */ - XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1); - XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, current_buffer); - XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; - store_symval_forwarding (symbol, - XBUFFER_LOCAL_VALUE (valcontents)->realvalue, - Fcdr (tem1), NULL); + blv->valcell = tem1; + if (blv->fwd) + store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); } - return XBUFFER_LOCAL_VALUE (valcontents)->realvalue; } /* Find the value of a symbol, returning Qunbound if it's not bound. @@ -1106,16 +1114,27 @@ find_symbol_value (symbol) Lisp_Object symbol; { - register Lisp_Object valcontents; - register Lisp_Object val; + struct Lisp_Symbol *sym; CHECK_SYMBOL (symbol); - valcontents = SYMBOL_VALUE (symbol); - - if (BUFFER_LOCAL_VALUEP (valcontents)) - valcontents = swap_in_symval_forwarding (symbol, valcontents); - - return do_symval_forwarding (valcontents); + sym = XSYMBOL (symbol); + + start: + switch (sym->redirect) + { + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym); + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + swap_in_symval_forwarding (sym, blv); + return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); + } + /* FALLTHROUGH */ + case SYMBOL_FORWARDED: + return do_symval_forwarding (SYMBOL_FWD (sym)); + default: abort (); + } } DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, @@ -1137,26 +1156,25 @@ (symbol, newval) register Lisp_Object symbol, newval; { - return set_internal (symbol, newval, current_buffer, 0); + set_internal (symbol, newval, Qnil, 0); + return newval; } /* Return 1 if SYMBOL currently has a let-binding which was made in the buffer that is now current. */ static int -let_shadows_buffer_binding_p (symbol) - struct Lisp_Symbol *symbol; +let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) { - volatile struct specbinding *p; + struct specbinding *p; for (p = specpdl_ptr - 1; p >= specpdl; p--) if (p->func == NULL && CONSP (p->symbol)) { struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); - if ((symbol == let_bound_symbol - || (let_bound_symbol->indirect_variable - && symbol == indirect_variable (let_bound_symbol))) + eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); + if (symbol == let_bound_symbol && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) break; } @@ -1164,141 +1182,173 @@ return p >= specpdl; } +static int +let_shadows_global_binding_p (symbol) + Lisp_Object symbol; +{ + struct specbinding *p; + + for (p = specpdl_ptr - 1; p >= specpdl; p--) + if (p->func == NULL && EQ (p->symbol, symbol)) + break; + + return p >= specpdl; +} + /* Store the value NEWVAL into SYMBOL. - If buffer-locality is an issue, BUF specifies which buffer to use. - (0 stands for the current buffer.) + If buffer/frame-locality is an issue, WHERE specifies which context to use. + (nil stands for the current buffer/frame). If BINDFLAG is zero, then if this symbol is supposed to become local in every buffer where it is set, then we make it local. If BINDFLAG is nonzero, we don't do that. */ -Lisp_Object -set_internal (symbol, newval, buf, bindflag) - register Lisp_Object symbol, newval; - struct buffer *buf; +void +set_internal (symbol, newval, where, bindflag) + register Lisp_Object symbol, newval, where; int bindflag; { int voide = EQ (newval, Qunbound); - - register Lisp_Object valcontents, innercontents, tem1, current_alist_element; - - if (buf == 0) - buf = current_buffer; + struct Lisp_Symbol *sym; + Lisp_Object tem1; /* If restoring in a dead buffer, do nothing. */ - if (NILP (buf->name)) - return newval; + /* if (BUFFERP (where) && NILP (XBUFFER (where)->name)) + return; */ CHECK_SYMBOL (symbol); - if (SYMBOL_CONSTANT_P (symbol) - && (NILP (Fkeywordp (symbol)) - || !EQ (newval, SYMBOL_VALUE (symbol)))) - xsignal1 (Qsetting_constant, symbol); - - innercontents = valcontents = SYMBOL_VALUE (symbol); - - if (BUFFER_OBJFWDP (valcontents)) + if (SYMBOL_CONSTANT_P (symbol)) { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - int idx = PER_BUFFER_IDX (offset); - if (idx > 0 - && !bindflag - && !let_shadows_buffer_binding_p (XSYMBOL (symbol))) - SET_PER_BUFFER_VALUE_P (buf, idx, 1); + if (NILP (Fkeywordp (symbol)) + || !EQ (newval, Fsymbol_value (symbol))) + xsignal1 (Qsetting_constant, symbol); + else + /* Allow setting keywords to their own value. */ + return; } - else if (BUFFER_LOCAL_VALUEP (valcontents)) + + sym = XSYMBOL (symbol); + + start: + switch (sym->redirect) { - /* valcontents is a struct Lisp_Buffer_Local_Value. */ - if (XSYMBOL (symbol)->indirect_variable) - XSETSYMBOL (symbol, indirect_variable (XSYMBOL (symbol))); - - /* What binding is loaded right now? */ - current_alist_element - = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); - - /* If the current buffer is not the buffer whose binding is - loaded, or if there may be frame-local bindings and the frame - isn't the right one, or if it's a Lisp_Buffer_Local_Value and - the default binding is loaded, the loaded binding may be the - wrong one. */ - if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer) - || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) - || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame - && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) - /* Also unload a global binding (if the var is local_if_set). */ - || (EQ (XCAR (current_alist_element), - current_alist_element))) - { - /* The currently loaded binding is not necessarily valid. - We need to unload it, and choose a new binding. */ - - /* Write out `realvalue' to the old loaded binding. */ - Fsetcdr (current_alist_element, - do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); - - /* Find the new binding. */ - tem1 = Fassq (symbol, buf->local_var_alist); - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1; - XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; - - if (NILP (tem1)) - { - /* This buffer still sees the default value. */ - - /* If the variable is not local_if_set, - or if this is `let' rather than `set', - make CURRENT-ALIST-ELEMENT point to itself, - indicating that we're seeing the default value. - Likewise if the variable has been let-bound - in the current buffer. */ - if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set - || let_shadows_buffer_binding_p (XSYMBOL (symbol))) - { - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; - - if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) - tem1 = Fassq (symbol, - XFRAME (selected_frame)->param_alist); - - if (! NILP (tem1)) - XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1; - else - tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr; - } - /* If it's a Lisp_Buffer_Local_Value, being set not bound, - and we're not within a let that was made for this buffer, - create a new buffer-local binding for the variable. - That means, give this buffer a new assoc for a local value - and load that binding. */ - else - { - tem1 = Fcons (symbol, XCDR (current_alist_element)); - buf->local_var_alist - = Fcons (tem1, buf->local_var_alist); - } - } - - /* Record which binding is now loaded. */ - XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1); - - /* Set `buffer' and `frame' slots for the binding now loaded. */ - XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); - XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; - } - innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; - - /* Store the new value in the cons-cell. */ - XSETCDR (XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr), newval); + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: SET_SYMBOL_VAL (sym , newval); return; + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + if (NILP (where)) + { + if (blv->frame_local) + where = selected_frame; + else + XSETBUFFER (where, current_buffer); + } + /* If the current buffer is not the buffer whose binding is + loaded, or if there may be frame-local bindings and the frame + isn't the right one, or if it's a Lisp_Buffer_Local_Value and + the default binding is loaded, the loaded binding may be the + wrong one. */ + if (!EQ (blv->where, where) + /* Also unload a global binding (if the var is local_if_set). */ + || (EQ (blv->valcell, blv->defcell))) + { + /* The currently loaded binding is not necessarily valid. + We need to unload it, and choose a new binding. */ + + /* Write out `realvalue' to the old loaded binding. */ + if (blv->fwd) + SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); + + /* Find the new binding. */ + XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ + tem1 = Fassq (symbol, + (blv->frame_local + ? XFRAME (where)->param_alist + : XBUFFER (where)->local_var_alist)); + blv->where = where; + blv->found = 1; + + if (NILP (tem1)) + { + /* This buffer still sees the default value. */ + + /* If the variable is a Lisp_Some_Buffer_Local_Value, + or if this is `let' rather than `set', + make CURRENT-ALIST-ELEMENT point to itself, + indicating that we're seeing the default value. + Likewise if the variable has been let-bound + in the current buffer. */ + if (bindflag || !blv->local_if_set + || let_shadows_buffer_binding_p (sym)) + { + blv->found = 0; + tem1 = blv->defcell; + } + /* If it's a local_if_set, being set not bound, + and we're not within a let that was made for this buffer, + create a new buffer-local binding for the variable. + That means, give this buffer a new assoc for a local value + and load that binding. */ + else + { + /* local_if_set is only supported for buffer-local + bindings, not for frame-local bindings. */ + eassert (!blv->frame_local); + tem1 = Fcons (symbol, XCDR (blv->defcell)); + XBUFFER (where)->local_var_alist + = Fcons (tem1, XBUFFER (where)->local_var_alist); + } + } + + /* Record which binding is now loaded. */ + blv->valcell = tem1; + } + + /* Store the new value in the cons cell. */ + SET_BLV_VALUE (blv, newval); + + if (blv->fwd) + { + if (voide) + /* If storing void (making the symbol void), forward only through + buffer-local indicator, not through Lisp_Objfwd, etc. */ + blv->fwd = NULL; + else + store_symval_forwarding (blv->fwd, newval, + BUFFERP (where) + ? XBUFFER (where) : current_buffer); + } + break; + } + case SYMBOL_FORWARDED: + { + struct buffer *buf + = BUFFERP (where) ? XBUFFER (where) : current_buffer; + union Lisp_Fwd *innercontents = SYMBOL_FWD (sym); + if (BUFFER_OBJFWDP (innercontents)) + { + int offset = XBUFFER_OBJFWD (innercontents)->offset; + int idx = PER_BUFFER_IDX (offset); + if (idx > 0 + && !bindflag + && !let_shadows_buffer_binding_p (sym)) + SET_PER_BUFFER_VALUE_P (buf, idx, 1); + } + + if (voide) + { /* If storing void (making the symbol void), forward only through + buffer-local indicator, not through Lisp_Objfwd, etc. */ + sym->redirect = SYMBOL_PLAINVAL; + SET_SYMBOL_VAL (sym, newval); + } + else + store_symval_forwarding (/* sym, */ innercontents, newval, buf); + break; + } + default: abort (); } - - /* If storing void (making the symbol void), forward only through - buffer-local indicator, not through Lisp_Objfwd, etc. */ - if (voide) - store_symval_forwarding (symbol, Qnil, newval, buf); - else - store_symval_forwarding (symbol, innercontents, newval, buf); - - return newval; + return; } /* Access or set a buffer-local symbol's default value. */ @@ -1310,38 +1360,46 @@ default_value (symbol) Lisp_Object symbol; { - register Lisp_Object valcontents; + struct Lisp_Symbol *sym; CHECK_SYMBOL (symbol); - valcontents = SYMBOL_VALUE (symbol); - - /* For a built-in buffer-local variable, get the default value - rather than letting do_symval_forwarding get the current value. */ - if (BUFFER_OBJFWDP (valcontents)) - { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - if (PER_BUFFER_IDX (offset) != 0) - return PER_BUFFER_DEFAULT (offset); - } - - /* Handle user-created local variables. */ - if (BUFFER_LOCAL_VALUEP (valcontents)) + sym = XSYMBOL (symbol); + + start: + switch (sym->redirect) { - /* If var is set up for a buffer that lacks a local value for it, - the current value is nominally the default value. - But the `realvalue' slot may be more up to date, since - ordinary setq stores just that slot. So use that. */ - Lisp_Object current_alist_element, alist_element_car; - current_alist_element - = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); - alist_element_car = XCAR (current_alist_element); - if (EQ (alist_element_car, current_alist_element)) - return do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue); - else - return XCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym); + case SYMBOL_LOCALIZED: + { + /* If var is set up for a buffer that lacks a local value for it, + the current value is nominally the default value. + But the `realvalue' slot may be more up to date, since + ordinary setq stores just that slot. So use that. */ + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + if (blv->fwd && EQ (blv->valcell, blv->defcell)) + return do_symval_forwarding (blv->fwd); + else + return XCDR (blv->defcell); + } + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *valcontents = SYMBOL_FWD (sym); + + /* For a built-in buffer-local variable, get the default value + rather than letting do_symval_forwarding get the current value. */ + if (BUFFER_OBJFWDP (valcontents)) + { + int offset = XBUFFER_OBJFWD (valcontents)->offset; + if (PER_BUFFER_IDX (offset) != 0) + return PER_BUFFER_DEFAULT (offset); + } + + /* For other variables, get the current value. */ + return do_symval_forwarding (valcontents); + } + default: abort (); } - /* For other variables, get the current value. */ - return do_symval_forwarding (valcontents); } DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0, @@ -1381,50 +1439,68 @@ (symbol, value) Lisp_Object symbol, value; { - register Lisp_Object valcontents, current_alist_element, alist_element_buffer; + struct Lisp_Symbol *sym; CHECK_SYMBOL (symbol); - valcontents = SYMBOL_VALUE (symbol); - - /* Handle variables like case-fold-search that have special slots - in the buffer. Make them work apparently like Lisp_Buffer_Local_Value - variables. */ - if (BUFFER_OBJFWDP (valcontents)) + if (SYMBOL_CONSTANT_P (symbol)) + { + if (NILP (Fkeywordp (symbol)) + || !EQ (value, Fdefault_value (symbol))) + xsignal1 (Qsetting_constant, symbol); + else + /* Allow setting keywords to their own value. */ + return value; + } + sym = XSYMBOL (symbol); + + start: + switch (sym->redirect) { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - int idx = PER_BUFFER_IDX (offset); - - PER_BUFFER_DEFAULT (offset) = value; - - /* If this variable is not always local in all buffers, - set it in the buffers that don't nominally have a local value. */ - if (idx > 0) - { - struct buffer *b; - - for (b = all_buffers; b; b = b->next) - if (!PER_BUFFER_VALUE_P (b, idx)) - PER_BUFFER_VALUE (b, offset) = value; - } - return value; + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return Fset (symbol, value); + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + + /* Store new value into the DEFAULT-VALUE slot. */ + XSETCDR (blv->defcell, value); + + /* If the default binding is now loaded, set the REALVALUE slot too. */ + if (blv->fwd && EQ (blv->defcell, blv->valcell)) + store_symval_forwarding (blv->fwd, value, NULL); + return value; + } + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *valcontents = SYMBOL_FWD (sym); + + /* Handle variables like case-fold-search that have special slots + in the buffer. + Make them work apparently like Lisp_Buffer_Local_Value variables. */ + if (BUFFER_OBJFWDP (valcontents)) + { + int offset = XBUFFER_OBJFWD (valcontents)->offset; + int idx = PER_BUFFER_IDX (offset); + + PER_BUFFER_DEFAULT (offset) = value; + + /* If this variable is not always local in all buffers, + set it in the buffers that don't nominally have a local value. */ + if (idx > 0) + { + struct buffer *b; + + for (b = all_buffers; b; b = b->next) + if (!PER_BUFFER_VALUE_P (b, idx)) + PER_BUFFER_VALUE (b, offset) = value; + } + return value; + } + else + return Fset (symbol, value); + } + default: abort (); } - - if (!BUFFER_LOCAL_VALUEP (valcontents)) - return Fset (symbol, value); - - /* Store new value into the DEFAULT-VALUE slot. */ - XSETCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, value); - - /* If the default binding is now loaded, set the REALVALUE slot too. */ - current_alist_element - = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); - alist_element_buffer = Fcar (current_alist_element); - if (EQ (alist_element_buffer, current_alist_element)) - store_symval_forwarding (symbol, - XBUFFER_LOCAL_VALUE (valcontents)->realvalue, - value, NULL); - - return value; } DEFUN ("setq-default", Fsetq_default, Ssetq_default, 0, UNEVALLED, 0, @@ -1468,6 +1544,39 @@ /* Lisp functions for creating and removing buffer-local variables. */ +union Lisp_Val_Fwd + { + Lisp_Object value; + union Lisp_Fwd *fwd; + }; + +static struct Lisp_Buffer_Local_Value * +make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents) +{ + struct Lisp_Buffer_Local_Value *blv + = xmalloc (sizeof (struct Lisp_Buffer_Local_Value)); + Lisp_Object symbol; + Lisp_Object tem; + + XSETSYMBOL (symbol, sym); + tem = Fcons (symbol, (forwarded + ? do_symval_forwarding (valcontents.fwd) + : valcontents.value)); + + /* Buffer_Local_Values cannot have as realval a buffer-local + or keyboard-local forwarding. */ + eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); + eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); + blv->fwd = forwarded ? valcontents.fwd : NULL; + blv->where = Qnil; + blv->frame_local = 0; + blv->local_if_set = 0; + blv->defcell = tem; + blv->valcell = tem; + SET_BLV_FOUND (blv, 0); + return blv; +} + DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local, 1, 1, "vMake Variable Buffer Local: ", doc: /* Make VARIABLE become buffer-local whenever it is set. @@ -1485,42 +1594,58 @@ (variable) register Lisp_Object variable; { - register Lisp_Object tem, valcontents, newval; struct Lisp_Symbol *sym; + struct Lisp_Buffer_Local_Value *blv = NULL; + union Lisp_Val_Fwd valcontents; + int forwarded; CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - - valcontents = sym->value; - if (sym->constant || KBOARD_OBJFWDP (valcontents)) - error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); - - if (BUFFER_OBJFWDP (valcontents)) - return variable; - else if (BUFFER_LOCAL_VALUEP (valcontents)) - { - if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) - error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); - newval = valcontents; - } - else + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - if (EQ (valcontents, Qunbound)) - sym->value = Qnil; - tem = Fcons (Qnil, Fsymbol_value (variable)); - XSETCAR (tem, tem); - newval = allocate_misc (); - XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; - XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; - XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); - XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; - XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; - XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; - XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; - XBUFFER_LOCAL_VALUE (newval)->cdr = tem; - sym->value = newval; + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: + forwarded = 0; valcontents.value = SYMBOL_VAL (sym); + if (EQ (valcontents.value, Qunbound)) + valcontents.value = Qnil; + break; + case SYMBOL_LOCALIZED: + blv = SYMBOL_BLV (sym); + if (blv->frame_local) + error ("Symbol %s may not be buffer-local", + SDATA (SYMBOL_NAME (variable))); + break; + case SYMBOL_FORWARDED: + forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); + if (KBOARD_OBJFWDP (valcontents.fwd)) + error ("Symbol %s may not be buffer-local", + SDATA (SYMBOL_NAME (variable))); + else if (BUFFER_OBJFWDP (valcontents.fwd)) + return variable; + break; + default: abort (); } - XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1; + + if (sym->constant) + error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); + + if (!blv) + { + blv = make_blv (sym, forwarded, valcontents); + sym->redirect = SYMBOL_LOCALIZED; + SET_SYMBOL_BLV (sym, blv); + { + Lisp_Object symbol; + XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ + if (let_shadows_global_binding_p (symbol)) + message ("Making %s buffer-local while let-bound!", + SDATA (SYMBOL_NAME (variable))); + } + } + + blv->local_if_set = 1; return variable; } @@ -1547,82 +1672,97 @@ (variable) register Lisp_Object variable; { - register Lisp_Object tem, valcontents; + register Lisp_Object tem; + int forwarded; + union Lisp_Val_Fwd valcontents; struct Lisp_Symbol *sym; + struct Lisp_Buffer_Local_Value *blv = NULL; CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - - valcontents = sym->value; - if (sym->constant || KBOARD_OBJFWDP (valcontents) - || (BUFFER_LOCAL_VALUEP (valcontents) - && (XBUFFER_LOCAL_VALUE (valcontents)->check_frame))) - error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); - - if ((BUFFER_LOCAL_VALUEP (valcontents) - && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) - || BUFFER_OBJFWDP (valcontents)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) + { + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: + forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break; + case SYMBOL_LOCALIZED: + blv = SYMBOL_BLV (sym); + if (blv->frame_local) + error ("Symbol %s may not be buffer-local", + SDATA (SYMBOL_NAME (variable))); + break; + case SYMBOL_FORWARDED: + forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); + if (KBOARD_OBJFWDP (valcontents.fwd)) + error ("Symbol %s may not be buffer-local", + SDATA (SYMBOL_NAME (variable))); + break; + default: abort (); + } + + if (sym->constant) + error ("Symbol %s may not be buffer-local", + SDATA (SYMBOL_NAME (variable))); + + if (blv ? blv->local_if_set + : (forwarded && BUFFER_OBJFWDP (valcontents.fwd))) { tem = Fboundp (variable); - /* Make sure the symbol has a local value in this particular buffer, by setting it to the same value it already has. */ Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound)); return variable; } - /* Make sure symbol is set up to hold per-buffer values. */ - if (!BUFFER_LOCAL_VALUEP (valcontents)) + if (!blv) { - Lisp_Object newval; - tem = Fcons (Qnil, do_symval_forwarding (valcontents)); - XSETCAR (tem, tem); - newval = allocate_misc (); - XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; - XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; - XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; - XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; - XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; - XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; - XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; - XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; - XBUFFER_LOCAL_VALUE (newval)->cdr = tem; - sym->value = newval; + blv = make_blv (sym, forwarded, valcontents); + sym->redirect = SYMBOL_LOCALIZED; + SET_SYMBOL_BLV (sym, blv); + { + Lisp_Object symbol; + XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ + if (let_shadows_global_binding_p (symbol)) + message ("Making %s local to %s while let-bound!", + SDATA (SYMBOL_NAME (variable)), + SDATA (current_buffer->name)); + } } + /* Make sure this buffer has its own value of symbol. */ - XSETSYMBOL (variable, sym); /* Propagate variable indirections. */ + XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ tem = Fassq (variable, current_buffer->local_var_alist); if (NILP (tem)) { + if (let_shadows_buffer_binding_p (sym)) + message ("Making %s buffer-local while locally let-bound!", + SDATA (SYMBOL_NAME (variable))); + /* Swap out any local binding for some other buffer, and make sure the current value is permanently recorded, if it's the default value. */ find_symbol_value (variable); current_buffer->local_var_alist - = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (sym->value)->cdr)), + = Fcons (Fcons (variable, XCDR (blv->defcell)), current_buffer->local_var_alist); /* Make sure symbol does not think it is set up for this buffer; force it to look once again for this buffer's value. */ - { - Lisp_Object *pvalbuf; - - valcontents = sym->value; - - pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; - if (current_buffer == XBUFFER (*pvalbuf)) - *pvalbuf = Qnil; - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; - } + if (current_buffer == XBUFFER (blv->where)) + blv->where = Qnil; + /* blv->valcell = blv->defcell; + * SET_BLV_FOUND (blv, 0); */ + blv->found = 0; } /* If the symbol forwards into a C variable, then load the binding for this buffer now. If C code modifies the variable before we load the binding in, then that new value will clobber the default binding the next time we unload it. */ - valcontents = XBUFFER_LOCAL_VALUE (sym->value)->realvalue; - if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) - swap_in_symval_forwarding (variable, sym->value); + if (blv->fwd) + swap_in_symval_forwarding (sym, blv); return variable; } @@ -1634,31 +1774,43 @@ (variable) register Lisp_Object variable; { - register Lisp_Object tem, valcontents; + register Lisp_Object tem; + struct Lisp_Buffer_Local_Value *blv; struct Lisp_Symbol *sym; CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - - valcontents = sym->value; - - if (BUFFER_OBJFWDP (valcontents)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - int idx = PER_BUFFER_IDX (offset); - - if (idx > 0) - { - SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); - PER_BUFFER_VALUE (current_buffer, offset) - = PER_BUFFER_DEFAULT (offset); - } - return variable; + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return variable; + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *valcontents = SYMBOL_FWD (sym); + if (BUFFER_OBJFWDP (valcontents)) + { + int offset = XBUFFER_OBJFWD (valcontents)->offset; + int idx = PER_BUFFER_IDX (offset); + + if (idx > 0) + { + SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); + PER_BUFFER_VALUE (current_buffer, offset) + = PER_BUFFER_DEFAULT (offset); + } + } + return variable; + } + case SYMBOL_LOCALIZED: + blv = SYMBOL_BLV (sym); + if (blv->frame_local) + return variable; + break; + default: abort (); } - if (!BUFFER_LOCAL_VALUEP (valcontents)) - return variable; - /* Get rid of this buffer's alist element, if any. */ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ tem = Fassq (variable, current_buffer->local_var_alist); @@ -1670,14 +1822,13 @@ loaded, recompute its value. We have to do it now, or else forwarded objects won't work right. */ { - Lisp_Object *pvalbuf, buf; - valcontents = sym->value; - pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; - XSETBUFFER (buf, current_buffer); - if (EQ (buf, *pvalbuf)) + Lisp_Object buf; XSETBUFFER (buf, current_buffer); + if (EQ (buf, blv->where)) { - *pvalbuf = Qnil; - XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; + blv->where = Qnil; + /* blv->valcell = blv->defcell; + * SET_BLV_FOUND (blv, 0); */ + blv->found = 0; find_symbol_value (variable); } } @@ -1712,39 +1863,52 @@ (variable) register Lisp_Object variable; { - register Lisp_Object tem, valcontents, newval; + int forwarded; + union Lisp_Val_Fwd valcontents; struct Lisp_Symbol *sym; + struct Lisp_Buffer_Local_Value *blv = NULL; CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - - valcontents = sym->value; - if (sym->constant || KBOARD_OBJFWDP (valcontents) - || BUFFER_OBJFWDP (valcontents)) - error ("Symbol %s may not be frame-local", SDATA (sym->xname)); - - if (BUFFER_LOCAL_VALUEP (valcontents)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - if (!XBUFFER_LOCAL_VALUE (valcontents)->check_frame) - error ("Symbol %s may not be frame-local", SDATA (sym->xname)); - return variable; + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: + forwarded = 0; valcontents.value = SYMBOL_VAL (sym); + if (EQ (valcontents.value, Qunbound)) + valcontents.value = Qnil; + break; + case SYMBOL_LOCALIZED: + if (SYMBOL_BLV (sym)->frame_local) + return variable; + else + error ("Symbol %s may not be frame-local", + SDATA (SYMBOL_NAME (variable))); + case SYMBOL_FORWARDED: + forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); + if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd)) + error ("Symbol %s may not be frame-local", + SDATA (SYMBOL_NAME (variable))); + break; + default: abort (); } - if (EQ (valcontents, Qunbound)) - sym->value = Qnil; - tem = Fcons (Qnil, Fsymbol_value (variable)); - XSETCAR (tem, tem); - newval = allocate_misc (); - XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; - XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; - XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; - XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; - XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; - XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; - XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; - XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; - XBUFFER_LOCAL_VALUE (newval)->cdr = tem; - sym->value = newval; + if (sym->constant) + error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); + + blv = make_blv (sym, forwarded, valcontents); + blv->frame_local = 1; + sym->redirect = SYMBOL_LOCALIZED; + SET_SYMBOL_BLV (sym, blv); + { + Lisp_Object symbol; + XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ + if (let_shadows_global_binding_p (symbol)) + message ("Making %s frame-local while let-bound!", + SDATA (SYMBOL_NAME (variable))); + } return variable; } @@ -1755,7 +1919,6 @@ (variable, buffer) register Lisp_Object variable, buffer; { - Lisp_Object valcontents; register struct buffer *buf; struct Lisp_Symbol *sym; @@ -1768,29 +1931,46 @@ } CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - XSETSYMBOL (variable, sym); - - valcontents = sym->value; - if (BUFFER_LOCAL_VALUEP (valcontents)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - Lisp_Object tail, elt; - - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) - { - elt = XCAR (tail); - if (EQ (variable, XCAR (elt))) - return Qt; - } + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return Qnil; + case SYMBOL_LOCALIZED: + { + Lisp_Object tail, elt, tmp; + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + XSETBUFFER (tmp, buf); + + for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + { + elt = XCAR (tail); + if (EQ (variable, XCAR (elt))) + { + eassert (!blv->frame_local); + eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); + return Qt; + } + } + eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); + return Qnil; + } + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *valcontents = SYMBOL_FWD (sym); + if (BUFFER_OBJFWDP (valcontents)) + { + int offset = XBUFFER_OBJFWD (valcontents)->offset; + int idx = PER_BUFFER_IDX (offset); + if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) + return Qt; + } + return Qnil; + } + default: abort (); } - if (BUFFER_OBJFWDP (valcontents)) - { - int offset = XBUFFER_OBJFWD (valcontents)->offset; - int idx = PER_BUFFER_IDX (offset); - if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) - return Qt; - } - return Qnil; } DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, @@ -1804,40 +1984,29 @@ (variable, buffer) register Lisp_Object variable, buffer; { - Lisp_Object valcontents; - register struct buffer *buf; struct Lisp_Symbol *sym; - if (NILP (buffer)) - buf = current_buffer; - else - { - CHECK_BUFFER (buffer); - buf = XBUFFER (buffer); - } - CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); - XSETSYMBOL (variable, sym); - - valcontents = sym->value; - - if (BUFFER_OBJFWDP (valcontents)) - /* All these slots become local if they are set. */ - return Qt; - else if (BUFFER_LOCAL_VALUEP (valcontents)) + sym = XSYMBOL (variable); + + start: + switch (sym->redirect) { - Lisp_Object tail, elt; - if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) - return Qt; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) - { - elt = XCAR (tail); - if (EQ (variable, XCAR (elt))) - return Qt; - } + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return Qnil; + case SYMBOL_LOCALIZED: + { + struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); + if (blv->local_if_set) + return Qt; + XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ + return Flocal_variable_p (variable, buffer); + } + case SYMBOL_FORWARDED: + /* All BUFFER_OBJFWD slots become local if they are set. */ + return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil); + default: abort (); } - return Qnil; } DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus, @@ -1849,30 +2018,40 @@ (variable) register Lisp_Object variable; { - Lisp_Object valcontents; struct Lisp_Symbol *sym; CHECK_SYMBOL (variable); - sym = indirect_variable (XSYMBOL (variable)); + sym = XSYMBOL (variable); /* Make sure the current binding is actually swapped in. */ find_symbol_value (variable); - valcontents = sym->value; - - if (BUFFER_LOCAL_VALUEP (valcontents) - || BUFFER_OBJFWDP (valcontents)) + start: + switch (sym->redirect) { + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: return Qnil; + case SYMBOL_FORWARDED: + { + union Lisp_Fwd *valcontents = SYMBOL_FWD (sym); + if (KBOARD_OBJFWDP (valcontents)) + return Fframe_terminal (Fselected_frame ()); + else if (!BUFFER_OBJFWDP (valcontents)) + return Qnil; + } + /* FALLTHROUGH */ + case SYMBOL_LOCALIZED: /* For a local variable, record both the symbol and which buffer's or frame's value we are saving. */ if (!NILP (Flocal_variable_p (variable, Qnil))) return Fcurrent_buffer (); - else if (BUFFER_LOCAL_VALUEP (valcontents) - && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) - return XBUFFER_LOCAL_VALUE (valcontents)->frame; + else if (sym->redirect == SYMBOL_LOCALIZED + && BLV_FOUND (SYMBOL_BLV (sym))) + return SYMBOL_BLV (sym)->where; + else + return Qnil; + default: abort (); } - - return Qnil; } /* This code is disabled now that we use the selected frame to return diff -r e56f669f17ce -r fe07c47cf7a7 src/dired.c --- a/src/dired.c Wed May 12 14:32:06 2010 +0200 +++ b/src/dired.c Thu May 13 15:13:52 2010 +0200 @@ -935,9 +935,9 @@ Value is nil if specified file cannot be opened. ID-FORMAT specifies the preferred format of attributes uid and gid (see -below) - valid values are 'string and 'integer. The latter is the default, -but we plan to change that, so you should specify a non-nil value for -ID-FORMAT if you use the returned uid or gid. +below) - valid values are 'string and 'integer. The latter is the +default, but we plan to change that, so you should specify a non-nil value +for ID-FORMAT if you use the returned uid or gid. Elements of the attribute list are: 0. t for directory, string (name linked to) for symbolic link, or nil. diff -r e56f669f17ce -r fe07c47cf7a7 src/dispextern.h --- a/src/dispextern.h Wed May 12 14:32:06 2010 +0200 +++ b/src/dispextern.h Thu May 13 15:13:52 2010 +0200 @@ -1956,6 +1956,7 @@ NUM_IT_METHODS }; +/* FIXME: What is this? Why 5? */ #define IT_STACK_SIZE 5 /* Iterator for composition (both for static and automatic). */ @@ -2222,13 +2223,22 @@ MODE_LINE_FACE_ID, etc, depending on what we are displaying. */ int base_face_id; - /* If what == IT_CHARACTER, character and length in bytes. This is - a character from a buffer or string. It may be different from - the character displayed in case that - unibyte_display_via_language_environment is set. - - If what == IT_COMPOSITION, the first component of a composition - and length in bytes of the composition. */ + /* If `what' == IT_CHARACTER, the character and the length in bytes + of its multibyte sequence. The character comes from a buffer or + a string. It may be different from the character displayed in + case that unibyte_display_via_language_environment is set. + + If `what' == IT_COMPOSITION, the first component of a composition + and length in bytes of the composition. + + If `what' is anything else, these two are undefined (will + probably hold values for the last IT_CHARACTER or IT_COMPOSITION + traversed by the iterator. + + The values are updated by get_next_display_element, so they are + out of sync with the value returned by IT_CHARPOS between the + time set_iterator_to_next advances the position and the time + get_next_display_element loads the new values into c and len. */ int c, len; /* If what == IT_COMPOSITION, iterator substructure for the @@ -2783,6 +2793,9 @@ /* Icon file name of right to left image when an RTL locale is used. */ TOOL_BAR_ITEM_RTL_IMAGE, + /* Label to show when text labels are enabled. */ + TOOL_BAR_ITEM_LABEL, + /* Sentinel = number of slots in tool_bar_items occupied by one tool-bar item. */ TOOL_BAR_ITEM_NSLOTS @@ -2804,6 +2817,15 @@ extern Lisp_Object Vtool_bar_button_margin; +/* Tool bar style */ + +extern Lisp_Object Vtool_bar_style; + +/* Maximum number of characters a label can have to be shown. */ + +extern EMACS_INT tool_bar_max_label_size; +#define DEFAULT_TOOL_BAR_LABEL_SIZE 14 + /* Thickness of relief to draw around tool-bar buttons. */ extern EMACS_INT tool_bar_button_relief; diff -r e56f669f17ce -r fe07c47cf7a7 src/dispnew.c --- a/src/dispnew.c Wed May 12 14:32:06 2010 +0200 +++ b/src/dispnew.c Thu May 13 15:13:52 2010 +0200 @@ -4251,7 +4251,9 @@ doesn't work with lbearing/rbearing), so we must do it this way. */ if (vpos == w->phys_cursor.vpos - && w->phys_cursor.hpos >= desired_row->used[TEXT_AREA]) + && (desired_row->reversed_p + ? (w->phys_cursor.hpos < 0) + : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA]))) { w->phys_cursor_on_p = 0; x = -1; @@ -4415,7 +4417,7 @@ } /* Window cursor can be out of sync for horizontally split windows. */ - hpos = max (0, hpos); + hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */ hpos = min (w->current_matrix->matrix_w - 1, hpos); vpos = max (0, vpos); vpos = min (w->current_matrix->nrows - 1, vpos); diff -r e56f669f17ce -r fe07c47cf7a7 src/doc.c --- a/src/doc.c Wed May 12 14:32:06 2010 +0200 +++ b/src/doc.c Thu May 13 15:13:52 2010 +0200 @@ -538,7 +538,7 @@ { tem = Fcdr (Fcdr (fun)); if (CONSP (tem) && INTEGERP (XCAR (tem))) - XSETCARFASTINT (tem, offset); + XSETCAR (tem, make_number (offset)); } else if (EQ (tem, Qmacro)) store_function_docstring (XCDR (fun), offset); diff -r e56f669f17ce -r fe07c47cf7a7 src/ecrt0.c --- a/src/ecrt0.c Wed May 12 14:32:06 2010 +0200 +++ b/src/ecrt0.c Thu May 13 15:13:52 2010 +0200 @@ -61,15 +61,7 @@ char **environ; -#ifndef static -/* On systems where the static storage class is usable, this function - should be declared as static. Otherwise, the static keyword has - been defined to be something else, and code for those systems must - take care of this declaration appropriately. */ static start1 (); -#endif - -#ifdef CRT0_DUMMIES /* Define symbol "start": here; some systems want that symbol. */ asm(" .text "); @@ -83,7 +75,7 @@ } static -start1 (CRT0_DUMMIES argc, xargv) +start1 (bogus_fp, argc, xargv) int argc; char *xargv; { @@ -98,7 +90,6 @@ and optimize it out. */ (void) &start1; } -#endif /* CRT0_DUMMIES */ /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/emacs.c --- a/src/emacs.c Wed May 12 14:32:06 2010 +0200 +++ b/src/emacs.c Thu May 13 15:13:52 2010 +0200 @@ -81,7 +81,7 @@ #endif #ifdef HAVE_SETPGID -#if !defined (USG) || defined (BSD_PGRPS) +#if !defined (USG) #undef setpgrp #define setpgrp setpgid #endif @@ -193,11 +193,6 @@ data on the first attempt to change it inside asynchronous code. */ int running_asynch_code; -#ifdef BSD_PGRPS -/* See sysdep.c. */ -extern int inherited_pgroup; -#endif - #if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) /* If non-zero, -d was specified, meaning we're using some window system. */ int display_arg; @@ -268,6 +263,7 @@ Initialization options:\n\ \n\ --batch do not do interactive display; implies -q\n\ +--chdir DIR change to directory DIR\n\ --daemon start a server in the background\n\ --debug-init enable Emacs Lisp debugger for init file\n\ --display, -d DISPLAY use X server DISPLAY\n\ @@ -385,6 +381,9 @@ { fatal_error_in_progress = 1; + if (sig == SIGTERM || sig == SIGHUP) + Fkill_emacs (make_number (sig)); + shut_down_emacs (sig, 0, Qnil); } @@ -765,6 +764,7 @@ #ifdef NS_IMPL_COCOA char dname_arg2[80]; #endif + char *ch_to_dir; #if GC_MARK_STACK extern Lisp_Object *stack_base; @@ -832,6 +832,14 @@ exit (0); } } + if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) + if (chdir (ch_to_dir) == -1) + { + fprintf (stderr, "%s: Can't chdir to %s: %s\n", + argv[0], ch_to_dir, strerror (errno)); + exit (1); + } + #ifdef HAVE_PERSONALITY_LINUX32 if (!initialized @@ -1174,17 +1182,9 @@ if (! noninteractive) { -#ifdef BSD_PGRPS - if (initialized) - { - inherited_pgroup = EMACS_GETPGRP (0); - setpgrp (0, getpid ()); - } -#else #if defined (USG5) && defined (INTERRUPT_INPUT) setpgrp (); #endif -#endif #if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) { extern void malloc_enable_thread P_ ((void)); @@ -1582,9 +1582,7 @@ syms_of_ccl (); syms_of_character (); syms_of_cmds (); -#ifndef NO_DIR_LIBRARY syms_of_dired (); -#endif /* not NO_DIR_LIBRARY */ syms_of_display (); syms_of_doc (); syms_of_editfns (); @@ -1802,6 +1800,7 @@ const struct standard_args standard_args[] = { { "-version", "--version", 150, 0 }, + { "-chdir", "--chdir", 130, 1 }, { "-t", "--terminal", 120, 1 }, { "-nw", "--no-window-system", 110, 0 }, { "-nw", "--no-windows", 110, 0 }, diff -r e56f669f17ce -r fe07c47cf7a7 src/eval.c --- a/src/eval.c Wed May 12 14:32:06 2010 +0200 +++ b/src/eval.c Thu May 13 15:13:52 2010 +0200 @@ -26,6 +26,7 @@ #include "commands.h" #include "keyboard.h" #include "dispextern.h" +#include "frame.h" /* For XFRAME. */ #if HAVE_X_WINDOWS #include "xterm.h" @@ -767,24 +768,43 @@ CHECK_SYMBOL (new_alias); CHECK_SYMBOL (base_variable); - if (SYMBOL_CONSTANT_P (new_alias)) + sym = XSYMBOL (new_alias); + + if (sym->constant) + /* Not sure why, but why not? */ error ("Cannot make a constant an alias"); - sym = XSYMBOL (new_alias); + switch (sym->redirect) + { + case SYMBOL_FORWARDED: + error ("Cannot make an internal variable an alias"); + case SYMBOL_LOCALIZED: + error ("Don't know how to make a localized variable an alias"); + } + /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html - If n_a is bound, but b_v is not, set the value of b_v to n_a. - This is for the sake of define-obsolete-variable-alias and user - customizations. */ - if (NILP (Fboundp (base_variable)) && !NILP (Fboundp (new_alias))) - XSYMBOL(base_variable)->value = sym->value; - sym->indirect_variable = 1; - sym->value = base_variable; + If n_a is bound, but b_v is not, set the value of b_v to n_a, + so that old-code that affects n_a before the aliasing is setup + still works. */ + if (NILP (Fboundp (base_variable))) + set_internal (base_variable, find_symbol_value (new_alias), Qnil, 1); + + { + struct specbinding *p; + + for (p = specpdl_ptr - 1; p >= specpdl; p--) + if (p->func == NULL + && (EQ (new_alias, + CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol))) + error ("Don't know how to make a let-bound variable an alias"); + } + + sym->redirect = SYMBOL_VARALIAS; + SET_SYMBOL_ALIAS (sym, XSYMBOL (base_variable)); sym->constant = SYMBOL_CONSTANT_P (base_variable); LOADHIST_ATTACH (new_alias); - if (!NILP (docstring)) - Fput (new_alias, Qvariable_documentation, docstring); - else - Fput (new_alias, Qvariable_documentation, Qnil); + /* Even if docstring is nil: remove old docstring. */ + Fput (new_alias, Qvariable_documentation, docstring); return base_variable; } @@ -944,7 +964,7 @@ return Qnil; /* If indirect and there's an alias loop, don't check anything else. */ - if (XSYMBOL (variable)->indirect_variable + if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS && NILP (internal_condition_case_1 (lisp_indirect_variable, variable, Qt, user_variable_p_eh))) return Qnil; @@ -968,11 +988,11 @@ || (!NILP (Fget (variable, intern ("custom-autoload"))))) return Qt; - if (!XSYMBOL (variable)->indirect_variable) + if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS)) return Qnil; /* An indirect variable? Let's follow the chain. */ - variable = XSYMBOL (variable)->value; + XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable))); } } @@ -1541,17 +1561,64 @@ return val; } +/* Like internal_condition_case_1 but call BFUN with ARG1 and ARG2 as + its arguments. */ + +Lisp_Object +internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), + Lisp_Object arg1, + Lisp_Object arg2, + Lisp_Object handlers, + Lisp_Object (*hfun) (Lisp_Object)) +{ + Lisp_Object val; + struct catchtag c; + struct handler h; + + /* Since Fsignal will close off all calls to x_catch_errors, + we will get the wrong results if some are not closed now. */ +#if HAVE_X_WINDOWS + if (x_catching_errors ()) + abort (); +#endif + + c.tag = Qnil; + c.val = Qnil; + c.backlist = backtrace_list; + c.handlerlist = handlerlist; + c.lisp_eval_depth = lisp_eval_depth; + c.pdlcount = SPECPDL_INDEX (); + c.poll_suppress_count = poll_suppress_count; + c.interrupt_input_blocked = interrupt_input_blocked; + c.gcpro = gcprolist; + c.byte_stack = byte_stack_list; + if (_setjmp (c.jmp)) + { + return (*hfun) (c.val); + } + c.next = catchlist; + catchlist = &c; + h.handler = handlers; + h.var = Qnil; + h.next = handlerlist; + h.tag = &c; + handlerlist = &h; + + val = (*bfun) (arg1, arg2); + catchlist = c.next; + handlerlist = h.next; + return val; +} /* Like internal_condition_case but call BFUN with NARGS as first, and ARGS as second argument. */ Lisp_Object -internal_condition_case_2 (bfun, nargs, args, handlers, hfun) - Lisp_Object (*bfun) (); - int nargs; - Lisp_Object *args; - Lisp_Object handlers; - Lisp_Object (*hfun) (); +internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), + int nargs, + Lisp_Object *args, + Lisp_Object handlers, + Lisp_Object (*hfun) (Lisp_Object)) { Lisp_Object val; struct catchtag c; @@ -2112,8 +2179,6 @@ (function, file, docstring, interactive, type) Lisp_Object function, file, docstring, interactive, type; { - Lisp_Object args[4]; - CHECK_SYMBOL (function); CHECK_STRING (file); @@ -2129,8 +2194,11 @@ LOADHIST_ATTACH (Fcons (Qautoload, function)); else /* We don't want the docstring in purespace (instead, - Snarf-documentation should (hopefully) overwrite it). */ - docstring = make_number (0); + Snarf-documentation should (hopefully) overwrite it). + We used to use 0 here, but that leads to accidental sharing in + purecopy's hash-consing, so we use a (hopefully) unique integer + instead. */ + docstring = make_number (XHASH (function)); return Ffset (function, Fpurecopy (list5 (Qautoload, file, docstring, interactive, type))); @@ -2764,7 +2832,6 @@ if (NILP (arg)) RETURN_UNGCPRO (Ffuncall (1, &fn)); gcpro1.nvars = 2; -#ifdef NO_ARG_ARRAY { Lisp_Object args[2]; args[0] = fn; @@ -2772,9 +2839,6 @@ gcpro1.var = args; RETURN_UNGCPRO (Fapply (2, args)); } -#else /* not NO_ARG_ARRAY */ - RETURN_UNGCPRO (Fapply (2, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn on no arguments */ @@ -2795,7 +2859,6 @@ Lisp_Object fn, arg1; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[2]; args[0] = fn; @@ -2803,11 +2866,6 @@ GCPRO1 (args[0]); gcpro1.nvars = 2; RETURN_UNGCPRO (Ffuncall (2, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 2; - RETURN_UNGCPRO (Ffuncall (2, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn with 2 arguments arg1, arg2 */ @@ -2817,7 +2875,6 @@ Lisp_Object fn, arg1, arg2; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[3]; args[0] = fn; args[1] = arg1; @@ -2825,11 +2882,6 @@ GCPRO1 (args[0]); gcpro1.nvars = 3; RETURN_UNGCPRO (Ffuncall (3, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 3; - RETURN_UNGCPRO (Ffuncall (3, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn with 3 arguments arg1, arg2, arg3 */ @@ -2839,7 +2891,6 @@ Lisp_Object fn, arg1, arg2, arg3; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[4]; args[0] = fn; args[1] = arg1; @@ -2848,11 +2899,6 @@ GCPRO1 (args[0]); gcpro1.nvars = 4; RETURN_UNGCPRO (Ffuncall (4, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 4; - RETURN_UNGCPRO (Ffuncall (4, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ @@ -2862,7 +2908,6 @@ Lisp_Object fn, arg1, arg2, arg3, arg4; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[5]; args[0] = fn; args[1] = arg1; @@ -2872,11 +2917,6 @@ GCPRO1 (args[0]); gcpro1.nvars = 5; RETURN_UNGCPRO (Ffuncall (5, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 5; - RETURN_UNGCPRO (Ffuncall (5, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ @@ -2886,7 +2926,6 @@ Lisp_Object fn, arg1, arg2, arg3, arg4, arg5; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[6]; args[0] = fn; args[1] = arg1; @@ -2897,11 +2936,6 @@ GCPRO1 (args[0]); gcpro1.nvars = 6; RETURN_UNGCPRO (Ffuncall (6, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 6; - RETURN_UNGCPRO (Ffuncall (6, &fn)); -#endif /* not NO_ARG_ARRAY */ } /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ @@ -2911,7 +2945,6 @@ Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6; { struct gcpro gcpro1; -#ifdef NO_ARG_ARRAY Lisp_Object args[7]; args[0] = fn; args[1] = arg1; @@ -2923,11 +2956,27 @@ GCPRO1 (args[0]); gcpro1.nvars = 7; RETURN_UNGCPRO (Ffuncall (7, args)); -#else /* not NO_ARG_ARRAY */ - GCPRO1 (fn); - gcpro1.nvars = 7; - RETURN_UNGCPRO (Ffuncall (7, &fn)); -#endif /* not NO_ARG_ARRAY */ +} + +/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ +/* ARGSUSED */ +Lisp_Object +call7 (fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7; +{ + struct gcpro gcpro1; + Lisp_Object args[8]; + args[0] = fn; + args[1] = arg1; + args[2] = arg2; + args[3] = arg3; + args[4] = arg4; + args[5] = arg5; + args[6] = arg6; + args[7] = arg7; + GCPRO1 (args[0]); + gcpro1.nvars = 8; + RETURN_UNGCPRO (Ffuncall (8, args)); } /* The caller should GCPRO all the elements of ARGS. */ @@ -3263,78 +3312,94 @@ specbind (symbol, value) Lisp_Object symbol, value; { - Lisp_Object valcontents; + struct Lisp_Symbol *sym; + + eassert (!handling_signal); CHECK_SYMBOL (symbol); + sym = XSYMBOL (symbol); if (specpdl_ptr == specpdl + specpdl_size) grow_specpdl (); - /* The most common case is that of a non-constant symbol with a - trivial value. Make that as fast as we can. */ - valcontents = SYMBOL_VALUE (symbol); - if (!MISCP (valcontents) && !SYMBOL_CONSTANT_P (symbol)) - { - specpdl_ptr->symbol = symbol; - specpdl_ptr->old_value = valcontents; - specpdl_ptr->func = NULL; - ++specpdl_ptr; - SET_SYMBOL_VALUE (symbol, value); - } - else + start: + switch (sym->redirect) { - Lisp_Object ovalue = find_symbol_value (symbol); - specpdl_ptr->func = 0; - specpdl_ptr->old_value = ovalue; - - valcontents = XSYMBOL (symbol)->value; - - if (BUFFER_LOCAL_VALUEP (valcontents) - || BUFFER_OBJFWDP (valcontents)) - { - Lisp_Object where, current_buffer; - - current_buffer = Fcurrent_buffer (); - - /* For a local variable, record both the symbol and which - buffer's or frame's value we are saving. */ - if (!NILP (Flocal_variable_p (symbol, Qnil))) - where = current_buffer; - else if (BUFFER_LOCAL_VALUEP (valcontents) - && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) - where = XBUFFER_LOCAL_VALUE (valcontents)->frame; + case SYMBOL_VARALIAS: + sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start; + case SYMBOL_PLAINVAL: + { /* The most common case is that of a non-constant symbol with a + trivial value. Make that as fast as we can. */ + specpdl_ptr->symbol = symbol; + specpdl_ptr->old_value = SYMBOL_VAL (sym); + specpdl_ptr->func = NULL; + ++specpdl_ptr; + if (!sym->constant) + SET_SYMBOL_VAL (sym, value); else - where = Qnil; - - /* We're not using the `unused' slot in the specbinding - structure because this would mean we have to do more - work for simple variables. */ - specpdl_ptr->symbol = Fcons (symbol, Fcons (where, current_buffer)); - - /* If SYMBOL is a per-buffer variable which doesn't have a - buffer-local value here, make the `let' change the global - value by changing the value of SYMBOL in all buffers not - having their own value. This is consistent with what - happens with other buffer-local variables. */ - if (NILP (where) - && BUFFER_OBJFWDP (valcontents)) - { - ++specpdl_ptr; - Fset_default (symbol, value); - return; - } + set_internal (symbol, value, Qnil, 1); + break; } - else - specpdl_ptr->symbol = symbol; - - specpdl_ptr++; - /* We used to do - if (BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue)) - store_symval_forwarding (symbol, ovalue, value, NULL); - else - but ovalue comes from find_symbol_value which should never return - such an internal value. */ - eassert (!(BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue))); - set_internal (symbol, value, 0, 1); + case SYMBOL_LOCALIZED: case SYMBOL_FORWARDED: + { + Lisp_Object ovalue = find_symbol_value (symbol); + specpdl_ptr->func = 0; + specpdl_ptr->old_value = ovalue; + + eassert (sym->redirect != SYMBOL_LOCALIZED + || (EQ (SYMBOL_BLV (sym)->where, + SYMBOL_BLV (sym)->frame_local ? + Fselected_frame () : Fcurrent_buffer ()))); + + if (sym->redirect == SYMBOL_LOCALIZED + || BUFFER_OBJFWDP (SYMBOL_FWD (sym))) + { + Lisp_Object where, cur_buf = Fcurrent_buffer (); + + /* For a local variable, record both the symbol and which + buffer's or frame's value we are saving. */ + if (!NILP (Flocal_variable_p (symbol, Qnil))) + { + eassert (sym->redirect != SYMBOL_LOCALIZED + || (BLV_FOUND (SYMBOL_BLV (sym)) + && EQ (cur_buf, SYMBOL_BLV (sym)->where))); + where = cur_buf; + } + else if (sym->redirect == SYMBOL_LOCALIZED + && BLV_FOUND (SYMBOL_BLV (sym))) + where = SYMBOL_BLV (sym)->where; + else + where = Qnil; + + /* We're not using the `unused' slot in the specbinding + structure because this would mean we have to do more + work for simple variables. */ + /* 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. */ + specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf)); + + /* If SYMBOL is a per-buffer variable which doesn't have a + buffer-local value here, make the `let' change the global + value by changing the value of SYMBOL in all buffers not + having their own value. This is consistent with what + happens with other buffer-local variables. */ + if (NILP (where) + && sym->redirect == SYMBOL_FORWARDED) + { + eassert (BUFFER_OBJFWDP (SYMBOL_FWD (sym))); + ++specpdl_ptr; + Fset_default (symbol, value); + return; + } + } + else + specpdl_ptr->symbol = symbol; + + specpdl_ptr++; + set_internal (symbol, value, Qnil, 1); + break; + } + default: abort (); } } @@ -3393,21 +3458,26 @@ if (NILP (where)) 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)) - set_internal (symbol, this_binding.old_value, XBUFFER (where), 1); - else - set_internal (symbol, this_binding.old_value, NULL, 1); + { + 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, + since that was already done by specbind. */ + else if (XSYMBOL (this_binding.symbol)->redirect == SYMBOL_PLAINVAL) + SET_SYMBOL_VAL (XSYMBOL (this_binding.symbol), + this_binding.old_value); else - { - /* If variable has a trivial value (no forwarding), we can - just set it. No need to check for constant symbols here, - since that was already done by specbind. */ - if (!MISCP (SYMBOL_VALUE (this_binding.symbol))) - SET_SYMBOL_VALUE (this_binding.symbol, this_binding.old_value); - else - set_internal (this_binding.symbol, this_binding.old_value, 0, 1); - } + /* NOTE: we only ever come here if make_local_foo was used for + the first time on this var within this let. */ + Fset_default (this_binding.symbol, this_binding.old_value); } if (NILP (Vquit_flag) && !NILP (quitf)) diff -r e56f669f17ce -r fe07c47cf7a7 src/fileio.c --- a/src/fileio.c Wed May 12 14:32:06 2010 +0200 +++ b/src/fileio.c Thu May 13 15:13:52 2010 +0200 @@ -53,6 +53,11 @@ #include #include +#ifdef HAVE_LIBSELINUX +#include +#include +#endif + #include "lisp.h" #include "intervals.h" #include "buffer.h" @@ -294,7 +299,7 @@ /* Restore point, having saved it as a marker. */ -static Lisp_Object +Lisp_Object restore_point_unwind (location) Lisp_Object location; { @@ -331,6 +336,8 @@ Lisp_Object Qfile_modes; Lisp_Object Qset_file_modes; Lisp_Object Qset_file_times; +Lisp_Object Qfile_selinux_context; +Lisp_Object Qset_file_selinux_context; Lisp_Object Qfile_newer_than_file_p; Lisp_Object Qinsert_file_contents; Lisp_Object Qwrite_region; @@ -1894,7 +1901,7 @@ return; } -DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, +DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, "fCopy file: \nGCopy %s to file: \np\nP", doc: /* Copy FILE to NEWNAME. Both args must be strings. If NEWNAME names a directory, copy FILE there. @@ -1916,10 +1923,13 @@ A prefix arg makes KEEP-TIME non-nil. If PRESERVE-UID-GID is non-nil, we try to transfer the -uid and gid of FILE to NEWNAME. */) - (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid) +uid and gid of FILE to NEWNAME. + +If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled +on the system, we copy the SELinux context of FILE to NEWNAME. */) + (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid, preserve_selinux_context) Lisp_Object file, newname, ok_if_already_exists, keep_time; - Lisp_Object preserve_uid_gid; + Lisp_Object preserve_uid_gid, preserve_selinux_context; { int ifd, ofd, n; char buf[16 * 1024]; @@ -1929,6 +1939,10 @@ int count = SPECPDL_INDEX (); int input_file_statable_p; Lisp_Object encoded_file, encoded_newname; +#if HAVE_LIBSELINUX + security_context_t con; + int fail, conlength = 0; +#endif encoded_file = encoded_newname = Qnil; GCPRO4 (file, newname, encoded_file, encoded_newname); @@ -1949,8 +1963,9 @@ if (NILP (handler)) handler = Ffind_file_name_handler (newname, Qcopy_file); if (!NILP (handler)) - RETURN_UNGCPRO (call6 (handler, Qcopy_file, file, newname, - ok_if_already_exists, keep_time, preserve_uid_gid)); + RETURN_UNGCPRO (call7 (handler, Qcopy_file, file, newname, + ok_if_already_exists, keep_time, preserve_uid_gid, + preserve_selinux_context)); encoded_file = ENCODE_FILE (file); encoded_newname = ENCODE_FILE (newname); @@ -2004,6 +2019,15 @@ copyable by us. */ input_file_statable_p = (fstat (ifd, &st) >= 0); +#if HAVE_LIBSELINUX + if (!NILP (preserve_selinux_context) && is_selinux_enabled ()) + { + conlength = fgetfilecon (ifd, &con); + if (conlength == -1) + report_file_error ("Doing fgetfilecon", Fcons (file, Qnil)); + } +#endif + if (out_st.st_mode != 0 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) { @@ -2061,6 +2085,18 @@ } #endif /* not MSDOS */ +#if HAVE_LIBSELINUX + if (conlength > 0) + { + /* Set the modified context back to the file. */ + fail = fsetfilecon (ofd, con); + if (fail) + report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil)); + + freecon (con); + } +#endif + /* Closing the output clobbers the file times on some systems. */ if (emacs_close (ofd) < 0) report_file_error ("I/O error", Fcons (newname, Qnil)); @@ -2158,11 +2194,17 @@ return Qnil; } -DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 1, "fDelete file: ", +DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, "fDelete file: \nP", doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. -If file has multiple names, it continues to exist with the other names. */) - (filename) +If file has multiple names, it continues to exist with the other names. + +If optional arg FORCE is non-nil, really delete the file regardless of +`delete-by-moving-to-trash'. Otherwise, \"deleting\" actually moves +it to the system's trash can if `delete-by-moving-to-trash' is non-nil. +Interactively, FORCE is non-nil if called with a prefix arg. */) + (filename, force) Lisp_Object filename; + Lisp_Object force; { Lisp_Object handler; Lisp_Object encoded_file; @@ -2181,7 +2223,7 @@ if (!NILP (handler)) return call2 (handler, Qdelete_file, filename); - if (delete_by_moving_to_trash) + if (delete_by_moving_to_trash && NILP (force)) return call1 (Qmove_file_to_trash, filename); encoded_file = ENCODE_FILE (filename); @@ -2198,14 +2240,15 @@ return Qt; } -/* Delete file FILENAME, returning 1 if successful and 0 if failed. */ +/* Delete file FILENAME, returning 1 if successful and 0 if failed. + FORCE means to ignore `delete-by-moving-to-trash'. */ int -internal_delete_file (filename) - Lisp_Object filename; +internal_delete_file (Lisp_Object filename, Lisp_Object force) { Lisp_Object tem; - tem = internal_condition_case_1 (Fdelete_file, filename, + + tem = internal_condition_case_2 (Fdelete_file, filename, force, Qt, internal_delete_file_1); return NILP (tem); } @@ -2287,7 +2330,7 @@ have copy-file prompt again. */ Fcopy_file (file, newname, NILP (ok_if_already_exists) ? Qnil : Qt, - Qt, Qt); + Qt, Qt, Qt); count = SPECPDL_INDEX (); specbind (Qdelete_by_moving_to_trash, Qnil); @@ -2299,7 +2342,7 @@ ) call2 (Qdelete_directory, file, Qt); else - Fdelete_file (file); + Fdelete_file (file, Qt); unbind_to (count, Qnil); } else @@ -2844,6 +2887,140 @@ #endif } +DEFUN ("file-selinux-context", Ffile_selinux_context, + Sfile_selinux_context, 1, 1, 0, + doc: /* Return SELinux context of file named FILENAME, +as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil) +if file does not exist, is not accessible, or SELinux is disabled */) + (filename) + Lisp_Object filename; +{ + Lisp_Object absname; + Lisp_Object values[4]; + Lisp_Object handler; +#if HAVE_LIBSELINUX + security_context_t con; + int conlength; + context_t context; +#endif + + absname = expand_and_dir_to_file (filename, current_buffer->directory); + + /* If the file name has special constructs in it, + call the corresponding file handler. */ + handler = Ffind_file_name_handler (absname, Qfile_selinux_context); + if (!NILP (handler)) + return call2 (handler, Qfile_selinux_context, absname); + + absname = ENCODE_FILE (absname); + + values[0] = Qnil; + values[1] = Qnil; + values[2] = Qnil; + values[3] = Qnil; +#if HAVE_LIBSELINUX + if (is_selinux_enabled ()) + { + conlength = lgetfilecon (SDATA (absname), &con); + if (conlength > 0) + { + context = context_new (con); + if (context_user_get (context)) + values[0] = build_string (context_user_get (context)); + if (context_role_get (context)) + values[1] = build_string (context_role_get (context)); + if (context_type_get (context)) + values[2] = build_string (context_type_get (context)); + if (context_range_get (context)) + values[3] = build_string (context_range_get (context)); + context_free (context); + } + if (con) + freecon (con); + } +#endif + + return Flist (sizeof(values) / sizeof(values[0]), values); +} + +DEFUN ("set-file-selinux-context", Fset_file_selinux_context, + Sset_file_selinux_context, 2, 2, 0, + doc: /* Set SELinux context of file named FILENAME to CONTEXT +as a list ("user", "role", "type", "range"). Has no effect if SELinux +is disabled. */) + (filename, context) + Lisp_Object filename, context; +{ + Lisp_Object absname, encoded_absname; + Lisp_Object handler; + Lisp_Object user = CAR_SAFE (context); + Lisp_Object role = CAR_SAFE (CDR_SAFE (context)); + Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); + Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); +#if HAVE_LIBSELINUX + security_context_t con; + int fail, conlength; + context_t parsed_con; +#endif + + absname = Fexpand_file_name (filename, current_buffer->directory); + + /* If the file name has special constructs in it, + call the corresponding file handler. */ + handler = Ffind_file_name_handler (absname, Qset_file_selinux_context); + if (!NILP (handler)) + return call3 (handler, Qset_file_selinux_context, absname, context); + + encoded_absname = ENCODE_FILE (absname); + +#if HAVE_LIBSELINUX + if (is_selinux_enabled ()) + { + /* Get current file context. */ + conlength = lgetfilecon (SDATA (encoded_absname), &con); + if (conlength > 0) + { + parsed_con = context_new (con); + /* Change the parts defined in the parameter.*/ + if (STRINGP (user)) + { + if (context_user_set (parsed_con, SDATA (user))) + error ("Doing context_user_set"); + } + if (STRINGP (role)) + { + if (context_role_set (parsed_con, SDATA (role))) + error ("Doing context_role_set"); + } + if (STRINGP (type)) + { + if (context_type_set (parsed_con, SDATA (type))) + error ("Doing context_type_set"); + } + if (STRINGP (range)) + { + if (context_range_set (parsed_con, SDATA (range))) + error ("Doing context_range_set"); + } + + /* Set the modified context back to the file. */ + fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con)); + if (fail) + report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil)); + + context_free (parsed_con); + } + else + report_file_error("Doing lgetfilecon", Fcons (absname, Qnil)); + + if (con) + freecon (con); + } +#endif + + return Qnil; +} + DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, doc: /* Return mode bits of file named FILENAME, as an integer. Return nil, if file does not exist or is not accessible. */) @@ -5505,6 +5682,8 @@ Qfile_modes = intern_c_string ("file-modes"); Qset_file_modes = intern_c_string ("set-file-modes"); Qset_file_times = intern_c_string ("set-file-times"); + Qfile_selinux_context = intern_c_string("file-selinux-context"); + Qset_file_selinux_context = intern_c_string("set-file-selinux-context"); Qfile_newer_than_file_p = intern_c_string ("file-newer-than-file-p"); Qinsert_file_contents = intern_c_string ("insert-file-contents"); Qwrite_region = intern_c_string ("write-region"); @@ -5540,6 +5719,8 @@ staticpro (&Qfile_modes); staticpro (&Qset_file_modes); staticpro (&Qset_file_times); + staticpro (&Qfile_selinux_context); + staticpro (&Qset_file_selinux_context); staticpro (&Qfile_newer_than_file_p); staticpro (&Qinsert_file_contents); staticpro (&Qwrite_region); @@ -5773,6 +5954,8 @@ defsubr (&Sfile_modes); defsubr (&Sset_file_modes); defsubr (&Sset_file_times); + defsubr (&Sfile_selinux_context); + defsubr (&Sset_file_selinux_context); defsubr (&Sset_default_file_modes); defsubr (&Sdefault_file_modes); defsubr (&Sfile_newer_than_file_p); diff -r e56f669f17ce -r fe07c47cf7a7 src/floatfns.c --- a/src/floatfns.c Wed May 12 14:32:06 2010 +0200 +++ b/src/floatfns.c Thu May 13 15:13:52 2010 +0200 @@ -288,6 +288,70 @@ IN_FLOAT (d = sin (d) / c, "tan", arg); return make_float (d); } + +#if defined HAVE_ISNAN && defined HAVE_COPYSIGN +DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, + doc: /* Return non nil iff argument X is a NaN. */) + (x) + Lisp_Object x; +{ + CHECK_FLOAT (x); + return isnan (XFLOAT_DATA (x)) ? Qt : Qnil; +} + +DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0, + doc: /* Copy sign of X2 to value of X1, and return the result. +Cause an error if X1 or X2 is not a float. */) + (x1, x2) + Lisp_Object x1, x2; +{ + double f1, f2; + + CHECK_FLOAT (x1); + CHECK_FLOAT (x2); + + f1 = XFLOAT_DATA (x1); + f2 = XFLOAT_DATA (x2); + + return make_float (copysign (f1, f2)); +} + +DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0, + doc: /* Get significand and exponent of a floating point number. +Breaks the floating point number X into its binary significand SGNFCAND +\(a floating point value between 0.5 (included) and 1.0 (excluded)) +and an integral exponent EXP for 2, such that: + + X = SGNFCAND * 2^EXP + +The function returns the cons cell (SGNFCAND . EXP). +If X is zero, both parts (SGNFCAND and EXP) are zero. */) + (x) + Lisp_Object x; +{ + double f = XFLOATINT (x); + + if (f == 0.0) + return Fcons (make_float (0.0), make_number (0)); + else + { + int exp; + double sgnfcand = frexp (f, &exp); + return Fcons (make_float (sgnfcand), make_number (exp)); + } +} + +DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0, + doc: /* Construct number X from significand SGNFCAND and exponent EXP. +Returns the floating point value resulting from multiplying SGNFCAND +(the significand) by 2 raised to the power of EXP (the exponent). */) + (sgnfcand, exp) + Lisp_Object sgnfcand, exp; +{ + CHECK_NUMBER (exp); + return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); +} +#endif #if 0 /* Leave these out unless we find there's a reason for them. */ @@ -1017,6 +1081,12 @@ defsubr (&Scos); defsubr (&Ssin); defsubr (&Stan); +#if defined HAVE_ISNAN && defined HAVE_COPYSIGN + defsubr (&Sisnan); + defsubr (&Scopysign); + defsubr (&Sfrexp); + defsubr (&Sldexp); +#endif #if 0 defsubr (&Sacosh); defsubr (&Sasinh); diff -r e56f669f17ce -r fe07c47cf7a7 src/fns.c --- a/src/fns.c Wed May 12 14:32:06 2010 +0200 +++ b/src/fns.c Thu May 13 15:13:52 2010 +0200 @@ -392,14 +392,10 @@ concat2 (s1, s2) Lisp_Object s1, s2; { -#ifdef NO_ARG_ARRAY Lisp_Object args[2]; args[0] = s1; args[1] = s2; return concat (2, args, Lisp_String, 0); -#else - return concat (2, &s1, Lisp_String, 0); -#endif /* NO_ARG_ARRAY */ } /* ARGSUSED */ @@ -407,15 +403,11 @@ concat3 (s1, s2, s3) Lisp_Object s1, s2, s3; { -#ifdef NO_ARG_ARRAY Lisp_Object args[3]; args[0] = s1; args[1] = s2; args[2] = s3; return concat (3, args, Lisp_String, 0); -#else - return concat (3, &s1, Lisp_String, 0); -#endif /* NO_ARG_ARRAY */ } DEFUN ("append", Fappend, Sappend, 0, MANY, 0, @@ -2344,14 +2336,10 @@ nconc2 (s1, s2) Lisp_Object s1, s2; { -#ifdef NO_ARG_ARRAY Lisp_Object args[2]; args[0] = s1; args[1] = s2; return Fnconc (2, args); -#else - return Fnconc (2, &s1); -#endif /* NO_ARG_ARRAY */ } DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0, diff -r e56f669f17ce -r fe07c47cf7a7 src/font.c --- a/src/font.c Wed May 12 14:32:06 2010 +0200 +++ b/src/font.c Thu May 13 15:13:52 2010 +0200 @@ -5376,22 +5376,30 @@ gets the repertory information by an opened font and ENCODING. */); Vfont_encoding_alist = Qnil; + /* FIXME: These 3 vars are not quite what they appear: setq on them + won't have any effect other than disconnect them from the style + table used by the font display code. So we make them read-only, + to avoid this confusing situation. */ + DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table, doc: /* Vector of valid font weight values. Each element has the form: [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...] NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */); Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); + XSYMBOL (intern_c_string ("font-weight-table"))->constant = 1; DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table, doc: /* Vector of font slant symbols vs the corresponding numeric values. See `font-weight-table' for the format of the vector. */); Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); + XSYMBOL (intern_c_string ("font-slant-table"))->constant = 1; DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table, doc: /* Alist of font width symbols vs the corresponding numeric values. See `font-weight-table' for the format of the vector. */); Vfont_width_table = BUILD_STYLE_TABLE (width_table); + XSYMBOL (intern_c_string ("font-width-table"))->constant = 1; staticpro (&font_style_table); font_style_table = Fmake_vector (make_number (3), Qnil); diff -r e56f669f17ce -r fe07c47cf7a7 src/frame.c --- a/src/frame.c Wed May 12 14:32:06 2010 +0200 +++ b/src/frame.c Thu May 13 15:13:52 2010 +0200 @@ -2298,13 +2298,20 @@ without messing up the symbol's status. */ if (SYMBOLP (prop)) { - Lisp_Object valcontents; - valcontents = SYMBOL_VALUE (prop); - if ((BUFFER_LOCAL_VALUEP (valcontents)) - && XBUFFER_LOCAL_VALUE (valcontents)->check_frame - && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame - && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f) - swap_in_global_binding (prop); + struct Lisp_Symbol *sym = XSYMBOL (prop); + start: + switch (sym->redirect) + { + case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; + case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break; + case SYMBOL_LOCALIZED: + { struct Lisp_Buffer_Local_Value *blv = sym->val.blv; + if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f) + swap_in_global_binding (sym); + break; + } + default: abort (); + } } /* The tty color needed to be set before the frame's parameter @@ -2520,6 +2527,8 @@ || EQ (parameter, Qbackground_mode)) value = Fcdr (Fassq (parameter, f->param_alist)); else + /* FIXME: Avoid this code path at all (as well as code duplication) + by sharing more code with Fframe_parameters. */ value = Fcdr (Fassq (parameter, Fframe_parameters (frame))); } diff -r e56f669f17ce -r fe07c47cf7a7 src/frame.h --- a/src/frame.h Wed May 12 14:32:06 2010 +0200 +++ b/src/frame.h Thu May 13 15:13:52 2010 +0200 @@ -980,7 +980,7 @@ at ROW/COL. */ #define FRAME_LINE_TO_PIXEL_Y(f, row) \ - ((row < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \ + (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \ + (row) * FRAME_LINE_HEIGHT (f)) #define FRAME_COL_TO_PIXEL_X(f, col) \ diff -r e56f669f17ce -r fe07c47cf7a7 src/fringe.c --- a/src/fringe.c Wed May 12 14:32:06 2010 +0200 +++ b/src/fringe.c Thu May 13 15:13:52 2010 +0200 @@ -825,7 +825,7 @@ { int overlay = 0; - if (!left_p && row->cursor_in_fringe_p) + if (left_p == row->reversed_p && row->cursor_in_fringe_p) { Lisp_Object cursor = Qnil; @@ -857,7 +857,7 @@ int bm = get_logical_cursor_bitmap (w, cursor); if (bm != NO_FRINGE_BITMAP) { - draw_fringe_bitmap_1 (w, row, 0, 2, bm); + draw_fringe_bitmap_1 (w, row, left_p, 2, bm); overlay = EQ (cursor, Qbox) ? 3 : 1; } } @@ -1082,7 +1082,8 @@ left = row->left_user_fringe_bitmap; left_face_id = row->left_user_fringe_face_id; } - else if (row->truncated_on_left_p) + else if ((!row->reversed_p && row->truncated_on_left_p) + || (row->reversed_p && row->truncated_on_right_p)) left = LEFT_FRINGE(0, Qtruncation, 0); else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) @@ -1090,7 +1091,8 @@ : LEFT_FRINGE (2, Qtop, 0)); else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); - else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) + else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)) + || (row->reversed_p && row->continued_p)) left = LEFT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) left = LEFT_FRINGE (5, Qempty_line, 0); @@ -1109,7 +1111,8 @@ right = row->right_user_fringe_bitmap; right_face_id = row->right_user_fringe_face_id; } - else if (row->truncated_on_right_p) + else if ((!row->reversed_p && row->truncated_on_right_p) + || (row->reversed_p && row->truncated_on_left_p)) right = RIGHT_FRINGE (0, Qtruncation, 0); else if (row->indicate_bob_p && EQ (boundary_top, Qright)) right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) @@ -1117,7 +1120,8 @@ : RIGHT_FRINGE (2, Qtop, 0)); else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); - else if (row->continued_p) + else if ((!row->reversed_p && row->continued_p) + || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))) right = RIGHT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) right = RIGHT_FRINGE (6, Qup, 0); diff -r e56f669f17ce -r fe07c47cf7a7 src/ftfont.c --- a/src/ftfont.c Wed May 12 14:32:06 2010 +0200 +++ b/src/ftfont.c Thu May 13 15:13:52 2010 +0200 @@ -1578,6 +1578,14 @@ #ifdef HAVE_M17N_FLT +#if (((LIBOTF_MAJOR_VERSION > 1) || (LIBOTF_RELEASE_NUMBER >= 10)) \ + && ((M17NLIB_MAJOR_VERSION > 1) || (M17NLIB_MINOR_VERSION >= 6))) +/* We can use the new feature of libotf and m17n-flt to handle the + character encoding scheme introduced in Unicode 5.1 and 5.2 for + some Agian scripts. */ +#define M17N_FLT_USE_NEW_FEATURE +#endif + struct MFLTFontFT { MFLTFont flt_font; @@ -1696,10 +1704,16 @@ else tags[n] = spec->features[i][n]; } +#ifdef M17N_FLT_USE_NEW_FEATURE + if (OTF_check_features (otf, i == 0, spec->script, spec->langsys, + tags, n - negative) != 1) + return 0; +#else /* not M17N_FLT_USE_NEW_FEATURE */ if (n - negative > 0 && OTF_check_features (otf, i == 0, spec->script, spec->langsys, tags, n - negative) != 1) return 0; +#endif /* not M17N_FLT_USE_NEW_FEATURE */ } return 1; } @@ -1757,6 +1771,356 @@ memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size); } +#ifdef M17N_FLT_USE_NEW_FEATURE + +/* Pack 32-bit OTF tag (0x7F7F7F7F) into 28-bit (0x0FFFFFFF). */ +#define PACK_OTF_TAG(TAG) \ + ((((TAG) & 0x7F000000) >> 3) \ + | (((TAG) & 0x7F0000) >> 2) \ + | (((TAG) & 0x7F00) >> 1) \ + | ((TAG) & 0x7F)) + +/* Assuming that FONT is an OpenType font, apply OpenType features + specified in SPEC on glyphs between FROM and TO of IN, and record + the lastly applied feature in each glyph of IN. If OUT is not + NULL, append the resulting glyphs to OUT while storing glyph + position adjustment information in ADJUSTMENT. */ + +static int +ftfont_drive_otf (font, spec, in, from, to, out, adjustment) + MFLTFont *font; + MFLTOtfSpec *spec; + MFLTGlyphString *in; + int from, to; + MFLTGlyphString *out; + MFLTGlyphAdjustment *adjustment; +{ + struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; + FT_Face ft_face = flt_font_ft->ft_face; + OTF *otf = flt_font_ft->otf; + int len = to - from; + int i, j, gidx; + OTF_Glyph *otfg; + char script[5], *langsys = NULL; + char *gsub_features = NULL, *gpos_features = NULL; + OTF_Feature *features; + + if (len == 0) + return from; + OTF_tag_name (spec->script, script); + if (spec->langsys) + { + langsys = alloca (5); + OTF_tag_name (spec->langsys, langsys); + } + for (i = 0; i < 2; i++) + { + char *p; + + if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) + { + for (j = 0; spec->features[i][j]; j++); + if (i == 0) + p = gsub_features = alloca (6 * j); + else + p = gpos_features = alloca (6 * j); + for (j = 0; spec->features[i][j]; j++) + { + if (spec->features[i][j] == 0xFFFFFFFF) + *p++ = '*', *p++ = ','; + else + { + OTF_tag_name (spec->features[i][j], p); + p[4] = ','; + p += 5; + } + } + *--p = '\0'; + } + } + + setup_otf_gstring (len); + for (i = 0; i < len; i++) + { + otf_gstring.glyphs[i].c = in->glyphs[from + i].c; + otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code; + } + + OTF_drive_gdef (otf, &otf_gstring); + gidx = out ? out->used : from; + + if (gsub_features && out) + { + if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, + gsub_features) < 0) + goto simple_copy; + if (out->allocated < out->used + otf_gstring.used) + return -2; + features = otf->gsub->FeatureList.Feature; + for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; ) + { + MFLTGlyph *g; + int min_from, max_to; + int j; + int feature_idx = otfg->positioning_type >> 4; + + g = out->glyphs + out->used; + *g = in->glyphs[from + otfg->f.index.from]; + if (g->code != otfg->glyph_id) + { + g->c = 0; + g->code = otfg->glyph_id; + g->measured = 0; + } + out->used++; + min_from = g->from; + max_to = g->to; + if (otfg->f.index.from < otfg->f.index.to) + { + /* OTFG substitutes multiple glyphs in IN. */ + for (j = from + otfg->f.index.from + 1; + j <= from + otfg->f.index.to; j++) + { + if (min_from > in->glyphs[j].from) + min_from = in->glyphs[j].from; + if (max_to < in->glyphs[j].to) + max_to = in->glyphs[j].to; + } + g->from = min_from; + g->to = max_to; + } + if (feature_idx) + { + unsigned int tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + g->internal = (g->internal & ~0x1FFFFFFF) | tag; + } + for (i++, otfg++; (i < otf_gstring.used + && otfg->f.index.from == otfg[-1].f.index.from); + i++, otfg++) + { + g = out->glyphs + out->used; + *g = in->glyphs[from + otfg->f.index.to]; + if (g->code != otfg->glyph_id) + { + g->c = 0; + g->code = otfg->glyph_id; + g->measured = 0; + } + feature_idx = otfg->positioning_type >> 4; + if (feature_idx) + { + unsigned int tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + g->internal = (g->internal & ~0x1FFFFFFF) | tag; + } + out->used++; + } + } + } + else if (gsub_features) + { + /* Just for checking which features will be applied. */ + if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, + gsub_features) < 0) + goto simple_copy; + features = otf->gsub->FeatureList.Feature; + for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, + otfg++) + { + int feature_idx = otfg->positioning_type >> 4; + + if (feature_idx) + { + unsigned int tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) + { + MFLTGlyph *g = in->glyphs + (from + j); + g->internal = (g->internal & ~0x1FFFFFFF) | tag; + } + } + } + } + else if (out) + { + if (out->allocated < out->used + len) + return -2; + for (i = 0; i < len; i++) + out->glyphs[out->used++] = in->glyphs[from + i]; + } + + if (gpos_features && out) + { + MFLTGlyph *base = NULL, *mark = NULL, *g; + int x_ppem, y_ppem, x_scale, y_scale; + + if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, + gpos_features) < 0) + return to; + features = otf->gpos->FeatureList.Feature; + x_ppem = ft_face->size->metrics.x_ppem; + y_ppem = ft_face->size->metrics.y_ppem; + x_scale = ft_face->size->metrics.x_scale; + y_scale = ft_face->size->metrics.y_scale; + + for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx; + i < otf_gstring.used; i++, otfg++, g++) + { + MFLTGlyph *prev; + int feature_idx = otfg->positioning_type >> 4; + + if (feature_idx) + { + unsigned int tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + g->internal = (g->internal & ~0x1FFFFFFF) | tag; + } + + if (! otfg->glyph_id) + continue; + switch (otfg->positioning_type & 0xF) + { + case 0: + break; + case 1: /* Single */ + case 2: /* Pair */ + { + int format = otfg->f.f1.format; + + if (format & OTF_XPlacement) + adjustment[i].xoff + = otfg->f.f1.value->XPlacement * x_scale / 0x10000; + if (format & OTF_XPlaDevice) + adjustment[i].xoff + += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); + if (format & OTF_YPlacement) + adjustment[i].yoff + = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000); + if (format & OTF_YPlaDevice) + adjustment[i].yoff + -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); + if (format & OTF_XAdvance) + adjustment[i].xadv + += otfg->f.f1.value->XAdvance * x_scale / 0x10000; + if (format & OTF_XAdvDevice) + adjustment[i].xadv + += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); + if (format & OTF_YAdvance) + adjustment[i].yadv + += otfg->f.f1.value->YAdvance * y_scale / 0x10000; + if (format & OTF_YAdvDevice) + adjustment[i].yadv + += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); + adjustment[i].set = 1; + } + break; + case 3: /* Cursive */ + /* Not yet supported. */ + break; + case 4: /* Mark-to-Base */ + case 5: /* Mark-to-Ligature */ + if (! base) + break; + prev = base; + goto label_adjust_anchor; + default: /* i.e. case 6 Mark-to-Mark */ + if (! mark) + break; + prev = mark; + + label_adjust_anchor: + { + int base_x, base_y, mark_x, mark_y; + int this_from, this_to; + + base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; + base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; + mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; + mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000; + + if (otfg->f.f4.base_anchor->AnchorFormat != 1) + adjust_anchor (ft_face, otfg->f.f4.base_anchor, + prev->code, x_ppem, y_ppem, &base_x, &base_y); + if (otfg->f.f4.mark_anchor->AnchorFormat != 1) + adjust_anchor (ft_face, otfg->f.f4.mark_anchor, g->code, + x_ppem, y_ppem, &mark_x, &mark_y); + adjustment[i].xoff = (base_x - mark_x); + adjustment[i].yoff = - (base_y - mark_y); + adjustment[i].back = (g - prev); + adjustment[i].xadv = 0; + adjustment[i].advance_is_absolute = 1; + adjustment[i].set = 1; + this_from = g->from; + this_to = g->to; + for (j = 0; prev + j < g; j++) + { + if (this_from > prev[j].from) + this_from = prev[j].from; + if (this_to < prev[j].to) + this_to = prev[j].to; + } + for (; prev <= g; prev++) + { + prev->from = this_from; + prev->to = this_to; + } + } + } + if (otfg->GlyphClass == OTF_GlyphClass0) + base = mark = g; + else if (otfg->GlyphClass == OTF_GlyphClassMark) + mark = g; + else + base = g; + } + } + else if (gpos_features) + { + if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, + gpos_features) < 0) + return to; + features = otf->gpos->FeatureList.Feature; + for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; + i++, otfg++) + if (otfg->positioning_type & 0xF) + { + int feature_idx = otfg->positioning_type >> 4; + + if (feature_idx) + { + unsigned int tag = features[feature_idx - 1].FeatureTag; + tag = PACK_OTF_TAG (tag); + for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) + { + MFLTGlyph *g = in->glyphs + (from + j); + g->internal = (g->internal & ~0x1FFFFFFF) | tag; + } + } + } + } + return to; + + simple_copy: + if (! out) + return to; + if (out->allocated < out->used + len) + return -2; + font->get_metrics (font, in, from, to); + memcpy (out->glyphs + out->used, in->glyphs + from, + sizeof (MFLTGlyph) * len); + out->used += len; + return to; +} + +static int +ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *in, int from, int to) +{ + return ftfont_drive_otf (font, spec, in, from, to, NULL, NULL); +} + +#else /* not M17N_FLT_USE_NEW_FEATURE */ static int ftfont_drive_otf (font, spec, in, from, to, out, adjustment) @@ -2011,6 +2375,8 @@ return to; } +#endif /* not M17N_FLT_USE_NEW_FEATURE */ + static MFLTGlyphString gstring; static int m17n_flt_initialized; @@ -2034,6 +2400,10 @@ if (! m17n_flt_initialized) { M17N_INIT (); +#ifdef M17N_FLT_USE_NEW_FEATURE + mflt_enable_new_feature = 1; + mflt_try_otf = ftfont_try_otf; +#endif /* M17N_FLT_USE_NEW_FEATURE */ m17n_flt_initialized = 1; } diff -r e56f669f17ce -r fe07c47cf7a7 src/gtkutil.c --- a/src/gtkutil.c Wed May 12 14:32:06 2010 +0200 +++ b/src/gtkutil.c Thu May 13 15:13:52 2010 +0200 @@ -35,6 +35,7 @@ #include "charset.h" #include "coding.h" #include +#include "xsettings.h" #ifdef HAVE_XFT #include @@ -542,7 +543,9 @@ if (yneg) top = -top; - sprintf (geom_str, "%c%d%c%d", + sprintf (geom_str, "=%dx%d%c%d%c%d", + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f), (xneg ? '-' : '+'), left, (yneg ? '-' : '+'), top); @@ -951,6 +954,12 @@ else if (win_gravity == StaticGravity) size_hints.win_gravity = GDK_GRAVITY_STATIC; + if (user_position) + { + hint_flags &= ~GDK_HINT_POS; + hint_flags |= GDK_HINT_USER_POS; + } + if (hint_flags != f->output_data.x->hint_flags || memcmp (&size_hints, &f->output_data.x->size_hints, @@ -3363,8 +3372,8 @@ || event->type == MotionNotify)) { /* If we are releasing or moving the scroll bar, it has the grab. */ - retval = gtk_grab_get_current () != 0 - && gtk_grab_get_current () != f->output_data.x->edit_widget; + GtkWidget *w = gtk_grab_get_current (); + retval = w != 0 && GTK_IS_SCROLLBAR (w); } return retval; @@ -3514,7 +3523,16 @@ { GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem)); GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox))); - GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label (""); + GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); + GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; + GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; + GtkImage *wimage = GTK_IS_IMAGE (c1->widget) + ? GTK_IMAGE (c1->widget) : GTK_IMAGE (c2->widget); + GtkLabel *wlbl = GTK_IS_LABEL (c1->widget) + ? GTK_LABEL (c1->widget) : GTK_LABEL (c2->widget); + GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label + (gtk_label_get_text (wlbl)); + GtkWidget *wmenuimage; if (gtk_button_get_use_stock (wbutton)) @@ -3522,7 +3540,6 @@ GTK_ICON_SIZE_MENU); else { - GtkImage *wimage = GTK_IMAGE (gtk_bin_get_child (GTK_BIN (wbutton))); GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); GtkImageType store_type = gtk_image_get_storage_type (wimage); @@ -3761,7 +3778,9 @@ gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, vbox_pos); - gtk_widget_show_all (x->handlebox_widget); + + gtk_widget_show (x->toolbar_widget); + gtk_widget_show (x->handlebox_widget); } /* Create a tool bar for frame F. */ @@ -3777,13 +3796,6 @@ gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); - /* We only have icons, so override any user setting. We could - use the caption property of the toolbar item (see update_frame_tool_bar - below), but some of those strings are long, making the toolbar so - long it does not fit on the screen. The GtkToolbar widget makes every - item equal size, so the longest caption determine the size of every - tool bar item. I think the creators of the GtkToolbar widget - counted on 4 or 5 character long strings. */ gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget), GTK_ORIENTATION_HORIZONTAL); @@ -3826,6 +3838,131 @@ return image; } +static GtkToolItem * +xg_make_tool_item (FRAME_PTR f, + GtkWidget *wimage, + GtkWidget **wbutton, + char *label, + int i) +{ + GtkToolItem *ti = gtk_tool_item_new (); + GtkWidget *vb = EQ (Vtool_bar_style, Qboth_horiz) + ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); + GtkWidget *wb = gtk_button_new (); + GtkWidget *weventbox = gtk_event_box_new (); + + if (wimage) + gtk_box_pack_start_defaults (GTK_BOX (vb), wimage); + + gtk_box_pack_start_defaults (GTK_BOX (vb), gtk_label_new (label)); + gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE); + gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE); + gtk_container_add (GTK_CONTAINER (wb), vb); + gtk_container_add (GTK_CONTAINER (weventbox), wb); + gtk_container_add (GTK_CONTAINER (ti), weventbox); + + if (wimage) + { + /* The EMACS_INT cast avoids a warning. */ + g_signal_connect (G_OBJECT (ti), "create-menu-proxy", + G_CALLBACK (xg_tool_bar_menu_proxy), + (gpointer) (EMACS_INT) i); + + g_signal_connect (G_OBJECT (wb), "clicked", + G_CALLBACK (xg_tool_bar_callback), + (gpointer) (EMACS_INT) i); + + g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); + + /* Catch expose events to overcome an annoying redraw bug, see + comment for xg_tool_bar_item_expose_callback. */ + g_signal_connect (G_OBJECT (ti), + "expose-event", + G_CALLBACK (xg_tool_bar_item_expose_callback), + 0); + + gtk_tool_item_set_homogeneous (ti, FALSE); + + /* Callback to save modifyer mask (Shift/Control, etc). GTK makes + no distinction based on modifiers in the activate callback, + so we have to do it ourselves. */ + g_signal_connect (wb, "button-release-event", + G_CALLBACK (xg_tool_bar_button_cb), + NULL); + + g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f); + + /* Use enter/leave notify to show help. We use the events + rather than the GtkButton specific signals "enter" and + "leave", so we can have only one callback. The event + will tell us what kind of event it is. */ + /* The EMACS_INT cast avoids a warning. */ + g_signal_connect (G_OBJECT (weventbox), + "enter-notify-event", + G_CALLBACK (xg_tool_bar_help_callback), + (gpointer) (EMACS_INT) i); + g_signal_connect (G_OBJECT (weventbox), + "leave-notify-event", + G_CALLBACK (xg_tool_bar_help_callback), + (gpointer) (EMACS_INT) i); + } + + if (wbutton) *wbutton = wb; + + return ti; +} + +static void +xg_show_toolbar_item (GtkToolItem *ti) +{ + Lisp_Object style = Ftool_bar_get_system_style (); + + int show_label = EQ (style, Qboth) + || EQ (style, Qboth_horiz) || EQ (style, Qtext); + int show_image = ! EQ (style, Qtext); + int horiz = EQ (style, Qboth_horiz); + + GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); + GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); + GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); + GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; + GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; + GtkWidget *wimage = GTK_IS_IMAGE (c1->widget) + ? c1->widget : c2->widget; + GtkWidget *wlbl = GTK_IS_LABEL (c1->widget) + ? c1->widget : c2->widget; + GtkWidget *new_box = NULL; + + if (GTK_IS_VBOX (vb) && horiz) + new_box = gtk_hbox_new (FALSE, 0); + else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image) + new_box = gtk_vbox_new (FALSE, 0); + if (new_box) + { + gtk_widget_ref (wimage); + gtk_widget_ref (wlbl); + gtk_container_remove (GTK_CONTAINER (vb), wimage); + gtk_container_remove (GTK_CONTAINER (vb), wlbl); + gtk_widget_destroy (GTK_WIDGET (vb)); + gtk_box_pack_start_defaults (GTK_BOX (new_box), wimage); + gtk_box_pack_start_defaults (GTK_BOX (new_box), wlbl); + gtk_container_add (GTK_CONTAINER (wbutton), new_box); + gtk_widget_unref (wimage); + gtk_widget_unref (wlbl); + vb = GTK_BOX (new_box); + } + + if (show_label) gtk_widget_show (wlbl); + else gtk_widget_hide (wlbl); + if (show_image) gtk_widget_show (wimage); + else gtk_widget_hide (wimage); + gtk_widget_show (GTK_WIDGET (weventbox)); + gtk_widget_show (GTK_WIDGET (vb)); + gtk_widget_show (GTK_WIDGET (wbutton)); + gtk_widget_show (GTK_WIDGET (ti)); +} + + /* Update the tool bar for frame F. Add new buttons and remove old. */ extern Lisp_Object Qx_gtk_map_stock; @@ -3877,8 +4014,8 @@ wtoolbar = GTK_TOOLBAR (x->toolbar_widget); gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req); - dir = gtk_widget_get_direction (x->toolbar_widget); - + dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); + for (i = 0; i < f->n_tool_bar_items; ++i) { int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); @@ -3896,8 +4033,10 @@ GtkWidget *wbutton = NULL; GtkWidget *weventbox; Lisp_Object specified_file; - - ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i); + Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL); + char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); + + ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); if (ti) { @@ -3905,6 +4044,7 @@ wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); } + image = PROP (TOOL_BAR_ITEM_IMAGES); /* Ignore invalid image specifications. */ @@ -3936,7 +4076,7 @@ icon_size = gtk_toolbar_get_icon_size (wtoolbar); } else if (gtk_stock_lookup (SSDATA (stock), &stock_item)) - icon_size = gtk_toolbar_get_icon_size (wtoolbar); + icon_size = gtk_toolbar_get_icon_size (wtoolbar); else { stock = Qnil; @@ -3980,22 +4120,15 @@ if (img->load_failed_p || img->pixmap == None) { - if (ti) - gtk_widget_hide_all (GTK_WIDGET (ti)); - else + if (ti) + gtk_widget_hide_all (GTK_WIDGET (ti)); + else { - /* Insert an empty (non-image) button */ - weventbox = gtk_event_box_new (); - wbutton = gtk_button_new (); - gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); - gtk_button_set_relief (GTK_BUTTON (wbutton), - GTK_RELIEF_NONE); - gtk_container_add (GTK_CONTAINER (weventbox), wbutton); - ti = gtk_tool_item_new (); - gtk_container_add (GTK_CONTAINER (ti), weventbox); - gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); + /* Insert an empty (non-image) button */ + ti = xg_make_tool_item (f, NULL, NULL, "", i); + gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); } - continue; + continue; } } @@ -4026,73 +4159,27 @@ } gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); - wbutton = gtk_button_new (); - gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); - gtk_button_set_relief (GTK_BUTTON (wbutton), GTK_RELIEF_NONE); - gtk_container_add (GTK_CONTAINER (wbutton), w); - weventbox = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (weventbox), wbutton); - ti = gtk_tool_item_new (); - gtk_container_add (GTK_CONTAINER (ti), weventbox); - gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1); - - - /* The EMACS_INT cast avoids a warning. */ - g_signal_connect (G_OBJECT (ti), "create-menu-proxy", - G_CALLBACK (xg_tool_bar_menu_proxy), - (gpointer) (EMACS_INT) i); - - g_signal_connect (G_OBJECT (wbutton), "clicked", - G_CALLBACK (xg_tool_bar_callback), - (gpointer) (EMACS_INT) i); - - gtk_widget_show_all (GTK_WIDGET (ti)); - - - g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); - - /* Catch expose events to overcome an annoying redraw bug, see - comment for xg_tool_bar_item_expose_callback. */ - g_signal_connect (G_OBJECT (ti), - "expose-event", - G_CALLBACK (xg_tool_bar_item_expose_callback), - 0); - + ti = xg_make_tool_item (f, w, &wbutton, label, i); + gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); gtk_widget_set_sensitive (wbutton, enabled_p); - gtk_tool_item_set_homogeneous (ti, FALSE); - - /* Callback to save modifyer mask (Shift/Control, etc). GTK makes - no distinction based on modifiers in the activate callback, - so we have to do it ourselves. */ - g_signal_connect (wbutton, "button-release-event", - G_CALLBACK (xg_tool_bar_button_cb), - NULL); - - g_object_set_data (G_OBJECT (wbutton), XG_FRAME_DATA, (gpointer)f); - - /* Use enter/leave notify to show help. We use the events - rather than the GtkButton specific signals "enter" and - "leave", so we can have only one callback. The event - will tell us what kind of event it is. */ - /* The EMACS_INT cast avoids a warning. */ - g_signal_connect (G_OBJECT (weventbox), - "enter-notify-event", - G_CALLBACK (xg_tool_bar_help_callback), - (gpointer) (EMACS_INT) i); - g_signal_connect (G_OBJECT (weventbox), - "leave-notify-event", - G_CALLBACK (xg_tool_bar_help_callback), - (gpointer) (EMACS_INT) i); } else { - GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); + GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; + GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; + GtkWidget *wimage = GTK_IS_IMAGE (c1->widget) + ? c1->widget : c2->widget; + GtkWidget *wlbl = GTK_IS_LABEL (c1->widget) + ? c1->widget : c2->widget; + Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA); gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME); gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME); + gtk_label_set_text (GTK_LABEL (wlbl), label); if (stock_name && (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) { @@ -4103,7 +4190,8 @@ (GDestroyNotify) xfree); g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, NULL); - g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL); + g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, + NULL); } else if (icon_name && (! old_icon_name || strcmp (old_icon_name, icon_name) != 0)) @@ -4126,14 +4214,15 @@ g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME, NULL); - g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL); + g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, + NULL); } gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); gtk_widget_set_sensitive (wbutton, enabled_p); - gtk_widget_show_all (GTK_WIDGET (ti)); - } + } + xg_show_toolbar_item (ti); #undef PROP } @@ -4142,16 +4231,16 @@ can be reused later on. */ do { - ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i++); + ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i++); if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); } while (ti != NULL); new_req.height = 0; if (pack_tool_bar && f->n_tool_bar_items != 0) - xg_pack_tool_bar (f); + xg_pack_tool_bar (f); - gtk_widget_size_request (GTK_WIDGET (x->toolbar_widget), &new_req); + gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req); if (old_req.height != new_req.height && ! FRAME_X_OUTPUT (f)->toolbar_detached) { @@ -4195,7 +4284,7 @@ /*********************************************************************** Initializing - ***********************************************************************/ +***********************************************************************/ void xg_initialize () { diff -r e56f669f17ce -r fe07c47cf7a7 src/image.c --- a/src/image.c Wed May 12 14:32:06 2010 +0200 +++ b/src/image.c Thu May 13 15:13:52 2010 +0200 @@ -7961,7 +7961,7 @@ DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0, doc: /* Return image file types supported by ImageMagick. - Since ImageMagic recognizes a lot of file-types that clash with Emacs, + Since ImageMagick recognizes a lot of file-types that clash with Emacs, such as .c, we want to be able to alter the list at the lisp level. */) () { diff -r e56f669f17ce -r fe07c47cf7a7 src/insdel.c --- a/src/insdel.c Wed May 12 14:32:06 2010 +0200 +++ b/src/insdel.c Thu May 13 15:13:52 2010 +0200 @@ -54,7 +54,7 @@ Lisp_Object Fcombine_after_change_execute (); /* Non-nil means don't call the after-change-functions right away, - just record an element in Vcombine_after_change_calls_list. */ + just record an element in combine_after_change_list. */ Lisp_Object Vcombine_after_change_calls; /* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT) diff -r e56f669f17ce -r fe07c47cf7a7 src/keyboard.c --- a/src/keyboard.c Wed May 12 14:32:06 2010 +0200 +++ b/src/keyboard.c Thu May 13 15:13:52 2010 +0200 @@ -496,7 +496,7 @@ /* menu item parts */ Lisp_Object Qmenu_enable; Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; -Lisp_Object QCbutton, QCtoggle, QCradio; +Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; extern Lisp_Object Qmenu_item; /* An event header symbol HEAD may have a property named @@ -1520,7 +1520,6 @@ command_loop_1 () { Lisp_Object cmd; - int lose; Lisp_Object keybuf[30]; int i; int prev_modiff = 0; @@ -8249,7 +8248,11 @@ - `:help HELP-STRING'. - Gives a help string to display for the tool bar item. */ + Gives a help string to display for the tool bar item. + + - `:label LABEL-STRING'. + + A text label to show with the tool bar button if labels are enabled. */ static int parse_tool_bar_item (key, item) @@ -8260,7 +8263,7 @@ Lisp_Object filter = Qnil; Lisp_Object caption; - int i; + int i, have_label = 0; /* Defininition looks like `(menu-item CAPTION BINDING PROPS...)'. Rule out items that aren't lists, don't start with @@ -8338,6 +8341,12 @@ else if (EQ (key, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; + else if (EQ (key, QClabel)) + { + /* `:label LABEL-STRING'. */ + PROP (TOOL_BAR_ITEM_LABEL) = value; + have_label = 1; + } else if (EQ (key, QCfilter)) /* ':filter FORM'. */ filter = value; @@ -8365,6 +8374,49 @@ PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; } + + if (!have_label) + { + /* Try to make one from caption and key. */ + Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY); + Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); + char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : ""; + char *caption = STRINGP (capt) ? (char *) SDATA (capt) : ""; + char buf[64]; + EMACS_INT max_lbl = 2*tool_bar_max_label_size; + Lisp_Object new_lbl; + + if (strlen (caption) < max_lbl && caption[0] != '\0') + { + strcpy (buf, caption); + while (buf[0] != '\0' && buf[strlen (buf) -1] == '.') + buf[strlen (buf)-1] = '\0'; + if (strlen (buf) <= max_lbl) + caption = buf; + } + + if (strlen (caption) <= max_lbl) + label = caption; + + if (strlen (label) <= max_lbl && label[0] != '\0') + { + int i; + if (label != buf) strcpy (buf, label); + + for (i = 0; i < strlen (buf); ++i) + { + if (buf[i] == '-') buf[i] = ' '; + } + label = buf; + + } + else label = ""; + + new_lbl = Fupcase_initials (make_string (label, strlen (label))); + if (SCHARS (new_lbl) <= tool_bar_max_label_size) + PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; + } + /* If got a filter apply it on binding. */ if (!NILP (filter)) PROP (TOOL_BAR_ITEM_BINDING) @@ -11700,6 +11752,8 @@ staticpro (&QCtoggle); QCradio = intern_c_string (":radio"); staticpro (&QCradio); + QClabel = intern_c_string (":label"); + staticpro (&QClabel); Qmode_line = intern_c_string ("mode-line"); staticpro (&Qmode_line); diff -r e56f669f17ce -r fe07c47cf7a7 src/lisp.h --- a/src/lisp.h Wed May 12 14:32:06 2010 +0200 +++ b/src/lisp.h Thu May 13 15:13:52 2010 +0200 @@ -223,13 +223,7 @@ { Lisp_Misc_Free = 0x5eab, Lisp_Misc_Marker, - Lisp_Misc_Intfwd, - Lisp_Misc_Boolfwd, - Lisp_Misc_Objfwd, - Lisp_Misc_Buffer_Objfwd, - Lisp_Misc_Buffer_Local_Value, Lisp_Misc_Overlay, - Lisp_Misc_Kboard_Objfwd, Lisp_Misc_Save_Value, /* Currently floats are not a misc type, but let's define this in case we want to change that. */ @@ -238,6 +232,18 @@ Lisp_Misc_Limit }; +/* These are the types of forwarding objects used in the value slot + of symbols for special built-in variables whose value is stored in + C variables. */ +enum Lisp_Fwd_Type + { + Lisp_Fwd_Int, /* Fwd to a C `int' variable. */ + Lisp_Fwd_Bool, /* Fwd to a C boolean var. */ + Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */ + Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */ + Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ + }; + #ifndef GCTYPEBITS #define GCTYPEBITS 3 #endif @@ -566,17 +572,19 @@ #define XMISCANY(a) (eassert (MISCP (a)), &(XMISC(a)->u_any)) #define XMISCTYPE(a) (XMISCANY (a)->type) #define XMARKER(a) (eassert (MARKERP (a)), &(XMISC(a)->u_marker)) -#define XINTFWD(a) (eassert (INTFWDP (a)), &(XMISC(a)->u_intfwd)) -#define XBOOLFWD(a) (eassert (BOOLFWDP (a)), &(XMISC(a)->u_boolfwd)) -#define XOBJFWD(a) (eassert (OBJFWDP (a)), &(XMISC(a)->u_objfwd)) #define XOVERLAY(a) (eassert (OVERLAYP (a)), &(XMISC(a)->u_overlay)) #define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC(a)->u_save_value)) + +/* Forwarding object types. */ + +#define XFWDTYPE(a) (a->u_intfwd.type) +#define XINTFWD(a) (eassert (INTFWDP (a)), &((a)->u_intfwd)) +#define XBOOLFWD(a) (eassert (BOOLFWDP (a)), &((a)->u_boolfwd)) +#define XOBJFWD(a) (eassert (OBJFWDP (a)), &((a)->u_objfwd)) #define XBUFFER_OBJFWD(a) \ - (eassert (BUFFER_OBJFWDP (a)), &(XMISC(a)->u_buffer_objfwd)) -#define XBUFFER_LOCAL_VALUE(a) \ - (eassert (BUFFER_LOCAL_VALUEP (a)), &(XMISC(a)->u_buffer_local_value)) + (eassert (BUFFER_OBJFWDP (a)), &((a)->u_buffer_objfwd)) #define XKBOARD_OBJFWD(a) \ - (eassert (KBOARD_OBJFWDP (a)), &(XMISC(a)->u_kboard_objfwd)) + (eassert (KBOARD_OBJFWDP (a)), &((a)->u_kboard_objfwd)) /* Pseudovector types. */ @@ -713,11 +721,6 @@ #define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n)) #define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n)) -/* For performance: Fast storage of positive integers into the - fields of a cons cell. See above caveats. */ -#define XSETCARFASTINT(c,n) XSETFASTINT(XCAR_AS_LVALUE(c),(n)) -#define XSETCDRFASTINT(c,n) XSETFASTINT(XCDR_AS_LVALUE(c),(n)) - /* Take the car or cdr of something whose type is not known. */ #define CAR(c) \ (CONSP ((c)) ? XCAR ((c)) \ @@ -988,19 +991,32 @@ SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2 }; +enum symbol_redirect +{ + SYMBOL_PLAINVAL = 4, + SYMBOL_VARALIAS = 1, + SYMBOL_LOCALIZED = 2, + SYMBOL_FORWARDED = 3 +}; + /* In a symbol, the markbit of the plist is used as the gc mark bit */ struct Lisp_Symbol { unsigned gcmarkbit : 1; - /* Non-zero means symbol serves as a variable alias. The symbol - holding the real value is found in the value slot. */ - unsigned indirect_variable : 1; + /* Indicates where the value can be found: + 0 : it's a plain var, the value is in the `value' field. + 1 : it's a varalias, the value is really in the `alias' symbol. + 2 : it's a localized var, the value is in the `blv' object. + 3 : it's a forwarding variable, the value is in `forward'. + */ + enum symbol_redirect redirect : 3; /* Non-zero means symbol is constant, i.e. changing its value - should signal an error. */ - unsigned constant : 1; + should signal an error. If the value is 3, then the var + can be changed, but only by `defconst'. */ + unsigned constant : 2; /* Interned state of the symbol. This is an enumerator from enum symbol_interned. */ @@ -1013,10 +1029,15 @@ Lisp_Object xname; /* Value of the symbol or Qunbound if unbound. If this symbol is a - defvaralias, `value' contains the symbol for which it is an + defvaralias, `alias' contains the symbol for which it is an alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get and set a symbol's value, to take defvaralias into account. */ - Lisp_Object value; + union { + Lisp_Object value; + struct Lisp_Symbol *alias; + struct Lisp_Buffer_Local_Value *blv; + union Lisp_Fwd *fwd; + } val; /* Function value of the symbol or Qunbound if not fboundp. */ Lisp_Object function; @@ -1030,6 +1051,23 @@ /* Value is name of symbol. */ +#define SYMBOL_VAL(sym) \ + (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value) +#define SYMBOL_ALIAS(sym) \ + (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias) +#define SYMBOL_BLV(sym) \ + (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv) +#define SYMBOL_FWD(sym) \ + (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd) +#define SET_SYMBOL_VAL(sym, v) \ + (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v)) +#define SET_SYMBOL_ALIAS(sym, v) \ + (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v)) +#define SET_SYMBOL_BLV(sym, v) \ + (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v)) +#define SET_SYMBOL_FWD(sym, v) \ + (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v)) + #define SYMBOL_NAME(sym) \ LISP_MAKE_RVALUE (XSYMBOL (sym)->xname) @@ -1049,24 +1087,6 @@ #define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant -/* Value is the value of SYM, with defvaralias taken into - account. */ - -#define SYMBOL_VALUE(sym) \ - (XSYMBOL (sym)->indirect_variable \ - ? indirect_variable (XSYMBOL (sym))->value \ - : XSYMBOL (sym)->value) - -/* Set SYM's value to VAL, taking defvaralias into account. */ - -#define SET_SYMBOL_VALUE(sym, val) \ - do { \ - if (XSYMBOL (sym)->indirect_variable) \ - indirect_variable (XSYMBOL (sym))->value = (val); \ - else \ - XSYMBOL (sym)->value = (val); \ - } while (0) - /*********************************************************************** Hash Tables @@ -1200,9 +1220,11 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */ { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Marker */ + enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */ unsigned gcmarkbit : 1; int spacer : 15; + /* Make it as long as "Lisp_Free without padding". */ + void *fill; }; struct Lisp_Marker @@ -1225,7 +1247,7 @@ - Fmarker_buffer - Fset_marker: check eq(oldbuf, newbuf) to avoid unchain+rechain. - unchain_marker: to find the list from which to unchain. - - Fkill_buffer: to unchain the markers of current indirect buffer. + - Fkill_buffer: to only unchain the markers of current indirect buffer. */ struct buffer *buffer; @@ -1239,7 +1261,10 @@ struct Lisp_Marker *next; /* This is the char position where the marker points. */ EMACS_INT charpos; - /* This is the byte position. */ + /* This is the byte position. + It's mostly used as a charpos<->bytepos cache (i.e. it's not directly + used to implement the functionality of markers, but rather to (ab)use + markers as a cache for char<->byte mappings). */ EMACS_INT bytepos; }; @@ -1249,9 +1274,7 @@ specified int variable. */ struct Lisp_Intfwd { - int type : 16; /* = Lisp_Misc_Intfwd */ - unsigned gcmarkbit : 1; - int spacer : 15; + enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Int */ EMACS_INT *intvar; }; @@ -1261,9 +1284,7 @@ nil if it is zero. */ struct Lisp_Boolfwd { - int type : 16; /* = Lisp_Misc_Boolfwd */ - unsigned gcmarkbit : 1; - int spacer : 15; + enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */ int *boolvar; }; @@ -1273,9 +1294,7 @@ specified variable. */ struct Lisp_Objfwd { - int type : 16; /* = Lisp_Misc_Objfwd */ - unsigned gcmarkbit : 1; - int spacer : 15; + enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Obj */ Lisp_Object *objvar; }; @@ -1283,11 +1302,9 @@ current buffer. Value is byte index of slot within buffer. */ struct Lisp_Buffer_Objfwd { - int type : 16; /* = Lisp_Misc_Buffer_Objfwd */ - unsigned gcmarkbit : 1; - int spacer : 15; + enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ + int offset; Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */ - int offset; }; /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when @@ -1316,48 +1333,51 @@ struct Lisp_Buffer_Local_Value { - int type : 16; /* = Lisp_Misc_Buffer_Local_Value */ - unsigned gcmarkbit : 1; - int spacer : 11; - /* 1 means that merely setting the variable creates a local binding for the current buffer */ unsigned int local_if_set : 1; - /* 1 means this variable is allowed to have frame-local bindings, - so check for them when looking for the proper binding. */ - unsigned int check_frame : 1; - /* 1 means that the binding now loaded was found - as a local binding for the buffer in the `buffer' slot. */ - unsigned int found_for_buffer : 1; - /* 1 means that the binding now loaded was found - as a local binding for the frame in the `frame' slot. */ - unsigned int found_for_frame : 1; - Lisp_Object realvalue; - /* The buffer and frame for which the loaded binding was found. */ - /* Having both is only needed if we want to allow variables that are - both buffer local and frame local (in which case, we currently give - precedence to the buffer-local binding). I don't think such - a combination is desirable. --Stef */ - Lisp_Object buffer, frame; - - /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE). - - LOADED-BINDING is the binding now loaded. It is a cons cell - whose cdr is the binding's value. The cons cell may be an - element of a buffer's local-variable alist, or an element of a - frame's parameter alist, or it may be this cons cell. - - DEFAULT-VALUE is the variable's default value, seen when the - current buffer and selected frame do not have their own - bindings for the variable. When the default binding is loaded, - LOADED-BINDING is actually this very cons cell; thus, its car - points to itself. */ - Lisp_Object cdr; + /* 1 means this variable can have frame-local bindings, otherwise, it is + can have buffer-local bindings. The two cannot be combined. */ + unsigned int frame_local : 1; + /* 1 means that the binding now loaded was found. + Presumably equivalent to (defcell!=valcell) */ + unsigned int found : 1; + /* If non-NULL, a forwarding to the C var where it should also be set. */ + union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */ + /* The buffer or frame for which the loaded binding was found. */ + Lisp_Object where; + /* A cons cell that holds the default value. It has the form + (SYMBOL . DEFAULT-VALUE). */ + Lisp_Object defcell; + /* The cons cell from `where's parameter alist. + It always has the form (SYMBOL . VALUE) + Note that if `forward' is non-nil, VALUE may be out of date. + Also if the currently loaded binding is the default binding, then + this is `eq'ual to defcell. */ + Lisp_Object valcell; }; +#define BLV_FOUND(blv) \ + (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found) +#define SET_BLV_FOUND(blv, v) \ + (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v)) + +#define BLV_VALUE(blv) (XCDR ((blv)->valcell)) +#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v)) + /* START and END are markers in the overlay's buffer, and PLIST is the overlay's property list. */ struct Lisp_Overlay +/* An overlay's real data content is: + - plist + - buffer + - insertion type of both ends + - start & start_byte + - end & end_byte + - next (singly linked list of overlays). + - start_next and end_next (singly linked list of markers). + I.e. 9words plus 2 bits, 3words of which are for external linked lists. +*/ { enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */ unsigned gcmarkbit : 1; @@ -1370,9 +1390,7 @@ current kboard. */ struct Lisp_Kboard_Objfwd { - enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Kboard_Objfwd */ - unsigned gcmarkbit : 1; - int spacer : 15; + enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Kboard_Obj */ int offset; }; @@ -1401,9 +1419,9 @@ #ifdef USE_LSB_TAG /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment. This assumes that Lisp_Marker is the largest of the alternatives and - that Lisp_Intfwd has the same size as "Lisp_Free w/o padding". */ + that Lisp_Misc_Any has the same size as "Lisp_Free w/o padding". */ char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1) - << GCTYPEBITS) - sizeof (struct Lisp_Intfwd)]; + << GCTYPEBITS) - sizeof (struct Lisp_Misc_Any)]; #endif }; @@ -1414,15 +1432,18 @@ { struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */ struct Lisp_Free u_free; /* Includes padding to force alignment. */ - struct Lisp_Marker u_marker; - struct Lisp_Intfwd u_intfwd; - struct Lisp_Boolfwd u_boolfwd; - struct Lisp_Objfwd u_objfwd; - struct Lisp_Buffer_Objfwd u_buffer_objfwd; - struct Lisp_Buffer_Local_Value u_buffer_local_value; - struct Lisp_Overlay u_overlay; - struct Lisp_Kboard_Objfwd u_kboard_objfwd; - struct Lisp_Save_Value u_save_value; + struct Lisp_Marker u_marker; /* 5 */ + struct Lisp_Overlay u_overlay; /* 5 */ + struct Lisp_Save_Value u_save_value; /* 3 */ + }; + +union Lisp_Fwd + { + struct Lisp_Intfwd u_intfwd; /* 2 */ + struct Lisp_Boolfwd u_boolfwd; /* 2 */ + struct Lisp_Objfwd u_objfwd; /* 2 */ + struct Lisp_Buffer_Objfwd u_buffer_objfwd; /* 2 */ + struct Lisp_Kboard_Objfwd u_kboard_objfwd; /* 2 */ }; /* Lisp floating point type */ @@ -1564,15 +1585,13 @@ #define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG)) #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay) #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) -#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd) -#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd) -#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd) -#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd) -#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value) -#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value) -#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd) #define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value) +#define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int) +#define BOOLFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Bool) +#define OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Obj) +#define BUFFER_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Buffer_Obj) +#define KBOARD_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Kboard_Obj) /* True if object X is a pseudovector whose code is CODE. */ #define PSEUDOVECTORP(x, code) \ @@ -1789,24 +1808,44 @@ #define MANY -2 #define UNEVALLED -1 -extern void defvar_lisp (const char *, Lisp_Object *); -extern void defvar_lisp_nopro (const char *, Lisp_Object *); -extern void defvar_bool (const char *, int *); -extern void defvar_int (const char *, EMACS_INT *); -extern void defvar_kboard (const char *, int); +extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); +extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); +extern void defvar_bool (struct Lisp_Boolfwd *, const char *, int *); +extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *); +extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); /* Macros we use to define forwarded Lisp variables. These are used in the syms_of_FILENAME functions. */ -#define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname) -#define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) -#define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) -#define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) - -#define DEFVAR_KBOARD(lname, vname, doc) \ - defvar_kboard (lname, \ - (int)((char *)(¤t_kboard->vname) \ - - (char *)current_kboard)) +#define DEFVAR_LISP(lname, vname, doc) \ + do { \ + static struct Lisp_Objfwd o_fwd; \ + defvar_lisp (&o_fwd, lname, vname); \ + } while (0) +#define DEFVAR_LISP_NOPRO(lname, vname, doc) \ + do { \ + static struct Lisp_Objfwd o_fwd; \ + defvar_lisp_nopro (&o_fwd, lname, vname); \ + } while (0) +#define DEFVAR_BOOL(lname, vname, doc) \ + do { \ + static struct Lisp_Boolfwd b_fwd; \ + defvar_bool (&b_fwd, lname, vname); \ + } while (0) +#define DEFVAR_INT(lname, vname, doc) \ + do { \ + static struct Lisp_Intfwd i_fwd; \ + defvar_int (&i_fwd, lname, vname); \ + } while (0) + +#define DEFVAR_KBOARD(lname, vname, doc) \ + do { \ + static struct Lisp_Kboard_Objfwd ko_fwd; \ + defvar_kboard (&ko_fwd, \ + lname, \ + (int)((char *)(¤t_kboard->vname) \ + - (char *)current_kboard)); \ + } while (0) @@ -2341,13 +2380,11 @@ extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN; extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; -extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, struct buffer *)); -extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object)); -extern Lisp_Object set_internal P_ ((Lisp_Object, Lisp_Object, struct buffer *, int)); +extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); +extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int); extern void syms_of_data P_ ((void)); extern void init_data P_ ((void)); -extern void swap_in_global_binding P_ ((Lisp_Object)); +extern void swap_in_global_binding P_ ((struct Lisp_Symbol *)); /* Defined in cmds.c */ EXFUN (Fend_of_line, 1); @@ -2593,7 +2630,7 @@ extern Lisp_Object Qinhibit_redisplay, Qdisplay; extern Lisp_Object Qinhibit_eval_during_redisplay; extern Lisp_Object Qmessage_truncate_lines; -extern Lisp_Object Qimage; +extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz; extern Lisp_Object Vmessage_log_max; extern int message_enable_multibyte; extern Lisp_Object echo_area_buffer[2]; @@ -2779,7 +2816,9 @@ extern Lisp_Object make_symbol P_ ((char *)); extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int)); #define LOADHIST_ATTACH(x) \ - if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list) + do { \ + if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \ + } while (0) extern Lisp_Object Vcurrent_load_list; extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes; extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object, @@ -2855,13 +2894,15 @@ extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); +extern Lisp_Object call7 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); EXFUN (Fdo_auto_save, 2); extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int)); extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object)); extern Lisp_Object internal_lisp_condition_case P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object))); extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object))); -extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object))); +extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object))); +extern Lisp_Object internal_condition_case_n P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object))); extern void specbind P_ ((Lisp_Object, Lisp_Object)); extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object)); extern Lisp_Object unbind_to P_ ((int, Lisp_Object)); @@ -3018,8 +3059,9 @@ EXFUN (Ffile_executable_p, 1); EXFUN (Fread_file_name, 6); extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); +extern Lisp_Object restore_point_unwind P_ ((Lisp_Object)); extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; -extern int internal_delete_file P_ ((Lisp_Object)); +extern int internal_delete_file P_ ((Lisp_Object, Lisp_Object)); extern void syms_of_fileio P_ ((void)); extern Lisp_Object make_temp_name P_ ((Lisp_Object, int)); EXFUN (Fmake_symbolic_link, 3); @@ -3388,6 +3430,7 @@ extern void fatal P_ ((const char *msgid, ...)) NO_RETURN; /* Defined in terminal.c */ +EXFUN (Fframe_terminal, 1); EXFUN (Fdelete_terminal, 2); extern void syms_of_terminal P_ ((void)); diff -r e56f669f17ce -r fe07c47cf7a7 src/lread.c --- a/src/lread.c Wed May 12 14:32:06 2010 +0200 +++ b/src/lread.c Thu May 13 15:13:52 2010 +0200 @@ -3687,7 +3687,8 @@ && EQ (obarray, initial_obarray)) { XSYMBOL (sym)->constant = 1; - XSYMBOL (sym)->value = sym; + XSYMBOL (sym)->redirect = SYMBOL_PLAINVAL; + SET_SYMBOL_VAL (XSYMBOL (sym), sym); } ptr = &XVECTOR (obarray)->contents[XINT (tem)]; @@ -3768,8 +3769,6 @@ error ("Attempt to unintern t or nil"); */ XSYMBOL (tem)->interned = SYMBOL_UNINTERNED; - XSYMBOL (tem)->constant = 0; - XSYMBOL (tem)->indirect_variable = 0; hash = oblookup_last_bucket_number; @@ -3914,35 +3913,31 @@ init_obarray () { Lisp_Object oblength; - int hash; - Lisp_Object *tem; XSETFASTINT (oblength, OBARRAY_SIZE); - Qnil = Fmake_symbol (make_pure_c_string ("nil")); Vobarray = Fmake_vector (oblength, make_number (0)); initial_obarray = Vobarray; staticpro (&initial_obarray); - /* Intern nil in the obarray */ - XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY; - XSYMBOL (Qnil)->constant = 1; - - /* These locals are to kludge around a pyramid compiler bug. */ - hash = hash_string ("nil", 3); - /* Separate statement here to avoid VAXC bug. */ - hash %= OBARRAY_SIZE; - tem = &XVECTOR (Vobarray)->contents[hash]; - *tem = Qnil; Qunbound = Fmake_symbol (make_pure_c_string ("unbound")); - XSYMBOL (Qnil)->function = Qunbound; - XSYMBOL (Qunbound)->value = Qunbound; + /* Set temporary dummy values to Qnil and Vpurify_flag to satisfy the + NILP (Vpurify_flag) check in intern_c_string. */ + Qnil = make_number (-1); Vpurify_flag = make_number (1); + Qnil = intern_c_string ("nil"); + + /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, + so those two need to be fixed manally. */ + SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); XSYMBOL (Qunbound)->function = Qunbound; + XSYMBOL (Qunbound)->plist = Qnil; + /* XSYMBOL (Qnil)->function = Qunbound; */ + SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); + XSYMBOL (Qnil)->constant = 1; + XSYMBOL (Qnil)->plist = Qnil; Qt = intern_c_string ("t"); - XSYMBOL (Qnil)->value = Qnil; - XSYMBOL (Qnil)->plist = Qnil; - XSYMBOL (Qt)->value = Qt; + SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); XSYMBOL (Qt)->constant = 1; /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */ @@ -3981,27 +3976,29 @@ to a C variable of type int. Sample call: DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ void -defvar_int (const char *namestring, EMACS_INT *address) +defvar_int (struct Lisp_Intfwd *i_fwd, + const char *namestring, EMACS_INT *address) { - Lisp_Object sym, val; + Lisp_Object sym; sym = intern_c_string (namestring); - val = allocate_misc (); - XMISCTYPE (val) = Lisp_Misc_Intfwd; - XINTFWD (val)->intvar = address; - SET_SYMBOL_VALUE (sym, val); + i_fwd->type = Lisp_Fwd_Int; + i_fwd->intvar = address; + XSYMBOL (sym)->redirect = SYMBOL_FORWARDED; + SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)i_fwd); } /* Similar but define a variable whose value is t if address contains 1, nil if address contains 0. */ void -defvar_bool (const char *namestring, int *address) +defvar_bool (struct Lisp_Boolfwd *b_fwd, + const char *namestring, int *address) { - Lisp_Object sym, val; + Lisp_Object sym; sym = intern_c_string (namestring); - val = allocate_misc (); - XMISCTYPE (val) = Lisp_Misc_Boolfwd; - XBOOLFWD (val)->boolvar = address; - SET_SYMBOL_VALUE (sym, val); + b_fwd->type = Lisp_Fwd_Bool; + b_fwd->boolvar = address; + XSYMBOL (sym)->redirect = SYMBOL_FORWARDED; + SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)b_fwd); Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars); } @@ -4011,20 +4008,22 @@ gc-marked for some other reason, since marking the same slot twice can cause trouble with strings. */ void -defvar_lisp_nopro (const char *namestring, Lisp_Object *address) +defvar_lisp_nopro (struct Lisp_Objfwd *o_fwd, + const char *namestring, Lisp_Object *address) { - Lisp_Object sym, val; + Lisp_Object sym; sym = intern_c_string (namestring); - val = allocate_misc (); - XMISCTYPE (val) = Lisp_Misc_Objfwd; - XOBJFWD (val)->objvar = address; - SET_SYMBOL_VALUE (sym, val); + o_fwd->type = Lisp_Fwd_Obj; + o_fwd->objvar = address; + XSYMBOL (sym)->redirect = SYMBOL_FORWARDED; + SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)o_fwd); } void -defvar_lisp (const char *namestring, Lisp_Object *address) +defvar_lisp (struct Lisp_Objfwd *o_fwd, + const char *namestring, Lisp_Object *address) { - defvar_lisp_nopro (namestring, address); + defvar_lisp_nopro (o_fwd, namestring, address); staticpro (address); } @@ -4032,14 +4031,15 @@ at a particular offset in the current kboard object. */ void -defvar_kboard (const char *namestring, int offset) +defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd, + const char *namestring, int offset) { - Lisp_Object sym, val; + Lisp_Object sym; sym = intern_c_string (namestring); - val = allocate_misc (); - XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd; - XKBOARD_OBJFWD (val)->offset = offset; - SET_SYMBOL_VALUE (sym, val); + ko_fwd->type = Lisp_Fwd_Kboard_Obj; + ko_fwd->offset = offset; + XSYMBOL (sym)->redirect = SYMBOL_FORWARDED; + SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd); } /* Record the value of load-path used at the start of dumping diff -r e56f669f17ce -r fe07c47cf7a7 src/m/alpha.h --- a/src/m/alpha.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/alpha.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* Machine description file for the alpha chip. - Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Author: Rainer Schoepf (according to authors.el) @@ -20,35 +21,16 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="note" - -NOTE-START -Use -opsystem=osf1 -NOTE-END - -*/ - #ifndef _LP64 -#define _LP64 /* This doesn't appear to be necessary - on OSF 4/5 -- fx. */ +#define _LP64 /* This doesn't appear to be necessary on OSF 4/5 -- fx. */ #endif /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Now define a symbol for the cpu type, if your compiler does not define it automatically. */ - /* __alpha defined automatically */ @@ -57,15 +39,12 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* GNU malloc and the relocating allocator do not work together @@ -82,16 +61,6 @@ /* #define SYSTEM_MALLOC */ #ifdef __ELF__ -/* With ELF, make sure that all common symbols get allocated to in the - data section. Otherwise, the dump of temacs may miss variables in - the shared library that have been initialized. For example, with - GNU libc, __malloc_initialized would normally be resolved to the - shared library's .bss section, which is fatal. */ -# ifdef __GNUC__ -# define C_SWITCH_MACHINE -fno-common -# else -# error What gives? Fix me if DEC Unix supports ELF now. -# endif #undef UNEXEC #define UNEXEC unexelf.o @@ -106,12 +75,10 @@ #else /* not __ELF__ */ /* Describe layout of the address space in an executing process. */ - #define TEXT_START 0x120000000 #define DATA_START 0x140000000 /* The program to be used for unexec. */ - #define UNEXEC unexalpha.o #endif /* __ELF__ */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/amdx86-64.h --- a/src/m/amdx86-64.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/amdx86-64.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for AMD x86-64. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,32 +18,13 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -#ifdef i386 -/* Although we're running on an amd64 kernel, we're actually compiling for - the x86 architecture. The user should probably have provided an - explicit --build to `configure', but if everything else than the kernel - is running in i386 mode, then the bug is really ours: we should have - guessed better. */ -#include "m/intel386.h" -#else - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="linux" */ - #define BITS_PER_LONG 64 #define BITS_PER_EMACS_INT 64 /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Now define a symbol for the cpu type, if your compiler does not define it automatically: Ones defined so far include vax, m68000, ns16000, pyramid, @@ -58,77 +40,16 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ #undef DATA_SEG_BITS -#ifdef __FreeBSD__ - -/* The libraries for binaries native to the build host's architecture are - installed under /usr/lib in FreeBSD, and the ones that need special paths - are 32-bit compatibility libraries (installed under /usr/lib32). To build - a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib. */ - -#undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o - -/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. - The reason is that some functions in libgcc.a call functions from libc.a, - and some libc.a functions need functions from libgcc.a. Since most - versions of ld are one-pass linkers, we need to mention -lgcc twice, - or else we risk getting unresolved externals. */ -#undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o - -#elif defined(__OpenBSD__) - -#undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o -#undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o - -#elif defined(__NetBSD__) - -/* LIB_STANDARD and START_FILES set correctly in s/netbsd.h */ - -#elif defined(SOLARIS2) - -#undef START_FILES -#undef LIB_STANDARD - -#elif defined(__APPLE__) - -/* LIB_STANDARD and START_FILES set correctly in s/darwin.h */ - -#else /* !__OpenBSD__ && !__FreeBSD__ && !__NetBSD__ && !SOLARIS2 - && !__APPLE__ */ -/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. - The reason is that some functions in libgcc.a call functions from libc.a, - and some libc.a functions need functions from libgcc.a. Since most - versions of ld are one-pass linkers, we need to mention -lgcc twice, - or else we risk getting unresolved externals. */ -#undef START_FILES -#undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif - -#endif /* __FreeBSD__ */ -#endif /* !i386 */ - /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/arm.h --- a/src/m/arm.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/arm.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* Machine description file for ARM-based non-RISCiX machines. - Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,30 +18,11 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. We can't - * do this on the arm with gcc, since the first 4 args are in registers. */ - -#ifdef __GNUC__ -#define NO_ARG_ARRAY -#else -#undef NO_ARG_ARRAY -#endif - #define NO_REMAP -/* armin76@gentoo.org reported that the lgcc_s flag is necessary to - build on ARM EABI under GNU/Linux (Bug#5518). */ -#ifdef GNU_LINUX -#define LIB_GCC -lgcc_s -#endif - /* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/hp800.h --- a/src/m/hp800.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/hp800.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for hp9000 series 800 machines. - Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,81 +18,17 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="hpux" */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend the bit field into an int. In other words, if bit fields are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND - -/* Stuff for just HPUX. */ - -#if defined (__hpux) - -/* Define NO_REMAP if memory segmentation makes it not work well - to change the boundary between the text section and data section - when Emacs is dumped. If you define this, the preloaded Lisp - code will not be sharable; but that's better than failing completely. */ - -#define NO_REMAP - -/* Define VIRT_ADDR_VARIES if the virtual addresses of - pure and impure space as loaded can vary, and even their - relative order cannot be relied on. - - Otherwise Emacs assumes that text space precedes data space, - numerically. */ - -#define VIRT_ADDR_VARIES - -/* the data segment on this machine always starts at address 0x40000000. */ - -#define DATA_SEG_BITS 0x40000000 - -#define DATA_START 0x40000000 -#define TEXT_START 0x00000000 - -/* Data type of load average, as read out of kmem. */ - -#define LOAD_AVE_TYPE double - -/* Convert that into an integer that is 100 for a load average of 1.0 */ - -#define LOAD_AVE_CVT(x) ((int) (x * 100.0)) - -/* The symbol in the kernel where the load average is found - is named _avenrun. At this time there are two major flavors - of hp-ux (there is the s800 and s300 (s200) flavors). The - differences are thusly moved to the corresponding machine description file. -*/ - -/* no underscore please */ -#define LDAV_SYMBOL "avenrun" - -/* On USG systems these have different names. */ - -#define index strchr -#define rindex strrchr - -#endif /* __hpux */ - /* Systems with GCC don't need to lose. */ #ifdef __NetBSD__ # ifdef __GNUC__ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/ia64.h --- a/src/m/ia64.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/ia64.h Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,9 @@ /* machine description file for the IA-64 architecture. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. - Contributed by David Mosberger + +Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. + +Contributed by David Mosberger This file is part of GNU Emacs. @@ -23,20 +25,12 @@ /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Now define a symbol for the cpu type, if your compiler does not define it automatically. */ - /* __ia64__ defined automatically */ - /* Define the type to use. */ #define EMACS_INT long #define EMACS_UINT unsigned long @@ -46,15 +40,12 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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__ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/ibmrs6000.h --- a/src/m/ibmrs6000.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/ibmrs6000.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* R2 AIX machine/system dependent defines - Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,39 +19,14 @@ along with GNU Emacs. If not, see . */ -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="aix3-1" */ - -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - -/* Now define a symbol for the cpu type, if your compiler - does not define it automatically. */ - -#define IBMR2AIX - /* The data segment in this machine always starts at address 0x20000000. An address of data cannot be stored correctly in a Lisp object; we always lose the high bits. We must tell XPNTR to add them back. */ - #define TEXT_START 0x10000000 #define DATA_START 0x20000000 #define WORDS_BIG_ENDIAN #define DATA_SEG_BITS 0x20000000 -/* sfreed@unm.edu says add -bI:/usr/lpp/X11/bin/smt.exp for AIX 3.2.4. */ -/* marc@sti.com (Marc Pawliger) says ibmrs6000.inp is needed to avoid - linker error for updated X11R5 libraries, which references pthread library - which most machines don't have. We use the name .inp instead of .imp - because .inp is a better convention to use in make-dist for naming - random input files. */ -#ifdef THIS_IS_MAKEFILE /* Don't use this in configure. */ -#define LD_SWITCH_MACHINE -Wl,-bnodelcsect -#endif /* THIS_IS_MAKEFILE */ - #ifndef NLIST_STRUCT /* AIX supposedly doesn't use this interface, but on the RS/6000 it apparently does. */ @@ -60,7 +36,6 @@ #undef ADDR_CORRECT #define ADDR_CORRECT(x) ((int)(x)) -#define START_FILES /*** BUILD 9008 - FIONREAD problem still exists in X-Windows. ***/ #define BROKEN_FIONREAD /* As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h. diff -r e56f669f17ce -r fe07c47cf7a7 src/m/ibmrs6000.inp --- a/src/m/ibmrs6000.inp Wed May 12 14:32:06 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#! -pthread_yield - -# arch-tag: fc6d01ea-c488-4862-bbdb-e8d3e0f6fdb3 diff -r e56f669f17ce -r fe07c47cf7a7 src/m/ibms390.h --- a/src/m/ibms390.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/ibms390.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file template. - Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,34 +19,21 @@ along with GNU Emacs. If not, see . */ -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="" */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend the 24-bit bit field into an int. In other words, if bit fields are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* Define VIRT_ADDR_VARIES if the virtual addresses of @@ -54,7 +42,6 @@ Otherwise Emacs assumes that text space precedes data space, numerically. */ - #define VIRT_ADDR_VARIES /* arch-tag: d8a0ffa4-a8f0-4736-90d3-7fd7b21b8314 diff -r e56f669f17ce -r fe07c47cf7a7 src/m/ibms390x.h --- a/src/m/ibms390x.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/ibms390x.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for IBM S390 in 64-bit mode - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,31 +21,14 @@ /* This file was made by copying the significant parts of amdx86-64.h into ibms390.h. */ - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="" - -NOTE-START -IBM s390 64 bits (-machine=ibms390x64) - - The possibilities for -opsystem are: gnu-linux. - -NOTE-END */ - +/* Used for machine IBM s390 64 bits with opsys gnu-linux. */ #define BITS_PER_LONG 64 #define BITS_PER_EMACS_INT 64 /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Define the type to use. */ #define EMACS_INT long #define EMACS_UINT unsigned long @@ -54,15 +38,12 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #undef EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* Define VIRT_ADDR_VARIES if the virtual addresses of @@ -71,38 +52,20 @@ Otherwise Emacs assumes that text space precedes data space, numerically. */ - #define VIRT_ADDR_VARIES /* Define HAVE_ALLOCA to say that the system provides a properly working alloca function and it should be used. Undefine it if an assembler-language alloca in the file alloca.s should be used. */ - #define HAVE_ALLOCA /* On the 64 bit architecture, we can use 60 bits for addresses */ - #define VALBITS 60 #define LINKER $(CC) -nostdlib /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ - #define XPNTR(a) XUINT (a) -#undef START_FILES -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#endif - -#undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif - /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/intel386.h --- a/src/m/intel386.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/intel386.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* Machine description file for intel 386. - Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,69 +19,10 @@ along with GNU Emacs. If not, see . */ -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="note" - -NOTE-START -Intel 386 (-machine=intel386) - - The possibilities for -opsystem are: bsd4-2, usg5-2-2, usg5-3, - isc2-2, 386-ix, and linux. - - 18.58 should support a wide variety of operating systems. - Use linux for Linux. - It isn't clear what to do on an SCO system. - -NOTE-END */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -/* #define NO_ARG_ARRAY */ - -/* crt0.c, if it is used, should use the i386-bsd style of entry. - with no extra dummy args. On USG and XENIX, - NO_REMAP says this isn't used. */ - -#define CRT0_DUMMIES bogus_fp, - -#ifdef SOLARIS2 -/* Data type of load average, as read out of kmem. */ -#define LOAD_AVE_TYPE long - -/* Convert that into an integer that is 100 for a load average of 1.0 */ -/* This is totally uncalibrated. */ -#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE)) - -/* J.W.Hawtin@lut.ac.uk say Solaris 2.4 as well as Solaris 2.1 on X86 - requires -lkvm as well. - And handa@etl.gov.jp says that -lkvm needs -llelf, at least on 2.5. */ -#define LIBS_MACHINE -lkvm -lelf - -/* configure thinks solaris X86 has gethostname, but it does not work, - so undefine it. */ -#undef HAVE_GETHOSTNAME - -#else /* not SOLARIS2 */ -#ifdef USG5_4 /* Older USG systems do not support the load average. */ -/* Data type of load average, as read out of kmem. */ - -#define LOAD_AVE_TYPE long - -/* Convert that into an integer that is 100 for a load average of 1.0 */ -/* This is totally uncalibrated. */ - -#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE)) -#define FSCALE 256.0 -#endif /* USG5_4 */ -#endif /* not SOLARIS2 */ - #ifdef USG #define TEXT_START 0 #endif /* USG */ @@ -88,7 +30,6 @@ #ifdef WINDOWSNT #define VIRT_ADDR_VARIES #define DATA_START get_data_start () -#define NO_ARG_ARRAY #endif #ifdef GNU_LINUX diff -r e56f669f17ce -r fe07c47cf7a7 src/m/iris4d.h --- a/src/m/iris4d.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/iris4d.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for Iris-4D machines. Use with s/irix*.h. - Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,49 +21,29 @@ /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend the bit field into an int. In other words, if bit fields are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND #define TEXT_START 0x400000 -/* - * DATA_SEG_BITS forces extra bits to be or'd in with any pointers which - * were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for - * the value field of a LISP_OBJECT). - */ - +/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which + were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for + the value field of a LISP_OBJECT). */ #define DATA_START 0x10000000 #define DATA_SEG_BITS 0x10000000 -/* Use terminfo instead of termcap. */ - -#define TERMINFO - -/* Letter to use in finding device name of first pty, - if system supports pty's. 'a' means it is /dev/ptya0 */ - -#undef FIRST_PTY_LETTER -#define FIRST_PTY_LETTER 'q' #if _MIPS_SZLONG != 64 /* fixme: should there be 64-bit definitions? (The ones below aren't OK.) */ /* The standard definitions of these macros would work ok, but these are faster because the constants are short. */ - #define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS) #define XSET(var, type, ptr) \ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/m68k.h --- a/src/m/m68k.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/m68k.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* Machine description file for generic Motorola 68k. - Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -19,12 +20,10 @@ /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN /* Now define a symbol for the cpu type, if your compiler does not define it automatically. */ - #ifndef m68k #define m68k #endif @@ -34,7 +33,6 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND #ifdef GNU_LINUX diff -r e56f669f17ce -r fe07c47cf7a7 src/m/macppc.h --- a/src/m/macppc.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/macppc.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file For the powerpc Macintosh. - Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -19,20 +20,12 @@ /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) #if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__) @@ -41,19 +34,8 @@ /* NAKAJI Hiroyuki says this is needed For MkLinux/LinuxPPC. */ - #ifdef GNU_LINUX #define LINKER $(CC) -nostdlib -/* s/gnu-linux.h defines this to `-z nocombreloc' which does not work here - because prefix-args is not used. */ -#undef LD_SWITCH_SYSTEM_TEMACS -#define LD_SWITCH_MACHINE_TEMACS -Xlinker -znocombreloc -#ifdef _ARCH_PPC64 -#undef START_FILES -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#endif #endif #ifdef _ARCH_PPC64 diff -r e56f669f17ce -r fe07c47cf7a7 src/m/mips.h --- a/src/m/mips.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/mips.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* m- file for Mips machines. - Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,57 +18,21 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="note" - -NOTE-START -This is used on GNU/Linux and netbsd. -NOTE-END */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL)) #define WORDS_BIG_ENDIAN #endif -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend the 24-bit bit field into an int. In other words, if bit fields are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Describe layout of the address space in an executing process. */ - #define TEXT_START 0x00400000 - -#if 0 /* These definitions were advantageous when not using - USE_LSB_TAG. With that, they get ignored but cause errors. */ - -#define DATA_SEG_BITS 0x10000000 - -/* The standard definitions of these macros would work ok, - but these are faster because the constants are short. */ - -#define XUINT(a) (((unsigned)(a) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)) - -#define XSET(var, type, ptr) \ - ((var) = \ - ((int)(type) << VALBITS) \ - + (((unsigned) (ptr) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS))) - /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee (do not change this comment) */ - -#endif /* 0 */ - diff -r e56f669f17ce -r fe07c47cf7a7 src/m/sh3.h --- a/src/m/sh3.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/sh3.h Thu May 13 15:13:52 2010 +0200 @@ -4,7 +4,5 @@ # define WORDS_BIG_ENDIAN #endif -#define NO_ARG_ARRAY - /* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/sparc.h --- a/src/m/sparc.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/sparc.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for Sun 4 SPARC. - Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,64 +18,34 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="note" - -NOTE-START -Use -opsystem=sunos4 for operating system version 4, and --opsystem=bsd4-2 for earlier versions. -NOTE-END */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* __sparc__ is defined by the compiler by default. */ /* XINT must explicitly sign-extend This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* Mask for address bits within a memory segment */ - #define SEGMENT_MASK (SEGSIZ - 1) #ifdef __arch64__ /* GCC, 64-bit ABI. */ + #define BITS_PER_LONG 64 -#ifdef __linux__ -#undef START_FILES -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. - The reason is that some functions in libgcc.a call functions from libc.a, - and some libc.a functions need functions from libgcc.a. Since most - versions of ld are one-pass linkers, we need to mention -lgcc twice, - or else we risk getting unresolved externals. */ -#undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o +#ifndef _LP64 +#define _LP64 /* Done on Alpha -- not sure if it should be here. -- fx */ #endif -#ifndef _LP64 -#define _LP64 /* Done on Alpha -- not sure if it - should be here. -- fx */ -#endif -#endif +#endif /* __arch64__ */ /* arch-tag: 0a6f7882-33fd-4811-9832-7466c51e50f7 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/m/template.h --- a/src/m/template.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/template.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file template. - Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,21 +18,10 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="" */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #define WORDS_BIG_ENDIAN -/* Define NO_ARG_ARRAY if you cannot take the address of the first of a - * group of arguments and treat it as an array of the arguments. */ - -#define NO_ARG_ARRAY - /* Now define a symbol for the cpu type, if your compiler does not define it automatically. Ones defined so far include m68k and many others */ @@ -41,21 +31,17 @@ are always unsigned. This flag only matters if you use USE_LISP_UNION_TYPE. */ - #define EXPLICIT_SIGN_EXTEND /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE long /* 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) /* Define CANNOT_DUMP on machines where unexec does not work. Then the function dump-emacs will not be defined and temacs will do (load "loadup") automatically unless told otherwise. */ - #define CANNOT_DUMP /* Define VIRT_ADDR_VARIES if the virtual addresses of @@ -64,31 +50,25 @@ Otherwise Emacs assumes that text space precedes data space, numerically. */ - #define VIRT_ADDR_VARIES /* Define NO_REMAP if memory segmentation makes it not work well to change the boundary between the text section and data section when Emacs is dumped. If you define this, the preloaded Lisp code will not be sharable; but that's better than failing completely. */ - #define NO_REMAP /* Some really obscure 4.2-based systems (like Sequent DYNIX) - * do not support asynchronous I/O (using SIGIO) on sockets, - * even though it works fine on tty's. If you have one of - * these systems, define the following, and then use it in - * config.h (or elsewhere) to decide when (not) to use SIGIO. - * - * You'd think this would go in an operating-system description file, - * but since it only occurs on some, but not all, BSD systems, the - * reasonable place to select for it is in the machine description - * file. - */ + do not support asynchronous I/O (using SIGIO) on sockets, + even though it works fine on tty's. If you have one of + these systems, define the following, and then use it in + config.h (or elsewhere) to decide when (not) to use SIGIO. + You'd think this would go in an operating-system description file, + but since it only occurs on some, but not all, BSD systems, the + 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 configuration names, and add a description of the system to diff -r e56f669f17ce -r fe07c47cf7a7 src/m/vax.h --- a/src/m/vax.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/vax.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* machine description file for vax. - Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,18 +19,8 @@ along with GNU Emacs. If not, see . */ -/* The following line tells the configuration script what sort of - operating system this machine is likely to run. - USUAL-OPSYS="note" - -NOTE-START -The vax (-machine=vax) runs zillions of different operating systems. - -NOTE-END */ - /* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word is the most significant byte. */ - #undef WORDS_BIG_ENDIAN /* #define vax -- appears to be done automatically */ @@ -38,11 +29,9 @@ support the load average, so disable it for them. */ /* Data type of load average, as read out of kmem. */ - #define LOAD_AVE_TYPE double /* Convert that into an integer that is 100 for a load average of 1.0 */ - #define LOAD_AVE_CVT(x) ((int) ((x) * 100.0)) #define HAVE_FTIME diff -r e56f669f17ce -r fe07c47cf7a7 src/m/xtensa.h --- a/src/m/xtensa.h Wed May 12 14:32:06 2010 +0200 +++ b/src/m/xtensa.h Thu May 13 15:13:52 2010 +0200 @@ -2,8 +2,6 @@ Add a license notice if this grows to > 10 lines of code. */ -#define NO_ARG_ARRAY - #ifdef __LITTLE_ENDIAN #undef WORDS_BIG_ENDIAN #else diff -r e56f669f17ce -r fe07c47cf7a7 src/makefile.w32-in --- a/src/makefile.w32-in Wed May 12 14:32:06 2010 +0200 +++ b/src/makefile.w32-in Thu May 13 15:13:52 2010 +0200 @@ -62,7 +62,6 @@ $(BLD)/callint.$(O) \ $(BLD)/callproc.$(O) \ $(BLD)/casefiddle.$(O) \ - $(BLD)/cm.$(O) \ $(BLD)/cmds.$(O) \ $(BLD)/data.$(O) \ $(BLD)/dired.$(O) \ @@ -98,7 +97,6 @@ $(BLD)/syntax.$(O) \ $(BLD)/sysdep.$(O) \ $(BLD)/term.$(O) \ - $(BLD)/termcap.$(O) \ $(BLD)/tparam.$(O) \ $(BLD)/undo.$(O) \ $(BLD)/unexw32.$(O) \ @@ -494,17 +492,6 @@ $(SRC)/character.h \ $(SRC)/charset.h -$(BLD)/cm.$(O) : \ - $(SRC)/cm.c \ - $(CONFIG_H) \ - $(SRC)/lisp.h \ - $(SRC)/cm.h \ - $(SRC)/dispextern.h \ - $(SRC)/frame.h \ - $(SRC)/termchar.h \ - $(SRC)/termhooks.h \ - $(SRC)/w32gui.h - $(BLD)/cmds.$(O) : \ $(SRC)/cmds.c \ $(CONFIG_H) \ @@ -710,6 +697,7 @@ $(SRC)/commands.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ + $(SRC)/frame.h \ $(SRC)/keyboard.h \ $(SRC)/systime.h \ $(SRC)/w32gui.h @@ -1407,13 +1395,6 @@ $(SRC)/w32gui.h \ $(SRC)/window.h -$(BLD)/termcap.$(O) : \ - $(SRC)/termcap.c \ - $(CONFIG_H) \ - $(EMACS_ROOT)/nt/inc/unistd.h \ - $(EMACS_ROOT)/nt/inc/sys/file.h \ - $(SRC)/lisp.h - $(BLD)/terminal.$(O) : \ $(SRC)/terminal.c \ $(CONFIG_H) \ @@ -1574,6 +1555,7 @@ $(SRC)/keyboard.h \ $(SRC)/systime.h \ $(SRC)/termhooks.h \ + $(SRC)/w32.h \ $(SRC)/w32font.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ diff -r e56f669f17ce -r fe07c47cf7a7 src/msdos.c --- a/src/msdos.c Wed May 12 14:32:06 2010 +0200 +++ b/src/msdos.c Thu May 13 15:13:52 2010 +0200 @@ -528,8 +528,7 @@ /* If the user specified a special video mode for these dimensions, use that mode. */ sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); - video_mode = XSYMBOL (Fintern_soft (build_string (video_name), - Qnil))-> value; + video_mode = Fsymbol_value (Fintern_soft (build_string (video_name), Qnil)); if (INTEGERP (video_mode) && (video_mode_value = XINT (video_mode)) > 0) @@ -4458,8 +4457,6 @@ #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 -#ifdef POSIX_SIGNALS - /* Augment DJGPP library POSIX signal functions. This is needed as of DJGPP v2.01, but might be in the library in later releases. */ @@ -4557,12 +4554,6 @@ return 0; } -#else /* not POSIX_SIGNALS */ - -sigsetmask (x) int x; { return 0; } -sigblock (mask) int mask; { return 0; } - -#endif /* not POSIX_SIGNALS */ #endif /* not __DJGPP_MINOR__ < 2 */ #ifndef HAVE_SELECT diff -r e56f669f17ce -r fe07c47cf7a7 src/nsmenu.m --- a/src/nsmenu.m Wed May 12 14:32:06 2010 +0200 +++ b/src/nsmenu.m Thu May 13 15:13:52 2010 +0200 @@ -1709,7 +1709,7 @@ - (Lisp_Object)runDialogAt: (NSPoint)p { - int ret; + NSInteger ret; extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */ /* initiate a session that will be ended by pop_down_menu */ diff -r e56f669f17ce -r fe07c47cf7a7 src/print.c --- a/src/print.c Wed May 12 14:32:06 2010 +0200 +++ b/src/print.c Thu May 13 15:13:52 2010 +0200 @@ -2267,70 +2267,6 @@ strout ("#", -1, -1, printcharfun, 0); break; - case Lisp_Misc_Intfwd: - sprintf (buf, "#", (long) *XINTFWD (obj)->intvar); - strout (buf, -1, -1, printcharfun, 0); - break; - - case Lisp_Misc_Boolfwd: - sprintf (buf, "#", - (*XBOOLFWD (obj)->boolvar ? "t" : "nil")); - strout (buf, -1, -1, printcharfun, 0); - break; - - case Lisp_Misc_Objfwd: - strout ("#objvar, printcharfun, escapeflag); - PRINTCHAR ('>'); - break; - - case Lisp_Misc_Buffer_Objfwd: - strout ("#offset), - printcharfun, escapeflag); - PRINTCHAR ('>'); - break; - - case Lisp_Misc_Kboard_Objfwd: - strout ("#offset), - printcharfun, escapeflag); - PRINTCHAR ('>'); - break; - - case Lisp_Misc_Buffer_Local_Value: - strout ("#local_if_set) - strout ("[local-if-set] ", -1, -1, printcharfun, 0); - strout ("[realvalue] ", -1, -1, printcharfun, 0); - print_object (XBUFFER_LOCAL_VALUE (obj)->realvalue, - printcharfun, escapeflag); - if (XBUFFER_LOCAL_VALUE (obj)->found_for_buffer) - strout ("[local in buffer] ", -1, -1, printcharfun, 0); - else - strout ("[buffer] ", -1, -1, printcharfun, 0); - print_object (XBUFFER_LOCAL_VALUE (obj)->buffer, - printcharfun, escapeflag); - if (XBUFFER_LOCAL_VALUE (obj)->check_frame) - { - if (XBUFFER_LOCAL_VALUE (obj)->found_for_frame) - strout ("[local in frame] ", -1, -1, printcharfun, 0); - else - strout ("[frame] ", -1, -1, printcharfun, 0); - print_object (XBUFFER_LOCAL_VALUE (obj)->frame, - printcharfun, escapeflag); - } - strout ("[alist-elt] ", -1, -1, printcharfun, 0); - print_object (XCAR (XBUFFER_LOCAL_VALUE (obj)->cdr), - printcharfun, escapeflag); - strout ("[default-value] ", -1, -1, printcharfun, 0); - print_object (XCDR (XBUFFER_LOCAL_VALUE (obj)->cdr), - printcharfun, escapeflag); - PRINTCHAR ('>'); - break; - case Lisp_Misc_Save_Value: strout ("#filter; @@ -6814,7 +6788,7 @@ /* There's no good reason to let sentinels change the current buffer, and many callers of accept-process-output, sit-for, and friends don't expect current-buffer to be changed from under them. */ - record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); sentinel = p->sentinel; if (NILP (sentinel)) diff -r e56f669f17ce -r fe07c47cf7a7 src/s/aix4-2.h --- a/src/s/aix4-2.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/aix4-2.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,6 @@ /* -Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,68 +17,48 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ - +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #define USG /* System III, System V, etc */ #define USG5 -/* This symbol should be defined on AIX Version 3 ??????? */ +/* This symbol should be defined on AIX Version 3 ??????? */ #ifndef _AIX #define _AIX #endif /* SYSTEM_TYPE should indicate the kind of system you are using. It sets the Lisp variable system-type. */ - #define SYSTEM_TYPE "aix" /* In AIX, you allocate a pty by opening /dev/ptc to get the master side. To get the name of the slave side, you just ttyname() the master side. */ - #define PTY_ITERATION for (c = 0; !c ; c++) #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); #define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); -/* - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - */ - +/* Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. */ #define HAVE_TERMIOS -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ - #define HAVE_SOCKETS -/* - * Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir - * library functions. Almost, but not quite the same as - * the 4.2 functions - */ - +/* Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir library + functions. Almost, but not quite the same as the 4.2 functions. */ #define SYSV_SYSTEM_DIR -/* Define this symbol if your system has the functions bcopy, etc. */ - +/* Define this symbol if your system has the functions bcopy, etc. */ #define BSTRING /* The file containing the kernel's symbol table is called /unix. */ - #define KERNEL_FILE "/unix" -/* The symbol in the kernel where the load average is found - is named avenrun. */ - +/* The kernel symbol where the load average is found is named avenrun. */ #define LDAV_SYMBOL "avenrun" /* Special itemss needed to make Emacs run on this system. */ @@ -87,40 +67,13 @@ #define LINKER cc #endif -/* No need to specify -lc when linking. */ - -#define LIB_STANDARD - -/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless - on older versions of X where it happens to exist. */ -#ifdef HAVE_LIBPTHREADS -#define LIBS_SYSTEM -lrts -lIM -liconv -lpthreads -#else -/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2. */ -#define LIBS_SYSTEM -lrts -lIM -liconv -#endif - -/* Use terminfo instead of termcap. */ - -#define TERMINFO - /* The following definition seems to be needed in AIX version 3.1.6.8. It may not have been needed in certain earlier versions. */ #define HAVE_TCATTR -/* Include unistd.h, even though we don't define POSIX. */ -#define NEED_UNISTD_H - /* AIX doesn't define this. */ #define unix 1 -#ifndef __GNUC__ -/* Some programs in src produce warnings saying certain subprograms - are to comples and need a MAXMEM value greater than 2000 for - additional optimization. --nils@exp-math.uni-essen.de */ -#define C_SWITCH_SYSTEM -ma -qmaxmem=4000 -#endif - /* string.h defines rindex as a macro, at least with native cc, so we lose declaring char * rindex without this. It is just a guess which versions of AIX need this definition. */ @@ -128,19 +81,12 @@ /* Perry Smith says these are correct. */ #define SIGNALS_VIA_CHARACTERS -#define MAIL_USE_LOCKF #define CLASH_DETECTION /* Perry Smith says these are correct. */ -#define POSIX_SIGNALS #undef sigmask -/* olson@mcs.anl.gov says -li18n is needed by -lXm. */ -#define LIB_MOTIF -lXm -li18n - #ifndef HAVE_LIBXMU -#define LIBXMU - /* Unfortunately without libXmu we cannot support EditRes. */ #define NO_EDITRES #endif @@ -148,7 +94,7 @@ /* On AIX Emacs uses the gmalloc.c malloc implementation. But given the way this system works, libc functions that return malloced memory use the libc malloc implementation. Calling xfree or - xrealloc on the results of such functions results in a crash. + xrealloc on the results of such functions results in a crash. One solution for this could be to define SYSTEM_MALLOC here, but that does not currently work on this system. @@ -156,11 +102,10 @@ It is possible to completely override the malloc implementation on AIX, but that involves putting the malloc functions in a shared library and setting the MALLOCTYPE environment variable to point to - tha shared library. - + that shared library. + Emacs currently calls xrealloc on the results of get_current_dir name, - to avoid a crash just use the Emacs implementation for that function. -*/ + to avoid a crash just use the Emacs implementation for that function. */ #define BROKEN_GET_CURRENT_DIR_NAME 1 #define UNEXEC unexaix.o diff -r e56f669f17ce -r fe07c47cf7a7 src/s/bsd-common.h --- a/src/s/bsd-common.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/bsd-common.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* Definitions file for GNU Emacs running on bsd 4.3 - Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,10 +19,8 @@ along with GNU Emacs. If not, see . */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ /* We give these symbols the numeric values found in to avoid warnings about redefined macros. */ @@ -48,9 +47,6 @@ #define SYSV_SYSTEM_DIR -/* POSIX-style pgrp behavior. */ -#undef BSD_PGRPS - #define UNEXEC unexelf.o /* If the system's imake configuration file defines `NeedWidePrototypes' @@ -58,61 +54,40 @@ generated in the Makefile generated by `xmkmf'. If we don't define NARROWPROTO, we will see the wrong function prototypes for X functions taking float or double parameters. */ - #define NARROWPROTO 1 /* SYSTEM_TYPE should indicate the kind of system you are using. It sets the Lisp variable system-type. */ - #define SYSTEM_TYPE "berkeley-unix" /* Do not use interrupt_input = 1 by default, because in 4.3 we can make noninterrupt input work properly. */ - #undef INTERRUPT_INPUT /* First pty name is /dev/ptyp0. */ - #define FIRST_PTY_LETTER 'p' -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ - #define HAVE_SOCKETS /* Define this symbol if your system has the functions bcopy, etc. */ - #define BSTRING -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -#define MAIL_USE_FLOCK - /* 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. */ - #define CLASH_DETECTION /* The file containing the kernel's symbol table is called /vmunix. */ - #define KERNEL_FILE "/vmunix" -/* The symbol in the kernel where the load average is found - is named _avenrun. */ - +/* The kernel symbol where the load average is found is named _avenrun. */ #define LDAV_SYMBOL "_avenrun" /* Send signals to subprocesses by "typing" special chars at them. */ - #define SIGNALS_VIA_CHARACTERS /* arch-tag: 0c367245-bde3-492e-9029-3ff6898beb95 diff -r e56f669f17ce -r fe07c47cf7a7 src/s/cygwin.h --- a/src/s/cygwin.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/cygwin.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* System description header file for Cygwin. - Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -19,7 +20,6 @@ /* SYSTEM_TYPE should indicate the kind of system you are using. It sets the Lisp variable system-type. */ - #define SYSTEM_TYPE "cygwin" /* Emacs can read input using SIGIO and buffering characters itself, @@ -43,26 +43,19 @@ It would have Emacs fork off a separate process to read the input and send it to the true Emacs process through a pipe. */ - #undef INTERRUPT_INPUT -/* - * Define HAVE_TERMIOS if the system provides POSIX-style - * functions and macros for terminal control. - * - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - * - * Do not define both. HAVE_TERMIOS is preferred, if it is - * supported on your system. - */ +/* Define HAVE_TERMIOS if the system provides POSIX-style + functions and macros for terminal control. + Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. + + Do not define both. HAVE_TERMIOS is preferred, if it is + supported on your system. */ #define HAVE_TERMIOS -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS #define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ #define PTY_NAME_SPRINTF /* none */ @@ -81,13 +74,11 @@ while (0) /* Define this symbol if your system has the functions bcopy, etc. */ - #define BSTRING /* 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. */ - #define CLASH_DETECTION /* If the system's imake configuration file defines `NeedWidePrototypes' @@ -95,22 +86,16 @@ generated in the Makefile generated by `xmkmf'. If we don't define NARROWPROTO, we will see the wrong function prototypes for X functions taking float or double parameters. */ - #define NARROWPROTO 1 -/* used in various places to enable cygwin-specific code changes */ +/* Used in various places to enable cygwin-specific code changes. */ #define CYGWIN 1 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) #define SYSV_SYSTEM_DIR 1 #define UNEXEC unexcw.o -#define POSIX_SIGNALS 1 #define LINKER $(CC) -/* Use terminfo instead of termcap. Fewer environment variables to - go wrong, more terminal types. */ -#define TERMINFO - #define HAVE_SOCKETS /* vfork() interacts badly with setsid(), causing ptys to fail to @@ -132,7 +117,5 @@ returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ #define G_SLICE_ALWAYS_MALLOC -/* the end */ - /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/darwin.h --- a/src/s/darwin.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/darwin.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* System description header file for Darwin (Mac OS X). - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,11 +19,8 @@ along with GNU Emacs. If not, see . */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ - +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #define BSD4_2 /* BSD4_3 and BSD4_4 are already defined in sys/param.h */ #define BSD_SYSTEM @@ -30,14 +28,12 @@ /* More specific than the above two. We cannot use __APPLE__ as this may not be defined on non-OSX Darwin, and we cannot define DARWIN here because Panther and lower CoreFoundation.h uses DARWIN to - distinguish OS X from pure Darwin. */ - + distinguish OS X from pure Darwin. */ #define DARWIN_OS /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "darwin" /* Emacs can read input using SIGIO and buffering characters itself, @@ -61,58 +57,54 @@ It would have Emacs fork off a separate process to read the input and send it to the true Emacs process through a pipe. */ - #define INTERRUPT_INPUT /* Letter to use in finding device name of first pty, if system supports pty's. 'a' means it is /dev/ptya0 */ - #define FIRST_PTY_LETTER 'p' -/* - * Define HAVE_TERMIOS if the system provides POSIX-style - * functions and macros for terminal control. - * - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - * - * Do not define both. HAVE_TERMIOS is preferred, if it is - * supported on your system. - */ +/* Define HAVE_TERMIOS if the system provides POSIX-style + functions and macros for terminal control. + Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. + + Do not define both. HAVE_TERMIOS is preferred, if it is supported + on your system. */ #define HAVE_TERMIOS - #define NO_TERMIO -/* - * Define HAVE_PTYS if the system supports pty devices. - * Note: PTYs are broken on darwin <6. Use at your own risk. - */ - +/* Define HAVE_PTYS if the system supports pty devices. + Note: PTYs are broken on darwin <6. Use at your own risk. */ #define HAVE_PTYS +/* Run only once. We need a `for'-loop because the code uses `continue'. */ +#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_NAME_SPRINTF /* none */ +#define PTY_TTY_NAME_SPRINTF /* none */ +/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. + But we don't have to block SIGCHLD because it is blocked in the + implementation of grantpt. */ +#define PTY_OPEN \ + do \ + { \ + int slave; \ + if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) \ + fd = -1; \ + else \ + emacs_close (slave); \ + } \ + while (0) -/** - * PTYs only work correctly on Darwin 7 or higher. So make the - * default for process-connection-type dependent on the kernel - * version. - */ +/* PTYs only work correctly on Darwin 7 or higher. So make the default + for process-connection-type dependent on the kernel version. */ #define MIN_PTY_KERNEL_VERSION '7' /* Define this symbol if your system has the functions bcopy, etc. */ - #define BSTRING -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -#define MAIL_USE_FLOCK - /* 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. */ - #define CLASH_DETECTION /* Avoid the use of the name init_process (process.c) because it is @@ -122,74 +114,42 @@ /* Used in dispnew.c. Copied from freebsd.h. */ #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) -/* System uses OXTABS instead of the expected TAB3. (Copied from - bsd386.h.) */ +/* System uses OXTABS instead of the expected TAB3. (Copied from bsd386.h.) */ #define TAB3 OXTABS -/* Darwin ld insists on the use of malloc routines in the System - framework. */ +/* Darwin ld insists on the use of malloc routines in the System framework. */ #define SYSTEM_MALLOC /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ #define HAVE_SOCKETS /* Definitions for how to dump. Copied from nextstep.h. */ - #define UNEXEC unexmacosx.o -#define START_FILES pre-crt0.o - /* start_of_text isn't actually used, so make it compile without error. */ #define TEXT_START (0) /* Definitions for how to compile & link. */ - #ifdef HAVE_NS -#define LIBS_NSGUI -framework AppKit #define SYSTEM_PURESIZE_EXTRA 200000 -#define HEADERPAD_EXTRA 6C8 -#else /* !HAVE_NS */ -#define LIBS_NSGUI -#define HEADERPAD_EXTRA 690 -#endif /* !HAVE_NS */ +#endif /* On Darwin, res_init appears not to be useful: see bug#562 and http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html */ - #undef HAVE_RES_INIT #undef HAVE_LIBRESOLV -/* The -headerpad option tells ld (see man page) to leave room at the - end of the header for adding load commands. Needed for dumping. - 0x690 is the total size of 30 segment load commands (at 56 - each); under Cocoa 31 commands are required. */ -#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA - #ifdef emacs #define malloc unexec_malloc #define realloc unexec_realloc #define free unexec_free -/* Don't use posix_memalign because it is not compatible with - unexmacosx.c. */ +/* Don't use posix_memalign because it is not compatible with unexmacosx.c. */ #undef HAVE_POSIX_MEMALIGN #endif -/* The ncurses library has been moved out of the System framework in - Mac OS X 10.2. So if ./configure detects it, set the command-line - option to use it. */ -#ifdef HAVE_LIBNCURSES -#define LIBS_TERMCAP -lncurses -/* This prevents crashes when running Emacs in Terminal.app under - 10.2. */ -#define TERMINFO -#endif - /* Link this program just by running cc. */ #define ORDINARY_LINK -/* Adding -lm confuses the dynamic linker, so omit it. */ -#define LIB_MATH - /* Define the following so emacs symbols will not conflict with those in the System framework. Otherwise -prebind will not work. */ @@ -211,12 +171,7 @@ ioctl TIOCSCTTY. */ #define DONT_REOPEN_PTY -/* This makes create_process in process.c save and restore signal - handlers correctly. Suggested by Nozomu Ando.*/ -#define POSIX_SIGNALS - -/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the - stack. */ +/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS /* arch-tag: 481d443d-4f89-43ea-b5fb-49706d95fa41 diff -r e56f669f17ce -r fe07c47cf7a7 src/s/freebsd.h --- a/src/s/freebsd.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/freebsd.h Thu May 13 15:13:52 2010 +0200 @@ -1,9 +1,8 @@ /* System description header for FreeBSD systems. - This file describes the parameters that system description files - should define or not. - Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. Author: Shawn M. Carey (according to authors.el) @@ -31,28 +30,10 @@ #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) -#define LIBS_SYSTEM -lutil -#if __FreeBSD_version < 400000 -#define LIBS_TERMCAP -ltermcap -#else -#define TERMINFO -#define LIBS_TERMCAP -lncurses -#endif - -/* Let `ld' find image libs and similar things in /usr/local/lib. The - system compiler, GCC, has apparently been modified to not look - there, contrary to what a stock GCC would do. */ - -#define LD_SWITCH_SYSTEM -L/usr/local/lib -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o -#undef LIB_GCC -#define LIB_GCC - #define HAVE_GETLOADAVG 1 #define DECLARE_GETPWUID_WITH_UID_T -/* this silences a few compilation warnings */ +/* This silences a few compilation warnings. */ #undef BSD_SYSTEM #if __FreeBSD__ == 1 #define BSD_SYSTEM 199103 @@ -67,13 +48,6 @@ ioctl TIOCSCTTY. */ #define DONT_REOPEN_PTY -/* The following is needed to make `configure' find Xpm, Xaw3d and - image include and library files if using /usr/bin/gcc. That - compiler seems to be modified to not find headers in - /usr/local/include or libs in /usr/local/lib by default. */ - -#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib - /* Circumvent a bug in FreeBSD. In the following sequence of writes/reads on a PTY, read(2) returns bogus data: @@ -87,37 +61,18 @@ successfully after processing (for example with CRs added if the terminal is set up that way which it is here). The same bytes will be seen again in a later read(2), without the CRs. */ - #define BROKEN_PTY_READ_AFTER_EAGAIN 1 /* Tell that garbage collector that setjmp is known to save all - registers relevant for conservative garbage collection in the - jmp_buf. */ - + registers relevant for conservative garbage collection in the jmp_buf. */ #define GC_SETJMP_WORKS 1 -/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the - stack. */ - +/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS /* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate buffer text. This overrides REL_ALLOC. */ - #define USE_MMAP_FOR_BUFFERS 1 -/* Use sigprocmask(2) and friends instead of sigblock(2); the man page - of sigblock says it is obsolete. */ - -#define POSIX_SIGNALS 1 - -/* The `combreloc' setting became the default, and it seems to be - incompatible with unexec. Symptom is an immediate SEGV in - XtInitializeWidget when starting Emacs under X11. */ - -#if defined __FreeBSD_version && __FreeBSD_version >= 500042 -#define LD_SWITCH_SYSTEM_TEMACS -znocombreloc -#endif - /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/gnu-linux.h --- a/src/s/gnu-linux.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/gnu-linux.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,9 @@ /* This file is the configuration file for Linux-based GNU systems - Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +This file was put together by Michael K. Johnson and Rik Faith. This file is part of GNU Emacs. @@ -17,20 +20,13 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* This file was put together by Michael K. Johnson and Rik Faith. */ - - -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ - +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #define USG #define GNU_LINUX /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */ #ifndef NOT_C_CODE @@ -49,9 +45,7 @@ #if defined HAVE_GRANTPT #define UNIX98_PTYS -/* Run only once. We need a `for'-loop because the code uses - `continue'. */ - +/* Run only once. We need a `for'-loop because the code uses `continue'. */ #define PTY_ITERATION for (i = 0; i < 1; i++) #ifdef HAVE_GETPT @@ -63,7 +57,6 @@ /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to prevent sigchld_handler from intercepting the child's death. */ - #define PTY_TTY_NAME_SPRINTF \ { \ char *ptyname; \ @@ -85,58 +78,29 @@ /* Letter to use in finding device name of first pty, if system supports pty's. 'p' means it is /dev/ptyp0 */ - #define FIRST_PTY_LETTER 'p' #endif /* not HAVE_GRANTPT */ /* Define HAVE_TERMIOS if the system provides POSIX-style functions and macros for terminal control. */ - #define HAVE_TERMIOS -/* Define HAVE_PTYS if the system supports pty devices. */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS #define HAVE_SOCKETS -/* Define this symbol if your system has the functions bcopy, etc. */ - +/* Define this symbol if your system has the functions bcopy, etc. */ #define BSTRING /* This is used in list_system_processes. */ #define HAVE_PROCFS 1 -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -/* On GNU/Linux systems, both methods are used by various mail - programs. I assume that most people are using newer mailers that - have heard of flock. Change this if you need to. */ -/* Debian contains a patch which says: ``On Debian/GNU/Linux systems, - configure gets the right answers, and that means *NOT* using flock. - Using flock is guaranteed to be the wrong thing. See Debian Policy - for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the - Debian maintainer hasn't provided a clean fix for Emacs. - movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and - HAVE_MAILLOCK_H are defined, so the following appears to be the - correct logic. -- fx */ -/* We must check for HAVE_LIBLOCKFILE too, as movemail does. - liblockfile is a Free Software replacement for libmail, used on - Debian systems and elsewhere. -rfr */ - -#if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \ - defined (HAVE_MAILLOCK_H)) -#define MAIL_USE_FLOCK -#endif /* 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. */ - #define CLASH_DETECTION /* Here, on a separate page, add any special hacks needed @@ -146,45 +110,24 @@ your system and must be used only through an encapsulation (Which you should place, by convention, in sysdep.c). */ -/* This is needed for dispnew.c:update_frame */ - +/* This is needed for dispnew.c:update_frame. */ #ifdef emacs #include /* Get the definition of _IO_STDIO_H. */ #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM) -/* new C libio names */ +/* New C libio names. */ #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base) #elif defined (__UCLIBC__) -/* using the uClibc library */ +/* Using the uClibc library. */ #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ ((FILE)->__bufpos - (FILE)->__bufstart) #else /* !_IO_STDIO_H && ! __UCLIBC__ */ -/* old C++ iostream names */ +/* Old C++ iostream names. */ #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ ((FILE)->_pptr - (FILE)->_pbase) #endif /* !_IO_STDIO_H && ! __UCLIBC__ */ #endif /* emacs */ -/* Ask GCC where to find libgcc.a. */ -#define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name` - -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o - -/* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option - says where to find X windows at run time. */ - -#ifdef __mips__ -#define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX -#else -#define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX -#endif /* __mips__ */ - -/* Link temacs with -z nocombreloc so that unexec works right, whether or - not -z combreloc is the default. GNU ld ignores unknown -z KEYWORD - switches, so this also works with older versions that don't implement - -z combreloc. */ -#define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc - #ifdef emacs #define INTERRUPT_INPUT #endif @@ -192,24 +135,6 @@ #define SYSV_SYSTEM_DIR /* use dirent.h */ #define POSIX /* affects getpagesize.h and systty.h */ -#define POSIX_SIGNALS - -#undef LIB_GCC -#define LIB_GCC -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o - -/* _BSD_SOURCE is redundant, at least in glibc2, since we define - _GNU_SOURCE. Left in in case it's relevant to libc5 systems and - anyone's still using Emacs on those. --fx 2002-12-14 */ -#define C_SWITCH_SYSTEM -D_BSD_SOURCE - -/* Paul Abrahams says this is needed. */ -#define LIB_MOTIF -lXm -lXpm - -#ifdef HAVE_LIBNCURSES -#define TERMINFO -#define LIBS_TERMCAP -lncurses -#endif #define UNEXEC unexelf.o @@ -220,11 +145,6 @@ #define HAVE_XRMSETDATABASE #endif -/* Use BSD process groups, but use setpgid() instead of setpgrp() to - actually set a process group. */ -/* Interesting: only GNU/Linux defines this, but the BSDs do not... */ -#define BSD_PGRPS - #define NARROWPROTO 1 /* Use mmap directly for allocating larger buffers. */ @@ -233,8 +153,7 @@ #endif /* Tell that garbage collector that setjmp is known to save all - registers relevant for conservative garbage collection in the - jmp_buf. */ + registers relevant for conservative garbage collection in the jmp_buf. */ /* Not all the architectures are tested, but there are Debian packages for SCM and/or Guile on them, so the technique must work. See also comments in alloc.c concerning setjmp and gcc. Fixme: it's @@ -242,7 +161,6 @@ register window-flushing. */ /* Don't use #cpu here since in newest development versions of GCC, we must call cpp with -traditional, and that disables #cpu. */ - #if defined __i386__ || defined __sparc__ || defined __mc68000__ \ || defined __alpha__ || defined __mips__ || defined __s390__ \ || defined __arm__ || defined __powerpc__ || defined __amd64__ \ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/gnu.h --- a/src/s/gnu.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/gnu.h Thu May 13 15:13:52 2010 +0200 @@ -28,13 +28,6 @@ #define SIGNALS_VIA_CHARACTERS -/* Tell Emacs that we are a terminfo based system; disable the use - of local termcap. (GNU uses ncurses.) */ -#ifdef HAVE_LIBNCURSES -#define TERMINFO -#define LIBS_TERMCAP -lncurses -#endif - /* Use mmap directly for allocating larger buffers. */ #ifdef DOUG_LEA_MALLOC #undef REL_ALLOC diff -r e56f669f17ce -r fe07c47cf7a7 src/s/hpux10-20.h --- a/src/s/hpux10-20.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/hpux10-20.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* System description file for hpux version 10.20. - Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,56 +21,39 @@ #define RUN_TIME_REMAP -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ - +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #define USG /* System III, System V, etc */ - #define USG5 - #define HPUX /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "hpux" /* Letter to use in finding device name of first pty, - if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ - + if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ #define FIRST_PTY_LETTER 'p' -/* - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - */ - +/* Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. */ #define HAVE_TERMIO -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ - #define HAVE_SOCKETS /* Define this symbol if your system has the functions bcopy, etc. - * s800 and later versions of s300 (s200) kernels have equivalents - * of the BSTRING functions of BSD. If your s200 kernel doesn't have - * em comment out this section. - */ - + s800 and later versions of s300 (s200) kernels have equivalents + of the BSTRING functions of BSD. If your s200 kernel doesn't have + em comment out this section. */ #define BSTRING /* 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. */ - #define CLASH_DETECTION /* The symbol in the kernel where the load average is found @@ -77,23 +61,15 @@ /* Special hacks needed to make Emacs run on this system. */ -/* Use the system provided termcap(3) library */ -#define TERMINFO - /* In hpux, the symbol SIGIO is defined, but the feature doesn't work in the way Emacs needs it to. */ - #define BROKEN_SIGIO /* Some additional system facilities exist. */ - #define HAVE_PERROR /* Delete this line for version 6. */ #define UNEXEC unexhp9k800.o -/* Include the file bsdtty.h, since this machine has job control. */ -#define NEED_BSDTTY - /* This is how to get the device name of the tty end of a pty. */ #define PTY_TTY_NAME_SPRINTF \ sprintf (pty_name, "/dev/pty/tty%c%x", c, i); @@ -105,17 +81,6 @@ /* This triggers a conditional in xfaces.c. */ #define XOS_NEEDS_TIME_H -/* Don't use shared libraries. unexec doesn't handle them. - Note GCC automatically passes -a archive to ld, and it has its own - conflicting -a. */ -#define LD_SWITCH_SYSTEM_TEMACS - -#ifndef HAVE_LIBXMU -/* HP-UX doesn't supply Xmu. */ -#define LIBXMU - -#endif - /* Assar Westerlund says this is necessary for HP-UX 10.20, and that it works for HP-UX 0 as well. */ #define NO_EDITRES @@ -128,7 +93,7 @@ version number A.09.05. You can fix the math library by installing patch number PHSS_4630. - But we can fix it more reliably for Emacs like this. */ + But we can fix it more reliably for Emacs like this. */ #undef HAVE_RINT /* We have to go this route, rather than hpux9's approach of renaming the @@ -143,35 +108,56 @@ /* AlainF 20-Jul-1996 says this is right. */ #define KERNEL_FILE "/stand/vmunix" -#define LIBS_SYSTEM -l:libdld.sl /* Rainer Malzbender says definining - HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 - using GCC. */ - + HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */ #ifndef HAVE_XRMSETDATABASE #define HAVE_XRMSETDATABASE #endif -/* Make sure we get select from libc rather than from libcurses - because libcurses on HPUX 10.10 has a broken version of select. - We used to use -lc -lcurses, but this may be cleaner. */ -#define LIBS_TERMCAP -ltermcap - -/* However, HPUX 10 puts Xaw and Xmu in a strange place - (if you install them at all). So search that place. */ -#define C_SWITCH_X_SYSTEM -I/usr/include/X11R6 -I/usr/include/X11R5 -I/usr/include/Motif1.2 -I/usr/contrib/X11R6/include -I/usr/contrib/X11R5/include -#define LD_SWITCH_X_DEFAULT -L/usr/lib/X11R6 -L/usr/lib/X11R5 -L/usr/lib/Motif1.2 -L/usr/contrib/X11R5/lib - /* 2000-11-21: Temporarily disable Unix 98 large file support found by configure. It fails on HPUX 11, at least, because it enables header sections which lose when `static' is defined away, as it is on HP-UX. (You get duplicate symbol errors on linking). */ - #undef _FILE_OFFSET_BITS -/* otherwise sigunblock wont be defined */ -#define POSIX_SIGNALS +/* Define NO_REMAP if memory segmentation makes it not work well + to change the boundary between the text section and data section + when Emacs is dumped. If you define this, the preloaded Lisp + code will not be sharable; but that's better than failing completely. */ +#define NO_REMAP + +/* Define VIRT_ADDR_VARIES if the virtual addresses of + pure and impure space as loaded can vary, and even their + relative order cannot be relied on. + + Otherwise Emacs assumes that text space precedes data space, + numerically. */ +#define VIRT_ADDR_VARIES + +/* The data segment on this machine always starts at address 0x40000000. */ +#define DATA_SEG_BITS 0x40000000 + +#define DATA_START 0x40000000 +#define TEXT_START 0x00000000 + +/* Data type of load average, as read out of kmem. */ +#define LOAD_AVE_TYPE double + +/* Convert that into an integer that is 100 for a load average of 1.0 */ +#define LOAD_AVE_CVT(x) ((int) (x * 100.0)) + +/* The kernel symbol where the load average is found is named _avenrun. + At this time there are two major flavors of hp-ux (there is the s800 + and s300 (s200) flavors). The differences are thusly moved to the + corresponding machine description file. */ + +/* No underscore please. */ +#define LDAV_SYMBOL "avenrun" + +/* On USG systems these have different names. */ +#define index strchr +#define rindex strrchr /* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/hpux11.h --- a/src/s/hpux11.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/hpux11.h Thu May 13 15:13:52 2010 +0200 @@ -1,10 +1,5 @@ #include "hpux10-20.h" -#ifdef POSIX_SIGNALS -#undef POSIX_SIGNALS -#endif -#define POSIX_SIGNALS 1 - /* SA_RESTART resets the timeout of `select', so don't use it. */ #define BROKEN_SA_RESTART diff -r e56f669f17ce -r fe07c47cf7a7 src/s/irix6-5.h --- a/src/s/irix6-5.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/irix6-5.h Thu May 13 15:13:52 2010 +0200 @@ -27,10 +27,6 @@ #define SETPGRP_RELEASES_CTTY -#ifdef LIB_STANDARD -#undef LIB_STANDARD -#endif - #ifdef SYSTEM_TYPE #undef SYSTEM_TYPE #endif @@ -44,6 +40,11 @@ /* Make process_send_signal work by "typing" a signal character on the pty. */ #define SIGNALS_VIA_CHARACTERS +/* Letter to use in finding device name of first pty, + if system supports pty's. 'a' means it is /dev/ptya0 */ +#undef FIRST_PTY_LETTER +#define FIRST_PTY_LETTER 'q' + /* No need to use sprintf to get the tty name--we get that from _getpty. */ #define PTY_TTY_NAME_SPRINTF /* No need to get the pty name at all. */ @@ -84,21 +85,10 @@ #define UNEXEC unexelf.o -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -#define MAIL_USE_FLOCK - #define NARROWPROTO 1 #define USE_MMAP_FOR_BUFFERS 1 -/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b - (do not change this comment) */ - - #if _MIPS_SZLONG == 64 /* -mabi=64 (gcc) or -64 (MIPSpro) */ #define _LP64 /* lisp.h takes care of the rest */ #endif /* _MIPS_SZLONG */ @@ -111,5 +101,8 @@ #define GC_SETJMP_WORKS 1 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS +/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b + (do not change this comment) */ + /* arch-tag: d7ad9ec2-54ad-4b2f-adf2-0070c5c63e83 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/ms-w32.h --- a/src/s/ms-w32.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/ms-w32.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,7 @@ /* System description file for Windows NT. - Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -17,10 +18,8 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #ifndef WINDOWSNT #define WINDOWSNT @@ -30,71 +29,55 @@ #endif /* If you are compiling with a non-C calling convention but need to - declare vararg routines differently, put it here */ + declare vararg routines differently, put it here. */ #define _VARARGS_ __cdecl /* If you are providing a function to something that will call the function back (like a signal handler and signal, or main) its calling - convention must be whatever standard the libraries expect */ + convention must be whatever standard the libraries expect. */ #define _CALLBACK_ __cdecl /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "windows-nt" #define SYMS_SYSTEM syms_of_ntterm () #define NO_MATHERR 1 /* Letter to use in finding device name of first pty, - if system supports pty's. 'a' means it is /dev/ptya0 */ - + if system supports pty's. 'a' means it is /dev/ptya0 */ #define FIRST_PTY_LETTER 'a' -/* - * Define HAVE_TIMEVAL if the system supports the BSD style clock values. - * Look in for a timeval structure. - */ - +/* Define HAVE_TIMEVAL if the system supports the BSD style clock values. + Look in for a timeval structure. */ #define HAVE_TIMEVAL 1 -/* NT supports Winsock which is close enough (with some hacks) */ - +/* NT supports Winsock which is close enough (with some hacks). */ #define HAVE_SOCKETS 1 /* But our select implementation doesn't allow us to make non-blocking connects. So until that is fixed, this is necessary: */ - #define BROKEN_NON_BLOCKING_CONNECT 1 /* And the select implementation does 1-byte read-ahead waiting for received packets, so datagrams are broken too. */ - #define BROKEN_DATAGRAM_SOCKETS 1 -/* Define this symbol if your system has the functions bcopy, etc. */ - +/* Define this symbol if your system has the functions bcopy, etc. */ #define BSTRING #define bzero(b, l) memset(b, 0, l) #define bcopy(s, d, l) memmove(d, s, l) #define bcmp(a, b, l) memcmp(a, b, l) -/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */ +/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */ #define GAP_USE_BCOPY 1 #define BCOPY_UPWARD_SAFE 1 #define BCOPY_DOWNWARD_SAFE 1 /* If your system uses COFF (Common Object File Format) then define the - preprocessor symbol "COFF". */ - + preprocessor symbol "COFF". */ #define COFF 1 -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -/* #define MAIL_USE_FLOCK */ #define MAIL_USE_POP 1 #define MAIL_USE_SYSTEM_LOCK 1 @@ -106,24 +89,33 @@ /* ============================================================ */ -/* Here, add any special hacks needed - to make Emacs work on this system. For example, - you might define certain system call names that don't - exist on your system, or that do different things on - your system and must be used only through an encapsulation - (Which you should place, by convention, in sysdep.c). */ +/* Here, add any special hacks needed to make Emacs work on this + system. For example, you might define certain system call names + that don't exist on your system, or that do different things on + your system and must be used only through an encapsulation (which + you should place, by convention, in sysdep.c). */ -/* Define this to be the separator between path elements */ +/* Define this to be the separator between path elements. */ #define DIRECTORY_SEP XINT (Vdirectory_sep_char) -/* Define this to be the separator between devices and paths */ +/* Define this to be the separator between devices and paths. */ #define DEVICE_SEP ':' /* We'll support either convention on NT. */ #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) -/* The null device on Windows NT. */ +#include +struct sigaction { + int sa_flags; + void (*sa_handler)(int); + sigset_t sa_mask; +}; +#define SIG_BLOCK 1 +#define SIG_SETMASK 2 +#define SIG_UNBLOCK 3 + +/* The null device on Windows NT. */ #define NULL_DEVICE "NUL:" #ifndef MAXPATHLEN @@ -213,11 +205,11 @@ #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B") -/* get some redefinitions in place */ +/* Get some redefinitions in place. */ #ifdef emacs -/* calls that are emulated or shadowed */ +/* Calls that are emulated or shadowed. */ #undef access #define access sys_access #undef chdir @@ -254,15 +246,26 @@ #undef write #define write sys_write -/* subprocess calls that are emulated */ +/* Subprocess calls that are emulated. */ #define spawnve sys_spawnve #define wait sys_wait #define kill sys_kill #define signal sys_signal +/* termcap.c calls that are emulated. */ +#define tputs sys_tputs +#define tgetstr sys_tgetstr + +/* cm.c calls that are emulated. */ +#define chcheckmagic sys_chcheckmagic +#define cmcostinit sys_cmcostinit +#define cmgoto sys_cmgoto +#define cmputc sys_cmputc +#define Wcm_clear sys_Wcm_clear + #endif /* emacs */ -/* map to MSVC names */ +/* Map to MSVC names. */ #define execlp _execlp #define execvp _execvp #define fdopen _fdopen @@ -296,8 +299,8 @@ #define utime _utime #endif -/* this is hacky, but is necessary to avoid warnings about macro - redefinitions using the SDK compilers */ +/* This is hacky, but is necessary to avoid warnings about macro + redefinitions using the SDK compilers. */ #ifndef __STDC__ #define __STDC__ 1 #define MUST_UNDEF__STDC__ @@ -310,7 +313,7 @@ #undef MUST_UNDEF__STDC__ #endif -/* Defines that we need that aren't in the standard signal.h */ +/* Defines that we need that aren't in the standard signal.h. */ #define SIGHUP 1 /* Hang up */ #define SIGQUIT 3 /* Quit process */ #define SIGTRAP 5 /* Trace trap */ @@ -353,8 +356,7 @@ #include -/* Define for those source files that do not include enough NT - system files. */ +/* Define for those source files that do not include enough NT system files. */ #ifndef NULL #ifdef __cplusplus #define NULL 0 @@ -389,7 +391,7 @@ removed. Also, obviously, all files that define initialized data must include config.h to pick up this pragma. */ -/* Names must be < 8 bytes */ +/* Names must be < 8 bytes. */ #ifdef _MSC_VER #pragma data_seg("EMDATA") #pragma bss_seg("EMBSS") diff -r e56f669f17ce -r fe07c47cf7a7 src/s/msdos.h --- a/src/s/msdos.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/msdos.h Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,7 @@ /* System description file for MS-DOS - Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -21,11 +21,8 @@ /* Note: lots of stuff here was taken from s-msdos.h in demacs. */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ - +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ #ifndef MSDOS #define MSDOS #endif @@ -38,46 +35,34 @@ #undef BSD_SYSTEM /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "ms-dos" #define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select() -/* NOMULTIPLEJOBS should be defined if your system's shell - does not have "job control" (the ability to stop a program, - run some other program, then continue the first one). */ - -#define NOMULTIPLEJOBS - #define SYSV_SYSTEM_DIR -/* Define this symbol if your system has the functions bcopy, etc. */ - +/* Define this symbol if your system has the functions bcopy, etc. */ #define BSTRING /* Define this is the compiler understands `volatile'. */ #define HAVE_VOLATILE -/* subprocesses should be defined if you want to - have code for asynchronous subprocesses - (as used in M-x compile and M-x shell). +/* subprocesses should be defined if you want to have code for + asynchronous subprocesses (as used in M-x compile and M-x shell). This is the only system that needs this. */ - #undef subprocesses /* If your system uses COFF (Common Object File Format) then define the - preprocessor symbol "COFF". */ - + preprocessor symbol "COFF". */ #define COFF -/* Here, on a separate page, add any special hacks needed - to make Emacs work on this system. For example, - you might define certain system call names that don't - exist on your system, or that do different things on - your system and must be used only through an encapsulation - (Which you should place, by convention, in sysdep.c). */ +/* Here, on a separate page, add any special hacks needed to make + Emacs work on this system. For example, you might define certain + system call names that don't exist on your system, or that do + different things on your system and must be used only through an + encapsulation (which you should place, by convention, in sysdep.c). */ /* Avoid incompatibilities between gmalloc.c and system header files in how to declare valloc. */ @@ -89,7 +74,6 @@ /* setjmp and longjmp can safely replace _setjmp and _longjmp, but they will run slower. */ - #define _setjmp setjmp #define _longjmp longjmp @@ -101,7 +85,6 @@ #define ORDINARY_LINK /* command.com does not understand `...` so we define this. */ -#define LIB_GCC -Lgcc #define SEPCHAR ';' #define NULL_DEVICE "nul" @@ -116,17 +99,17 @@ :AB=:AF=:op=:" /* Define this to a function (Fdowncase, Fupcase) if your file system - likes that */ + likes that. */ #define FILE_SYSTEM_CASE Fmsdos_downcase_filename -/* Define this to be the separator between devices and paths */ +/* Define this to be the separator between devices and paths. */ #define DEVICE_SEP ':' /* We'll support either convention on MSDOG. */ #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) -/* bcopy under djgpp is quite safe */ +/* bcopy under djgpp is quite safe. */ #define GAP_USE_BCOPY #define BCOPY_UPWARD_SAFE 1 #define BCOPY_DOWNWARD_SAFE 1 @@ -134,13 +117,10 @@ /* Mode line description of a buffer's type. */ #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") -/* Do we have POSIX signals? */ -#define POSIX_SIGNALS - /* We have (the code to control) a mouse. */ #define HAVE_MOUSE -/* We canuse mouse menus. */ +/* We can use mouse menus. */ #define HAVE_MENUS /* Define one of these for easier conditionals. */ @@ -149,7 +129,6 @@ commentary below, in the non-X branch. The 140KB number was measured on GNU/Linux and on MS-WIndows. */ #define SYSTEM_PURESIZE_EXTRA (-170000+140000) -#define LIBS_SYSTEM -lxext -lsys #else /* We need a little extra space, see ../../lisp/loadup.el. As of 20091024, DOS-specific files use up 62KB of pure space. But @@ -164,15 +143,11 @@ #endif /* Tell the garbage collector that setjmp is known to save all - registers relevant for conservative garbage collection in the - jmp_buf. */ - + registers relevant for conservative garbage collection in the jmp_buf. */ #define GC_SETJMP_WORKS 1 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS #define NO_REMAP -#define UNEXEC unexec.o - /* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/netbsd.h --- a/src/s/netbsd.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/netbsd.h Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,7 @@ /* s/ file for netbsd system. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -19,55 +19,19 @@ along with GNU Emacs. If not, see . */ -/* Get most of the stuff from bsd-common */ +/* Get most of the stuff from bsd-common. */ #include "bsd-common.h" #define HAVE_GETLOADAVG 1 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) -#define LIBS_TERMCAP -ltermcap - -#define START_FILES pre-crt0.o /usr/lib/crt0.o START_FILES_1 /usr/lib/crtbegin.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o END_FILES_1 -#undef LIB_GCC -#define LIB_GCC - -#ifdef HAVE_CRTIN -#define START_FILES_1 /usr/lib/crti.o -#define END_FILES_1 /usr/lib/crtn.o -#else -#define START_FILES_1 -#define END_FILES_1 -#endif - #define AMPERSAND_FULL_NAME -/* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option - says where to find X windows at run time. We convert it to a -rpath option - which is what OSF1 uses. */ -#define LD_SWITCH_SYSTEM_tmp `echo LD_SWITCH_X_SITE_AUX | sed -e 's/-R/-Wl,-rpath,/'` -#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib - -/* The following is needed to make `configure' find Xpm, Xaw3d and - image include and library files if using /usr/bin/gcc. That - compiler seems to be modified to not find headers in - /usr/local/include or libs in /usr/local/lib by default. */ - -#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/pkg/include -I/usr/local/include -L/usr/pkg/lib -L/usr/local/lib - -/* Link temacs with -z nocombreloc so that unexec works right, whether or - not -z combreloc is the default. GNU ld ignores unknown -z KEYWORD - switches, so this also works with older versions that don't implement - -z combreloc. */ - -#define LD_SWITCH_SYSTEM_TEMACS -Wl,-z,nocombreloc - /* On post 1.3 releases of NetBSD, gcc -nostdlib also clears the library search parth, i.e. it won't search /usr/lib - for libc and friends. Using -nostartfiles instead avoids - this problem, and will also work on earlier NetBSD releases */ - + for libc and friends. Using -nostartfiles instead avoids + this problem, and will also work on earlier NetBSD releases. */ #define LINKER $(CC) -nostartfiles #define DEFAULT_SOUND_DEVICE "/dev/audio" @@ -75,7 +39,6 @@ /* Greg A. Woods says we must include signal.h before syssignal.h is included, to work around interface conflicts that are handled with CPP __RENAME() macro in signal.h. */ - #ifndef NOT_C_CODE #include #endif @@ -83,23 +46,14 @@ /* Don't close pty in process.c to make it as controlling terminal. It is already a controlling terminal of subprocess, because we did ioctl TIOCSCTTY. */ - #define DONT_REOPEN_PTY /* Tell that garbage collector that setjmp is known to save all - registers relevant for conservative garbage collection in the - jmp_buf. */ - + registers relevant for conservative garbage collection in the jmp_buf. */ #define GC_SETJMP_WORKS 1 /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */ - #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS -/* Use sigprocmask and friends instead of sigblock; - sigblock is considered obsolete on NetBSD. */ - -#define POSIX_SIGNALS 1 - /* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/openbsd.h --- a/src/s/openbsd.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/openbsd.h Thu May 13 15:13:52 2010 +0200 @@ -1,32 +1,7 @@ -/* s/ file for openbsd systems. */ - -/* Mostly the same as NetBSD. */ -#include "netbsd.h" - -/* This very-badly named symbol is conditionally defined in netbsd.h. - Better would be either to not need it in the first place, or to choose - a more descriptive name. */ -#ifndef LD_SWITCH_SYSTEM_tmp -#define LD_SWITCH_SYSTEM_tmp /* empty */ -#endif +/* System file for openbsd. */ -/* David Mazieres says this - is necessary. Otherwise Emacs dumps core when run -nw. */ -#undef LIBS_TERMCAP - -#define TERMINFO -#define LIBS_TERMCAP -lncurses - -#undef LD_SWITCH_SYSTEM_TEMACS -#undef LD_SWITCH_SYSTEM - - /* Han Boetes says this - is necessary, otherwise Emacs dumps core on elf systems. */ -#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z - -/* The version of gcc on OpenBSD doesn't search /usr/local/lib by - default. */ -#define LD_SWITCH_X_DEFAULT -L/usr/local/lib +/* The same as NetBSD. Note there are differences in configure. */ +#include "netbsd.h" /* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2 (do not change this comment) */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/sol2-10.h --- a/src/s/sol2-10.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/sol2-10.h Thu May 13 15:13:52 2010 +0200 @@ -4,20 +4,18 @@ #define SYSTEM_MALLOC -/* - * Use the Solaris dldump() function, called from unexsol.c, to dump - * emacs, instead of the generic ELF dump code found in unexelf.c. - * The resulting binary has a complete symbol table, and is better - * for debugging and other observabilty tools (debuggers, pstack, etc). - * - * If you encounter a problem using dldump(), please consider sending - * a message to the OpenSolaris tools-linking mailing list: - * http://mail.opensolaris.org/mailman/listinfo/tools-linking - * - * It is likely that dldump() works with older Solaris too, - * but this has not been tested, and so, this change is for - * Solaris 10 and newer only at this time. - */ +/* Use the Solaris dldump() function, called from unexsol.c, to dump + emacs, instead of the generic ELF dump code found in unexelf.c. + The resulting binary has a complete symbol table, and is better + for debugging and other observabilty tools (debuggers, pstack, etc). + + If you encounter a problem using dldump(), please consider sending + a message to the OpenSolaris tools-linking mailing list: + http://mail.opensolaris.org/mailman/listinfo/tools-linking + + It is likely that dldump() works with older Solaris too, + but this has not been tested, and so, this change is for + Solaris 10 and newer only at this time. */ #undef UNEXEC #define UNEXEC unexsol.o diff -r e56f669f17ce -r fe07c47cf7a7 src/s/sol2-6.h --- a/src/s/sol2-6.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/sol2-6.h Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,7 @@ /* Definitions file for GNU Emacs running on Solaris 2.6. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -27,8 +27,6 @@ #define POSIX -#define LIBS_SYSTEM -lsocket -lnsl -lkstat - /* Prefer kstat over kvm in getloadavg.c, kstat doesn't require root. ghazi@caip.rutgers.edu, 7/21/97. Don't redefine if already defined (e.g., by config.h). */ @@ -38,19 +36,11 @@ /* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style XIM support. */ - #define INHIBIT_X11R6_XIM -/* Must use the system's termcap, if we use any termcap. - It does special things. */ - -#ifndef TERMINFO -#define LIBS_TERMCAP -ltermcap -#endif - /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock - rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't - work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x + rather than sighold/sigrelse, which appear to be BSD4.1 specific. + It may also be appropriate for SVR4.x (x<2) but I'm not sure. fnf@cygnus.com */ /* This sets the name of the slave side of the PTY. On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() from @@ -73,35 +63,6 @@ pty_name[sizeof (pty_name) - 1] = 0; \ } -/* `#ifdef USE_MOTIF' won't work here, since USE_MOTIF isn't defined yet. - Instead, dynamically check whether USE_MOTIF expands to something. */ -#define NOT_USING_MOTIF { set x USE_MOTIF; test "$$2" = "USE_MOTIF"; } - -#ifndef __GNUC__ -#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib LD_SWITCH_X_SITE_AUX \ - `NOT_USING_MOTIF || echo ' -R/usr/dt/lib'` -#else /* GCC */ -/* We use ./prefix-args because we don't know whether LD_SWITCH_X_SITE_AUX - has anything in it. It can be empty. - This works ok in temacs. */ -#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib \ - `./prefix-args -Xlinker LD_SWITCH_X_SITE_AUX` \ - `NOT_USING_MOTIF || echo ' -R/usr/dt/lib -L/usr/dt/lib'` - -/* Get rid of -traditional and let const really do its thing. */ -#undef C_SWITCH_SYSTEM -#undef const -#endif /* GCC */ - -/* Gregory Neil Shapiro reports the Motif header files - are in this directory on Solaris 2.4. */ -#define C_SWITCH_X_SYSTEM -I/usr/dt/include - -/* -lgen is needed for the regex and regcmp functions - which are used by Motif. In the future we can try changing - regex.c to provide them in Emacs, but this is safer for now. */ -#define LIB_MOTIF -lXm -lgen - /* This is the only known way to avoid some crashes that seem to relate to screwed up malloc data after deleting a frame. */ diff -r e56f669f17ce -r fe07c47cf7a7 src/s/template.h --- a/src/s/template.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/template.h Thu May 13 15:13:52 2010 +0200 @@ -1,8 +1,9 @@ /* Template for system description header files. This file describes the parameters that system description files should define or not. - Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -20,10 +21,8 @@ along with GNU Emacs. If not, see . */ -/* - * Define symbols to identify the version of Unix this is. - * Define all the symbols that apply correctly. - */ +/* Define symbols to identify the version of Unix this is. + Define all the symbols that apply correctly. */ /* #define USG5 */ /* #define USG */ @@ -33,16 +32,10 @@ /* #define BSD_SYSTEM */ /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "berkeley-unix" -/* NOMULTIPLEJOBS should be defined if your system's shell - does not have "job control" (the ability to stop a program, - run some other program, then continue the first one). */ - -/* #define NOMULTIPLEJOBS */ - /* Emacs can read input using SIGIO and buffering characters itself, or using CBREAK mode and making C-g cause SIGINT. The choice is controlled by the variable interrupt_input. @@ -63,62 +56,46 @@ Another method of doing input is planned but not implemented. It would have Emacs fork off a separate process to read the input and send it to the true Emacs process - through a pipe. */ - + through a pipe. */ #define INTERRUPT_INPUT /* Letter to use in finding device name of first pty, - if system supports pty's. 'a' means it is /dev/ptya0 */ - + if system supports pty's. 'a' means it is /dev/ptya0. */ #define FIRST_PTY_LETTER 'a' -/* - * Define HAVE_TERMIOS if the system provides POSIX-style - * functions and macros for terminal control. - * - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - * - * Do not define both. HAVE_TERMIOS is preferred, if it is - * supported on your system. - */ +/* Define HAVE_TERMIOS if the system provides POSIX-style + functions and macros for terminal control. + + Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. + + Do not define both. HAVE_TERMIOS is preferred, if it is + supported on your system. */ #define HAVE_TERMIOS /* #define HAVE_TERMIO */ -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS -/* Define this symbol if your system has the functions bcopy, etc. */ - +/* Define this symbol if your system has the functions bcopy, etc. */ #define BSTRING /* subprocesses should be undefined if you do NOT want to have code for asynchronous subprocesses (as used in M-x compile and M-x shell). - Currently only MSDOS does not support this. */ + Currently only MSDOS does not support this. */ /* #undef subprocesses */ /* If your system uses COFF (Common Object File Format) then define the - preprocessor symbol "COFF". */ + preprocessor symbol "COFF". */ /* #define COFF */ -/* define MAIL_USE_FLOCK if the mailer uses flock - to interlock access to /usr/spool/mail/$USER. - The alternative is that a lock file named - /usr/spool/mail/$USER.lock. */ - -#define MAIL_USE_FLOCK - /* 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. */ - #define CLASH_DETECTION /* Define this if your operating system declares signal handlers to @@ -139,12 +116,11 @@ /* ============================================================ */ -/* Here, add any special hacks needed - to make Emacs work on this system. For example, - you might define certain system call names that don't - exist on your system, or that do different things on - your system and must be used only through an encapsulation - (Which you should place, by convention, in sysdep.c). */ +/* Here, add any special hacks needed to make Emacs work on this + system. For example, you might define certain system call names + that don't exist on your system, or that do different things on + your system and must be used only through an encapsulation (which + you should place, by convention, in sysdep.c). */ /* If the system's imake configuration file defines `NeedWidePrototypes' as `NO', we must define NARROWPROTO manually. Such a define is diff -r e56f669f17ce -r fe07c47cf7a7 src/s/unixware.h --- a/src/s/unixware.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/unixware.h Thu May 13 15:13:52 2010 +0200 @@ -1,7 +1,7 @@ /* s/ file for Unixware. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -28,18 +28,14 @@ #undef HAVE_SYSV_SIGPAUSE -/* Motif needs -lgen. */ -#define LIBS_SYSTEM -lsocket -lnsl -lelf -lgen - /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock - rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't - work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x + rather than sighold/sigrelse, which appear to be BSD4.1 specific. + It may also be appropriate for SVR4.x (x<2) but I'm not sure. fnf@cygnus.com */ /* This sets the name of the slave side of the PTY. On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() from intercepting that death. If any child but grantpt's should die - within, it should be caught after sigrelse(2). */ - + within, it should be caught after sigrelse(2). */ #define PTY_TTY_NAME_SPRINTF \ { \ char *ptsname(), *ptyname; \ @@ -56,15 +52,13 @@ pty_name[sizeof(pty_name) - 1] = 0; \ } -/* Use libw.a along with X11R6 Xt. */ -#define NEED_LIBW +/* Data type of load average, as read out of kmem. */ +#define LOAD_AVE_TYPE long -/* ryanr@ellingtn.ftc.nrcs.usda.gov (Richard Anthony Ryan) says -lXimp - is needed in UNIX_SV ... 4.2 1.1.2. */ -#define LIB_MOTIF -lXm -lXimp - -/* arch-tag: 9bbfcfc1-19be-45a1-9699-af57b87da2c6 - (do not change this comment) */ +/* Convert that into an integer that is 100 for a load average of 1.0 */ +/* This is totally uncalibrated. */ +#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE)) +#define FSCALE 256.0 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base) diff -r e56f669f17ce -r fe07c47cf7a7 src/s/usg5-4.h --- a/src/s/usg5-4.h Wed May 12 14:32:06 2010 +0200 +++ b/src/s/usg5-4.h Thu May 13 15:13:52 2010 +0200 @@ -1,6 +1,10 @@ /* Definitions file for GNU Emacs running on AT&T's System V Release 4 - Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Written by James Van Artsdalen of Dell Computer Corp. james@bigtex.cactus.org. +Subsequently improved for Dell 2.2 by Eric S. Raymond . This file is part of GNU Emacs. @@ -17,61 +21,36 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* This file written by James Van Artsdalen of Dell Computer Corporation. - * james@bigtex.cactus.org. Subsequently improved for Dell 2.2 by Eric - * S. Raymond . - */ - -/* Use the SysVr3 file for at least base configuration. */ - +/* Use the SysVr3 file for at least base configuration. */ #define USG /* System III, System V, etc */ #define USG5 #define USG5_4 /* SYSTEM_TYPE should indicate the kind of system you are using. - It sets the Lisp variable system-type. */ - + It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "usg-unix-v" -/* - * Define HAVE_TERMIO if the system provides sysV-style ioctls - * for terminal control. - */ - +/* Define HAVE_TERMIO if the system provides sysV-style ioctls + for terminal control. */ #define HAVE_TERMIO -/* - * Define HAVE_PTYS if the system supports pty devices. - */ - -/* - * Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir - * library functions. Almost, but not quite the same as - * the 4.2 functions - */ +/* Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir library + functions. Almost, but not quite the same as the 4.2 functions. */ #define SYSV_SYSTEM_DIR /* The file containing the kernel's symbol table is called /unix. */ - #define KERNEL_FILE "/unix" -/* The symbol in the kernel where the load average is found - is named avenrun. */ - +/* The kernel symbol where the load average is found is named avenrun. */ #define LDAV_SYMBOL "avenrun" -/* Special hacks needed to make Emacs run on this system. */ - -#define POSIX_SIGNALS - /* setjmp and longjmp can safely replace _setjmp and _longjmp, but they will run slower. */ - #define _setjmp setjmp #define _longjmp longjmp -/* On USG systems these have different names */ +/* On USG systems these have different names. */ #ifndef HAVE_INDEX #define index strchr #endif /* ! defined (HAVE_INDEX) */ @@ -79,41 +58,27 @@ #define rindex strrchr #endif /* ! defined (HAVE_RINDEX) */ -/* Use terminfo instead of termcap. */ - -#define TERMINFO - - -/* The docs for system V/386 suggest v.3 has sigpause, - so let's give it a try. */ +/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ #define HAVE_SYSV_SIGPAUSE - -/* If we're using the System V X port, BSD bstring functions will be handy */ - +/* If we're using the System V X port, BSD bstring functions will be handy. */ #ifdef HAVE_X_WINDOWS #define BSTRING #endif /* HAVE_X_WINDOWS */ -/* On USG systems signal handlers return void */ - +/* On USG systems signal handlers return void. */ #define SIGTYPE void #define ORDINARY_LINK -#define LIB_STANDARD - -/* Undump with ELF */ - +/* Undump with ELF. */ #undef COFF #define UNEXEC unexelf.o -/* Get FIONREAD from . Get to get struct - * tchars. But get first to make sure ttold.h doesn't - * interfere. And don't try to use SIGIO yet. - */ - +/* Get FIONREAD from . Get to get struct tchars. + But get first to make sure ttold.h doesn't interfere. + And don't try to use SIGIO yet. */ #ifndef NOT_C_CODE #include #endif @@ -130,15 +95,14 @@ #endif /* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments; - * instead, there's a system variable _sys_nsig. Unfortunately, we need the - * constant to dimension an array. So wire in the appropriate value here. - */ + instead, there's a system variable _sys_nsig. Unfortunately, we need the + constant to dimension an array. So wire in the appropriate value here. */ #define NSIG_MINIMUM 32 -/* We can support this */ - +/* We can support this. */ #define CLASH_DETECTION +/* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS #define HAVE_TERMIOS @@ -146,7 +110,6 @@ waiting, because a previous waitsys(2) cleaned up the carcass of child without clearing the SIGCHLD pending info. So, use a non-blocking wait3 instead, which maps to waitpid(2) in SysVr4. */ - #define wait3(status, options, rusage) \ waitpid ((pid_t) -1, (status), (options)) #define WRETCODE(w) (w >> 8) @@ -154,20 +117,16 @@ /* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and this is all we need. */ - #define TIOCSIGSEND TIOCSIGNAL /* This change means that we don't loop through allocate_pty too many - times in the (rare) event of a failure. */ - + times in the (rare) event of a failure. */ #define FIRST_PTY_LETTER 'z' -/* This sets the name of the master side of the PTY. */ - +/* This sets the name of the master side of the PTY. */ #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx"); -/* Push various streams modules onto a PTY channel. */ - +/* Push various streams modules onto a PTY channel. */ #define SETUP_SLAVE_PTY \ if (ioctl (xforkin, I_PUSH, "ptem") == -1) \ fatal ("ioctl I_PUSH ptem", errno); \ @@ -176,8 +135,7 @@ if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \ fatal ("ioctl I_PUSH ttcompat", errno); -/* This definition was suggested for next release. - So give it a try. */ +/* This definition was suggested for next release. So give it a try. */ #define HAVE_SOCKETS /* arch-tag: 1a0ed909-5faa-434b-b7c3-9d86c63d53a6 diff -r e56f669f17ce -r fe07c47cf7a7 src/syntax.c --- a/src/syntax.c Wed May 12 14:32:06 2010 +0200 +++ b/src/syntax.c Thu May 13 15:13:52 2010 +0200 @@ -858,7 +858,7 @@ Lisp_Object character; { int char_int; - CHECK_NUMBER (character); + CHECK_CHARACTER (character); char_int = XINT (character); SETUP_BUFFER_SYNTAX_TABLE (); return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); diff -r e56f669f17ce -r fe07c47cf7a7 src/sysdep.c --- a/src/sysdep.c Wed May 12 14:32:06 2010 +0200 +++ b/src/sysdep.c Thu May 13 15:13:52 2010 +0200 @@ -73,7 +73,7 @@ #include #ifdef HAVE_SETPGID -#if !defined (USG) || defined (BSD_PGRPS) +#if !defined (USG) #undef setpgrp #define setpgrp setpgid #endif @@ -419,7 +419,10 @@ else sigpause (SIGEMPTYMASK); #else /* not BSD_SYSTEM, and not HPUX version >= 6 */ -#ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */ +#ifdef WINDOWSNT + wait (0); + break; +#else /* not WINDOWSNT */ sigblock (sigmask (SIGCHLD)); errno = 0; if (kill (pid, 0) == -1 && errno == ESRCH) @@ -429,29 +432,7 @@ } sigsuspend (&empty_mask); -#else /* not POSIX_SIGNALS */ -#ifdef HAVE_SYSV_SIGPAUSE - sighold (SIGCHLD); - if (0 > kill (pid, 0)) - { - sigrelse (SIGCHLD); - break; - } - sigpause (SIGCHLD); -#else /* not HAVE_SYSV_SIGPAUSE */ -#ifdef WINDOWSNT - wait (0); - break; -#else /* not WINDOWSNT */ - if (0 > kill (pid, 0)) - break; - /* Using sleep instead of pause avoids timing error. - If the inferior dies just before the sleep, - we lose just one second. */ - sleep (1); #endif /* not WINDOWSNT */ -#endif /* not HAVE_SYSV_SIGPAUSE */ -#endif /* not POSIX_SIGNALS */ #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ #else /* not subprocesses */ break; @@ -546,11 +527,6 @@ #endif /* not SIGNALS_VIA_CHARACTERS */ #ifdef AIX -/* AIX enhanced edit loses NULs, so disable it */ -#ifndef IBMR2AIX - s.main.c_line = 0; - s.main.c_iflag &= ~ASCEDIT; -#endif /* Also, PTY overloads NUL and BREAK. don't ignore break, but don't signal either, so it looks like NUL. */ s.main.c_iflag &= ~IGNBRK; @@ -883,65 +859,7 @@ #endif /* FASYNC */ #endif /* F_SETFL */ #endif /* SIGIO */ - -/* Saving and restoring the process group of Emacs's terminal. */ - -#ifdef BSD_PGRPS - -/* The process group of which Emacs was a member when it initially - started. - - If Emacs was in its own process group (i.e. inherited_pgroup == - getpid ()), then we know we're running under a shell with job - control (Emacs would never be run as part of a pipeline). - Everything is fine. - - If Emacs was not in its own process group, then we know we're - running under a shell (or a caller) that doesn't know how to - separate itself from Emacs (like sh). Emacs must be in its own - process group in order to receive SIGIO correctly. In this - situation, we put ourselves in our own pgroup, forcibly set the - tty's pgroup to our pgroup, and make sure to restore and reinstate - the tty's pgroup just like any other terminal setting. If - inherited_group was not the tty's pgroup, then we'll get a - SIGTTmumble when we try to change the tty's pgroup, and a CONT if - it goes foreground in the future, which is what should happen. - - This variable is initialized in emacs.c. */ -int inherited_pgroup; - -/* Split off the foreground process group to Emacs alone. When we are - in the foreground, but not started in our own process group, - redirect the tty device handle FD to point to our own process - group. We need to be in our own process group to receive SIGIO - properly. */ -static void -narrow_foreground_group (int fd) -{ - int me = getpid (); - - setpgrp (0, inherited_pgroup); -#if 0 - /* XXX inherited_pgroup should not be zero here, but GTK seems to - mess this up. */ - if (! inherited_pgroup) - abort (); /* Should not happen. */ -#endif - if (inherited_pgroup != me) - EMACS_SET_TTY_PGRP (fd, &me); /* XXX This only works on the controlling tty. */ - setpgrp (0, me); -} - -/* Set the tty to our original foreground group. */ -static void -widen_foreground_group (int fd) -{ - if (inherited_pgroup != getpid ()) - EMACS_SET_TTY_PGRP (fd, &inherited_pgroup); - setpgrp (0, inherited_pgroup); -} - -#endif /* BSD_PGRPS */ + /* Getting and setting emacs_tty structures. */ @@ -1126,15 +1044,6 @@ if (!tty_out->output) return; /* The tty is suspended. */ -#ifdef BSD_PGRPS -#if 0 - /* read_socket_hook is not global anymore. I think doing this - unconditionally will not cause any problems. */ - if (! read_socket_hook && EQ (Vinitial_window_system, Qnil)) -#endif - narrow_foreground_group (fileno (tty_out->input)); -#endif - if (! tty_out->old_tty) tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); @@ -1258,16 +1167,10 @@ #endif /* mips or HAVE_TCATTR */ #ifdef AIX -#ifndef IBMR2AIX - /* AIX enhanced edit loses NULs, so disable it. */ - tty.main.c_line = 0; - tty.main.c_iflag &= ~ASCEDIT; -#else tty.main.c_cc[VSTRT] = CDISABLE; tty.main.c_cc[VSTOP] = CDISABLE; tty.main.c_cc[VSUSP] = CDISABLE; tty.main.c_cc[VDSUSP] = CDISABLE; -#endif /* IBMR2AIX */ if (tty_out->flow_control) { #ifdef VSTART @@ -1590,9 +1493,6 @@ dos_ttcooked (); #endif -#ifdef BSD_PGRPS - widen_foreground_group (fileno (tty_out->input)); -#endif } #ifdef HAVE_PTYS @@ -2101,10 +2001,10 @@ /* POSIX signals support - DJB */ /* Anyone with POSIX signals should have ANSI C declarations */ -#ifdef POSIX_SIGNALS - sigset_t empty_mask, full_mask; +#ifndef WINDOWSNT + signal_handler_t sys_signal (int signal_number, signal_handler_t action) { @@ -2133,6 +2033,8 @@ return (old_action.sa_handler); } +#endif /* WINDOWSNT */ + #ifndef __GNUC__ /* If we're compiling with GCC, we don't need this function, since it can be written as a macro. */ @@ -2175,7 +2077,6 @@ return (old_mask); } -#endif /* POSIX_SIGNALS */ #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST static char *my_sys_siglist[NSIG]; @@ -2188,10 +2089,8 @@ void init_signals () { -#ifdef POSIX_SIGNALS sigemptyset (&empty_mask); sigfillset (&full_mask); -#endif #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST if (! initialized) @@ -2709,13 +2608,6 @@ int rtnval; rtnval = emacs_close (dirp->dd_fd); - - /* Some systems (like Solaris) allocate the buffer and the DIR all - in one block. Why in the world are we freeing this ourselves - anyway? */ -#if ! defined (SOLARIS2) - xfree ((char *) dirp->dd_buf); /* directory block defined in */ -#endif xfree ((char *) dirp); return rtnval; diff -r e56f669f17ce -r fe07c47cf7a7 src/syssignal.h --- a/src/syssignal.h Wed May 12 14:32:06 2010 +0200 +++ b/src/syssignal.h Thu May 13 15:13:52 2010 +0200 @@ -30,8 +30,6 @@ extern pthread_t main_thread; #endif -#ifdef POSIX_SIGNALS - /* Don't #include . That header should always be #included before "config.h", because some configuration files (like s/hpux.h) indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file @@ -87,15 +85,6 @@ #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) -#else /* ! defined (POSIX_SIGNALS) */ - -#ifndef sigunblock -#define sigunblock(SIG) \ -{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } -#endif - -#endif /* ! defined (POSIX_SIGNALS) */ - #ifndef SIGMASKTYPE #define SIGMASKTYPE int #endif diff -r e56f669f17ce -r fe07c47cf7a7 src/systty.h --- a/src/systty.h Wed May 12 14:32:06 2010 +0200 +++ b/src/systty.h Thu May 13 15:13:52 2010 +0200 @@ -51,11 +51,8 @@ #include #endif -#ifdef NEED_BSDTTY +#ifdef HPUX #include -#endif - -#if defined (HPUX) && defined (HAVE_PTYS) #include #endif @@ -63,7 +60,7 @@ #include #endif /* AIX */ -#if (defined (POSIX) || defined (NEED_UNISTD_H)) && defined (HAVE_UNISTD_H) +#ifdef HAVE_UNISTD_H #include #endif diff -r e56f669f17ce -r fe07c47cf7a7 src/term.c --- a/src/term.c Wed May 12 14:32:06 2010 +0200 +++ b/src/term.c Thu May 13 15:13:52 2010 +0200 @@ -1589,7 +1589,6 @@ } } - /* Produce glyphs for the display element described by IT. *IT specifies what we want to produce a glyph for (character, image, ...), and where in the glyph matrix we currently are (glyph row and hpos). @@ -1808,6 +1807,17 @@ glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; if (glyph < it->glyph_row->glyphs[1 + it->area]) { + /* If the glyph row is reversed, we need to prepend the glyph + rather than append it. */ + if (it->glyph_row->reversed_p && it->area == TEXT_AREA) + { + struct glyph *g; + + /* Make room for the new glyph. */ + for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--) + g[1] = *g; + glyph = it->glyph_row->glyphs[it->area]; + } glyph->type = COMPOSITE_GLYPH; glyph->pixel_width = it->pixel_width; glyph->u.cmp.id = it->cmp_it.id; @@ -1828,6 +1838,18 @@ glyph->padding_p = 0; glyph->charpos = CHARPOS (it->position); glyph->object = it->object; + if (it->bidi_p) + { + glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); + glyph->bidi_type = it->bidi_it.type; + } + else + { + glyph->resolved_level = 0; + glyph->bidi_type = UNKNOWN_BT; + } ++it->glyph_row->used[it->area]; ++glyph; @@ -1889,12 +1911,16 @@ if (what == IT_CONTINUATION) { - /* Continuation glyph. */ - SET_GLYPH_FROM_CHAR (glyph, '\\'); + /* Continuation glyph. For R2L lines, we mirror it by hand. */ + if (it->bidi_it.paragraph_dir == R2L) + SET_GLYPH_FROM_CHAR (glyph, '/'); + else + SET_GLYPH_FROM_CHAR (glyph, '\\'); if (it->dp && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)) && GLYPH_CODE_CHAR_VALID_P (gc)) { + /* FIXME: Should we mirror GC for R2L lines? */ SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); spec_glyph_lookup_face (XWINDOW (it->window), &glyph); } @@ -1907,6 +1933,7 @@ && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)) && GLYPH_CODE_CHAR_VALID_P (gc)) { + /* FIXME: Should we mirror GC for R2L lines? */ SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); spec_glyph_lookup_face (XWINDOW (it->window), &glyph); } @@ -2244,7 +2271,7 @@ struct tty_display_info *tty; struct frame *f; { - Lisp_Object tem, val, color_mode_spec; + Lisp_Object tem, val; Lisp_Object color_mode; int mode; extern Lisp_Object Qtty_color_mode; @@ -2256,12 +2283,13 @@ if (INTEGERP (val)) color_mode = val; - else + else if (SYMBOLP (tty_color_mode_alist)) { - tem = (NILP (tty_color_mode_alist) ? Qnil - : Fassq (val, XSYMBOL (tty_color_mode_alist)->value)); + tem = Fassq (val, Fsymbol_value (tty_color_mode_alist)); color_mode = CONSP (tem) ? XCDR (tem) : Qnil; } + else + color_mode = Qnil; mode = INTEGERP (color_mode) ? XINT (color_mode) : 0; @@ -3351,7 +3379,7 @@ EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ if (pgid != -1) { -#if defined (USG) && !defined (BSD_PGRPS) +#if defined (USG) setpgrp (); no_controlling_tty = 1; #elif defined (CYGWIN) diff -r e56f669f17ce -r fe07c47cf7a7 src/w16select.c --- a/src/w16select.c Wed May 12 14:32:06 2010 +0200 +++ b/src/w16select.c Thu May 13 15:13:52 2010 +0200 @@ -685,8 +685,8 @@ into the clipboard if we run under Windows, so we cannot check the clipboard alone.) */ if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY)) - && ! NILP (SYMBOL_VALUE (Fintern_soft (build_string ("kill-ring"), - Qnil)))) + && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"), + Qnil)))) return Qt; if (EQ (selection, QCLIPBOARD)) diff -r e56f669f17ce -r fe07c47cf7a7 src/w32.c --- a/src/w32.c Wed May 12 14:32:06 2010 +0200 +++ b/src/w32.c Thu May 13 15:13:52 2010 +0200 @@ -1482,6 +1482,30 @@ } int +sigemptyset (sigset_t *set) +{ + return 0; +} + +int +sigaddset (sigset_t *set, int signo) +{ + return 0; +} + +int +sigfillset (sigset_t *set) +{ + return 0; +} + +int +sigprocmask (int how, const sigset_t *set, sigset_t *oset) +{ + return 0; +} + +int setpgrp (int pid, int gid) { return 0; diff -r e56f669f17ce -r fe07c47cf7a7 src/w32console.c --- a/src/w32console.c Wed May 12 14:32:06 2010 +0200 +++ b/src/w32console.c Thu May 13 15:13:52 2010 +0200 @@ -488,6 +488,62 @@ } /*********************************************************************** + stubs from termcap.c + ***********************************************************************/ + +void +sys_tputs (char *str, int nlines, int (*outfun)()) +{ +} + +char * +sys_tgetstr (char *cap, char **area) +{ + return NULL; +} + + +/*********************************************************************** + stubs from cm.c + ***********************************************************************/ + +struct tty_display_info *current_tty = NULL; +int cost = 0; + +int +evalcost (char c) +{ + return c; +} + +int +cmputc (char c) +{ + return c; +} + +void +cmcheckmagic (struct tty_display_info *tty) +{ +} + +void +cmcostinit (struct tty_display_info *tty) +{ +} + +void +cmgoto (struct tty_display_info *tty, int row, int col) +{ +} + +void +Wcm_clear (struct tty_display_info *tty) +{ +} + + +/*********************************************************************** Faces ***********************************************************************/ diff -r e56f669f17ce -r fe07c47cf7a7 src/w32fns.c --- a/src/w32fns.c Wed May 12 14:32:06 2010 +0200 +++ b/src/w32fns.c Thu May 13 15:13:52 2010 +0200 @@ -47,6 +47,7 @@ #include "systime.h" #include "termhooks.h" #include "w32heap.h" +#include "w32.h" #include "bitmaps/gray.xbm" @@ -6333,6 +6334,7 @@ Lisp_Object operation, document, parameters, show_flag; { Lisp_Object current_dir; + char *errstr; CHECK_STRING (document); @@ -6353,7 +6355,17 @@ XINT (show_flag) : SW_SHOWDEFAULT)) > 32) return Qt; - error ("ShellExecute failed: %s", w32_strerror (0)); + errstr = w32_strerror (0); + /* The error string might be encoded in the locale's encoding. */ + if (!NILP (Vlocale_coding_system)) + { + Lisp_Object decoded = + code_convert_string_norecord (make_unibyte_string (errstr, + strlen (errstr)), + Vlocale_coding_system, 0); + errstr = (char *)SDATA (decoded); + } + error ("ShellExecute failed: %s", errstr); } /* Lookup virtual keycode from string representing the name of a diff -r e56f669f17ce -r fe07c47cf7a7 src/w32term.c --- a/src/w32term.c Wed May 12 14:32:06 2010 +0200 +++ b/src/w32term.c Thu May 13 15:13:52 2010 +0200 @@ -5136,10 +5136,12 @@ } if (glyph_row->exact_window_width_line_p - && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) + && (glyph_row->reversed_p + ? (w->phys_cursor.hpos < 0) + : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]))) { glyph_row->cursor_in_fringe_p = 1; - draw_fringe_bitmap (w, glyph_row, 0); + draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p); return; } diff -r e56f669f17ce -r fe07c47cf7a7 src/window.c --- a/src/window.c Wed May 12 14:32:06 2010 +0200 +++ b/src/window.c Thu May 13 15:13:52 2010 +0200 @@ -54,7 +54,7 @@ Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; Lisp_Object Qdisplay_buffer; -Lisp_Object Qscroll_up, Qscroll_down; +Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; Lisp_Object Qwindow_size_fixed; extern Lisp_Object Qleft_margin, Qright_margin; @@ -168,10 +168,6 @@ Lisp_Object Vscroll_preserve_screen_position; -/* List of commands affected by `Vscroll_preserve_screen_position'. */ - -Lisp_Object Vscroll_preserve_screen_position_commands; - /* Non-nil means that text is inserted before window's markers. */ Lisp_Object Vwindow_point_insertion_type; @@ -4946,12 +4942,13 @@ if (!NILP (Vscroll_preserve_screen_position)) { /* We preserve the goal pixel coordinate across consecutive - calls to scroll-up or scroll-down. This avoids the + calls to scroll-up, scroll-down and other commands that + have the `scroll-command' property. This avoids the possibility of point becoming "stuck" on a tall line when scrolling by one line. */ if (window_scroll_pixel_based_preserve_y < 0 - || NILP (Fmemq (current_kboard->Vlast_command, - Vscroll_preserve_screen_position_commands))) + || !SYMBOLP (current_kboard->Vlast_command) + || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) { start_display (&it, w, start); move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); @@ -5211,8 +5208,8 @@ if (!NILP (Vscroll_preserve_screen_position)) { if (window_scroll_preserve_vpos <= 0 - || NILP (Fmemq (current_kboard->Vlast_command, - Vscroll_preserve_screen_position_commands))) + || !SYMBOLP (current_kboard->Vlast_command) + || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) { struct position posit = *compute_motion (startpos, 0, 0, 0, @@ -7180,6 +7177,12 @@ Qscroll_down = intern_c_string ("scroll-down"); staticpro (&Qscroll_down); + Qscroll_command = intern_c_string ("scroll-command"); + staticpro (&Qscroll_command); + + Fput (Qscroll_up, Qscroll_command, Qt); + Fput (Qscroll_down, Qscroll_command, Qt); + Qwindow_size_fixed = intern_c_string ("window-size-fixed"); staticpro (&Qwindow_size_fixed); Fset (Qwindow_size_fixed, Qnil); @@ -7270,18 +7273,10 @@ command moved it vertically out of the window, e.g. when scrolling by full screens. Any other value means point always keeps its screen position. -Scroll commands are defined by the variable -`scroll-preserve-screen-position-commands'. */); +Scroll commands should have the `scroll-command' property +on their symbols to be controlled by this variable. */); Vscroll_preserve_screen_position = Qnil; - DEFVAR_LISP ("scroll-preserve-screen-position-commands", - &Vscroll_preserve_screen_position_commands, - doc: /* A list of commands whose scrolling should keep screen position unchanged. -This list defines the names of scroll commands affected by the variable -`scroll-preserve-screen-position'. */); - Vscroll_preserve_screen_position_commands = - Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil)); - DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, doc: /* Type of marker to use for `window-point'. */); Vwindow_point_insertion_type = Qnil; diff -r e56f669f17ce -r fe07c47cf7a7 src/xdisp.c --- a/src/xdisp.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xdisp.c Thu May 13 15:13:52 2010 +0200 @@ -80,7 +80,39 @@ You will find a lot of redisplay optimizations when you start looking at the innards of redisplay. The overall goal of all these optimizations is to make redisplay fast because it is done - frequently. + frequently. Some of these optimizations are implemented by the + following functions: + + . try_cursor_movement + + This function tries to update the display if the text in the + window did not change and did not scroll, only point moved, and + it did not move off the displayed portion of the text. + + . try_window_reusing_current_matrix + + This function reuses the current matrix of a window when text + has not changed, but the window start changed (e.g., due to + scrolling). + + . try_window_id + + This function attempts to redisplay a window by reusing parts of + its existing display. It finds and reuses the part that was not + changed, and redraws the rest. + + . try_window + + This function performs the full redisplay of a single window + assuming that its fonts were not changed and that the cursor + will not end up in the scroll margins. (Loading fonts requires + re-adjustment of dimensions of glyph matrices, which makes this + method impossible to use.) + + These optimizations are tried in sequence (some can be skipped if + it is known that they are not applicable). If none of the + optimizations were successful, redisplay calls redisplay_windows, + which performs a full redisplay of all windows. Desired matrices. @@ -112,13 +144,16 @@ see in dispextern.h. Glyphs in a desired matrix are normally constructed in a loop - calling get_next_display_element and then produce_glyphs. The call - to produce_glyphs will fill the iterator structure with pixel + calling get_next_display_element and then PRODUCE_GLYPHS. The call + to PRODUCE_GLYPHS will fill the iterator structure with pixel information about the element being displayed and at the same time produce glyphs for it. If the display element fits on the line being displayed, set_iterator_to_next is called next, otherwise the - glyphs produced are discarded. - + glyphs produced are discarded. The function display_line is the + workhorse of filling glyph rows in the desired matrix with glyphs. + In addition to producing glyphs, it also handles line truncation + and continuation, word wrap, and cursor positioning (for the + latter, see also set_cursor_from_row). Frame matrices. @@ -139,7 +174,50 @@ wanted to have without having to move many bytes around. To be honest, there is a little bit more done, but not much more. If you plan to extend that code, take a look at dispnew.c. The function - build_frame_matrix is a good starting point. */ + build_frame_matrix is a good starting point. + + Bidirectional display. + + Bidirectional display adds quite some hair to this already complex + design. The good news are that a large portion of that hairy stuff + is hidden in bidi.c behind only 3 interfaces. bidi.c implements a + 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 + 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 + buffer/string is replaced with a non-linear one. All the rest of + the redisplay is oblivious to the bidi reordering. + + Well, almost oblivious---there are still complications, most of + them due to the fact that buffer and string positions no longer + change monotonously with glyph indices in a glyph row. Moreover, + for continued lines, the buffer positions may not even be + monotonously changing with vertical positions. Also, accounting + for face changes, overlays, etc. becomes more complex because + non-linear iteration could potentially skip many positions with + changes, and then cross them again on the way back... + + One other prominent effect of bidirectional display is that some + paragraphs of text need to be displayed starting at the right + margin of the window---the so-called right-to-left, or R2L + paragraphs. R2L paragraphs are displayed with R2L glyph rows, + which have their reversed_p flag set. The bidi reordering engine + produces characters in such rows starting from the character which + should be the rightmost on display. PRODUCE_GLYPHS then reverses + the order, when it fills up the glyph row whose reversed_p flag is + set, by prepending each new glyph to what is already there, instead + of appending it. When the glyph row is complete, the function + extend_face_to_end_of_line fills the empty space to the left of the + leftmost character with special glyphs, which will display as, + well, empty. On text terminals, these special glyphs are simply + blank characters. On graphics terminals, there's a single stretch + glyph with suitably computed width. Both the blanks and the + stretch glyph are given the face of the background of the line. + This way, the terminal-specific back-end can still draw the glyphs + left to right, even for R2L lines. */ #include #include @@ -279,6 +357,14 @@ Lisp_Object Vauto_resize_tool_bars; +/* Type of tool bar. Can be symbols image, text, both or both-hroiz. */ + +Lisp_Object Vtool_bar_style; + +/* Maximum number of characters a label can have to be shown. */ + +EMACS_INT tool_bar_max_label_size; + /* Non-zero means draw block and hollow cursor as wide as the glyph under it. For example, if a block cursor is over a tab, it will be drawn as wide as that tab on the display. */ @@ -326,12 +412,14 @@ /* Test if overflow newline into fringe. Called with iterator IT at or past right window margin, and with IT->current_x set. */ -#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) \ - (!NILP (Voverflow_newline_into_fringe) \ - && FRAME_WINDOW_P (it->f) \ - && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ - && it->current_x == it->last_visible_x \ - && it->line_wrap != WORD_WRAP) +#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(IT) \ + (!NILP (Voverflow_newline_into_fringe) \ + && FRAME_WINDOW_P ((IT)->f) \ + && ((IT)->bidi_it.paragraph_dir == R2L \ + ? (WINDOW_LEFT_FRINGE_WIDTH ((IT)->w) > 0) \ + : (WINDOW_RIGHT_FRINGE_WIDTH ((IT)->w) > 0)) \ + && (IT)->current_x == (IT)->last_visible_x \ + && (IT)->line_wrap != WORD_WRAP) #else /* !HAVE_WINDOW_SYSTEM */ #define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0 @@ -362,7 +450,7 @@ Lisp_Object Qnobreak_space; /* The symbol `image' which is the car of the lists used to represent - images in Lisp. */ + images in Lisp. Also a tool bar style. */ Lisp_Object Qimage; @@ -370,6 +458,9 @@ Lisp_Object QCmap, QCpointer; Lisp_Object Qrect, Qcircle, Qpoly; +/* Tool bar styles */ +Lisp_Object Qtext, Qboth, Qboth_horiz; + /* Non-zero means print newline to stdout before next mini-buffer message. */ @@ -999,6 +1090,8 @@ static void notice_overwritten_cursor P_ ((struct window *, enum glyph_row_area, int, int, int, int)); +static void append_stretch_glyph P_ ((struct it *, Lisp_Object, + int, int, int)); @@ -2358,7 +2451,7 @@ specbind (Qinhibit_redisplay, Qt); /* Use Qt to ensure debugger does not run, so there is no possibility of wanting to redisplay. */ - val = internal_condition_case_2 (Ffuncall, nargs, args, Qt, + val = internal_condition_case_n (Ffuncall, nargs, args, Qt, safe_eval_handler); UNGCPRO; val = unbind_to (count, val); @@ -2605,8 +2698,12 @@ /* Are multibyte characters enabled in current_buffer? */ it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); - /* Do we need to reorder bidirectional text? */ - it->bidi_p = !NILP (current_buffer->bidi_display_reordering); + /* Do we need to reorder bidirectional text? Not if this is a + unibyte buffer: by definition, none of the single-byte characters + are strong R2L, so no reordering is needed. And bidi.c doesn't + support unibyte buffers anyway. */ + it->bidi_p + = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p; /* Non-zero if we should highlight the region. */ highlight_region_p @@ -5166,6 +5263,33 @@ ++it->sp; } +static void +iterate_out_of_display_property (it) + struct it *it; +{ + /* Maybe initialize paragraph direction. If we are at the beginning + of a new paragraph, next_element_from_buffer may not have a + chance to do that. */ + if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) + bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); + /* prev_stop can be zero, so check against BEGV as well. */ + 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); + /* Record the stop_pos we just crossed, for when we cross it + back, maybe. */ + if (it->bidi_it.charpos > CHARPOS (it->position)) + it->prev_stop = CHARPOS (it->position); + /* If we ended up not where pop_it put us, resync IT's + positional members with the bidi iterator. */ + if (it->bidi_it.charpos != CHARPOS (it->position)) + { + SET_TEXT_POS (it->position, + it->bidi_it.charpos, it->bidi_it.bytepos); + it->current.pos = it->position; + } +} /* Restore IT's settings from IT->stack. Called, for example, when no more overlay strings must be processed, and we return to delivering @@ -5206,6 +5330,18 @@ break; case GET_FROM_BUFFER: it->object = it->w->buffer; + if (it->bidi_p) + { + /* Bidi-iterate until we get out of the portion of text, if + any, covered by a `display' text property or an overlay + with `display' property. (We cannot just jump there, + because the internal coherency of the bidi iterator state + can not be preserved across such jumps.) We also must + determine the paragraph base direction if the overlay we + just processed is at the beginning of a new + paragraph. */ + iterate_out_of_display_property (it); + } break; case GET_FROM_STRING: it->object = it->string; @@ -6151,6 +6287,15 @@ { IT_CHARPOS (*it) += it->cmp_it.nchars; IT_BYTEPOS (*it) += it->cmp_it.nbytes; + if (it->bidi_p) + { + if (it->bidi_it.new_paragraph) + bidi_paragraph_init (it->paragraph_embedding, &it->bidi_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); + } if (it->cmp_it.to < it->cmp_it.nglyphs) it->cmp_it.from = it->cmp_it.to; else @@ -6631,13 +6776,20 @@ { it->bidi_it.charpos = IT_CHARPOS (*it); it->bidi_it.bytepos = IT_BYTEPOS (*it); - /* If we are at the beginning of a line, we can produce the next - element right away. */ - if (it->bidi_it.bytepos == BEGV_BYTE + if (it->bidi_it.bytepos == ZV_BYTE) + { + /* Nothing to do, but reset the FIRST_ELT flag, like + bidi_paragraph_init does, because we are not going to + call it. */ + it->bidi_it.first_elt = 0; + } + else if (it->bidi_it.bytepos == BEGV_BYTE /* FIXME: Should support all Unicode line separators. */ || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' || FETCH_CHAR (it->bidi_it.bytepos) == '\n') { + /* 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); } @@ -6865,6 +7017,15 @@ { IT_CHARPOS (*it) += it->cmp_it.nchars; IT_BYTEPOS (*it) += it->cmp_it.nbytes; + if (it->bidi_p) + { + if (it->bidi_it.new_paragraph) + bidi_paragraph_init (it->paragraph_embedding, &it->bidi_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); + } return 0; } it->position = it->current.pos; @@ -8472,7 +8633,6 @@ if (m) { int len; -#ifdef NO_ARG_ARRAY char *a[3]; a[0] = (char *) a1; a[1] = (char *) a2; @@ -8480,11 +8640,6 @@ len = doprnt (FRAME_MESSAGE_BUF (f), FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a); -#else - len = doprnt (FRAME_MESSAGE_BUF (f), - FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, - (char **) &a1); -#endif /* NO_ARG_ARRAY */ message2 (FRAME_MESSAGE_BUF (f), len, 0); } @@ -9837,7 +9992,8 @@ update_tool_bar (f, 0); #endif #ifdef HAVE_NS - if (windows_or_buffers_changed) + if (windows_or_buffers_changed + && FRAME_NS_P (f)) ns_set_doc_edited (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->buffer)); #endif @@ -11519,7 +11675,7 @@ select_frame_for_redisplay (frame) Lisp_Object frame; { - Lisp_Object tail, symbol, val; + Lisp_Object tail, tem; Lisp_Object old = selected_frame; struct Lisp_Symbol *sym; @@ -11527,20 +11683,18 @@ selected_frame = frame; - do - { - for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) - if (CONSP (XCAR (tail)) - && (symbol = XCAR (XCAR (tail)), - SYMBOLP (symbol)) - && (sym = indirect_variable (XSYMBOL (symbol)), - val = sym->value, - (BUFFER_LOCAL_VALUEP (val))) - && XBUFFER_LOCAL_VALUE (val)->check_frame) - /* Use find_symbol_value rather than Fsymbol_value - to avoid an error if it is void. */ - find_symbol_value (symbol); - } while (!EQ (frame, old) && (frame = old, 1)); + do { + for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) + if (CONSP (XCAR (tail)) + && (tem = XCAR (XCAR (tail)), + SYMBOLP (tem)) + && (sym = indirect_variable (XSYMBOL (tem)), + sym->redirect == SYMBOL_LOCALIZED) + && sym->val.blv->frame_local) + /* Use find_symbol_value rather than Fsymbol_value + to avoid an error if it is void. */ + find_symbol_value (tem); + } while (!EQ (frame, old) && (frame = old, 1)); } @@ -12548,7 +12702,6 @@ /* The last known character position in row. */ int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; int x = row->x; - int cursor_x = x; EMACS_INT pt_old = PT - delta; EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; @@ -12584,8 +12737,8 @@ } while (end > glyph && INTEGERP ((end - 1)->object) - /* CHARPOS is zero for blanks inserted by - extend_face_to_end_of_line. */ + /* CHARPOS is zero for blanks and stretch glyphs + inserted by extend_face_to_end_of_line. */ && (end - 1)->charpos <= 0) --end; glyph_before = glyph - 1; @@ -12599,9 +12752,6 @@ to front, so swap the edge pointers. */ glyphs_end = end = glyph - 1; glyph += row->used[TEXT_AREA] - 1; - /* Reverse the known positions in the row. */ - last_pos = pos_after = MATRIX_ROW_START_CHARPOS (row) + delta; - pos_before = MATRIX_ROW_END_CHARPOS (row) + delta; while (glyph > end + 1 && INTEGERP (glyph->object) @@ -12616,7 +12766,6 @@ rightmost (first in the reading order) glyph. */ for (g = end + 1; g < glyph; g++) x += g->pixel_width; - cursor_x = x; while (end < glyph && INTEGERP ((end + 1)->object) && (end + 1)->charpos <= 0) @@ -12631,7 +12780,14 @@ rightmost glyph. Case in point: an empty last line that is part of an R2L paragraph. */ cursor = end - 1; - x = -1; /* will be computed below, at lable compute_x */ + /* Avoid placing the cursor on the last glyph of the row, where + on terminal frames we hold the vertical border between + adjacent windows. */ + if (!FRAME_WINDOW_P (WINDOW_XFRAME (w)) + && !WINDOW_RIGHTMOST_P (w) + && cursor == row->glyphs[LAST_AREA] - 1) + cursor--; + x = -1; /* will be computed below, at label compute_x */ } /* Step 1: Try to find the glyph whose character position @@ -12767,8 +12923,11 @@ string_seen = 1; } --glyph; - if (glyph == end) - break; + if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */ + { + x--; /* can't use any pixel_width */ + break; + } x -= glyph->pixel_width; } @@ -12808,7 +12967,10 @@ } else if (match_with_avoid_cursor /* zero-width characters produce no glyphs */ - || eabs (glyph_after - glyph_before) == 1) + || ((row->reversed_p + ? glyph_after > glyphs_end + : glyph_after < glyphs_end) + && eabs (glyph_after - glyph_before) == 1)) { cursor = glyph_after; x = -1; @@ -12864,7 +13026,8 @@ cursor = glyph; for (glyph += incr; - EQ (glyph->object, str); + (row->reversed_p ? glyph > stop : glyph < stop) + && EQ (glyph->object, str); glyph += incr) { Lisp_Object cprop; @@ -12904,8 +13067,9 @@ /* If we reached the end of the line, and END was from a string, the cursor is not on this line. */ - if (glyph == end - && STRINGP ((glyph - incr)->object) + if (cursor == NULL + && (row->reversed_p ? glyph <= end : glyph >= end) + && STRINGP (end->object) && row->continued_p) return 0; } @@ -12927,11 +13091,17 @@ } } - /* ROW could be part of a continued line, which might have other - rows whose start and end charpos occlude point. Only set - w->cursor if we found a better approximation to the cursor - position than we have from previously examined rows. */ - if (w->cursor.vpos >= 0 + /* ROW could be part of a continued line, which, under bidi + reordering, might have other rows whose start and end charpos + occlude point. Only set w->cursor if we found a better + approximation to the cursor position than we have from previously + examined candidate rows belonging to the same continued line. */ + if (/* we already have a candidate row */ + w->cursor.vpos >= 0 + /* that candidate is not the row we are processing */ + && MATRIX_ROW (matrix, w->cursor.vpos) != row + /* the row we are processing is part of a continued line */ + && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row)) /* Make sure cursor.vpos specifies a row whose start and end charpos occlude point. This is because some callers of this function leave cursor.vpos at the row where the cursor was @@ -13557,11 +13727,14 @@ ++row; } - /* The end position of a row equals the start position - of the next row. If PT is there, we would rather - display it in the next line. */ + /* If the end position of a row equals the start + position of the next row, and PT is at that position, + we would rather display cursor in the next line. */ while (MATRIX_ROW_BOTTOM_Y (row) < last_y && MATRIX_ROW_END_CHARPOS (row) == PT + && row < w->current_matrix->rows + + w->current_matrix->nrows - 1 + && MATRIX_ROW_START_CHARPOS (row+1) == PT && !cursor_row_p (w, row)) ++row; @@ -16580,24 +16753,61 @@ produce_special_glyphs (&truncate_it, IT_TRUNCATION); /* Overwrite glyphs from IT with truncation glyphs. */ - from = truncate_it.glyph_row->glyphs[TEXT_AREA]; - end = from + truncate_it.glyph_row->used[TEXT_AREA]; - to = it->glyph_row->glyphs[TEXT_AREA]; - toend = to + it->glyph_row->used[TEXT_AREA]; - - while (from < end) - *to++ = *from++; - - /* There may be padding glyphs left over. Overwrite them too. */ - while (to < toend && CHAR_GLYPH_PADDING_P (*to)) + if (!it->glyph_row->reversed_p) { from = truncate_it.glyph_row->glyphs[TEXT_AREA]; + end = from + truncate_it.glyph_row->used[TEXT_AREA]; + to = it->glyph_row->glyphs[TEXT_AREA]; + toend = to + it->glyph_row->used[TEXT_AREA]; + while (from < end) *to++ = *from++; - } - - if (to > toend) - it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA]; + + /* There may be padding glyphs left over. Overwrite them too. */ + while (to < toend && CHAR_GLYPH_PADDING_P (*to)) + { + from = truncate_it.glyph_row->glyphs[TEXT_AREA]; + while (from < end) + *to++ = *from++; + } + + if (to > toend) + it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA]; + } + else + { + /* In R2L rows, overwrite the last (rightmost) glyphs, and do + that back to front. */ + end = truncate_it.glyph_row->glyphs[TEXT_AREA]; + from = end + truncate_it.glyph_row->used[TEXT_AREA] - 1; + toend = it->glyph_row->glyphs[TEXT_AREA]; + to = toend + it->glyph_row->used[TEXT_AREA] - 1; + + while (from >= end && to >= toend) + *to-- = *from--; + while (to >= toend && CHAR_GLYPH_PADDING_P (*to)) + { + from = + truncate_it.glyph_row->glyphs[TEXT_AREA] + + truncate_it.glyph_row->used[TEXT_AREA] - 1; + while (from >= end && to >= toend) + *to-- = *from--; + } + if (from >= end) + { + /* Need to free some room before prepending additional + glyphs. */ + int move_by = from - end + 1; + struct glyph *g0 = it->glyph_row->glyphs[TEXT_AREA]; + struct glyph *g = g0 + it->glyph_row->used[TEXT_AREA] - 1; + + for ( ; g >= g0; g--) + g[move_by] = *g; + while (from >= end) + *to-- = *from--; + it->glyph_row->used[TEXT_AREA] += move_by; + } + } } @@ -16774,9 +16984,11 @@ /* Extend the face of the last glyph in the text area of IT->glyph_row - to the end of the display line. Called from display_line. - If the glyph row is empty, add a space glyph to it so that we - know the face to draw. Set the glyph row flag fill_line_p. */ + to the end of the display line. Called from display_line. If the + glyph row is empty, add a space glyph to it so that we know the + face to draw. Set the glyph row flag fill_line_p. If the glyph + row is R2L, prepend a stretch glyph to cover the empty space to the + left of the leftmost glyph. */ static void extend_face_to_end_of_line (it) @@ -16785,15 +16997,22 @@ struct face *face; struct frame *f = it->f; - /* If line is already filled, do nothing. */ - if (it->current_x >= it->last_visible_x) + /* If line is already filled, do nothing. Non window-system frames + get a grace of one more ``pixel'' because their characters are + 1-``pixel'' wide, so they hit the equality too early. This grace + is needed only for R2L rows that are not continued, to produce + one extra blank where we could display the cursor. */ + if (it->current_x >= it->last_visible_x + + (!FRAME_WINDOW_P (f) + && it->glyph_row->reversed_p + && !it->glyph_row->continued_p)) return; /* Face extension extends the background and box of IT->face_id to the end of the line. If the background equals the background of the frame, we don't have to do anything. */ if (it->face_before_selective_p) - face = FACE_FROM_ID (it->f, it->saved_face_id); + face = FACE_FROM_ID (f, it->saved_face_id); else face = FACE_FROM_ID (f, it->face_id); @@ -16801,7 +17020,8 @@ && it->glyph_row->displays_text_p && face->box == FACE_NO_BOX && face->background == FRAME_BACKGROUND_PIXEL (f) - && !face->stipple) + && !face->stipple + && !it->glyph_row->reversed_p) return; /* Set the glyph row flag indicating that the face of the last glyph @@ -16828,6 +17048,50 @@ it->glyph_row->glyphs[TEXT_AREA][0].face_id = it->face_id; it->glyph_row->used[TEXT_AREA] = 1; } +#ifdef HAVE_WINDOW_SYSTEM + if (it->glyph_row->reversed_p) + { + /* Prepend a stretch glyph to the row, such that the + rightmost glyph will be drawn flushed all the way to the + right margin of the window. The stretch glyph that will + occupy the empty space, if any, to the left of the + glyphs. */ + struct font *font = face->font ? face->font : FRAME_FONT (f); + struct glyph *row_start = it->glyph_row->glyphs[TEXT_AREA]; + struct glyph *row_end = row_start + it->glyph_row->used[TEXT_AREA]; + struct glyph *g; + int row_width, stretch_ascent, stretch_width; + struct text_pos saved_pos; + int saved_face_id, saved_avoid_cursor; + + for (row_width = 0, g = row_start; g < row_end; g++) + row_width += g->pixel_width; + stretch_width = window_box_width (it->w, TEXT_AREA) - row_width; + if (stretch_width > 0) + { + stretch_ascent = + (((it->ascent + it->descent) + * FONT_BASE (font)) / FONT_HEIGHT (font)); + saved_pos = it->position; + bzero (&it->position, sizeof it->position); + saved_avoid_cursor = it->avoid_cursor_p; + it->avoid_cursor_p = 1; + saved_face_id = it->face_id; + /* The last row's stretch glyph should get the default + face, to avoid painting the rest of the window with + the region face, if the region ends at ZV. */ + if (it->glyph_row->ends_at_zv_p) + it->face_id = DEFAULT_FACE_ID; + else + it->face_id = face->id; + append_stretch_glyph (it, make_number (0), stretch_width, + it->ascent + it->descent, stretch_ascent); + it->position = saved_pos; + it->avoid_cursor_p = saved_avoid_cursor; + it->face_id = saved_face_id; + } + } +#endif /* HAVE_WINDOW_SYSTEM */ } else { @@ -16846,7 +17110,13 @@ it->object = make_number (0); it->c = ' '; it->len = 1; - it->face_id = face->id; + /* The last row's blank glyphs should get the default face, to + avoid painting the rest of the window with the region face, + if the region ends at ZV. */ + if (it->glyph_row->ends_at_zv_p) + it->face_id = DEFAULT_FACE_ID; + else + it->face_id = face->id; PRODUCE_GLYPHS (it); @@ -17132,6 +17402,148 @@ +/* Remove N glyphs at the start of a reversed IT->glyph_row. Called + only for R2L lines from display_line, when it decides that too many + glyphs were produced by PRODUCE_GLYPHS, and the line needs to be + continued. */ +static void +unproduce_glyphs (it, n) + struct it *it; + int n; +{ + struct glyph *glyph, *end; + + xassert (it->glyph_row); + xassert (it->glyph_row->reversed_p); + xassert (it->area == TEXT_AREA); + xassert (n <= it->glyph_row->used[TEXT_AREA]); + + if (n > it->glyph_row->used[TEXT_AREA]) + n = it->glyph_row->used[TEXT_AREA]; + glyph = it->glyph_row->glyphs[TEXT_AREA] + n; + end = it->glyph_row->glyphs[TEXT_AREA] + it->glyph_row->used[TEXT_AREA]; + for ( ; glyph < end; glyph++) + glyph[-n] = *glyph; +} + +/* Find the positions in a bidi-reordered ROW to serve as ROW->start + and ROW->end. */ +static struct display_pos +find_row_end (it, row) + struct it *it; + struct glyph_row *row; +{ + /* FIXME: Revisit this when glyph ``spilling'' in continuation + lines' rows is implemented for bidi-reordered rows. */ + EMACS_INT min_pos = ZV + 1, max_pos = 0; + struct glyph *g; + struct it save_it; + struct text_pos tpos; + struct display_pos row_end = it->current; + + for (g = row->glyphs[TEXT_AREA]; + g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; + g++) + { + if (BUFFERP (g->object)) + { + if (g->charpos > 0 && g->charpos < min_pos) + min_pos = g->charpos; + if (g->charpos > max_pos) + max_pos = g->charpos; + } + } + /* Empty lines have a valid buffer position at their first + glyph, but that glyph's OBJECT is zero, as if it didn't come + from a buffer. If we didn't find any valid buffer positions + in this row, maybe we have such an empty line. */ + if (max_pos == 0 && row->used[TEXT_AREA]) + { + for (g = row->glyphs[TEXT_AREA]; + g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; + g++) + { + if (INTEGERP (g->object)) + { + if (g->charpos > 0 && g->charpos < min_pos) + min_pos = g->charpos; + if (g->charpos > max_pos) + max_pos = g->charpos; + } + } + } + + /* ROW->start is the value of min_pos, the minimal buffer position + we have in ROW. */ + if (min_pos <= ZV) + { + /* Avoid calling the costly CHAR_TO_BYTE if possible. */ + if (min_pos != row->start.pos.charpos) + SET_TEXT_POS (row->start.pos, min_pos, CHAR_TO_BYTE (min_pos)); + if (max_pos == 0) + max_pos = min_pos; + } + + /* For ROW->end, we need the position that is _after_ max_pos, in + the logical order, unless we are at ZV. */ + if (row->ends_at_zv_p) + { + if (!row->used[TEXT_AREA]) + row->start.pos = row_end.pos; + } + else if (row->used[TEXT_AREA] && max_pos) + { + int at_eol_p; + + SET_TEXT_POS (tpos, max_pos, CHAR_TO_BYTE (max_pos)); + save_it = *it; + it->bidi_p = 0; + reseat (it, tpos, 0); + if (!get_next_display_element (it)) + abort (); /* this row cannot be at ZV, see above */ + at_eol_p = ITERATOR_AT_END_OF_LINE_P (it); + set_iterator_to_next (it, 1); + row_end = it->current; + /* If the character at max_pos is not a newline and the + characters at max_pos+1 is a newline, skip that newline as + well. Note that this may skip some invisible text. */ + if (!at_eol_p + && get_next_display_element (it) + && ITERATOR_AT_END_OF_LINE_P (it)) + { + set_iterator_to_next (it, 1); + /* Record the position after the newline of a continued row. + We will need that to set ROW->end of the last row + produced for a continued line. */ + if (row->continued_p) + save_it.eol_pos = it->current.pos; + else + { + row_end = it->current; + save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0; + } + } + else if (!row->continued_p + && MATRIX_ROW_CONTINUATION_LINE_P (row) + && it->eol_pos.charpos > 0) + { + /* Last row of a continued line. Use the position recorded + in IT->eol_pos, to the effect that the newline belongs to + this row, not to the row which displays the character + with the largest buffer position before the newline. */ + row_end.pos = it->eol_pos; + it->eol_pos.charpos = it->eol_pos.bytepos = 0; + } + *it = save_it; + /* The members of ROW->end that are not taken from buffer + positions are copied from IT->current. */ + row_end.string_pos = it->current.string_pos; + row_end.overlay_string_index = it->current.overlay_string_index; + row_end.dpvec_index = it->current.dpvec_index; + } + return row_end; +} + /* Construct the glyph row IT->glyph_row in the desired matrix of IT->w from text at the current position of IT. See dispextern.h for an overview of struct it. Value is non-zero if @@ -17149,7 +17561,6 @@ int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; int wrap_row_phys_ascent, wrap_row_phys_height; int wrap_row_extra_line_spacing; - struct display_pos row_end; int cvpos; /* We always start displaying at hpos zero even if hscrolled. */ @@ -17396,6 +17807,9 @@ /* A padding glyph that doesn't fit on this line. This means the whole character doesn't fit on the line. */ + if (row->reversed_p) + unproduce_glyphs (it, row->used[TEXT_AREA] + - n_glyphs_before); row->used[TEXT_AREA] = n_glyphs_before; /* Fill the rest of the row with continuation @@ -17418,6 +17832,9 @@ else if (wrap_row_used > 0) { back_to_wrap: + if (row->reversed_p) + unproduce_glyphs (it, + row->used[TEXT_AREA] - wrap_row_used); *it = wrap_it; it->continuation_lines_width += wrap_x; row->used[TEXT_AREA] = wrap_row_used; @@ -17453,6 +17870,9 @@ /* Something other than a TAB that draws past the right edge of the window. Restore positions to values before the element. */ + if (row->reversed_p) + unproduce_glyphs (it, row->used[TEXT_AREA] + - (n_glyphs_before + i)); row->used[TEXT_AREA] = n_glyphs_before + i; /* Display continuation glyphs. */ @@ -17558,9 +17978,26 @@ { int i, n; - for (i = row->used[TEXT_AREA] - 1; i > 0; --i) - if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) - break; + if (!row->reversed_p) + { + for (i = row->used[TEXT_AREA] - 1; i > 0; --i) + if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) + break; + } + else + { + for (i = 0; i < row->used[TEXT_AREA]; i++) + if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) + break; + /* Remove any padding glyphs at the front of ROW, to + make room for the truncation glyphs we will be + adding below. The loop below always inserts at + least one truncation glyph, so also remove the + last glyph added to ROW. */ + unproduce_glyphs (it, i + 1); + /* Adjust i for the loop below. */ + i = row->used[TEXT_AREA] - (i + 1); + } for (n = row->used[TEXT_AREA]; i < n; ++i) { @@ -17651,116 +18088,13 @@ compute_line_metrics (it); /* Remember the position at which this line ends. */ - row->end = row_end = it->current; + row->end = it->current; + /* ROW->start and ROW->end must be the smallest and the largest + buffer positions in ROW. But if ROW was bidi-reordered, these + two positions can be anywhere in the row, so we must rescan all + of the ROW's glyphs to find them. */ if (it->bidi_p) - { - /* ROW->start and ROW->end must be the smallest and largest - buffer positions in ROW. But if ROW was bidi-reordered, - these two positions can be anywhere in the row, so we must - rescan all of the ROW's glyphs to find them. */ - /* FIXME: Revisit this when glyph ``spilling'' in continuation - lines' rows is implemented for bidi-reordered rows. */ - EMACS_INT min_pos = ZV + 1, max_pos = 0; - struct glyph *g; - struct it save_it; - struct text_pos tpos; - - for (g = row->glyphs[TEXT_AREA]; - g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; - g++) - { - if (BUFFERP (g->object)) - { - if (g->charpos > 0 && g->charpos < min_pos) - min_pos = g->charpos; - if (g->charpos > max_pos) - max_pos = g->charpos; - } - } - /* Empty lines have a valid buffer position at their first - glyph, but that glyph's OBJECT is zero, as if it didn't come - from a buffer. If we didn't find any valid buffer positions - in this row, maybe we have such an empty line. */ - if (min_pos == ZV + 1 && row->used[TEXT_AREA]) - { - for (g = row->glyphs[TEXT_AREA]; - g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; - g++) - { - if (INTEGERP (g->object)) - { - if (g->charpos > 0 && g->charpos < min_pos) - min_pos = g->charpos; - if (g->charpos > max_pos) - max_pos = g->charpos; - } - } - } - if (min_pos <= ZV) - { - if (min_pos != row->start.pos.charpos) - { - row->start.pos.charpos = min_pos; - row->start.pos.bytepos = CHAR_TO_BYTE (min_pos); - } - if (max_pos == 0) - max_pos = min_pos; - } - /* For ROW->end, we need the position that is _after_ max_pos, - in the logical order, unless we are at ZV. */ - if (row->ends_at_zv_p) - { - row_end = row->end = it->current; - if (!row->used[TEXT_AREA]) - { - row->start.pos.charpos = row_end.pos.charpos; - row->start.pos.bytepos = row_end.pos.bytepos; - } - } - else if (row->used[TEXT_AREA] && max_pos) - { - SET_TEXT_POS (tpos, max_pos + 1, CHAR_TO_BYTE (max_pos + 1)); - row_end = it->current; - row_end.pos = tpos; - /* If the character at max_pos+1 is a newline, skip that as - well. Note that this may skip some invisible text. */ - if (FETCH_CHAR (tpos.bytepos) == '\n' - || (FETCH_CHAR (tpos.bytepos) == '\r' && it->selective)) - { - save_it = *it; - it->bidi_p = 0; - reseat_1 (it, tpos, 0); - set_iterator_to_next (it, 1); - /* Record the position after the newline of a continued - row. We will need that to set ROW->end of the last - row produced for a continued line. */ - if (row->continued_p) - { - save_it.eol_pos.charpos = IT_CHARPOS (*it); - save_it.eol_pos.bytepos = IT_BYTEPOS (*it); - } - else - { - row_end = it->current; - save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0; - } - *it = save_it; - } - else if (!row->continued_p - && row->continuation_lines_width - && it->eol_pos.charpos > 0) - { - /* Last row of a continued line. Use the position - recorded in ROW->eol_pos, to the effect that the - newline belongs to this row, not to the row which - displays the character with the largest buffer - position. */ - row_end.pos = it->eol_pos; - it->eol_pos.charpos = it->eol_pos.bytepos = 0; - } - row->end = row_end; - } - } + row->end = find_row_end (it, row); /* Record whether this row ends inside an ellipsis. */ row->ends_in_ellipsis_p @@ -17808,11 +18142,13 @@ it->current_y += row->height; ++it->vpos; ++it->glyph_row; - /* The next row should use same value of the reversed_p flag as this - one. set_iterator_to_next decides when it's a new paragraph, and - PRODUCE_GLYPHS recomputes the value of the flag accordingly. */ - it->glyph_row->reversed_p = row->reversed_p; - it->start = row_end; + /* The next row should by default use the same value of the + reversed_p flag as this one. set_iterator_to_next decides when + it's a new paragraph, and PRODUCE_GLYPHS recomputes the value of + the flag accordingly. */ + if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w)) + it->glyph_row->reversed_p = row->reversed_p; + it->start = row->end; return row->displays_text_p; } @@ -21415,6 +21751,17 @@ glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; if (glyph < it->glyph_row->glyphs[area + 1]) { + /* If the glyph row is reversed, we need to prepend the glyph + rather than append it. */ + if (it->glyph_row->reversed_p && it->area == TEXT_AREA) + { + struct glyph *g; + + /* Make room for the new glyph. */ + for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--) + g[1] = *g; + glyph = it->glyph_row->glyphs[it->area]; + } glyph->charpos = CHARPOS (it->position); glyph->object = it->object; glyph->pixel_width = it->pixel_width; @@ -21660,6 +22007,17 @@ glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; if (glyph < it->glyph_row->glyphs[area + 1]) { + /* If the glyph row is reversed, we need to prepend the glyph + rather than append it. */ + if (it->glyph_row->reversed_p && area == TEXT_AREA) + { + struct glyph *g; + + /* Make room for the additional glyph. */ + for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) + g[1] = *g; + glyph = it->glyph_row->glyphs[area]; + } glyph->charpos = CHARPOS (it->position); glyph->object = object; glyph->pixel_width = width; @@ -21686,6 +22044,11 @@ abort (); glyph->bidi_type = it->bidi_it.type; } + else + { + glyph->resolved_level = 0; + glyph->bidi_type = UNKNOWN_BT; + } ++it->glyph_row->used[area]; } else @@ -23166,7 +23529,7 @@ if (row->cursor_in_fringe_p) { row->cursor_in_fringe_p = 0; - draw_fringe_bitmap (w, row, 0); + draw_fringe_bitmap (w, row, row->reversed_p); w->phys_cursor_on_p = 0; return; } @@ -23267,7 +23630,9 @@ /* If cursor hpos is out of bounds, don't draw garbage. This can happen in mini-buffer windows when switching between echo area glyphs and mini-buffer. */ - if (w->phys_cursor.hpos < row->used[TEXT_AREA]) + if ((row->reversed_p + ? (w->phys_cursor.hpos >= 0) + : (w->phys_cursor.hpos < row->used[TEXT_AREA]))) { int on_p = w->phys_cursor_on_p; int x1; @@ -23347,7 +23712,7 @@ if (cursor_row->cursor_in_fringe_p) { cursor_row->cursor_in_fringe_p = 0; - draw_fringe_bitmap (w, cursor_row, 0); + draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p); goto mark_cursor_off; } @@ -23356,7 +23721,9 @@ should have cleared the cursor. Note that we wouldn't be able to erase the cursor in this case because we don't have a cursor glyph at hand. */ - if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) + if ((cursor_row->reversed_p + ? (w->phys_cursor.hpos < 0) + : (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]))) goto mark_cursor_off; /* If the cursor is in the mouse face area, redisplay that when @@ -23372,7 +23739,7 @@ /* Don't redraw the cursor's spot in mouse face if it is at the end of a line (on a newline). The cursor appears there, but mouse highlighting does not. */ - && cursor_row->used[TEXT_AREA] > hpos) + && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0) mouse_face_here_p = 1; /* Maybe clear the display under the cursor. */ @@ -23454,7 +23821,7 @@ glyph = NULL; if (!glyph_row->exact_window_width_line_p - || hpos < glyph_row->used[TEXT_AREA]) + || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) glyph = glyph_row->glyphs[TEXT_AREA] + hpos; xassert (interrupt_input_blocked); @@ -25557,6 +25924,12 @@ staticpro (&Qnobreak_space); Qimage = intern_c_string ("image"); staticpro (&Qimage); + Qtext = intern_c_string ("text"); + staticpro (&Qtext); + Qboth = intern_c_string ("both"); + staticpro (&Qboth); + Qboth_horiz = intern_c_string ("both-horiz"); + staticpro (&Qboth_horiz); QCmap = intern_c_string (":map"); staticpro (&QCmap); QCpointer = intern_c_string (":pointer"); @@ -25897,6 +26270,22 @@ doc: /* *Relief thickness of tool-bar buttons. */); tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF; + DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style, + doc: /* *Tool bar style to use. +It can be one of + image - show images only + text - show text only + both - show both, text under image + both-horiz - show text to the right of the image + any other - use system default or image if no system default. */); + Vtool_bar_style = Qnil; + + DEFVAR_INT ("tool-bar-max-label-size", &tool_bar_max_label_size, + doc: /* *Maximum number of characters a label can have to be shown. +The tool bar style must also show labels for this to have any effect, see +`tool-bar-style'. */); + tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE; + DEFVAR_LISP ("fontification-functions", &Vfontification_functions, doc: /* List of functions to call to fontify regions of text. Each function is called with one argument POS. Functions must diff -r e56f669f17ce -r fe07c47cf7a7 src/xmenu.c --- a/src/xmenu.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xmenu.c Thu May 13 15:13:52 2010 +0200 @@ -978,14 +978,9 @@ if (XtIsShell (w)) /* popup menu */ { Widget *childs = NULL; - int num = 0; - - XtVaGetValues (w, XtNnumChildren, &num, NULL); - if (num != 1) return; /* Should only be one. */ - - childs[0] = 0; + XtVaGetValues (w, XtNchildren, &childs, NULL); - if (childs && *childs) w = *childs; + if (*childs) w = *childs; } /* Only use system font if the default is used for the menu. */ diff -r e56f669f17ce -r fe07c47cf7a7 src/xrdb.c --- a/src/xrdb.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xrdb.c Thu May 13 15:13:52 2010 +0200 @@ -34,24 +34,8 @@ #include #include -#if 1 /* I'd really appreciate it if this code could go away... -JimB */ -/* This avoids lossage in the `dual-universe' headers on AT&T SysV - X11. Don't do it on Solaris, because it breaks compilation with - XFree86 4.0.3 (and probably many other X11R6 releases) on Solaris - 2 */ -#if defined(USG5) && !defined(SOLARIS2) -#ifndef SYSV -#define SYSV -#endif -#endif /* USG5 && !SOLARIS2 */ - -#endif /* 1 */ - #include #include -#if 0 -#include -#endif #include #include #include diff -r e56f669f17ce -r fe07c47cf7a7 src/xsettings.c --- a/src/xsettings.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xsettings.c Thu May 13 15:13:52 2010 +0200 @@ -1,4 +1,4 @@ -/* Functions for handle font changes dynamically. +/* Functions for handle font and other changes dynamically. Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -18,6 +18,7 @@ along with GNU Emacs. If not, see . */ #include "config.h" +#include #include #include #include "lisp.h" @@ -41,10 +42,11 @@ static char *current_mono_font; static char *current_font; static struct x_display_info *first_dpyinfo; -static Lisp_Object Qfont_name, Qfont_render; +static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render, + Qtool_bar_style; static int use_system_font; static Lisp_Object Vxft_settings; - +static Lisp_Object current_tool_bar_style; #ifdef HAVE_GCONF static GConfClient *gconf_client; @@ -52,7 +54,7 @@ static void -store_font_changed_event (arg, display_name) +store_config_changed_event (arg, display_name) Lisp_Object arg; Lisp_Object display_name; { @@ -64,7 +66,32 @@ kbd_buffer_store_event (&event); } -#define XSETTINGS_FONT_NAME "Gtk/FontName" +#define XSETTINGS_FONT_NAME "Gtk/FontName" +#define XSETTINGS_TOOL_BAR_STYLE "Gtk/ToolbarStyle" + +enum { + SEEN_AA = 0x01, + SEEN_HINTING = 0x02, + SEEN_RGBA = 0x04, + SEEN_LCDFILTER = 0x08, + SEEN_HINTSTYLE = 0x10, + SEEN_DPI = 0x20, + SEEN_FONT = 0x40, + SEEN_TB_STYLE = 0x80, +}; +struct xsettings +{ +#ifdef HAVE_XFT + FcBool aa, hinting; + int rgba, lcdfilter, hintstyle; + double dpi; +#endif + + char *font; + char *tb_style; + + unsigned seen; +}; #ifdef HAVE_GCONF @@ -105,8 +132,8 @@ found = dpyinfo == first_dpyinfo; if (found && use_system_font) - store_font_changed_event (Qfont_name, - XCAR (first_dpyinfo->name_list_element)); + store_config_changed_event (Qmonospace_font_name, + XCAR (first_dpyinfo->name_list_element)); } } #endif /* HAVE_GCONF */ @@ -124,6 +151,8 @@ #define FC_LCD_FILTER "lcdfilter" #endif +#endif /* HAVE_XFT */ + /* Find the window that contains the XSETTINGS property values. */ static void @@ -144,23 +173,6 @@ XUngrabServer (dpy); } -enum { - SEEN_AA = 0x01, - SEEN_HINTING = 0x02, - SEEN_RGBA = 0x04, - SEEN_LCDFILTER = 0x08, - SEEN_HINTSTYLE = 0x10, - SEEN_DPI = 0x20, -}; -struct xsettings -{ - FcBool aa, hinting; - int rgba, lcdfilter, hintstyle; - double dpi; - - unsigned seen; -}; - #define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000) \ | (((nr) >> 8) & 0xff00) | ((nr) >> 24)) #define SWAP16(nr) (((nr) << 8) | ((nr) >> 8)) @@ -217,7 +229,7 @@ */ static int -parse_xft_settings (prop, bytes, settings) +parse_settings (prop, bytes, settings) unsigned char *prop; unsigned long bytes; struct xsettings *settings; @@ -268,8 +280,13 @@ bytes_parsed += 4; /* Skip serial for this value */ if (bytes_parsed > bytes) return BadLength; - want_this = (nlen > 6 && strncmp (name, "Xft/", 4) == 0) - || (strcmp (XSETTINGS_FONT_NAME, name) == 0); + want_this = +#ifdef HAVE_XFT + (nlen > 6 && strncmp (name, "Xft/", 4) == 0) + || +#endif + (strcmp (XSETTINGS_FONT_NAME, name) == 0) + || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0); switch (type) { @@ -311,7 +328,18 @@ if (want_this) { ++settings_seen; - if (strcmp (name, "Xft/Antialias") == 0) + if (strcmp (name, XSETTINGS_FONT_NAME) == 0) + { + settings->font = xstrdup (sval); + settings->seen |= SEEN_FONT; + } + else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0) + { + settings->tb_style = xstrdup (sval); + settings->seen |= SEEN_TB_STYLE; + } +#ifdef HAVE_XFT + else if (strcmp (name, "Xft/Antialias") == 0) { settings->seen |= SEEN_AA; settings->aa = ival != 0; @@ -366,11 +394,7 @@ else settings->seen &= ~SEEN_LCDFILTER; } - else if (strcmp (name, XSETTINGS_FONT_NAME) == 0) - { - free (current_font); - current_font = xstrdup (sval); - } +#endif /* HAVE_XFT */ } } @@ -378,7 +402,7 @@ } static int -read_xft_settings (dpyinfo, settings) +read_settings (dpyinfo, settings) struct x_display_info *dpyinfo; struct xsettings *settings; { @@ -400,7 +424,7 @@ if (rc == Success && prop != NULL && act_form == 8 && nitems > 0 && act_type == dpyinfo->Xatom_xsettings_prop) - rc = parse_xft_settings (prop, nitems, settings); + rc = parse_settings (prop, nitems, settings); XFree (prop); @@ -411,18 +435,17 @@ static void -apply_xft_settings (dpyinfo, send_event_p) +apply_xft_settings (dpyinfo, send_event_p, settings) struct x_display_info *dpyinfo; int send_event_p; + struct xsettings *settings; { +#ifdef HAVE_XFT FcPattern *pat; - struct xsettings settings, oldsettings; + struct xsettings oldsettings; int changed = 0; char buf[256]; - if (!read_xft_settings (dpyinfo, &settings)) - return; - memset (&oldsettings, 0, sizeof (oldsettings)); buf[0] = '\0'; pat = FcPatternCreate (); @@ -436,74 +459,74 @@ FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); - if ((settings.seen & SEEN_AA) != 0 && oldsettings.aa != settings.aa) + if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa) { FcPatternDel (pat, FC_ANTIALIAS); - FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa); + FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa); ++changed; - oldsettings.aa = settings.aa; + oldsettings.aa = settings->aa; } sprintf (buf, "Antialias: %d", oldsettings.aa); - if ((settings.seen & SEEN_HINTING) != 0 - && oldsettings.hinting != settings.hinting) + if ((settings->seen & SEEN_HINTING) != 0 + && oldsettings.hinting != settings->hinting) { FcPatternDel (pat, FC_HINTING); - FcPatternAddBool (pat, FC_HINTING, settings.hinting); + FcPatternAddBool (pat, FC_HINTING, settings->hinting); ++changed; - oldsettings.hinting = settings.hinting; + oldsettings.hinting = settings->hinting; } if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting); - if ((settings.seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings.rgba) + if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba) { FcPatternDel (pat, FC_RGBA); - FcPatternAddInteger (pat, FC_RGBA, settings.rgba); - oldsettings.rgba = settings.rgba; + FcPatternAddInteger (pat, FC_RGBA, settings->rgba); + oldsettings.rgba = settings->rgba; ++changed; } if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba); /* Older fontconfig versions don't have FC_LCD_FILTER. */ - if ((settings.seen & SEEN_LCDFILTER) != 0 - && oldsettings.lcdfilter != settings.lcdfilter) + if ((settings->seen & SEEN_LCDFILTER) != 0 + && oldsettings.lcdfilter != settings->lcdfilter) { FcPatternDel (pat, FC_LCD_FILTER); - FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter); + FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter); ++changed; - oldsettings.lcdfilter = settings.lcdfilter; + oldsettings.lcdfilter = settings->lcdfilter; } if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter); - if ((settings.seen & SEEN_HINTSTYLE) != 0 - && oldsettings.hintstyle != settings.hintstyle) + if ((settings->seen & SEEN_HINTSTYLE) != 0 + && oldsettings.hintstyle != settings->hintstyle) { FcPatternDel (pat, FC_HINT_STYLE); - FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle); + FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle); ++changed; - oldsettings.hintstyle = settings.hintstyle; + oldsettings.hintstyle = settings->hintstyle; } if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle); - if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.dpi - && settings.dpi > 0) + if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi + && settings->dpi > 0) { Lisp_Object frame, tail; FcPatternDel (pat, FC_DPI); - FcPatternAddDouble (pat, FC_DPI, settings.dpi); + FcPatternAddDouble (pat, FC_DPI, settings->dpi); ++changed; - oldsettings.dpi = settings.dpi; + oldsettings.dpi = settings->dpi; /* Change the DPI on this display and all frames on the display. */ - dpyinfo->resy = dpyinfo->resx = settings.dpi; + dpyinfo->resy = dpyinfo->resx = settings->dpi; FOR_EACH_FRAME (tail, frame) if (FRAME_X_P (XFRAME (frame)) && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) - XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi; + XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi; } if (strlen (buf) > 0) strcat (buf, ", "); @@ -513,23 +536,68 @@ { XftDefaultSet (dpyinfo->display, pat); if (send_event_p) - store_font_changed_event (Qfont_render, - XCAR (dpyinfo->name_list_element)); + store_config_changed_event (Qfont_render, + XCAR (dpyinfo->name_list_element)); Vxft_settings = make_string (buf, strlen (buf)); } else FcPatternDestroy (pat); +#endif /* HAVE_XFT */ } -#endif /* HAVE_XFT */ +static void +read_and_apply_settings (dpyinfo, send_event_p) + struct x_display_info *dpyinfo; + int send_event_p; +{ + struct xsettings settings; + Lisp_Object dpyname = XCAR (dpyinfo->name_list_element); + + if (!read_settings (dpyinfo, &settings)) + return; + + apply_xft_settings (dpyinfo, True, &settings); + if (settings.seen & SEEN_TB_STYLE) + { + Lisp_Object style = Qnil; + if (strcmp (settings.tb_style, "both") == 0) + style = Qboth; + else if (strcmp (settings.tb_style, "both-horiz") == 0) + style = Qboth_horiz; + else if (strcmp (settings.tb_style, "icons") == 0) + style = Qimage; + else if (strcmp (settings.tb_style, "text") == 0) + style = Qtext; + if (!NILP (style) && !EQ (style, current_tool_bar_style)) + { + current_tool_bar_style = style; + if (send_event_p) + store_config_changed_event (Qtool_bar_style, dpyname); + } + free (settings.tb_style); + } + + if (settings.seen & SEEN_FONT) + { + if (!current_font || strcmp (current_font, settings.font) != 0) + { + free (current_font); + current_font = settings.font; + if (send_event_p) + store_config_changed_event (Qfont_name, dpyname); + } + else + free (settings.font); + } +} void xft_settings_event (dpyinfo, event) struct x_display_info *dpyinfo; XEvent *event; { -#ifdef HAVE_XFT int check_window_p = 0; + int apply_settings = 0; switch (event->type) { @@ -549,20 +617,21 @@ if (event->xproperty.window == dpyinfo->xsettings_window && event->xproperty.state == PropertyNewValue && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) - { - apply_xft_settings (dpyinfo, True); - } + apply_settings = 1; break; } + if (check_window_p) { dpyinfo->xsettings_window = None; get_prop_window (dpyinfo); if (dpyinfo->xsettings_window != None) - apply_xft_settings (dpyinfo, True); + apply_settings = 1; } -#endif /* HAVE_XFT */ + + if (apply_settings) + read_and_apply_settings (dpyinfo, True); } @@ -600,10 +669,9 @@ } static void -init_xfd_settings (dpyinfo) +init_xsettings (dpyinfo) struct x_display_info *dpyinfo; { -#ifdef HAVE_XFT char sel[64]; Display *dpy = dpyinfo->display; @@ -622,18 +690,9 @@ get_prop_window (dpyinfo); if (dpyinfo->xsettings_window != None) - apply_xft_settings (dpyinfo, False); + read_and_apply_settings (dpyinfo, False); UNBLOCK_INPUT; - -#else /* ! HAVE_XFT */ - - dpyinfo->Xatom_xsettings_sel = None; - dpyinfo->Xatom_xsettings_prop = None; - dpyinfo->Xatom_xsettings_mgr = None; - dpyinfo->xsettings_window = None; - -#endif /* ! HAVE_XFT */ } void @@ -642,7 +701,7 @@ { if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo; init_gconf (); - init_xfd_settings (dpyinfo); + init_xsettings (dpyinfo); } const char * @@ -678,6 +737,23 @@ : Qnil; } +DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_system_style, + 0, 0, 0, + doc: /* Get the system tool bar style. +If no system tool bar style is known, return `tool-bar-style' if set to a +known style. Otherwise return image. */) + () +{ + if (EQ (Vtool_bar_style, Qimage) + || EQ (Vtool_bar_style, Qtext) + || EQ (Vtool_bar_style, Qboth) + || EQ (Vtool_bar_style, Qboth_horiz)) + return Vtool_bar_style; + if (!NILP (current_tool_bar_style)) + return current_tool_bar_style; + return Qimage; +} + void syms_of_xsettings () { @@ -688,6 +764,8 @@ gconf_client = NULL; #endif + Qmonospace_font_name = intern_c_string ("monospace-font-name"); + staticpro (&Qmonospace_font_name); Qfont_name = intern_c_string ("font-name"); staticpro (&Qfont_name); Qfont_render = intern_c_string ("font-render"); @@ -709,6 +787,13 @@ Fprovide (intern_c_string ("system-font-setting"), Qnil); #endif #endif + + current_tool_bar_style = Qnil; + Qtool_bar_style = intern_c_string ("tool-bar-style"); + staticpro (&Qtool_bar_style); + defsubr (&Stool_bar_get_system_style); + + Fprovide (intern_c_string ("dynamic-setting"), Qnil); } /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d diff -r e56f669f17ce -r fe07c47cf7a7 src/xsettings.h --- a/src/xsettings.h Wed May 12 14:32:06 2010 +0200 +++ b/src/xsettings.h Thu May 13 15:13:52 2010 +0200 @@ -22,6 +22,7 @@ EXFUN (Ffont_get_system_font, 0); EXFUN (Ffont_get_system_normal_font, 0); +EXFUN (Ftool_bar_get_system_style, 0); extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo)); extern void xft_settings_event P_ ((struct x_display_info *dpyinfo, diff -r e56f669f17ce -r fe07c47cf7a7 src/xsmfns.c --- a/src/xsmfns.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xsmfns.c Thu May 13 15:13:52 2010 +0200 @@ -90,6 +90,10 @@ #define NOSPLASH_OPT "--no-splash" +/* The option to make Emacs start in the given directory. */ + +#define CHDIR_OPT "--chdir=" + static void ice_connection_closed () { @@ -206,7 +210,7 @@ int props_idx = 0; char *cwd = NULL; - char *smid_opt; + char *smid_opt, *chdir_opt = NULL; /* How to start a new instance of Emacs. */ props[props_idx] = &prop_ptr[props_idx]; @@ -228,11 +232,12 @@ props[props_idx]->vals[0].value = SDATA (Vinvocation_name); ++props_idx; - /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx --no-splash). */ + /* How to restart Emacs. */ props[props_idx] = &prop_ptr[props_idx]; props[props_idx]->name = SmRestartCommand; props[props_idx]->type = SmLISTofARRAY8; - props[props_idx]->num_vals = 3; /* /path/to/emacs, --smid=xxx --no-splash */ + /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */ + props[props_idx]->num_vals = 4; props[props_idx]->vals = &values[val_idx]; props[props_idx]->vals[0].length = strlen (emacs_program); props[props_idx]->vals[0].value = emacs_program; @@ -246,7 +251,19 @@ props[props_idx]->vals[2].length = strlen (NOSPLASH_OPT); props[props_idx]->vals[2].value = NOSPLASH_OPT; - val_idx += 3; + + cwd = get_current_dir_name (); + if (cwd) + { + chdir_opt = xmalloc (strlen (CHDIR_OPT) + strlen (cwd) + 1); + strcpy (chdir_opt, CHDIR_OPT); + strcat (chdir_opt, cwd); + + props[props_idx]->vals[3].length = strlen (chdir_opt); + props[props_idx]->vals[3].value = chdir_opt; + } + + val_idx += cwd ? 4 : 3; ++props_idx; /* User id. */ @@ -259,7 +276,6 @@ props[props_idx]->vals[0].value = SDATA (Vuser_login_name); ++props_idx; - cwd = get_current_dir_name (); if (cwd) { @@ -277,6 +293,7 @@ SmcSetProperties (smcConn, props_idx, props); xfree (smid_opt); + xfree (chdir_opt); free (cwd); diff -r e56f669f17ce -r fe07c47cf7a7 src/xterm.c --- a/src/xterm.c Wed May 12 14:32:06 2010 +0200 +++ b/src/xterm.c Thu May 13 15:13:52 2010 +0200 @@ -2291,7 +2291,7 @@ x_draw_image_relief (s) struct glyph_string *s; { - int x0, y0, x1, y1, thick, raised_p; + int x0, y0, x1, y1, thick, raised_p, extra; XRectangle r; int x = s->x; int y = s->ybase - image_ascent (s->img, s->face, &s->slice); @@ -2322,10 +2322,13 @@ raised_p = s->img->relief > 0; } - x0 = x - thick; - y0 = y - thick; - x1 = x + s->slice.width + thick - 1; - y1 = y + s->slice.height + thick - 1; + extra = s->face->id == TOOL_BAR_FACE_ID + ? XINT (Vtool_bar_button_margin) : 0; + + x0 = x - thick - extra; + y0 = y - thick - extra; + x1 = x + s->slice.width + thick - 1 + extra; + y1 = y + s->slice.height + thick - 1 + extra; x_setup_relief_colors (s); get_glyph_string_clip_rect (s, &r); @@ -7492,36 +7495,40 @@ w->phys_cursor_on_p = 1; if (glyph_row->exact_window_width_line_p - && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) + && (glyph_row->reversed_p + ? (w->phys_cursor.hpos < 0) + : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]))) { glyph_row->cursor_in_fringe_p = 1; - draw_fringe_bitmap (w, glyph_row, 0); + draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p); } else - switch (cursor_type) { - case HOLLOW_BOX_CURSOR: - x_draw_hollow_cursor (w, glyph_row); - break; - - case FILLED_BOX_CURSOR: - draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); - break; - - case BAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); - break; - - case HBAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); - break; - - case NO_CURSOR: - w->phys_cursor_width = 0; - break; - - default: - abort (); + switch (cursor_type) + { + case HOLLOW_BOX_CURSOR: + x_draw_hollow_cursor (w, glyph_row); + break; + + case FILLED_BOX_CURSOR: + draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); + break; + + case BAR_CURSOR: + x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); + break; + + case HBAR_CURSOR: + x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); + break; + + case NO_CURSOR: + w->phys_cursor_width = 0; + break; + + default: + abort (); + } } #ifdef HAVE_X_I18N @@ -7929,8 +7936,8 @@ if (terminal_list->next_terminal == NULL) { fprintf (stderr, "%s\n", error_msg); - shut_down_emacs (0, 0, Qnil); - exit (70); + Fkill_emacs (make_number (70)); + /* NOTREACHED */ } xg_display_close (dpyinfo->display); #endif @@ -7956,8 +7963,8 @@ if (terminal_list == 0) { fprintf (stderr, "%s\n", error_msg); - shut_down_emacs (0, 0, Qnil); - exit (70); + Fkill_emacs (make_number (70)); + /* NOTREACHED */ } /* Ordinary stack unwind doesn't deal with these. */ diff -r e56f669f17ce -r fe07c47cf7a7 test/ChangeLog --- a/test/ChangeLog Wed May 12 14:32:06 2010 +0200 +++ b/test/ChangeLog Thu May 13 15:13:52 2010 +0200 @@ -1,3 +1,7 @@ +2010-05-07 Chong Yidong + + * Version 23.2 released. + 2010-03-29 Chong Yidong * cedet/semantic-ia-utest.el