From 395b1ea5b876b112b77fc241a362716725424e72 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 9 Jun 2010 22:00:18 -0700 Subject: [PATCH 01/36] * INSTALL: General update. --- ChangeLog | 4 + INSTALL | 340 +++++++++++++++++++++++++----------------------------- 2 files changed, 159 insertions(+), 185 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5317cbeb7ea..92b618c1cd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-10 Glenn Morris + + * INSTALL: General update. + 2010-05-30 Stefan Monnier * .bzrignore: Ignore new files from trunk, which appear if you use diff --git a/INSTALL b/INSTALL index 040b25f6d6d..0fd77ea045e 100644 --- a/INSTALL +++ b/INSTALL @@ -1,35 +1,42 @@ GNU Emacs Installation Guide Copyright (C) 1992, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, -2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. See the end of the file for license conditions. -This file contains general information. For more specific information -for the Windows, GNUstep/Mac OS X, and MS-DOS ports, also see the files -nt/INSTALL nextstep/INSTALL, and msdos/INSTALL. For information -specific to building from a Bazaar checkout (rather than a release), see -the file INSTALL.BZR. +This file contains general information on building GNU Emacs. +For more information specific to the MS-Windows, GNUstep/Mac OS X, and +MS-DOS ports, also read the files nt/INSTALL, nextstep/INSTALL, and +msdos/INSTALL. For information about building from a Bazaar checkout +(rather than a release), also read the file INSTALL.BZR. BASIC INSTALLATION -The simplest way to build Emacs is to use the `configure' shell script -which attempts to guess correct values for various system-dependent -variables and features and find the directories where various system -headers and libraries are kept. It then creates a `Makefile' in each -subdirectory and a `config.h' file containing system-dependent -definitions. Running the `make' utility then builds the package for -your system. +On most Unix systems, you build Emacs by first running the `configure' +shell script. This attempts to deduce the correct values for +various system-dependent variables and features, and find the +directories where certain system headers and libraries are kept. +In a few cases, you may need to explicitly tell configure where to +find some things, or what options to use. + +`configure' creates a `Makefile' in several subdirectories, and a +`src/config.h' file containing system-dependent definitions. +Running the `make' utility then builds the package for your system. Here's the procedure to build Emacs using `configure' on systems which -are supported by it. If this simplified procedure fails, or if you -are using a platform such as MS-Windows, where `configure' script -doesn't work, you might need to use various non-default options, and -maybe perform some of the steps manually. The more detailed -description in the rest of the sections of this guide will help you do -that, so please refer to them if the simple procedure does not work. +are supported by it. In some cases, if the simplified procedure fails, +you might need to use various non-default options, and maybe perform +some of the steps manually. The more detailed description in the other +sections of this guide will help you do that, so please refer to those +sections if you need to. - 1. Make sure your system has at least 120 MB of free disk space. + 1. Unpacking the Emacs 23.2 release requires about 170 MB of free + disk space. Building Emacs uses about another 60 MB of space. + The final installed Emacs uses about 120 MB of disk space. + This includes the space-saving that comes from automatically + compressing the Lisp source files on installation. 2a. `cd' to the directory where you unpacked Emacs and invoke the `configure' script: @@ -42,8 +49,8 @@ that, so please refer to them if the simple procedure does not work. SOURCE-DIR/configure - where SOURCE-DIR is the top-level Emacs source directory. This - may not work unless you use GNU make. + where SOURCE-DIR is the top-level Emacs source directory. + This may not work unless you use GNU make. 3. When `configure' finishes, it prints several lines of details about the system configuration. Read those details carefully @@ -51,17 +58,18 @@ that, so please refer to them if the simple procedure does not work. system names, wrong places for headers or libraries, missing libraries that you know are installed on your system, etc. - If you find anything wrong, you will have to pass to `configure' - explicit machine configuration name, and one or more options - which tell it where to find various headers and libraries; refer - to DETAILED BUILDING AND INSTALLATION section below. + If you find anything wrong, you may have to pass to `configure' + one or more options specifying the explicit machine configuration + name, where to find various headers and libraries, etc. + Refer to the section DETAILED BUILDING AND INSTALLATION below. - If `configure' didn't find some image support libraries, such as - Xpm, jpeg, etc., and you want to use them refer to the subsection - "Image support libraries", below. + If `configure' didn't find some (optional) image support libraries, + such as Xpm, jpeg, etc., and you want to use them, refer to the + subsection "Image support libraries" below. If the details printed by `configure' don't make any sense to - you, assume that `configure' did its job and proceed. + you, but there are no obvious errors, assume that `configure' did + its job and proceed. 4. If you need to run the `configure' script more than once (e.g., with some non-default options), always clean the source @@ -78,7 +86,7 @@ that, so please refer to them if the simple procedure does not work. in the `src' directory. You can try this program, to make sure it works: - src/emacs -q + src/emacs -Q 7. Assuming that the program `src/emacs' starts and displays its opening screen, you can install the program and its auxiliary @@ -92,9 +100,13 @@ that, so please refer to them if the simple procedure does not work. make clean - You can also save some space by compressing (with `gzip') Info files - and installed Lisp source (.el) files which have corresponding .elc - versions. + You can delete the entire build directory if you do not plan to + build Emacs again, but it can be useful to keep for debugging. + + Note that the install automatically saves space by compressing + (provided you have the `gzip' program) those installed Lisp source (.el) + files that have corresponding .elc versions. You may also wish + to compress the installed Info files. ADDITIONAL DISTRIBUTION FILES @@ -156,19 +168,15 @@ download and build libraries from sources. None of them are vital for running Emacs; however, note that Emacs will not be able to use colored icons in the toolbar if XPM support is not compiled in. -Here's the list of these optional libraries, and the URLs where they -can be found: +Here's the list of some of these optional libraries, and the URLs +where they can be found (in the unlikely event that your distribution +does not provide them): - . libXaw3d for fancy 3D-style - scroll bars: ftp://ftp.x.org/contrib/widgets/Xaw3d/ - . libxpm for XPM: ftp://ftp.x.org/contrib/libraries/ - Get version 3.4k or later, which lets Emacs - use its own color allocation functions. - . libpng for PNG: ftp://ftp.simplesystems.org/pub/libpng/png/ + . libXaw3d http://directory.fsf.org/project/xaw3d/ + . libxpm for XPM: http://www.x.org/releases/current/src/lib/ + . libpng for PNG: http://www.libpng.org/ . libz (for PNG): http://www.zlib.net/ - . libjpeg for JPEG: ftp://ftp.uu.net/graphics/jpeg/ - Get version 6b -- 6a is reported to fail in - Emacs. + . libjpeg for JPEG: http://www.ijg.org/ . libtiff for TIFF: http://www.libtiff.org/ . libgif for GIF: http://sourceforge.net/projects/giflib/ @@ -177,34 +185,27 @@ Emacs will configure itself to build with these libraries if the appropriate --without-LIB option. In some cases, older versions of these libraries won't work because some routines are missing, and configure should avoid such old versions. If that happens, use the ---without-LIB options to `configure'. See below for more details. +--without-LIB options to `configure', if you need to. * Extra fonts The Emacs distribution does not include fonts and does not install -them. You must do that yourself. +them. If you need more fonts than your distribution normally provides, +you must install them yourself. Emacs running on the GNU system supports both X fonts and local fonts (i.e. the fonts managed by the fontconfig library). For `Unicode' (ISO 10646) X fonts, see (packaged in Debian), - (packaged in Debian). (In -recent Debian versions, there is an extensive `misc-fixed' iso10646-1 -in the default X installation.) Perhaps also see + (packaged in Debian). +(In recent Debian versions, there is an extensive `misc-fixed' +iso10646-1 in the default X installation.) Perhaps also see . has basic fonts for Emacs's ISO-8859 charsets. -XFree86 release 4 (from and mirrors) -contains font support for most, if not all, of the charsets that Emacs -currently supports, including iso10646-1 encoded fonts for use with -the mule-unicode charsets. The font files should also be usable with -older X releases. Note that XFree 4 contains many iso10646-1 fonts -with minimal character repertoires, which can cause problems -- see -etc/PROBLEMS. - BDF Unicode fonts etl-unicode.tar.gz are available from and . These @@ -216,22 +217,23 @@ lists a large number of free Unicode fonts. * GNU/Linux development packages -Many GNU/Linux systems do not come with development packages by -default; they just include the files that you need to run Emacs, but -not those you need to compile it. For example, to compile Emacs with -X11 support, you may need to install the special `X11 development' -package. For example, in April 2003, the package names to install -were `XFree86-devel' and `Xaw3d-devel' on Red Hat. On Debian, the -packages necessary to build the installed version should be -sufficient; they can be installed using `apt-get build-dep emacs21' in -Debian 3 and above. +Many GNU/Linux systems do not come with development packages by default; +they include the files that you need to run Emacs, but not those you +need to compile it. For example, to compile Emacs with support for X +and graphics libraries, you may need to install the `X development' +package(s), and development versions of the jpeg, png, etc. packages. + +The names of the packages that you need varies according to the +GNU/Linux distribution that you use, and the options that you want to +configure Emacs with. On Debian-based systems, you can install all the +packages needed to build the installed version of Emacs with a command +like `apt-get build-dep emacs23'. DETAILED BUILDING AND INSTALLATION: -(This is for a Unix or Unix-like system. For MS-DOS and Windows 3.X, -see msdos/INSTALL. For Windows 9X, Windows ME, Windows NT, Windows -2000, Windows XP/2003, and Windows Vista/2008, see the file +(This is for a Unix or Unix-like system. For MS-DOS and MS Windows 3.X, +see msdos/INSTALL. For later versions of MS Windows, see the file nt/INSTALL. For GNUstep and Mac OS X, see nextstep/INSTALL.) 1) Make sure your system has enough swapping space allocated to handle @@ -239,21 +241,20 @@ a program whose pure code is 1.5 MB and whose data area is at least 2.8 MB and can reach 100 MB or more. If the swapping space is insufficient, you will get an error in the command `temacs -batch -l loadup dump', found in `./src/Makefile.in', or possibly when -running the final dumped Emacs. +running the final dumped Emacs. (This should not be an issue +on any recent system.) -Building Emacs requires about 140 MB of disk space (including the -Emacs sources) Once installed, Emacs occupies about 77 MB in the file +Building Emacs requires about 230 MB of disk space (including the +Emacs sources). Once installed, Emacs occupies about 120 MB in the file system where it is installed; this includes the executable files, Lisp libraries, miscellaneous data files, and on-line documentation. If the building and installation take place in different directories, -then the installation procedure momentarily requires 140+77 MB. +then the installation procedure momentarily requires 230+120 MB. -2) Consult `./etc/MACHINES' to see what configuration name you should -give to the `configure' program. That file offers hints for -getting around some possible installation problems. The file lists -many different configurations, but only the part for your machine and -operating system is relevant. (The list is arranged in alphabetical -order by the vendor name.) +2) In the unlikely event that `configure' does not detect your system +type correctly, consult `./etc/MACHINES' to see what --host, --build +options you should pass to `configure'. That file also offers hints +for getting around some possible installation problems. 3) You can build Emacs in the top-level Emacs source directory or in a separate directory. @@ -261,15 +262,10 @@ or in a separate directory. 3a) To build in the top-level Emacs source directory, go to that directory and run the program `configure' as follows: - ./configure [CONFIGURATION-NAME] [--OPTION[=VALUE]] ... + ./configure [--OPTION[=VALUE]] ... -The CONFIGURATION-NAME argument should be a configuration name given -in `./etc/MACHINES', with the system version number added at the end. - -You should try first omitting CONFIGURATION-NAME. This way, -`configure' will try to guess your system type. If it cannot guess, -or if something goes wrong in building or installing Emacs this way, -try again specifying the proper CONFIGURATION-NAME explicitly. +If `configure' cannot determine your system type, try again +specifying the proper --build, --host options explicitly. If you don't want X support, specify `--with-x=no'. If you omit this option, `configure' will try to figure out for itself whether your @@ -284,20 +280,19 @@ accept a list of directories, separated with colons. To get more attractive menus, you can specify an X toolkit when you configure Emacs; use the option `--with-x-toolkit=TOOLKIT', where -TOOLKIT is `athena', `motif' or `gtk' (`yes' and `lucid' are synonyms -for `athena'). On some systems, it does not work to use a toolkit -with shared libraries. A free implementation of Motif, called -LessTif, is available from . Compiling with -LessTif or Motif causes a standard File Selection Dialog to pop up -when you invoke file commands with the mouse. You can get fancy -3D-style scroll bars, even without LessTif/Motif, if you have the -Xaw3d library installed (see "Image support libraries" above for Xaw3d -availability). +TOOLKIT is `gtk' (the default), `athena', or `motif' (`yes' and +`lucid' are synonyms for `athena'). On some systems, it does not work +to use a toolkit with shared libraries. A free implementation of +Motif, called LessTif, is available from . +Compiling with LessTif or Motif causes a standard File Selection +Dialog to pop up when you invoke file commands with the mouse. You +can get fancy 3D-style scroll bars, even without Gtk or LessTif/Motif, +if you have the Xaw3d library installed (see "Image support libraries" +above for Xaw3d availability). -If `--with-x-toolkit=gtk' is specified, you can tell configure where -to search for GTK by specifying `--with-pkg-config-prog=PATH' where -PATH is the pathname to pkg-config. Note that GTK version 2.4 or -newer is required for Emacs. +You can tell configure where to search for GTK by specifying +`--with-pkg-config-prog=PATH' where PATH is the pathname to +pkg-config. Note that GTK version 2.6 or newer is required for Emacs. The Emacs mail reader RMAIL is configured to be able to read mail from a POP3 server by default. Versions of the POP protocol older than @@ -324,10 +319,10 @@ or more of these options: Use --without-toolkit-scroll-bars to disable LessTif/Motif or Xaw3d scroll bars. -Use --without-xim to inhibit the default use of X Input Methods. In -this case, the X resource useXIM can be used to turn on use of XIM. +Use --without-xim to inhibit the default use of X Input Methods. +In this case, the X resource useXIM can be used to turn on use of XIM. -Use --disable-largefile omits support for files larger than 2GB on +Use --disable-largefile to omit support for files larger than 2GB on systems which support that. Use --without-sound to disable sound support. @@ -337,11 +332,11 @@ should put emacs and its data files. This defaults to `/usr/local'. - Emacs (and the other utilities users run) go in PREFIXDIR/bin (unless the `--exec-prefix' option says otherwise). - The architecture-independent files go in PREFIXDIR/share/emacs/VERSION - (where VERSION is the version number of Emacs, like `19.27'). + (where VERSION is the version number of Emacs, like `23.2'). - The architecture-dependent files go in PREFIXDIR/libexec/emacs/VERSION/CONFIGURATION - (where CONFIGURATION is the configuration name, like mips-dec-ultrix4.2), - unless the `--exec-prefix' option says otherwise. + (where CONFIGURATION is the configuration name, like + i686-pc-linux-gnu), unless the `--exec-prefix' option says otherwise. The `--exec-prefix=EXECDIR' option allows you to specify a separate portion of the directory tree for installing architecture-specific @@ -353,17 +348,16 @@ EXECDIR/bin should be a directory that is normally in users' PATHs. For example, the command - ./configure mips-dec-ultrix --with-x11 + ./configure --build=i386-linux-gnu --without-sound -configures Emacs to build for a DECstation running Ultrix, with -support for the X11 window system. +configures Emacs to build for a 32-bit GNU/Linux distribution, +without sound support. -`configure' doesn't do any compilation or installation -itself. It just creates the files that influence those things: -`./Makefile', `lib-src/Makefile', `oldXMenu/Makefile', -`lwlib/Makefile', `src/Makefile', and `./src/config.h'. For details -on exactly what it does, see the section called `CONFIGURATION BY -HAND', below. +`configure' doesn't do any compilation or installation itself. +It just creates the files that influence those things: +`./Makefile' in the top-level directory and several subdirectories; +and `./src/config.h'. For details on exactly what it does, see the +section called `CONFIGURATION BY HAND', below. When it is done, `configure' prints a description of what it did and creates a shell script `config.status' which, when run, recreates the @@ -405,7 +399,7 @@ shell such as Bash, which uses these variables: preprocessor to look in the `/foo/myinclude' directory for header files (in addition to the standard directories), instruct the linker to look in `/bar/mylib' for libraries, pass the -O3 optimization -switch to the compiler, and link against libfoo.a and libbar.a +switch to the compiler, and link against libfoo and libbar libraries in addition to the standard ones. For some libraries, like Gtk+, fontconfig and ALSA, `configure' uses @@ -435,14 +429,9 @@ Emacs source code in the directory that `configure' is in. To build in a separate directory, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. -3c) Some people try to build in a separate directory by filling -it full of symlinks to the files in the real source directory. -If you do that, `make all' does work, but `make install' fails: -it copies the symbolic links rather than the actual files. - -As far as is known, there is no particular reason to use -a directory full of links rather than use the standard GNU -facilities to build in a separate directory (see 3b above). +(Do not try to build in a separate directory by creating many links +to the real source directory--there is no need, and installation will +fail.) 4) Look at `./lisp/paths.el'; if some of those values are not right for your system, set up the file `./lisp/site-init.el' with Emacs @@ -453,7 +442,7 @@ rather than `defvar', as used by `./lisp/paths.el'. For example, (setq news-inews-program "/usr/bin/inews") is how you would override the default value of the variable -news-inews-program (which is "/usr/local/inews"). +news-inews-program. Before you override a variable this way, *look at the value* that the variable gets by default! Make sure you know what kind of value the @@ -472,18 +461,11 @@ 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 again. If you do this, you are on your own! -Note that, on some systems, the code you place in site-init.el must -not use expand-file-name or any other function which may look -something up in the system's password and user information database. -See `./etc/PROBLEMS' for more details on which systems this affects. - The `site-*.el' files are nonexistent in the distribution. You do not need to create them if you have nothing to put in them. 6) Refer to the file `./etc/TERMS' for information on fields you may -wish to add to various termcap entries. The files `./etc/termcap.ucb' -and `./etc/termcap.dat' may already contain appropriately-modified -entries. +wish to add to various termcap entries. (This is unlikely to be necessary.) 7) Run `make' in the top directory of the Emacs distribution to finish building Emacs in the standard way. The final executable file is @@ -497,11 +479,11 @@ are installed in the following directories: `/usr/local/bin' holds the executable programs users normally run - `emacs', `etags', `ctags', `b2m', `emacsclient', - and `rcs-checkin'. + `grep-changelog', and `rcs-checkin'. `/usr/local/share/emacs/VERSION/lisp' holds the Emacs Lisp library; `VERSION' stands for the number of the Emacs version - you are installing, like `18.59' or `19.27'. Since the + you are installing, like `23.1' or `23.2'. Since the Lisp library changes from one version of Emacs to another, including the version number in the path allows you to have several versions of Emacs installed @@ -509,18 +491,17 @@ are installed in the following directories: make Emacs unavailable while installing a new version. `/usr/local/share/emacs/VERSION/etc' holds the Emacs tutorial, the DOC - file, the `yow' database, and other - architecture-independent files Emacs might need while - running. VERSION is as specified for `.../lisp'. + file, and other architecture-independent files Emacs + might need while running. `/usr/local/libexec/emacs/VERSION/CONFIGURATION-NAME' contains executable programs used by Emacs that users are not expected to run themselves. `VERSION' is the number of the Emacs version you are - installing, and `CONFIGURATION-NAME' is the argument - you gave to the `configure' program to identify the + installing, and `CONFIGURATION-NAME' is the value + deduced by the `configure' program to identify the architecture and operating system of your machine, - like `mips-dec-ultrix' or `sparc-sun-sunos'. Since + like `i686-pc-linux-gnu' or `sparc-sun-sunos'. Since these files are specific to the version of Emacs, operating system, and architecture in use, including the configuration name in the path allows you to have @@ -532,10 +513,9 @@ are installed in the following directories: `/usr/local/share/info' holds the on-line documentation for Emacs, known as "info files". Many other GNU programs are documented using info files as well, so this directory - stands apart from the other, Emacs-specific - directories. + stands apart from the other, Emacs-specific directories. -`/usr/local/man/man1' holds the man pages for the programs installed +`/usr/local/share/man/man1' holds the man pages for the programs installed in `/usr/local/bin'. Any version of Emacs, whether installed or not, also looks for Lisp @@ -598,10 +578,9 @@ Here is a complete list of the variables you may want to set. defaults to /usr/local/share. We create the following subdirectories under `datadir': - `emacs/VERSION/lisp', containing the Emacs Lisp library, and - - `emacs/VERSION/etc', containing the Emacs tutorial, the DOC - file, and the `yow' database. + - `emacs/VERSION/etc', containing the tutorials, DOC file, etc. `VERSION' is the number of the Emacs version you are installing, - like `18.59' or `19.0'. Since these files vary from one version + like `23.1' or `23.2'. Since these files vary from one version of Emacs to another, including the version number in the path allows you to have several versions of Emacs installed at the same time; this means that you don't have to make Emacs @@ -614,29 +593,23 @@ Here is a complete list of the variables you may want to set. programs used by Emacs that users are not expected to run themselves. `VERSION' is the number of the Emacs version you are installing, - and `CONFIGURATION-NAME' is the argument you gave to the + and `CONFIGURATION-NAME' is the value deduced by the `configure' program to identify the architecture and operating - system of your machine, like `mips-dec-ultrix' or - `sparc-sun-sunos'. Since these files are specific to the version - of Emacs, operating system, and architecture in use, including - the configuration name in the path allows you to have several - versions of Emacs for any mix of machines and operating systems - installed at the same time; this is useful for sites at which - different kinds of machines share the file system Emacs is - installed on. + system of your machine, like `i686-pc-linux-gnu' or `sparc-sun-sunos'. + Since these files are specific to the version of Emacs, + operating system, and architecture in use, including the + configuration name in the path allows you to have several + versions of Emacs for any mix of machines and operating + systems installed at the same time; this is useful for sites + at which different kinds of machines share the file system + Emacs is installed on. `infodir' indicates where to put the info files distributed with Emacs; it defaults to `/usr/local/share/info'. `mandir' indicates where to put the man pages for Emacs and its utilities (like `etags'); it defaults to - `/usr/local/man/man1'. - -`manext' gives the extension the man pages should be installed with. - It should contain a period, followed by the appropriate - digit. It defaults to `.1'. For example given the default - values for `mandir' and `manext', the Emacs man page would be - installed as `/usr/local/man/man1/emacs.1'. + `/usr/local/share/man/man1'. `prefix' doesn't give a path for any specific part of Emacs; instead, its value is used to determine the defaults for all the @@ -658,7 +631,7 @@ Here is a complete list of the variables you may want to set. path variables - `bindir' and `libexecdir'. The above variables serve analogous purposes in the makefiles for all -GNU software; this variable is specific to Emacs. +GNU software; the following variable is specific to Emacs. `archlibdir' indicates where Emacs installs and expects the executable files and other architecture-dependent data it uses while @@ -674,7 +647,7 @@ settings persist, you can edit them into the `Makefile' in the top directory, but be aware that running the `configure' program erases `Makefile' and rebuilds it from `Makefile.in'. -The path for finding Lisp files is specified in src/paths.h, +The path for finding Lisp files is specified in src/epaths.h, a file which is generated by running configure. To change the path, you can edit the definition of PATH_LOADSEARCH in that file before you run `make'. @@ -686,8 +659,8 @@ when running make in the subdirectories. CONFIGURATION BY HAND -Instead of running the `configure' program, you have to perform the -following steps. +This should not be necessary and is not recommended. Instead of +running the `configure' program, you have to perform the following steps. 1) Copy `./src/config.in' to `./src/config.h'. @@ -701,8 +674,7 @@ the appropriate system and architecture description files. 2) Edit `./src/config.h' to set the right options for your system. If you need to override any of the definitions in the s/*.h and m/*.h files for your system and machine, do so by editing config.h, not by -changing the s/*.h and m/*.h files. Occasionally you may need to -redefine parameters used in `./lib-src/movemail.c'. +changing the s/*.h and m/*.h files. 3) Create src/Makefile and lib-src/Makefile from the corresponding `Makefile.in' files. First copy `Makefile.in' to `Makefile.c', @@ -710,28 +682,28 @@ then edit in appropriate substitutions for the @...@ constructs, and then copy the shell commands near the end of `configure' that run cpp to construct `Makefile'. -4) Create `Makefile' files in various other directories -from the corresponding `Makefile.in' files. This isn't so hard, -just a matter of substitution. +4) Create `Makefile' files in various other directories from the +corresponding `Makefile.in' files. This isn't so hard, just a matter +of editing in appropriate substitutions for the @...@ constructs. The `configure' script is built from `configure.in' by the `autoconf' -program. You need version 2.51 or newer of `autoconf' to rebuild -`configure'. +program. You need at least the version of autoconf specified in the +AC_PREREQ(...) command to rebuild `configure' from `configure.in'. BUILDING GNU EMACS BY HAND Once Emacs is configured, running `make' in the top directory performs the following steps. -1) Run `make src/paths.h' in the top directory. This produces -`./src/paths.h' from the template file `./src/paths.in', changing +1) Run `make epaths-force' in the top directory. This produces +`./src/epaths.h' from the template file `./src/epaths.in', changing the paths to the values specified in `./Makefile'. 2) Go to directory `./lib-src' and run `make'. This creates executables named `ctags' and `etags' and `make-docfile' and `digest-doc' and `test-distrib'. And others. -3) Go to directory `./src' and Run `make'. This refers to files in +3) Go to directory `./src' and run `make'. This refers to files in the `./lisp' and `./lib-src' subdirectories using names `../lisp' and `../lib-src'. @@ -743,8 +715,7 @@ It also creates a file in `./etc' whose name is `DOC' followed by the current Emacs version. This file contains documentation strings for all the functions in Emacs. Each time you run make to make a new emacs, a new DOC file with a new name is made. You must keep the DOC -file for an Emacs version as long as you keep using that Emacs -version. +file for an Emacs version as long as you keep using that Emacs version. INSTALLATION BY HAND @@ -753,7 +724,7 @@ The steps below are done by running `make install' in the main directory of the Emacs distribution. 1) Copy `./lisp' and its subdirectories, `./etc', and the executables -in `./lib-src' to their final destinations, as selected in `./src/paths.h'. +in `./lib-src' to their final destinations, as selected in `./src/epaths.h'. Strictly speaking, not all of the executables in `./lib-src' need be copied. - The programs `fakemail', `hexl', `movemail', `profile', `rcs2log', @@ -784,8 +755,7 @@ You can delete `./src/temacs'. `rcs-checkin' from `./lib-src' to `/usr/local/bin'. These programs are intended for users to run. -5) Copy the man pages in `./etc' for emacs, ctags, and etags into the -appropriate man directories. +5) Copy the man pages in `./doc/man' into the appropriate man directory. 6) The files in the `./src' subdirectory, except for `emacs', are not used by Emacs once it is built. However, it is very desirable to keep @@ -794,8 +764,8 @@ the source on line for debugging. PROBLEMS -See the file PROBLEMS in etc subdirectory for a list of various -problems sometimes encountered, and what to do about them. +See the file `./etc/PROBLEMS' for a list of various problems sometimes +encountered, and what to do about them. This file is part of GNU Emacs. From 04d3bb6ce4956982a5146f175ec44952edbe79c6 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 9 Jun 2010 22:04:06 -0700 Subject: [PATCH 02/36] Doc typo fixes. * doc/emacs/basic.texi (Inserting Text): Fix typo. * doc/misc/idlwave.texi (Load-Path Shadows): * doc/misc/org.texi (Handling links): Fix typos. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/basic.texi | 5 +++-- doc/misc/ChangeLog | 5 +++++ doc/misc/idlwave.texi | 2 +- doc/misc/org.texi | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 5551cc4a5e1..900f546fbdd 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2010-06-10 Glenn Morris + + * basic.texi (Inserting Text): Fix typo. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index ae04ebf9c41..a6424f0d37c 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -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 Basic, Minibuffer, Exiting, Top @chapter Basic Editing Commands @@ -104,7 +105,7 @@ character to insert (@pxref{Arguments}). @cindex Unicode Instead of @kbd{C-q}, you can use @kbd{C-x 8 @key{RET}} (@code{ucs-insert}) to insert a character based on its Unicode name or -code-point. This commands prompts for a character to insert, using +code-point. This command prompts for a character to insert, using the minibuffer; you can specify the character using either (i) the character's name in the Unicode standard, or (ii) the character's code-point in the Unicode standard. If you specify the character's diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 2294dc3a070..5518050fb7f 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2010-06-10 Glenn Morris + + * idlwave.texi (Load-Path Shadows): + * org.texi (Handling links): Fix typos. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi index 6292902aa99..94a2c2c6db7 100644 --- a/doc/misc/idlwave.texi +++ b/doc/misc/idlwave.texi @@ -3717,7 +3717,7 @@ C-i}. Here are the different routines (also available in the Menu @table @asis @item @kbd{M-x idlwave-list-buffer-load-path-shadows} -This commands checks the names of all routines defined in the current +This command checks the names of all routines defined in the current buffer for shadowing conflicts with other routines accessible to IDLWAVE. The command also has a key binding: @kbd{C-c C-b} @item @kbd{M-x idlwave-list-shell-load-path-shadows}. diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 507dfad5c31..4539c55ac64 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -2928,7 +2928,7 @@ link and description parts of the link. Open link at point. This will launch a web browser for URLs (using @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for the corresponding links, and execute the command in a shell link. When the -cursor is on an internal link, this commands runs the corresponding search. +cursor is on an internal link, this command runs the corresponding search. When the cursor is on a TAG list in a headline, it creates the corresponding TAGS view. If the cursor is on a timestamp, it compiles the agenda for that date. Furthermore, it will visit text and remote files in @samp{file:} links From 103dd3a81a88539029038804d5444f71ed6ab514 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 9 Jun 2010 22:09:27 -0700 Subject: [PATCH 03/36] * doc/emacs/basic.texi (Inserting Text): Minor clarification. (Bug#6374) --- doc/emacs/ChangeLog | 2 ++ doc/emacs/basic.texi | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 900f546fbdd..5e434b5e6c1 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,5 +1,7 @@ 2010-06-10 Glenn Morris + * basic.texi (Inserting Text): Minor clarification. (Bug#6374) + * basic.texi (Inserting Text): Fix typo. 2010-05-07 Chong Yidong diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index a6424f0d37c..6204fb1be03 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -93,9 +93,9 @@ of overwriting with it. @vindex read-quoted-char-radix @noindent To use decimal or hexadecimal instead of octal, set the variable -@code{read-quoted-char-radix} to 10 or 16. If the radix is greater -than 10, some letters starting with @kbd{a} serve as part of a -character code, just like digits. +@code{read-quoted-char-radix} to 10 or 16. If the radix is 16, +the letters @kbd{a} to @kbd{f} serve as part of a character code, +just like digits. Case is ignored. A numeric argument tells @kbd{C-q} how many copies of the quoted character to insert (@pxref{Arguments}). From 37a7e764e86838d21d72dc03d0c42e076cf3e7ea Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Sat, 12 Jun 2010 00:06:15 -0700 Subject: [PATCH 04/36] Close bug#6408. * lisp/emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote', used by cl-do-arglist. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/cl-macs.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d193663ed09..1de8e4af69b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-12 Helmut Eller + + * emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote', + used by cl-do-arglist. (Bug#6408) + 2010-06-09 Stefan Monnier * emacs-lisp/advice.el (ad-compile-function): diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 8a60ffdf1fe..3e800c53008 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -432,7 +432,7 @@ It is a list of elements of the form either: ;;;###autoload (defmacro destructuring-bind (args expr &rest body) (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil) - (bind-defs nil) (bind-block 'cl-none)) + (bind-defs nil) (bind-block 'cl-none) (bind-enquote nil)) (cl-do-arglist (or args '(&aux)) expr) (append '(progn) bind-inits (list (nconc (list 'let* (nreverse bind-lets)) From 6955432c9f1efc386ff544162afdf7163ee101b7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 12 Jun 2010 00:09:32 -0700 Subject: [PATCH 05/36] * etc/tutorials/TUTORIAL.bg, etc/tutorials/TUTORIAL.es: Fix typos. --- etc/ChangeLog | 4 ++++ etc/tutorials/TUTORIAL.bg | 2 +- etc/tutorials/TUTORIAL.es | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 96a5a85f325..395c77b02d3 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2010-06-12 Glenn Morris + + * tutorials/TUTORIAL.bg, tutorials/TUTORIAL.es: Fix typos. + 2010-05-19 Stefan Monnier * NEWS: Add sections for Emacs-23.3. diff --git a/etc/tutorials/TUTORIAL.bg b/etc/tutorials/TUTORIAL.bg index 3f8ea6e2c45..e8300d26653 100644 --- a/etc/tutorials/TUTORIAL.bg +++ b/etc/tutorials/TUTORIAL.bg @@ -625,7 +625,7 @@ C-f. Åìàêñ ñåñèÿòà. >> Âúâåäåòå C-x b *Messages* , çà äà âèäèòå áóôåðà ñúñ - ñúîáùåíèÿòà. Ñëåä òîâà âúâåäåòå C-x C-b TUTORIAL , çà äà + ñúîáùåíèÿòà. Ñëåä òîâà âúâåäåòå C-x b TUTORIAL , çà äà ñå âúðíåòå êúì òîâà âúâåäåíèå. Àêî íàïðàâèòå ïðîìåíè â òåêñòà íà åäèí ôàéë è òîãàâà íàìåðèòå äðóã diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es index 1af1b97537c..7fb7ac2c2a3 100644 --- a/etc/tutorials/TUTORIAL.es +++ b/etc/tutorials/TUTORIAL.es @@ -630,7 +630,7 @@ contiene los mensajes que han aparecido en la l su sesión de Emacs. >> Teclee C-x b *Messages* para ver el buffer de mensajes. - Luego teclee C-b TUTORIAL para regresar a este tutorial. + Luego teclee C-x b TUTORIAL para regresar a este tutorial. Si hace cambios al texto de un archivo, y luego encuentra otro archivo, esto no guarda el primer archivo. Sus cambios permanecerán From 7fb277a9f0bad84a19e8bf748d3bc6a3b7cc140c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Sat, 12 Jun 2010 00:25:20 -0700 Subject: [PATCH 06/36] Close bug#6406. * lisp/url/url-vars.el (url-privacy-level): Fix doc typo. --- lisp/url/ChangeLog | 4 ++++ lisp/url/url-vars.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 232259f39ea..c6f07fec2c0 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,7 @@ +2010-06-12 Å tÄ›pán NÄ›mec (tiny change) + + * url-vars.el (url-privacy-level): Fix doc typo. (Bug#6406) + 2010-05-19 Stefan Monnier * url-util.el (url-unhex-string): Don't accidentally decode as latin-1. diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 2062f482ede..c7df921f585 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -128,7 +128,7 @@ email -- the email address os -- the operating system info lastloc -- the last location agent -- do not send the User-Agent string -cookie -- never accept HTTP cookies +cookies -- never accept HTTP cookies Samples: From a9de35feef40cef53f6205628cf8a8ebe9b0c99b Mon Sep 17 00:00:00 2001 From: Bob Rogers Date: Sat, 12 Jun 2010 00:34:36 -0700 Subject: [PATCH 07/36] Close bug#6361. * lisp/vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions older than version 1.6. --- lisp/ChangeLog | 5 +++++ lisp/vc-svn.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1de8e4af69b..903c0d46f86 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-12 Bob Rogers (tiny change) + + * vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions + older than version 1.6. (Bug#6361) + 2010-06-12 Helmut Eller * emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote', diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 6883556f249..34ebc3bb949 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -170,7 +170,7 @@ want to force an empty list of arguments, use t." (?? . unregistered) ;; This is what vc-svn-parse-status does. (?~ . edited))) - (re (if remote "^\\(.\\)...... \\([ *]\\) +\\(?:[-0-9]+\\)? \\(.*\\)$" + (re (if remote "^\\(.\\)......? \\([ *]\\) +\\(?:[-0-9]+\\)? \\(.*\\)$" ;; Subexp 2 is a dummy in this case, so the numbers match. "^\\(.\\)....\\(.\\) \\(.*\\)$")) result) From 77d7d2aea45164ca9b5f63056c2f6f73950858f9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 12 Jun 2010 13:21:01 -0400 Subject: [PATCH 08/36] * INSTALL: Update font information (Bug#6389). --- ChangeLog | 4 ++++ INSTALL | 29 ++++++----------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92b618c1cd9..1612b8bd299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-12 Chong Yidong + + * INSTALL: Update font information (Bug#6389). + 2010-06-10 Glenn Morris * INSTALL: General update. diff --git a/INSTALL b/INSTALL index 0fd77ea045e..005aac08d87 100644 --- a/INSTALL +++ b/INSTALL @@ -190,30 +190,13 @@ configure should avoid such old versions. If that happens, use the * Extra fonts The Emacs distribution does not include fonts and does not install -them. If you need more fonts than your distribution normally provides, -you must install them yourself. +them. -Emacs running on the GNU system supports both X fonts and local fonts -(i.e. the fonts managed by the fontconfig library). - -For `Unicode' (ISO 10646) X fonts, see - (packaged in Debian), - (packaged in Debian). -(In recent Debian versions, there is an extensive `misc-fixed' -iso10646-1 in the default X installation.) Perhaps also see -. - - has basic fonts for Emacs's -ISO-8859 charsets. - -BDF Unicode fonts etl-unicode.tar.gz are available from - and -. These -fonts can also be used by ps-print and ps-mule to print Unicode -characters. - -Finally, the Web page -lists a large number of free Unicode fonts. +On the GNU system, Emacs supports both X fonts and local fonts +(i.e. fonts managed by the fontconfig library). If you need more +fonts than your distribution normally provides, you must install them +yourself. See for a large +number of free Unicode fonts. * GNU/Linux development packages From 8c3a217f33026350610772132291a62ed866b1bf Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 14 Jun 2010 01:33:06 +0200 Subject: [PATCH 09/36] * src/makefile.w32-in ($(BLD)/bidi.$(O)): Keep dependencies sorted. --- src/makefile.w32-in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/makefile.w32-in b/src/makefile.w32-in index ca2bb13b972..e8d08727915 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -341,11 +341,11 @@ $(BLD)/bidi.$(O) : \ $(SRC)/bidi.c \ $(CONFIG_H) \ $(SRC)/lisp.h \ + $(SRC)/bidimirror.h \ + $(SRC)/biditype.h \ $(SRC)/buffer.h \ $(SRC)/character.h \ $(SRC)/dispextern.h \ - $(SRC)/biditype.h \ - $(SRC)/bidimirror.h \ $(SRC)/w32gui.h $(BLD)/buffer.$(O) : \ From b263a4c43f492f50e0201c6656033b1e54224d54 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 13 Jun 2010 21:43:11 -0400 Subject: [PATCH 10/36] * lisp/nxml/nxml-mode.el (nxml-indent-line): Standardize indent behavior. Fixes: debbugs:6412 --- lisp/ChangeLog | 4 ++++ lisp/nxml/nxml-mode.el | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c33ed04e0c2..cae64856263 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-14 Stefan Monnier + + * nxml/nxml-mode.el (nxml-indent-line): Standardize indent behavior. + 2010-06-12 Chong Yidong * term/common-win.el (x-colors): Add all the color names defined diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 101b2585186..b428d8bf224 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -1370,17 +1370,21 @@ of the inserted start-tag or nil if none was inserted." (defun nxml-indent-line () "Indent current line as XML." - (let ((indent (nxml-compute-indent)) - (from-end (- (point-max) (point)))) - (when (and indent - (/= indent (current-indentation))) - (beginning-of-line) - (let ((bol (point))) - (skip-chars-forward " \t") - (delete-region bol (point))) - (indent-to indent) - (when (> (- (point-max) from-end) (point)) - (goto-char (- (point-max) from-end)))))) + (let* ((savep (point)) + (indent (condition-case nil + (save-excursion + (forward-line 0) + (skip-chars-forward " \t") + (if (>= (point) savep) (setq savep nil)) + (or (nxml-compute-indent) 0)) + (error 0)))) + (if (not (numberp indent)) + ;; If something funny is used (e.g. `noindent'), return it. + indent + (if (< indent 0) (setq indent 0)) ;Just in case. + (if savep + (save-excursion (indent-line-to indent)) + (indent-line-to indent))))) (defun nxml-compute-indent () "Return the indent for the line containing point." From d8b0cdddb3c1e4555a50423a9b69234f55fc8f9b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 13 Jun 2010 23:19:46 -0400 Subject: [PATCH 11/36] * lisp/image-mode.el (image-mode-map): Remap left-char and right-char. --- lisp/ChangeLog | 2 ++ lisp/image-mode.el | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cae64856263..49e1ee9fc6a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-06-14 Stefan Monnier + * image-mode.el (image-mode-map): Remap left-char and right-char. + * nxml/nxml-mode.el (nxml-indent-line): Standardize indent behavior. 2010-06-12 Chong Yidong diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 04a81f9038e..585d82e9beb 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -298,6 +298,8 @@ This variable is used to display the current image type in the mode line.") (define-key map (kbd "DEL") 'image-scroll-down) (define-key map [remap forward-char] 'image-forward-hscroll) (define-key map [remap backward-char] 'image-backward-hscroll) + (define-key map [remap right-char] 'image-forward-hscroll) + (define-key map [remap left-char] 'image-backward-hscroll) (define-key map [remap previous-line] 'image-previous-line) (define-key map [remap next-line] 'image-next-line) (define-key map [remap scroll-up] 'image-scroll-up) From c42fe9a55d2356f509ea38e6de6fcec95fd6ac63 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 14 Jun 2010 18:48:52 +0300 Subject: [PATCH 12/36] * compare-w.el: Move to the "vc" subdirectory. --- lisp/ChangeLog | 4 ++++ lisp/{ => vc}/compare-w.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) rename lisp/{ => vc}/compare-w.el (99%) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 49e1ee9fc6a..1afc00e9214 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-14 Juri Linkov + + * compare-w.el: Move to the "vc" subdirectory. + 2010-06-14 Stefan Monnier * image-mode.el (image-mode-map): Remap left-char and right-char. diff --git a/lisp/compare-w.el b/lisp/vc/compare-w.el similarity index 99% rename from lisp/compare-w.el rename to lisp/vc/compare-w.el index 866c6e3e4f8..6e2ab7327de 100644 --- a/lisp/compare-w.el +++ b/lisp/vc/compare-w.el @@ -4,7 +4,7 @@ ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Maintainer: FSF -;; Keywords: convenience files +;; Keywords: convenience files vc ;; This file is part of GNU Emacs. From f0bf7c8e5525fb4f964530c17399c3c987a79927 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 14 Jun 2010 19:03:04 +0300 Subject: [PATCH 13/36] Add sort option `list-colors-sort'. (Bug#6332) * lisp/facemenu.el (color-rgb-to-hsv): New function. (list-colors-sort): New defcustom. (list-colors-sort-key): New function. (list-colors-display): Doc fix. Sort list according to the option `list-colors-sort'. (list-colors-print): Add HSV values to `help-echo' property of RGB strings. --- etc/NEWS | 3 ++ lisp/ChangeLog | 11 +++++ lisp/facemenu.el | 110 +++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 120 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index e9d29c9ea87..60de0a286f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -125,6 +125,9 @@ trashing. This avoids inadvertently trashing temporary files. *** Calling `delete-file' or `delete-directory' with a prefix argument now forces true deletion, regardless of `delete-by-moving-to-trash'. +** New option `list-colors-sort' defines the color sort order +for `list-colors-display'. + * Editing Changes in Emacs 24.1 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1afc00e9214..e7303f63f00 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2010-06-14 Juri Linkov + + Add sort option `list-colors-sort'. (Bug#6332) + * facemenu.el (color-rgb-to-hsv): New function. + (list-colors-sort): New defcustom. + (list-colors-sort-key): New function. + (list-colors-display): Doc fix. Sort list according to the option + `list-colors-sort'. + (list-colors-print): Add HSV values to `help-echo' property of + RGB strings. + 2010-06-14 Juri Linkov * compare-w.el: Move to the "vc" subdirectory. diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 187383d44e2..9e8299720a6 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -479,6 +479,73 @@ These special properties include `invisible', `intangible' and `read-only'." nil col))) +(defun color-rgb-to-hsv (r g b) + "For R, G, B color components return a list of hue, saturation, value. +R, G, B input values should be in [0..65535] range. +Output values for hue are integers in [0..360] range. +Output values for saturation and value are integers in [0..100] range." + (let* ((r (/ r 65535.0)) + (g (/ g 65535.0)) + (b (/ b 65535.0)) + (max (max r g b)) + (min (min r g b)) + (h (cond ((= max min) 0) + ((= max r) (mod (+ (* 60 (/ (- g b) (- max min))) 360) 360)) + ((= max g) (+ (* 60 (/ (- b r) (- max min))) 120)) + ((= max b) (+ (* 60 (/ (- r g) (- max min))) 240)))) + (s (cond ((= max 0) 0) + (t (- 1 (/ min max))))) + (v max)) + (list (round h) (round s 0.01) (round v 0.01)))) + +(defcustom list-colors-sort nil + "Color sort order for `list-colors-display'. +`nil' means default implementation-dependent order (defined in `x-colors'). +`name' sorts by color name. +`rgb' sorts by red, green, blue components. +`rgb-dist' sorts by the RGB distance to the specified color. +`hsv' sorts by hue, saturation, value. +`hsv-dist' sorts by the HVS distance to the specified color +and excludes grayscale colors." + :type '(choice (const :tag "Unsorted" nil) + (const :tag "Color Name" name) + (const :tag "Red-Green-Blue" rgb) + (cons :tag "Distance on RGB cube" + (const :tag "Distance from Color" rgb-dist) + (color :tag "Source Color Name")) + (const :tag "Hue-Saturation-Value" hsv) + (cons :tag "Distance on HSV cylinder" + (const :tag "Distance from Color" hsv-dist) + (color :tag "Source Color Name"))) + :group 'facemenu + :version "24.1") + +(defun list-colors-sort-key (color) + "Return a list of keys for sorting colors depending on `list-colors-sort'. +COLOR is the name of the color. When return value is nil, +filter out the color from the output." + (cond + ((null list-colors-sort) color) + ((eq list-colors-sort 'name) + (downcase color)) + ((eq list-colors-sort 'rgb) + (color-values color)) + ((eq (car-safe list-colors-sort) 'rgb-dist) + (color-distance color (cdr list-colors-sort))) + ((eq list-colors-sort 'hsv) + (apply 'color-rgb-to-hsv (color-values color))) + ((eq (car-safe list-colors-sort) 'hsv-dist) + (let* ((c-rgb (color-values color)) + (c-hsv (apply 'color-rgb-to-hsv c-rgb)) + (o-hsv (apply 'color-rgb-to-hsv + (color-values (cdr list-colors-sort))))) + (unless (and (eq (nth 0 c-rgb) (nth 1 c-rgb)) ; exclude grayscale + (eq (nth 1 c-rgb) (nth 2 c-rgb))) + ;; 3D Euclidean distance (sqrt is not needed for sorting) + (+ (expt (- 180 (abs (- 180 (abs (- (nth 0 c-hsv) ; wrap hue + (nth 0 o-hsv)))))) 2) + (expt (- (nth 1 c-hsv) (nth 1 o-hsv)) 2) + (expt (- (nth 2 c-hsv) (nth 2 o-hsv)) 2))))))) (defun list-colors-display (&optional list buffer-name callback) "Display names of defined colors, and show what they look like. @@ -492,10 +559,38 @@ If the optional argument BUFFER-NAME is nil, it defaults to If the optional argument CALLBACK is non-nil, it should be a function to call each time the user types RET or clicks on a color. The function should accept a single argument, the color -name." +name. + +You can change the color sort order by customizing `list-colors-sort'." (interactive) (when (and (null list) (> (display-color-cells) 0)) (setq list (list-colors-duplicates (defined-colors))) + (when list-colors-sort + ;; Schwartzian transform with `(color key1 key2 key3 ...)'. + (setq list (mapcar + 'car + (sort (delq nil (mapcar + (lambda (c) + (let ((key (list-colors-sort-key + (car c)))) + (when key + (cons c (if (consp key) key + (list key)))))) + list)) + (lambda (a b) + (let* ((a-keys (cdr a)) + (b-keys (cdr b)) + (a-key (car a-keys)) + (b-key (car b-keys))) + ;; Skip common keys at the beginning of key lists. + (while (and a-key b-key (equal a-key b-key)) + (setq a-keys (cdr a-keys) a-key (car a-keys) + b-keys (cdr b-keys) b-key (car b-keys))) + (cond + ((and (numberp a-key) (numberp b-key)) + (< a-key b-key)) + ((and (stringp a-key) (stringp b-key)) + (string< a-key b-key))))))))) (when (memq (display-visual-class) '(gray-scale pseudo-color direct-color)) ;; Don't show more than what the display can handle. (let ((lc (nthcdr (1- (display-color-cells)) list))) @@ -550,9 +645,16 @@ name." (point) 'face (list :foreground (car color))) (indent-to (max (- (window-width) 8) 44)) - (insert (apply 'format "#%02x%02x%02x" - (mapcar (lambda (c) (lsh c -8)) - color-values))) + (insert (propertize + (apply 'format "#%02x%02x%02x" + (mapcar (lambda (c) (lsh c -8)) + color-values)) + 'mouse-face 'highlight + 'help-echo + (let ((hsv (apply 'color-rgb-to-hsv + (color-values (car color))))) + (format "H:%d S:%d V:%d" + (nth 0 hsv) (nth 1 hsv) (nth 2 hsv))))) (when callback (make-text-button opoint (point) From b15922cc08bcd2c699b6b9123495851371f34aee Mon Sep 17 00:00:00 2001 From: Bob Rogers Date: Mon, 14 Jun 2010 20:34:12 -0700 Subject: [PATCH 14/36] * lisp/progmodes/sql.el (sql-connect-mysql): Fix typo. --- lisp/ChangeLog | 4 ++++ lisp/progmodes/sql.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e7303f63f00..3ab7fe35140 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-15 Bob Rogers (tiny change) + + * progmodes/sql.el (sql-connect-mysql): Fix typo. + 2010-06-14 Juri Linkov Add sort option `list-colors-sort'. (Bug#6332) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index e4df102f542..19e60da7ea2 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -3119,7 +3119,7 @@ The default comes from `process-coding-system-alist' and (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))) + (if (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))) From a675c749113b67eaf83ffab14f536c284614926b Mon Sep 17 00:00:00 2001 From: Ivan Kanis Date: Mon, 14 Jun 2010 20:38:58 -0700 Subject: [PATCH 15/36] Close bug#5176. * lisp/calendar/appt.el (appt-check): Let the 3rd element of appt-time-msg-list specify the warning time. (appt-add): Add new argument with the warning time. --- lisp/ChangeLog | 6 ++++++ lisp/calendar/appt.el | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 903c0d46f86..7ddd2325882 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-06-15 Ivan Kanis + + * calendar/appt.el (appt-check): Let the 3rd element of + appt-time-msg-list specify the warning time. + (appt-add): Add new argument with the warning time. (Bug#5176) + 2010-06-12 Bob Rogers (tiny change) * vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index b403b7043d8..4ccdaac5264 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -353,6 +353,8 @@ displayed in a window: ;; calculate the number of minutes until the appointment. (when (and appt-issue-message appt-time-msg-list) (setq appt-comp-time (caar (car appt-time-msg-list)) + appt-warn-time (or (nth 3 (car appt-time-msg-list)) + appt-message-warning-time) min-to-app (- appt-comp-time cur-comp-time)) (while (and appt-time-msg-list (< appt-comp-time cur-comp-time)) @@ -360,21 +362,21 @@ displayed in a window: (if appt-time-msg-list (setq appt-comp-time (caar (car appt-time-msg-list))))) ;; If we have an appointment between midnight and - ;; `appt-message-warning-time' minutes after midnight, we + ;; `appt-warn-time' minutes after midnight, we ;; must begin to issue a message before midnight. Midnight ;; is considered 0 minutes and 11:59pm is 1439 ;; minutes. Therefore we must recalculate the minutes to ;; appointment variable. It is equal to the number of ;; minutes before midnight plus the number of minutes after ;; midnight our appointment is. - (if (and (< appt-comp-time appt-message-warning-time) - (> (+ cur-comp-time appt-message-warning-time) + (if (and (< appt-comp-time appt-warn-time) + (> (+ cur-comp-time appt-warn-time) appt-max-time)) (setq min-to-app (+ (- (1+ appt-max-time) cur-comp-time) appt-comp-time))) ;; Issue warning if the appointment time is within ;; appt-message-warning time. - (when (and (<= min-to-app appt-message-warning-time) + (when (and (<= min-to-app appt-warn-time) (>= min-to-app 0)) (setq appt-now-displayed t appt-display-count (1+ prev-appt-display-count)) @@ -470,14 +472,20 @@ Usually just deletes the appointment buffer." "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?") ;;;###autoload -(defun appt-add (new-appt-time new-appt-msg) +(defun appt-add (new-appt-time new-appt-msg new-appt-warning-time) "Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG. The time should be in either 24 hour format or am/pm format." - (interactive "sTime (hh:mm[am/pm]): \nsMessage: ") + (interactive "sTime (hh:mm[am/pm]): \nsMessage: +sDelay in minutes (press return for default): ") (unless (string-match appt-time-regexp new-appt-time) (error "Unacceptable time-string")) + (setq new-appt-warning-time + (if (string= new-appt-warning-time "") + appt-message-warning-time + (string-to-number new-appt-warning-time))) (let ((time-msg (list (list (appt-convert-time new-appt-time)) - (concat new-appt-time " " new-appt-msg) t))) + (concat new-appt-time " " new-appt-msg) t + new-appt-warning-time))) (unless (member time-msg appt-time-msg-list) (setq appt-time-msg-list (appt-sort-list (nconc appt-time-msg-list (list time-msg))))))) From d7cd4abb48010f908bfb2109a020edab65d18e8e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 14 Jun 2010 20:42:33 -0700 Subject: [PATCH 16/36] Tweak previous change. * lisp/calendar/appt.el (appt-time-msg-list): Doc fix. (appt-check): Let-bind appt-warn-time. (appt-add): Make the 3rd argument optional. Simplify argument names. Doc fix. Check for integer WARNTIME. Only add WARNTIME to the output list if non-nil. --- lisp/ChangeLog | 8 +++++++ lisp/calendar/appt.el | 53 ++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ddd2325882..f3aff53e1b3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2010-06-15 Glenn Morris + + * calendar/appt.el (appt-time-msg-list): Doc fix. + (appt-check): Let-bind appt-warn-time. + (appt-add): Make the 3rd argument optional. + Simplify argument names. Doc fix. Check for integer WARNTIME. + Only add WARNTIME to the output list if non-nil. + 2010-06-15 Ivan Kanis * calendar/appt.el (appt-check): Let the 3rd element of diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index 4ccdaac5264..7fcaab9da34 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -183,16 +183,25 @@ Only relevant if reminders are being displayed in a window." (defconst appt-buffer-name "*appt-buf*" "Name of the appointments buffer.") +;; TODO Turn this into an alist? It would be easier to add more +;; optional elements. +;; TODO There should be a way to set WARNTIME (and other properties) +;; from the diary-file. Implementing that would be a good reason +;; to change this to an alist. (defvar appt-time-msg-list nil "The list of appointments for today. Use `appt-add' and `appt-delete' to add and delete appointments. The original list is generated from today's `diary-entries-list', and can be regenerated using the function `appt-check'. -Each element of the generated list has the form (MINUTES STRING [FLAG]); where -MINUTES is the time in minutes of the appointment after midnight, and -STRING is the description of the appointment. -FLAG, if non-nil, says that the element was made with `appt-add' -so calling `appt-make-list' again should preserve it.") +Each element of the generated list has the form +\(MINUTES STRING [FLAG] [WARNTIME]) +where MINUTES is the time in minutes of the appointment after midnight, +and STRING is the description of the appointment. +FLAG and WARNTIME can only be present if the element was made +with `appt-add'. A non-nil FLAG indicates that the element was made +with `appt-add', so calling `appt-make-list' again should preserve it. +If WARNTIME is non-nil, it is an integer to use in place +of `appt-message-warning-time'.") (defconst appt-max-time (1- (* 24 60)) "11:59pm in minutes - number of minutes in a day minus 1.") @@ -313,7 +322,7 @@ displayed in a window: (zerop (mod prev-appt-display-count appt-display-interval)))) ;; Non-nil means only update the interval displayed in the mode line. (mode-line-only (unless full-check appt-now-displayed)) - now cur-comp-time appt-comp-time) + now cur-comp-time appt-comp-time appt-warn-time) (when (or full-check mode-line-only) (save-excursion ;; Convert current time to minutes after midnight (12.01am = 1). @@ -472,20 +481,28 @@ Usually just deletes the appointment buffer." "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?") ;;;###autoload -(defun appt-add (new-appt-time new-appt-msg new-appt-warning-time) - "Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG. -The time should be in either 24 hour format or am/pm format." +(defun appt-add (time msg &optional warntime) + "Add an appointment for today at TIME with message MSG. +The time should be in either 24 hour format or am/pm format. +Optional argument WARNTIME is an integer (or string) giving the number +of minutes before the appointment at which to start warning. +The default is `appt-message-warning-time'." (interactive "sTime (hh:mm[am/pm]): \nsMessage: -sDelay in minutes (press return for default): ") - (unless (string-match appt-time-regexp new-appt-time) +sMinutes before the appointment to start warning: ") + (unless (string-match appt-time-regexp time) (error "Unacceptable time-string")) - (setq new-appt-warning-time - (if (string= new-appt-warning-time "") - appt-message-warning-time - (string-to-number new-appt-warning-time))) - (let ((time-msg (list (list (appt-convert-time new-appt-time)) - (concat new-appt-time " " new-appt-msg) t - new-appt-warning-time))) + (and (stringp warntime) + (setq warntime (unless (string-equal warntime "") + (string-to-number warntime)))) + (and warntime + (not (integerp warntime)) + (error "Argument WARNTIME must be an integer, or nil")) + (let ((time-msg (list (list (appt-convert-time time)) + (concat time " " msg) t))) + ;; It is presently non-sensical to have multiple warnings about + ;; the same appointment with just different delays, but it might + ;; not always be so. TODO + (if warntime (setq time-msg (append time-msg (list warntime)))) (unless (member time-msg appt-time-msg-list) (setq appt-time-msg-list (appt-sort-list (nconc appt-time-msg-list (list time-msg))))))) From 95344a11bf9cc3a26985892bba37176dd0972a04 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 14 Jun 2010 20:49:39 -0700 Subject: [PATCH 17/36] * etc/NEWS: appt-add. --- etc/NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 9124fe1c069..74291bab8ab 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -27,6 +27,10 @@ with a prefix argument or by typing C-u C-h C-n. * Changes in Specialized Modes and Packages in Emacs 23.3 +--- +** The appt-add command takes an optional argument for the warning time. +This can be used in place of the default appt-message-warning-time. + * New Modes and Packages in Emacs 23.3 From 12755d08466fd26fcba7d9b9c7ed4f466f4ad2ca Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 15 Jun 2010 00:51:42 -0400 Subject: [PATCH 18/36] * lisp/vc-annotate.el (vc-annotate): Use vc-read-revision. --- lisp/ChangeLog | 4 ++++ lisp/vc-annotate.el | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f3aff53e1b3..6e8ba492710 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-15 Stefan Monnier + + * vc-annotate.el (vc-annotate): Use vc-read-revision. + 2010-06-15 Glenn Morris * calendar/appt.el (appt-time-msg-list): Doc fix. diff --git a/lisp/vc-annotate.el b/lisp/vc-annotate.el index 71839443553..437081293cb 100644 --- a/lisp/vc-annotate.el +++ b/lisp/vc-annotate.el @@ -315,7 +315,7 @@ use; you may override this using the second optional arg MODE." ;;;###autoload (defun vc-annotate (file rev &optional display-mode buf move-point-to) - "Display the edit history of the current file using colors. + "Display the edit history of the current FILE using colors. This command creates a buffer that shows, for each line of the current file, when it was last edited and by whom. Additionally, colors are @@ -325,7 +325,7 @@ default, the time scale stretches back one year into the past; everything that is older than that is shown in blue. With a prefix argument, this command asks two questions in the -minibuffer. First, you may enter a revision number; then the buffer +minibuffer. First, you may enter a revision number REV; then the buffer displays and annotates that revision instead of the working revision \(type RET in the minibuffer to leave that default unchanged). Then, you are prompted for the time span in days which the color range @@ -347,9 +347,9 @@ mode-specific menu. `vc-annotate-color-map' and (list buffer-file-name (let ((def (vc-working-revision buffer-file-name))) (if (null current-prefix-arg) def - (read-string + (vc-read-revision (format "Annotate from revision (default %s): " def) - nil nil def))) + (list buffer-file-name) nil def))) (if (null current-prefix-arg) vc-annotate-display-mode (float (string-to-number From 6fda6a0c40b45d210f94d3593a66d16003238835 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 14 Jun 2010 23:16:19 -0700 Subject: [PATCH 19/36] Backport from trunk: * src/editfns.c (Fbyte_to_string): Pacify compiler. --- src/ChangeLog | 4 ++++ src/editfns.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 35d68ae2599..26c95ae77ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-06-15 Glenn Morris + + * editfns.c (Fbyte_to_string): Pacify compiler. + 2010-06-09 Stefan Monnier * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string. diff --git a/src/editfns.c b/src/editfns.c index caac2c5c199..ea279a462f2 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1,7 +1,8 @@ /* Lisp functions pertaining to editing. - Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -225,8 +226,9 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, (byte) Lisp_Object byte; { + unsigned char b; CHECK_NUMBER (byte); - unsigned char b = XINT (byte); + b = XINT (byte); return make_string_from_bytes (&b, 1, 1); } From 8fd02581c8d7d4e6a14aa666304308f41940dba4 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 15 Jun 2010 13:05:06 +0200 Subject: [PATCH 20/36] * facemenu.el (list-colors-sort): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/facemenu.el | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ab7fe35140..f1c83da671a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-15 Juanma Barranquero + + * facemenu.el (list-colors-sort): Doc fix. + 2010-06-15 Bob Rogers (tiny change) * progmodes/sql.el (sql-connect-mysql): Fix typo. diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 9e8299720a6..19b5967215a 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -503,9 +503,9 @@ Output values for saturation and value are integers in [0..100] range." `nil' means default implementation-dependent order (defined in `x-colors'). `name' sorts by color name. `rgb' sorts by red, green, blue components. -`rgb-dist' sorts by the RGB distance to the specified color. +`(rgb-dist . COLOR)' sorts by the RGB distance to the specified color. `hsv' sorts by hue, saturation, value. -`hsv-dist' sorts by the HVS distance to the specified color +`(hsv-dist . COLOR)' sorts by the HSV distance to the specified color and excludes grayscale colors." :type '(choice (const :tag "Unsorted" nil) (const :tag "Color Name" name) From 8b9f5fe8d850c7724aabbfdbd26cb4afdf1d6440 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 15 Jun 2010 13:41:21 +0200 Subject: [PATCH 21/36] * etc/NEWS.1-17: Fix typos. --- etc/NEWS.1-17 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/NEWS.1-17 b/etc/NEWS.1-17 index 23184c45689..122c634b0f2 100644 --- a/etc/NEWS.1-17 +++ b/etc/NEWS.1-17 @@ -760,7 +760,7 @@ not try to give commands in it when no longer really in the debugger. * New function `switch-to-buffer-other-window'. This is the new primitive to select a specified buffer (the -argument) in another window. It is not quite the same as +argument) in another window. It is not quite the same as `pop-to-buffer', because it is guaranteed to create another window (assuming there is room on the screen) so that it can leave the current window's old buffer displayed as well. @@ -971,7 +971,7 @@ once again "unmodified". This command creates an inferior Lisp process whose input and output appear in the Emacs buffer named `*lisp*'. That buffer uses a major mode called inferior-lisp-mode, which has many of the commands of lisp-mode -and those of shell-mode. Calls the value of shell-mode-hook and +and those of shell-mode. Calls the value of shell-mode-hook and lisp-mode-hook, in that order, if non-nil. Meanwhile, in lisp-mode, the command C-M-x is defined to @@ -1421,7 +1421,7 @@ Changes in Emacs 15 of the executing emacs, for use in run-time conditionalization. The function featurep of one argument may be used to test for the - presence of a feature. It is just the same as + presence of a feature. It is just the same as (not (null (memq FEATURE features))) where FEATURE is its argument. For example, (if (featurep 'magic-window-hack) (transmogrify-window 'vertical) @@ -1541,13 +1541,13 @@ Changes in Emacs 15 This function returns a cons cell whose car is the object produced by reading from the string and whose cdr is a number giving the - index in the string of the first character not read. That index may + index in the string of the first character not read. That index may be passed as the second argument to a later call to read-from-string to read the next form represented by the string. In addition, the function read now accepts a string as its argument. In this case, it calls read-from-string on the whole string, and - returns the car of the result. (ie the actual object read.) + returns the car of the result (ie the actual object read.) From 85350e06b0c0de0e774ce6e4e7713b309938f248 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 15 Jun 2010 22:13:34 +0200 Subject: [PATCH 22/36] * auth-source.el (auth-source-pick): If choice does not contain a questioned keyword, set the check to t. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/auth-source.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 78d3d234285..e50bdb58575 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-06-15 Michael Albinus + + * auth-source.el (auth-source-pick): If choice does not contain a + questioned keyword, set the check to t. + 2010-06-12 Romain Francoise * gnus-util.el (gnus-date-get-time): Move up before first use. diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 89b2ef3d11d..e43f09e5ed1 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -229,7 +229,8 @@ matched as a regex." ;; Check keywords. (dolist (k keys match) (let* ((v (plist-get spec k)) - (choicev (plist-get choice k))) + (choicev (if (plist-member choice k) + (plist-get choice k) t))) (setq match (and match (or From 30d7ac37e5899f928c9efc045b53232a4379d53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Wed, 16 Jun 2010 15:42:59 +0200 Subject: [PATCH 23/36] =?UTF-8?q?ispell.el:=20Fix=20portuguese=20casechars?= =?UTF-8?q?/not-casechars=20for=20missing=20'=C3=A7=C3=87'.=20(bug#6434).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 6 ++++++ lisp/textmodes/ispell.el | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f1c83da671a..2346cf3449f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-06-16 Agustín Martín + + * ispell.el (ispell-dictionary-base-alist): Fix + portuguese casechars/not-casechars for missing 'çÇ'. + Suggested by Rolando Pereira (bug#6434). + 2010-06-15 Juanma Barranquero * facemenu.el (list-colors-sort): Doc fix. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 94eb721e4cf..1a657b0fdf9 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -660,8 +660,8 @@ re-start Emacs." "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" "[.]" nil nil nil iso-8859-2) ("portugues" ; Portuguese mode - "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" - "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" + "[a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]" + "[^a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]" "[']" t ("-C") "~latin1" iso-8859-1) ("russian" ; Russian.aff (KOI8-R charset) "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" From 288cf4e907c0350eb24824016763bddd09df8ea8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Jun 2010 10:10:02 -0400 Subject: [PATCH 24/36] * src/lread.c (read1): Phase out old-style backquotes a bit more. --- etc/NEWS | 4 ++++ src/ChangeLog | 7 +++++-- src/lread.c | 12 +++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 60de0a286f3..b881edfb3b4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -257,7 +257,11 @@ Notifications API. It requires D-Bus for communication. * Incompatible Lisp Changes in Emacs 24.1 +** A backquote not followed by a space is now always treated as new-style. + ** Test for special mode-class was moved from view-file to view-buffer. +FIXME: This only says what was changed, but not what are the +programmer-visible consequences. ** Passing a nil argument to a minor mode function now turns the mode ON unconditionally. diff --git a/src/ChangeLog b/src/ChangeLog index 3e6c8f24398..799680498ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-06-16 Stefan Monnier + + * lread.c (read1): Phase out old-style backquotes a bit more. + 2010-06-12 Eli Zaretskii * makefile.w32-in ($(BLD)/bidi.$(O)): Depend on biditype.h and @@ -7,8 +11,7 @@ * bidi.c (bidi_initialize): Remove explicit initialization of bidi_type_table; include biditype.h instead. Don't support - entries whose second codepoint is zero. Initialize - bidi_mirror_table. + entries whose second codepoint is zero. Initialize bidi_mirror_table. (bidi_mirror_char): Use bidi_mirror_table. * biditype.h: New file. diff --git a/src/lread.c b/src/lread.c index 3a77a62b27f..c73f7f32e51 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2683,7 +2683,17 @@ read1 (readcharfun, pch, first_in_list) } case '`': - if (first_in_list) + /* Transition from old-style to new-style: + If we see "(`" it used to mean old-style, which usually works + fine because ` should almost never appear in such a position + for new-style. But occasionally we need "(`" to mean new + style, so we try to distinguish the two by the fact that we + can either write "( `foo" or "(` foo", where the first + intends to use new-style whereas the second intends to use + old-style. For Emacs-25, we should completely remove this + first_in_list exception (old-style can still be obtained via + "(\`" anyway). */ + if (first_in_list && (c = READCHAR, UNREAD (c), c == ' ')) { Vold_style_backquotes = Qt; goto default_label; From 36901266a8acb83880fefee50c93abb09f64533b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Jun 2010 16:00:22 -0400 Subject: [PATCH 25/36] * lisp/font-lock.el (font-lock-major-mode): Rename from font-lock-mode-major-mode to distinguish it from global-font-lock-mode's own font-lock-mode-major-mode. (font-lock-set-defaults): * lisp/font-core.el (font-lock-default-function): Adjust users. (font-lock-mode): Don't set it at all. Fixes: debbugs:6135 --- lisp/ChangeLog | 9 +++++++++ lisp/font-core.el | 10 ++++------ lisp/font-lock.el | 9 ++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e8ba492710..5e24d87f085 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2010-06-16 Stefan Monnier + + * font-lock.el (font-lock-major-mode): Rename from + font-lock-mode-major-mode to distinguish it from + global-font-lock-mode's own font-lock-mode-major-mode (bug#6135). + (font-lock-set-defaults): + * font-core.el (font-lock-default-function): Adjust users. + (font-lock-mode): Don't set it at all. + 2010-06-15 Stefan Monnier * vc-annotate.el (vc-annotate): Use vc-read-revision. diff --git a/lisp/font-core.el b/lisp/font-core.el index be3a2a3eaca..d33295b3c34 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -97,7 +97,7 @@ It will be passed one argument, which is the current value of `font-lock-mode'.") ;; The mode for which font-lock was initialized, or nil if none. -(defvar font-lock-mode-major-mode) +(defvar font-lock-major-mode) (define-minor-mode font-lock-mode "Toggle Font Lock mode. With arg, turn Font Lock mode off if and only if arg is a non-positive @@ -159,9 +159,7 @@ your own function which is called when `font-lock-mode' is toggled via ;; Arrange to unfontify this buffer if we change major mode later. (if font-lock-mode (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t) - (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)) - (when font-lock-mode - (setq font-lock-mode-major-mode major-mode))) + (remove-hook 'change-major-mode-hook 'font-lock-change-mode t))) ;; Get rid of fontification for the old major mode. ;; We do this when changing major modes. @@ -213,8 +211,8 @@ this function onto `change-major-mode-hook'." (and mode (boundp 'font-lock-set-defaults) font-lock-set-defaults - font-lock-mode-major-mode - (not (eq font-lock-mode-major-mode major-mode)))) + font-lock-major-mode + (not (eq font-lock-major-mode major-mode)))) (font-lock-mode-internal mode))) (defun turn-on-font-lock () diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 0a0499d8db4..b4a2a72eee8 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1784,15 +1784,18 @@ preserve `hi-lock-mode' highlighting patterns." (kill-local-variable 'font-lock-set-defaults) (font-lock-mode 1)) -(defvar font-lock-mode-major-mode) +(defvar font-lock-major-mode nil + "Major mode for which the font-lock settings have been setup.") +(make-variable-buffer-local 'font-lock-major-mode) + (defun font-lock-set-defaults () "Set fontification defaults appropriately for this mode. Sets various variables using `font-lock-defaults' (or, if nil, using `font-lock-defaults-alist') and `font-lock-maximum-decoration'." ;; Set fontification defaults if not previously set for correct major mode. (unless (and font-lock-set-defaults - (eq font-lock-mode-major-mode major-mode)) - (setq font-lock-mode-major-mode major-mode) + (eq font-lock-major-mode major-mode)) + (setq font-lock-major-mode major-mode) (set (make-local-variable 'font-lock-set-defaults) t) (make-local-variable 'font-lock-fontified) (make-local-variable 'font-lock-multiline) From 49b2e83db4e53168cfdef4caf0c9ea975397e044 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Jun 2010 17:11:06 -0400 Subject: [PATCH 26/36] * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda' specially, since it's a macro. Fix up wrong hint passed to maybe-cons. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/cl-loaddefs.el | 2 +- lisp/emacs-lisp/macroexp.el | 7 +------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a70c564b1ef..18c99d4ebf0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-06-16 Stefan Monnier + * emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda' + specially, since it's a macro. Fix up wrong hint passed to maybe-cons. + * font-lock.el (font-lock-major-mode): Rename from font-lock-mode-major-mode to distinguish it from global-font-lock-mode's own font-lock-mode-major-mode (bug#6135). diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 325c7b1479f..b14c879fcf7 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -282,7 +282,7 @@ Not documented ;;;;;; 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" "fbeedbf769c72fee9b4e0671957c1077") +;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "36cafd5054969b5bb0b1ce6a21605fed") ;;; Generated autoloads from cl-macs.el (autoload 'gensym "cl-macs" "\ diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 364e3540703..aabf940964b 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -134,7 +134,7 @@ Assumes the caller has bound `macroexpand-all-environment'." (maybe-cons fun (maybe-cons (macroexpand-all-forms (cadr form) 2) nil - (cadr form)) + (cdr form)) form) form)) ((memq fun '(let let*)) @@ -145,11 +145,6 @@ Assumes the caller has bound `macroexpand-all-environment'." form)) ((eq fun 'quote) form) - ((and (consp fun) (eq (car fun) 'lambda)) - ;; embedded lambda - (maybe-cons (macroexpand-all-forms fun 2) - (macroexpand-all-forms (cdr form)) - form)) ;; The following few cases are for normal function calls that ;; are known to funcall one of their arguments. The byte ;; compiler has traditionally handled these functions specially From e020fb59a3a7df1c47ef6bdae4b49eef4bab6c1b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 17 Jun 2010 00:33:54 +0300 Subject: [PATCH 27/36] * lisp/facemenu.el (list-colors-display): Call `pop-to-buffer' before `list-colors-print'. (Bug#6332) --- lisp/ChangeLog | 5 +++++ lisp/facemenu.el | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 18c99d4ebf0..b59e5f2708c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-16 Juri Linkov + + * facemenu.el (list-colors-display): Call `pop-to-buffer' before + `list-colors-print'. (Bug#6332) + 2010-06-16 Stefan Monnier * emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda' diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 19b5967215a..20b86676ea9 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -600,9 +600,11 @@ You can change the color sort order by customizing `list-colors-sort'." (with-current-buffer buf (erase-buffer) (setq truncate-lines t) + ;; Display buffer before generating content to allow + ;; `list-colors-print' to get the right window-width. + (pop-to-buffer buf) (list-colors-print list callback) - (set-buffer-modified-p nil)) - (pop-to-buffer buf)) + (set-buffer-modified-p nil))) (if callback (message "Click on a color to select it."))) From fb3e306a4f7d229bce20e36afe8a128146c0932a Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Wed, 16 Jun 2010 18:27:20 -0500 Subject: [PATCH 28/36] calc-poly.el: (math-accum-factors): Make sure that constants aren't distributed after they are factored out. --- lisp/ChangeLog | 5 +++++ lisp/calc/calc-poly.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b59e5f2708c..ce2560ffa8e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-16 Jay Belanger + + * calc/calc-poly.el: (math-accum-factors): Make sure that + constants aren't distributed after they are factored out. + 2010-06-16 Juri Linkov * facemenu.el (list-colors-display): Call `pop-to-buffer' before diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el index a994ace6fb6..f268a032d14 100644 --- a/lisp/calc/calc-poly.el +++ b/lisp/calc/calc-poly.el @@ -663,7 +663,7 @@ (cons 'vec (cons (nth 1 facs) (cons (list 'vec fac pow) (cdr (cdr facs))))) (cons 'vec (cons (list 'vec fac pow) (cdr facs)))))))) - (math-mul (math-pow fac pow) facs))) + (math-mul (math-pow fac pow) (math-factor-protect facs)))) (defun math-factor-poly-coefs (p &optional square-free) ; uses "x" (let (t1 t2 temp) From e20f04215a264939f74306fa7a29deb97bad3f1c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 16 Jun 2010 20:17:22 -0400 Subject: [PATCH 29/36] * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Put back special handling for `lambda' (misunderstanding). --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/macroexp.el | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce2560ffa8e..479d8673bf1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-17 Stefan Monnier + + * emacs-lisp/macroexp.el (macroexpand-all-1): Put back special + handling for `lambda' (misunderstanding). + 2010-06-16 Jay Belanger * calc/calc-poly.el: (math-accum-factors): Make sure that diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index aabf940964b..876b9a468ac 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -145,6 +145,11 @@ Assumes the caller has bound `macroexpand-all-environment'." form)) ((eq fun 'quote) form) + ((and (consp fun) (eq (car fun) 'lambda)) + ;; Embedded lambda in function position. + (maybe-cons (macroexpand-all-forms fun 2) + (macroexpand-all-forms (cdr form)) + form)) ;; The following few cases are for normal function calls that ;; are known to funcall one of their arguments. The byte ;; compiler has traditionally handled these functions specially From 44198b6ee97bcb0ac88a5cadd1bf9b62048d0156 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 16 Jun 2010 22:08:10 -0400 Subject: [PATCH 30/36] Merge package.el, written by Tom Tromey . Changes relative to version 0.9 of package.el are listed below: * emacs-lisp/package-x.el: New file. Package uploading functionality split out from package.el. * emacs-lisp/package.el (package-archive-base): Point to elpa.gnu.org. (package-enable, package-load-list): New defcustoms. (package-user-dir, package-directory-list): Turn into defcustoms. Don't include package-user-dir in package-directory-list. (package--builtins-base): Don't include Emacs as a "package". (package-subdirectory-regexp): New var. (package-load-all-descriptors, package-compute-transaction) (package-download-transaction): Obey package-load-list. (package-activate-1): Rename from package-do-activate. (package-list-packages-internal): Check package-load-list. (package-load-descriptor, package-generate-autoloads) (package-unpack, package-unpack-single) (package--read-archive-file, package-delete): Use expand-file-name. * startup.el (command-line): Load packages after reading init file. --- etc/NEWS | 10 + lisp/ChangeLog | 28 + lisp/emacs-lisp/package-x.el | 217 ++++++ lisp/emacs-lisp/package.el | 1409 ++++++++++++++++++++++++++++++++++ lisp/startup.el | 3 + 5 files changed, 1667 insertions(+) create mode 100644 lisp/emacs-lisp/package-x.el create mode 100644 lisp/emacs-lisp/package.el diff --git a/etc/NEWS b/etc/NEWS index b881edfb3b4..122bd27d805 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -128,6 +128,16 @@ now forces true deletion, regardless of `delete-by-moving-to-trash'. ** New option `list-colors-sort' defines the color sort order for `list-colors-display'. +** An Emacs Lisp package manager is now included. +This is a convenient way to download and install additional packages, +from elpa.gnu.org. `M-x package-list-packages' shows a list of +packages, which can be selected for installation. + +*** By default, all installed packages are loaded and activated +automatically when Emacs starts up. To disable this, set +`package-enable-at-startup' to nil. To change which packages are +loaded, customize `package-load-list'. + * Editing Changes in Emacs 24.1 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 479d8673bf1..eb6c15841f7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,31 @@ +2010-06-17 Chong Yidong + + * emacs-lisp/package.el (package-archive-base): Point to + elpa.gnu.org. + (package-enable, package-load-list): New defcustoms. + (package-user-dir, package-directory-list): Turn into defcustoms. + Don't include package-user-dir in package-directory-list. + (package--builtins-base): Don't include Emacs as a "package". + (package-subdirectory-regexp): New var. + (package-load-all-descriptors, package-compute-transaction) + (package-download-transaction): Obey package-load-list. + (package-activate-1): Rename from package-do-activate. + (package-list-packages-internal): Check package-load-list. + (package-load-descriptor, package-generate-autoloads) + (package-unpack, package-unpack-single) + (package--read-archive-file, package-delete): Use + expand-file-name. + + * emacs-lisp/package-x.el: New file. Package uploading + functionality split out from package.el. + + * startup.el (command-line): Load packages after reading init + file. + +2010-06-17 Tom Tromey + + * emacs-lisp/package.el: New file. + 2010-06-17 Stefan Monnier * emacs-lisp/macroexp.el (macroexpand-all-1): Put back special diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el new file mode 100644 index 00000000000..c2d85aa574a --- /dev/null +++ b/lisp/emacs-lisp/package-x.el @@ -0,0 +1,217 @@ +;;; package-x.el --- Package extras + +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;; Author: Tom Tromey +;; Created: 10 Mar 2007 +;; Version: 0.9 +;; Keywords: tools + +;; 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, 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; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This file currently contains parts of the package system most +;; people won't need, such as package uploading. + +;;; Code: + +;; Note that this only works if you have the password, which you +;; probably don't :-). +(defvar package-archive-upload-base nil + "Base location for uploading to package archive.") + +(defun package--encode (string) + "Encode a string by replacing some characters with XML entities." + ;; We need a special case for translating "&" to "&". + (let ((index)) + (while (setq index (string-match "[&]" string index)) + (setq string (replace-match "&" t nil string)) + (setq index (1+ index)))) + (while (string-match "[<]" string) + (setq string (replace-match "<" t nil string))) + (while (string-match "[>]" string) + (setq string (replace-match ">" t nil string))) + (while (string-match "[']" string) + (setq string (replace-match "'" t nil string))) + (while (string-match "[\"]" string) + (setq string (replace-match """ t nil string))) + string) + +(defun package--make-rss-entry (title text) + (let ((date-string (format-time-string "%a, %d %B %Y %T %z"))) + (concat "\n" + "" (package--encode title) "\n" + ;; FIXME: should have a link in the web page. + "" package-archive-base "news.html\n" + "" (package--encode text) "\n" + "" date-string "\n" + "\n"))) + +(defun package--make-html-entry (title text) + (concat "
  • " (format-time-string "%B %e") " - " + title " - " (package--encode text) + "
  • \n")) + +(defun package--update-file (file location text) + (save-excursion + (let ((old-buffer (find-buffer-visiting file))) + (with-current-buffer (let ((find-file-visit-truename t)) + (or old-buffer (find-file-noselect file))) + (goto-char (point-min)) + (search-forward location) + (forward-line) + (insert text) + (let ((file-precious-flag t)) + (save-buffer)) + (unless old-buffer + (kill-buffer (current-buffer))))))) + +(defun package-maint-add-news-item (title description) + "Add a news item to the ELPA web pages. +TITLE is the title of the news item. +DESCRIPTION is the text of the news item. +You need administrative access to ELPA to use this." + (interactive "sTitle: \nsText: ") + (package--update-file (concat package-archive-upload-base "elpa.rss") + "" + (package--make-rss-entry title description)) + (package--update-file (concat package-archive-upload-base "news.html") + "New entries go here" + (package--make-html-entry title description))) + +(defun package--update-news (package version description) + "Update the ELPA web pages when a package is uploaded." + (package-maint-add-news-item (concat package " version " version) + description)) + +(defun package-upload-buffer-internal (pkg-info extension) + "Upload a package whose contents are in the current buffer. +PKG-INFO is the package info, see `package-buffer-info'. +EXTENSION is the file extension, a string. It can be either +\"el\" or \"tar\"." + (save-excursion + (save-restriction + (let* ((file-type (cond + ((equal extension "el") 'single) + ((equal extension "tar") 'tar) + (t (error "Unknown extension `%s'" extension)))) + (file-name (aref pkg-info 0)) + (pkg-name (intern file-name)) + (requires (aref pkg-info 1)) + (desc (if (string= (aref pkg-info 2) "") + (read-string "Description of package: ") + (aref pkg-info 2))) + (pkg-version (aref pkg-info 3)) + (commentary (aref pkg-info 4)) + (split-version (package-version-split pkg-version)) + (pkg-buffer (current-buffer)) + + ;; Download latest archive-contents. + (buffer (url-retrieve-synchronously + (concat package-archive-base "archive-contents")))) + + ;; Parse archive-contents. + (set-buffer buffer) + (package-handle-response) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (let ((contents (package-read-from-string + (buffer-substring-no-properties (point-min) + (point-max)))) + (new-desc (vector split-version requires desc file-type))) + (if (> (car contents) package-archive-version) + (error "Unrecognized archive version %d" (car contents))) + (let ((elt (assq pkg-name (cdr contents)))) + (if elt + (if (package-version-compare split-version + (package-desc-vers (cdr elt)) + '<=) + (error "New package has smaller version: %s" pkg-version) + (setcdr elt new-desc)) + (setq contents (cons (car contents) + (cons (cons pkg-name new-desc) + (cdr contents)))))) + + ;; Now CONTENTS is the updated archive contents. Upload + ;; this and the package itself. For now we assume ELPA is + ;; writable via file primitives. + (let ((print-level nil) + (print-length nil)) + (write-region (concat (pp-to-string contents) "\n") + nil + (concat package-archive-upload-base + "archive-contents"))) + + ;; If there is a commentary section, write it. + (when commentary + (write-region commentary nil + (concat package-archive-upload-base + (symbol-name pkg-name) "-readme.txt"))) + + (set-buffer pkg-buffer) + (kill-buffer buffer) + (write-region (point-min) (point-max) + (concat package-archive-upload-base + file-name "-" pkg-version + "." extension) + nil nil nil 'excl) + + ;; Write a news entry. + (package--update-news (concat file-name "." extension) + pkg-version desc) + + ;; special-case "package": write a second copy so that the + ;; installer can easily find the latest version. + (if (string= file-name "package") + (write-region (point-min) (point-max) + (concat package-archive-upload-base + file-name "." extension) + nil nil nil 'ask))))))) + +(defun package-upload-buffer () + "Upload a single .el file to ELPA from the current buffer." + (interactive) + (save-excursion + (save-restriction + ;; Find the package in this buffer. + (let ((pkg-info (package-buffer-info))) + (package-upload-buffer-internal pkg-info "el"))))) + +(defun package-upload-file (file) + (interactive "fPackage file name: ") + (with-temp-buffer + (insert-file-contents-literally file) + (let ((info (cond + ((string-match "\\.tar$" file) (package-tar-file-info file)) + ((string-match "\\.el$" file) (package-buffer-info)) + (t (error "Unrecognized extension `%s'" + (file-name-extension file)))))) + (package-upload-buffer-internal info (file-name-extension file))))) + +(defun package-gnus-summary-upload () + "Upload a package contained in the current *Article* buffer. +This should be invoked from the gnus *Summary* buffer." + (interactive) + (with-current-buffer gnus-article-buffer + (package-upload-buffer))) + +(provide 'package-x) + +;;; package.el ends here diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el new file mode 100644 index 00000000000..8632fcd5647 --- /dev/null +++ b/lisp/emacs-lisp/package.el @@ -0,0 +1,1409 @@ +;;; package.el --- Simple package system for Emacs + +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;; Author: Tom Tromey +;; Created: 10 Mar 2007 +;; Version: 0.9 +;; Keywords: tools + +;; 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, 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; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Change Log: + +;; 2 Apr 2007 - now using ChangeLog file +;; 15 Mar 2007 - updated documentation +;; 14 Mar 2007 - Changed how obsolete packages are handled +;; 13 Mar 2007 - Wrote package-install-from-buffer +;; 12 Mar 2007 - Wrote package-menu mode + +;;; Commentary: + +;; The idea behind package.el is to be able to download packages and +;; install them. Packages are versioned and have versioned +;; dependencies. Furthermore, this supports built-in packages which +;; may or may not be newer than user-specified packages. This makes +;; it possible to upgrade Emacs and automatically disable packages +;; which have moved from external to core. (Note though that we don't +;; currently register any of these, so this feature does not actually +;; work.) + +;; This code supports a single package repository, ELPA. All packages +;; must be registered there. + +;; A package is described by its name and version. The distribution +;; format is either a tar file or a single .el file. + +;; A tar file should be named "NAME-VERSION.tar". The tar file must +;; unpack into a directory named after the package and version: +;; "NAME-VERSION". It must contain a file named "PACKAGE-pkg.el" +;; which consists of a call to define-package. It may also contain a +;; "dir" file and the info files it references. + +;; A .el file will be named "NAME-VERSION.el" in ELPA, but will be +;; installed as simply "NAME.el" in a directory named "NAME-VERSION". + +;; The downloader will download all dependent packages. It will also +;; byte-compile the package's lisp at install time. + +;; At activation time we will set up the load-path and the info path, +;; and we will load the package's autoloads. If a package's +;; dependencies are not available, we will not activate that package. + +;; Conceptually a package has multiple state transitions: +;; +;; * Download. Fetching the package from ELPA. +;; * Install. Untar the package, or write the .el file, into +;; ~/.emacs.d/elpa/ directory. +;; * Byte compile. Currently this phase is done during install, +;; but we may change this. +;; * Activate. Evaluate the autoloads for the package to make it +;; available to the user. +;; * Load. Actually load the package and run some code from it. + +;; Other external functions you may want to use: +;; +;; M-x package-list-packages +;; Enters a mode similar to buffer-menu which lets you manage +;; packages. You can choose packages for install (mark with "i", +;; then "x" to execute) or deletion (not implemented yet), and you +;; can see what packages are available. This will automatically +;; fetch the latest list of packages from ELPA. +;; +;; M-x package-list-packages-no-fetch +;; Like package-list-packages, but does not automatically fetch the +;; new list of packages. +;; +;; M-x package-install-from-buffer +;; Install a package consisting of a single .el file that appears +;; in the current buffer. This only works for packages which +;; define a Version header properly; package.el also supports the +;; extension headers Package-Version (in case Version is an RCS id +;; or similar), and Package-Requires (if the package requires other +;; packages). +;; +;; M-x package-install-file +;; Install a package from the indicated file. The package can be +;; either a tar file or a .el file. A tar file must contain an +;; appropriately-named "-pkg.el" file; a .el file must be properly +;; formatted as with package-install-from-buffer. + +;;; Thanks: +;;; (sorted by sort-lines): + +;; Jim Blandy +;; Karl Fogel +;; Kevin Ryde +;; Lawrence Mitchell +;; Michael Olson +;; Sebastian Tennant +;; Stefan Monnier +;; Vinicius Jose Latorre +;; Phil Hagelberg + +;;; ToDo: + +;; - putting info dirs at the start of the info path means +;; users see a weird ordering of categories. OTOH we want to +;; override later entries. maybe emacs needs to enforce +;; the standard layout? +;; - put bytecode in a separate directory tree +;; - perhaps give users a way to recompile their bytecode +;; or do it automatically when emacs changes +;; - give users a way to know whether a package is installed ok +;; - give users a way to view a package's documentation when it +;; only appears in the .el +;; - use/extend checkdoc so people can tell if their package will work +;; - "installed" instead of a blank in the status column +;; - tramp needs its files to be compiled in a certain order. +;; how to handle this? fix tramp? +;; - on emacs 21 we don't kill the -autoloads.el buffer. what about 22? +;; - maybe we need separate .elc directories for various emacs versions +;; and also emacs-vs-xemacs. That way conditional compilation can +;; work. But would this break anything? +;; - should store the package's keywords in archive-contents, then +;; let the users filter the package-menu by keyword. See +;; finder-by-keyword. (We could also let people view the +;; Commentary, but it isn't clear how useful this is.) +;; - William Xu suggests being able to open a package file without +;; installing it +;; - Interface with desktop.el so that restarting after an install +;; works properly +;; - Implement M-x package-upgrade, to upgrade any/all existing packages +;; - Use hierarchical layout. PKG/etc PKG/lisp PKG/info +;; ... except maybe lisp? +;; - It may be nice to have a macro that expands to the package's +;; private data dir, aka ".../etc". Or, maybe data-directory +;; needs to be a list (though this would be less nice) +;; a few packages want this, eg sokoban +;; - package menu needs: +;; ability to know which packages are built-in & thus not deletable +;; it can sometimes print odd results, like 0.3 available but 0.4 active +;; why is that? +;; - Allow multiple versions on the server...? +;; [ why bother? ] +;; - Don't install a package which will invalidate dependencies overall +;; - Allow something like (or (>= emacs 21.0) (>= xemacs 21.5)) +;; [ currently thinking, why bother.. KISS ] +;; - Allow optional package dependencies +;; then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb +;; and just don't compile to add to load path ...? +;; - Have a list of archive URLs? [ maybe there's no point ] +;; - David Kastrup pointed out on the xemacs list that for GPL it +;; is friendlier to ship the source tree. We could "support" that +;; by just having a "src" subdir in the package. This isn't ideal +;; but it probably is not worth trying to support random source +;; tree layouts, build schemes, etc. +;; - Our treatment of the info path is somewhat bogus +;; - perhaps have an "unstable" tree in ELPA as well as a stable one + +;;; Code: + +(defgroup package nil + "Manager for Emacs Lisp packages." + :group 'applications + :version "24.1") + +;;;###autoload +(defcustom package-enable-at-startup t + "Whether to activate installed packages when Emacs starts. +If non-nil, packages are activated after reading the init file +and before `after-init-hook'. Activation is not done if +`user-init-file' is nil (e.g. Emacs was started with \"-q\"). + +Even if the value is nil, you can type \\[package-initialize] to +activate the package system at any time." + :type 'boolean + :group 'package + :version "24.1") + +(defcustom package-load-list '(all) + "List of packages for `package-initialize' to load. +Each element in this list should be a list (NAME VERSION), or the +symbol `all'. The symbol `all' says to load the latest installed +versions of all packages not specified by other elements. + +For an element (NAME VERSION), NAME is a package name (a symbol). +VERSION should be t, a string, or nil. +If VERSION is t, all versions are loaded, though obsolete ones + will be put in `package-obsolete-alist' and not activated. +If VERSION is a string, only that version is ever loaded. + Any other version, even if newer, is silently ignored. + Hence, the package is \"held\" at that version. +If VERSION is nil, the package is not loaded (it is \"disabled\")." + :type '(repeat symbol) + :group 'package + :version "24.1") + +(defvar Info-directory-list) +(defvar gnus-article-buffer) +(declare-function info-initialize "info" ()) +(declare-function url-http-parse-response "url-http" ()) +(declare-function lm-header "lisp-mnt" (header)) +(declare-function lm-commentary "lisp-mnt" (&optional file)) +(declare-function dired-delete-file "dired" (file &optional recursive trash)) + +(defconst package-archive-base "http://elpa.gnu.org/packages/" + "Base URL for the Emacs Lisp Package Archive (ELPA). +Ordinarily you should not need to change this. +Note that some code in package.el assumes that this is an http: URL.") + +(defconst package-archive-version 1 + "Version number of the package archive understood by this file. +Lower version numbers than this will probably be understood as well.") + +(defconst package-el-version "1.0" + "Version of package.el.") + +;; We don't prime the cache since it tends to get out of date. +(defvar package-archive-contents nil + "Cache of the contents of the Emacs Lisp Package Archive. +This is an alist mapping package names (symbols) to package +descriptor vectors. These are like the vectors for `package-alist' +but have an extra entry which is 'tar for tar packages and +'single for single-file packages.") + +(defcustom package-user-dir (locate-user-emacs-file "elpa") + "Directory containing the user's Emacs Lisp packages. +The directory name should be absolute. +Apart from this directory, Emacs also looks for system-wide +packages in `package-directory-list'." + :type 'directory + :group 'package + :version "24.1") + +(defcustom package-directory-list + ;; Defaults are subdirs named "elpa" in the site-lisp dirs. + (let (result) + (dolist (f load-path) + (if (equal (file-name-nondirectory f) "site-lisp") + (push (expand-file-name "elpa" f) result))) + (nreverse result)) + "List of additional directories containing Emacs Lisp packages. +Each directory name should be absolute. + +These directories contain packages intended for system-wide; in +contrast, `package-user-dir' contains packages for personal use." + :type '(repeat directory) + :group 'package + :version "24.1") + +(defun package-version-split (string) + "Split a package string into a version list." + (mapcar 'string-to-int (split-string string "[.]"))) + +(defconst package--builtins-base + ;; We use package-version split here to make sure to pick up the + ;; minor version. + `((emacs . [,(package-version-split emacs-version) nil + "GNU Emacs"]) + (package . [,(package-version-split package-el-version) + nil "Simple package system for GNU Emacs"])) + "Packages which are always built-in.") + +(defvar package--builtins + (delq nil + (append + package--builtins-base + (if (>= emacs-major-version 22) + ;; FIXME: emacs 22 includes tramp, rcirc, maybe + ;; other things... + '((erc . [(5 2) nil "An Emacs Internet Relay Chat client"]) + ;; The external URL is version 1.15, so make sure the + ;; built-in one looks newer. + (url . [(1 16) nil "URL handling libary"]))) + (if (>= emacs-major-version 23) + '(;; Strangely, nxml-version is missing in Emacs 23. + ;; We pick the merge date as the version. + (nxml . [(20071123) nil "Major mode for editing XML documents."]) + (bubbles . [(0 5) nil "Puzzle game for Emacs."]))))) + "Alist of all built-in packages. +Maps the package name to a vector [VERSION REQS DOCSTRING].") + +(defvar package-alist package--builtins + "Alist of all packages available for activation. +This maps the package name to a vector [VERSION REQS DOCSTRING]. + +The value is generated by `package-load-descriptor', usually +called via `package-initialize'. For user customizations of +which packages to load/activate, see `package-load-list'.") + +(defvar package-activated-list + (mapcar #'car package-alist) + "List of the names of currently activated packages.") + +(defvar package-obsolete-alist nil + "Representation of obsolete packages. +Like `package-alist', but maps package name to a second alist. +The inner alist is keyed by version.") + +(defconst package-subdirectory-regexp + "^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$" + "Regular expression matching the name of a package subdirectory. +The first subexpression is the package name. +The second subexpression is the version string.") + +(defun package-version-join (l) + "Turn a list of version numbers into a version string." + (mapconcat 'int-to-string l ".")) + +(defun package--version-first-nonzero (l) + (while (and l (= (car l) 0)) + (setq l (cdr l))) + (if l (car l) 0)) + +(defun package-version-compare (v1 v2 fun) + "Compare two version lists according to FUN. +FUN can be <, <=, =, >, >=, or /=." + (while (and v1 v2 (= (car v1) (car v2))) + (setq v1 (cdr v1) + v2 (cdr v2))) + (if v1 + (if v2 + ;; Both not null; we know the cars are not =. + (funcall fun (car v1) (car v2)) + ;; V1 not null, V2 null. + (funcall fun (package--version-first-nonzero v1) 0)) + (if v2 + ;; V1 null, V2 not null. + (funcall fun 0 (package--version-first-nonzero v2)) + ;; Both null. + (funcall fun 0 0)))) + +(defun package--test-version-compare () + "Test suite for `package-version-compare'." + (unless (and (package-version-compare '(0) '(0) '=) + (not (package-version-compare '(1) '(0) '=)) + (package-version-compare '(1 0 1) '(1) '>=) + (package-version-compare '(1 0 1) '(1) '>) + (not (package-version-compare '(0 9 1) '(1 0 2) '>=))) + (error "Failed")) + t) + +(defun package-strip-version (dirname) + "Strip the version from a combined package name and version. +E.g., if given \"quux-23.0\", will return \"quux\"" + (if (string-match package-subdirectory-regexp dirname) + (match-string 1 dirname))) + +(defun package-load-descriptor (dir package) + "Load the description file for a package. +DIR is the directory in which to find the package subdirectory, +and PACKAGE is the name of the package subdirectory. +Return nil if the package could not be found." + (let ((pkg-dir (expand-file-name package dir))) + (if (file-directory-p pkg-dir) + (load (expand-file-name (concat (package-strip-version package) + "-pkg") + pkg-dir) + nil t)))) + +(defun package-load-all-descriptors () + "Load descriptors for installed Emacs Lisp packages. +This looks for package subdirectories in `package-user-dir' and +`package-directory-list'. The variable `package-load-list' +controls which package subdirectories may be loaded. + +In each valid package subdirectory, this function loads the +description file containing a call to `define-package', which +updates `package-alist' and `package-obsolete-alist'." + (let ((all (memq 'all package-load-list)) + name version force) + (dolist (dir (cons package-user-dir package-directory-list)) + (when (file-directory-p dir) + (dolist (subdir (directory-files dir)) + (when (and (file-directory-p (expand-file-name subdir dir)) + (string-match package-subdirectory-regexp subdir)) + (setq name (intern (match-string 1 subdir)) + version (match-string 2 subdir) + force (assq name package-load-list)) + (when (cond + ((null force) + all) ; not in package-load-list + ((null (setq force (cadr force))) + nil) ; disabled + ((eq force t) + t) + ((stringp force) ; held + (package-version-compare (package-version-split version) + (package-version-split force) + '=)) + (t + (error "Invalid element in `package-load-list'"))) + (package-load-descriptor dir subdir)))))))) + +(defsubst package-desc-vers (desc) + "Extract version from a package description vector." + (aref desc 0)) + +(defsubst package-desc-reqs (desc) + "Extract requirements from a package description vector." + (aref desc 1)) + +(defsubst package-desc-doc (desc) + "Extract doc string from a package description vector." + (aref desc 2)) + +(defsubst package-desc-kind (desc) + "Extract the kind of download from an archive package description vector." + (aref desc 3)) + +(defun package-activate-1 (package pkg-vec) + (let* ((pkg-name (symbol-name package)) + (pkg-ver-str (package-version-join (package-desc-vers pkg-vec))) + (dir-list (cons package-user-dir package-directory-list)) + (pkg-dir)) + (while dir-list + (let ((subdir (expand-file-name (concat pkg-name "-" pkg-ver-str) + (car dir-list)))) + (if (file-directory-p subdir) + (progn + (setq pkg-dir subdir) + (setq dir-list nil)) + (setq dir-list (cdr dir-list))))) + (unless pkg-dir + (error "Internal error: could not find directory for %s-%s" + pkg-name pkg-ver-str)) + (if (file-exists-p (expand-file-name "dir" pkg-dir)) + (progn + ;; FIXME: not the friendliest, but simple. + (require 'info) + (info-initialize) + (setq Info-directory-list (cons pkg-dir Info-directory-list)))) + (setq load-path (cons pkg-dir load-path)) + ;; Load the autoloads and activate the package. + (load (expand-file-name (concat (symbol-name package) "-autoloads") + pkg-dir) + nil t) + (setq package-activated-list (cons package package-activated-list)) + ;; Don't return nil. + t)) + +(defun package--built-in (package version) + "Return true if the package is built-in to Emacs." + (let ((elt (assq package package--builtins))) + (and elt + (package-version-compare (package-desc-vers (cdr elt)) version '=)))) + +;; FIXME: return a reason instead? +(defun package-activate (package version) + "Activate a package, and recursively activate its dependencies. +Return nil if the package could not be activated." + ;; Assume the user knows what he is doing -- go ahead and activate a + ;; newer version of a package if an older one has already been + ;; activated. This is not ideal; we'd at least need to check to see + ;; if the package has actually been loaded, and not merely + ;; activated. However, don't try to activate 'emacs', as that makes + ;; no sense. + (unless (eq package 'emacs) + (let* ((pkg-desc (assq package package-alist)) + (this-version (package-desc-vers (cdr pkg-desc))) + (req-list (package-desc-reqs (cdr pkg-desc))) + ;; If the package was never activated, we want to do it + ;; now. + (keep-going (or (not (memq package package-activated-list)) + (package-version-compare this-version version '>)))) + (while (and req-list keep-going) + (let* ((req (car req-list)) + (req-name (car req)) + (req-version (cadr req))) + (or (package-activate req-name req-version) + (setq keep-going nil))) + (setq req-list (cdr req-list))) + (if keep-going + (package-activate-1 package (cdr pkg-desc)) + ;; We get here if a dependency failed to activate -- but we + ;; can also get here if the requested package was already + ;; activated. Return non-nil in the latter case. + (and (memq package package-activated-list) + (package-version-compare this-version version '>=)))))) + +(defun package-mark-obsolete (package pkg-vec) + "Put package on the obsolete list, if not already there." + (let ((elt (assq package package-obsolete-alist))) + (if elt + ;; If this obsolete version does not exist in the list, update + ;; it the list. + (unless (assoc (package-desc-vers pkg-vec) (cdr elt)) + (setcdr elt (cons (cons (package-desc-vers pkg-vec) pkg-vec) + (cdr elt)))) + ;; Make a new association. + (setq package-obsolete-alist + (cons (cons package (list (cons (package-desc-vers pkg-vec) + pkg-vec))) + package-obsolete-alist))))) + +;; (define-package "emacs" "21.4.1" "GNU Emacs core package.") +;; (define-package "erc" "5.1" "ERC - irc client" '((emacs "21.0"))) +(defun define-package (name-str version-string + &optional docstring requirements) + "Define a new package. +NAME is the name of the package, a string. +VERSION-STRING is the version of the package, a dotted sequence +of integers. +DOCSTRING is the optional description. +REQUIREMENTS is a list of requirements on other packages. +Each requirement is of the form (OTHER-PACKAGE \"VERSION\")." + (let* ((name (intern name-str)) + (pkg-desc (assq name package-alist)) + (new-version (package-version-split version-string)) + (new-pkg-desc + (cons name + (vector new-version + (mapcar + (lambda (elt) + (list (car elt) + (package-version-split (car (cdr elt))))) + requirements) + docstring)))) + ;; Only redefine a package if the redefinition is newer. + (if (or (not pkg-desc) + (package-version-compare new-version + (package-desc-vers (cdr pkg-desc)) + '>)) + (progn + (when pkg-desc + ;; Remove old package and declare it obsolete. + (setq package-alist (delq pkg-desc package-alist)) + (package-mark-obsolete (car pkg-desc) (cdr pkg-desc))) + ;; Add package to the alist. + (setq package-alist (cons new-pkg-desc package-alist))) + ;; You can have two packages with the same version, for instance + ;; one in the system package directory and one in your private + ;; directory. We just let the first one win. + (unless (package-version-compare new-version + (package-desc-vers (cdr pkg-desc)) + '=) + ;; The package is born obsolete. + (package-mark-obsolete (car new-pkg-desc) (cdr new-pkg-desc)))))) + +;; From Emacs 22. +(defun package-autoload-ensure-default-file (file) + "Make sure that the autoload file FILE exists and if not create it." + (unless (file-exists-p file) + (write-region + (concat ";;; " (file-name-nondirectory file) + " --- automatically extracted autoloads\n" + ";;\n" + ";;; Code:\n\n" + " \n;; Local Variables:\n" + ";; version-control: never\n" + ";; no-byte-compile: t\n" + ";; no-update-autoloads: t\n" + ";; End:\n" + ";;; " (file-name-nondirectory file) + " ends here\n") + nil file)) + file) + +(defun package-generate-autoloads (name pkg-dir) + (let* ((auto-name (concat name "-autoloads.el")) + (ignore-name (concat name "-pkg.el")) + (generated-autoload-file (expand-file-name auto-name pkg-dir)) + (version-control 'never)) + (require 'autoload) + (unless (fboundp 'autoload-ensure-default-file) + (package-autoload-ensure-default-file generated-autoload-file)) + (update-directory-autoloads pkg-dir))) + +(defun package-untar-buffer () + "Untar the current buffer. +This uses `tar-untar-buffer' if it is available. +Otherwise it uses an external `tar' program. +`default-directory' should be set by the caller." + (require 'tar-mode) + (if (fboundp 'tar-untar-buffer) + (progn + ;; tar-mode messes with narrowing, so we just let it have the + ;; whole buffer to play with. + (delete-region (point-min) (point)) + (tar-mode) + (tar-untar-buffer)) + ;; FIXME: check the result. + (call-process-region (point) (point-max) "tar" nil '(nil nil) nil + "xf" "-"))) + +(defun package-unpack (name version) + (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version) + package-user-dir))) + ;; Be careful!! + (make-directory package-user-dir t) + (if (file-directory-p pkg-dir) + (mapc (lambda (file) nil) ; 'delete-file -- FIXME: when we're + ; more confident + (directory-files pkg-dir t "^[^.]"))) + (let* ((default-directory (file-name-as-directory package-user-dir))) + (package-untar-buffer) + (package-generate-autoloads (symbol-name name) pkg-dir) + (let ((load-path (cons pkg-dir load-path))) + (byte-recompile-directory pkg-dir 0 t))))) + +(defun package-unpack-single (file-name version desc requires) + "Install the contents of the current buffer as a package." + ;; Special case "package". + (if (string= file-name "package") + (write-region (point-min) (point-max) + (expand-file-name (concat file-name ".el") + package-user-dir) + nil nil nil nil) + (let* ((pkg-dir (expand-file-name (concat file-name "-" version) + package-user-dir)) + (el-file (expand-file-name (concat file-name ".el") pkg-dir)) + (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir))) + (make-directory pkg-dir t) + (write-region (point-min) (point-max) el-file nil nil nil 'excl) + (let ((print-level nil) + (print-length nil)) + (write-region + (concat + (prin1-to-string + (list 'define-package + file-name + version + desc + (list 'quote + ;; Turn version lists into string form. + (mapcar + (lambda (elt) + (list (car elt) + (package-version-join (car (cdr elt))))) + requires)))) + "\n") + nil + pkg-file + nil nil nil 'excl)) + (package-generate-autoloads file-name pkg-dir) + (let ((load-path (cons pkg-dir load-path))) + (byte-recompile-directory pkg-dir 0 t))))) + +(defun package-handle-response () + "Handle the response from the server. +Parse the HTTP response and throw if an error occurred. +The url package seems to require extra processing for this. +This should be called in a `save-excursion', in the download buffer. +It will move point to somewhere in the headers." + ;; We assume HTTP here. + (require 'url-http) + (let ((response (url-http-parse-response))) + (when (or (< response 200) (>= response 300)) + (display-buffer (current-buffer)) + (error "Error during download request:%s" + (buffer-substring-no-properties (point) (progn + (end-of-line) + (point))))))) + +(defun package-download-single (name version desc requires) + "Download and install a single-file package." + (let ((buffer (url-retrieve-synchronously + (concat package-archive-base + (symbol-name name) "-" version ".el")))) + (with-current-buffer buffer + (package-handle-response) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (package-unpack-single (symbol-name name) version desc requires) + (kill-buffer buffer)))) + +(defun package-download-tar (name version) + "Download and install a tar package." + (let ((tar-buffer (url-retrieve-synchronously + (concat package-archive-base + (symbol-name name) "-" version ".tar")))) + (with-current-buffer tar-buffer + (package-handle-response) + (re-search-forward "^$" nil 'move) + (forward-char) + (package-unpack name version) + (kill-buffer tar-buffer)))) + +(defun package-installed-p (package version) + (let ((pkg-desc (assq package package-alist))) + (and pkg-desc + (package-version-compare version + (package-desc-vers (cdr pkg-desc)) + '>=)))) + +(defun package-compute-transaction (result requirements) + (dolist (elt requirements) + (let* ((next-pkg (car elt)) + (next-version (cadr elt))) + (unless (package-installed-p next-pkg next-version) + ;; A package is required, but not installed. It might also be + ;; blocked via `package-load-list'. + (let ((pkg-desc (assq next-pkg package-archive-contents)) + hold) + (when (setq hold (assq next-pkg package-load-list)) + (setq hold (cadr hold)) + (cond ((eq hold nil) + (error "Required package '%s' is disabled" + (symbol-name next-pkg))) + ((null (stringp hold)) + (error "Invalid element in `package-load-list'")) + ((package-version-compare next-version + (package-version-split hold) + '>) + (error "Package '%s' held at version %s, \ +but version %s required" + (symbol-name next-pkg) hold + (package-version-join next-version))))) + (unless pkg-desc + (error "Package '%s' is not available for installation" + (symbol-name next-pkg))) + (unless (package-version-compare (package-desc-vers (cdr pkg-desc)) + next-version + '>=) + (error + "Need package '%s' with version %s, but only %s is available" + (symbol-name next-pkg) (package-version-join next-version) + (package-version-join (package-desc-vers (cdr pkg-desc))))) + ;; Only add to the transaction if we don't already have it. + (unless (memq next-pkg result) + (setq result (cons next-pkg result))) + (setq result + (package-compute-transaction result + (package-desc-reqs + (cdr pkg-desc)))))))) + result) + +(defun package-read-from-string (str) + "Read a Lisp expression from STR. +Signal an error if the entire string was not used." + (let* ((read-data (read-from-string str)) + (more-left + (condition-case nil + ;; The call to `ignore' suppresses a compiler warning. + (progn (ignore (read-from-string + (substring str (cdr read-data)))) + t) + (end-of-file nil)))) + (if more-left + (error "Can't read whole string") + (car read-data)))) + +(defun package--read-archive-file (file) + "Re-read archive file FILE, if it exists. +Will return the data from the file, or nil if the file does not exist. +Will throw an error if the archive version is too new." + (let ((filename (expand-file-name file package-user-dir))) + (if (file-exists-p filename) + (with-temp-buffer + (insert-file-contents-literally filename) + (let ((contents (package-read-from-string + (buffer-substring-no-properties (point-min) + (point-max))))) + (if (> (car contents) package-archive-version) + (error "Package archive version %d is greater than %d - upgrade package.el" + (car contents) package-archive-version)) + (cdr contents)))))) + +(defun package-read-archive-contents () + "Re-read `archive-contents' and `builtin-packages', if they exist. +Set `package-archive-contents' and `package--builtins' if successful. +Throw an error if the archive version is too new." + (let ((archive-contents (package--read-archive-file "archive-contents")) + (builtins (package--read-archive-file "builtin-packages"))) + (if archive-contents + ;; Version 1 of 'archive-contents' is identical to our + ;; internal representation. + (setq package-archive-contents archive-contents)) + (if builtins + ;; Version 1 of 'builtin-packages' is a list where the car is + ;; a split emacs version and the cdr is an alist suitable for + ;; package--builtins. + (let ((our-version (package-version-split emacs-version)) + (result package--builtins-base)) + (setq package--builtins + (dolist (elt builtins result) + (if (package-version-compare our-version (car elt) '>=) + (setq result (append (cdr elt) result))))))))) + +(defun package-download-transaction (transaction) + "Download and install all the packages in the given transaction." + (dolist (elt transaction) + (let* ((desc (cdr (assq elt package-archive-contents))) + ;; As an exception, if package is "held" in + ;; `package-load-list', download the held version. + (hold (cadr (assq elt package-load-list))) + (v-string (or (and (stringp hold) hold) + (package-version-join (package-desc-vers desc)))) + (kind (package-desc-kind desc))) + (cond + ((eq kind 'tar) + (package-download-tar elt v-string)) + ((eq kind 'single) + (package-download-single elt v-string + (package-desc-doc desc) + (package-desc-reqs desc))) + (t + (error "Unknown package kind: %s" (symbol-name kind))))))) + +;;;###autoload +(defun package-install (name) + "Install the package named NAME. +Interactively, prompt for the package name. +The package is found on the archive site, see `package-archive-base'." + (interactive + (list (progn + ;; Make sure we're using the most recent download of the + ;; archive. Maybe we should be updating the archive first? + (package-read-archive-contents) + (intern (completing-read "Install package: " + (mapcar (lambda (elt) + (cons (symbol-name (car elt)) + nil)) + package-archive-contents) + nil t))))) + (let ((pkg-desc (assq name package-archive-contents))) + (unless pkg-desc + (error "Package '%s' not available for installation" + (symbol-name name))) + (let ((transaction + (package-compute-transaction (list name) + (package-desc-reqs (cdr pkg-desc))))) + (package-download-transaction transaction))) + ;; Try to activate it. + (package-initialize)) + +(defun package-strip-rcs-id (v-str) + "Strip RCS version ID from the version string. +If the result looks like a dotted numeric version, return it. +Otherwise return nil." + (if v-str + (if (string-match "^[ \t]*[$]Revision:[ \t]\([0-9.]+\)[ \t]*[$]$" v-str) + (match-string 1 v-str) + (if (string-match "^[0-9.]*$" v-str) + v-str)))) + +(defun package-buffer-info () + "Return a vector of information about the package in the current buffer. +The vector looks like [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] +FILENAME is the file name, a string. It does not have the \".el\" extension. +REQUIRES is a requires list, or nil. +DESCRIPTION is the package description (a string). +VERSION is the version, a string. +COMMENTARY is the commentary section, a string, or nil if none. +Throws an exception if the buffer does not contain a conforming package. +If there is a package, narrows the buffer to the file's boundaries. +May narrow buffer or move point even on failure." + (goto-char (point-min)) + (if (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t) + (let ((file-name (match-string 1)) + (desc (match-string 2)) + (start (progn (beginning-of-line) (point)))) + (if (search-forward (concat ";;; " file-name ".el ends here")) + (progn + ;; Try to include a trailing newline. + (forward-line) + (narrow-to-region start (point)) + (require 'lisp-mnt) + ;; Use some headers we've invented to drive the process. + (let* ((requires-str (lm-header "package-requires")) + (requires (if requires-str + (package-read-from-string requires-str))) + ;; Prefer Package-Version, because if it is + ;; defined the package author probably wants us + ;; to use it. Otherwise try Version. + (pkg-version + (or (package-strip-rcs-id (lm-header "package-version")) + (package-strip-rcs-id (lm-header "version")))) + (commentary (lm-commentary))) + (unless pkg-version + (error + "Package does not define a usable \"Version\" or \"Package-Version\" header")) + ;; Turn string version numbers into list form. + (setq requires + (mapcar + (lambda (elt) + (list (car elt) + (package-version-split (car (cdr elt))))) + requires)) + (set-text-properties 0 (length file-name) nil file-name) + (set-text-properties 0 (length pkg-version) nil pkg-version) + (set-text-properties 0 (length desc) nil desc) + (vector file-name requires desc pkg-version commentary))) + (error "Package missing a terminating comment"))) + (error "No starting comment for package"))) + +(defun package-tar-file-info (file) + "Find package information for a tar file. +FILE is the name of the tar file to examine. +The return result is a vector like `package-buffer-info'." + (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) + (error "`%s' doesn't have a package-ish name" file)) + (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file))) + (pkg-version (match-string-no-properties 2 file)) + ;; Extract the package descriptor. + (pkg-def-contents (shell-command-to-string + ;; Requires GNU tar. + (concat "tar -xOf " file " " + pkg-name "-" pkg-version "/" + pkg-name "-pkg.el"))) + (pkg-def-parsed (package-read-from-string pkg-def-contents))) + (unless (eq (car pkg-def-parsed) 'define-package) + (error "%s-pkg.el doesn't contain `define-package' sexp" pkg-name)) + (let ((name-str (nth 1 pkg-def-parsed)) + (version-string (nth 2 pkg-def-parsed)) + (docstring (nth 3 pkg-def-parsed)) + (requires (nth 4 pkg-def-parsed)) + + (readme (shell-command-to-string + ;; Requires GNU tar. + (concat "tar -xOf " file " " + pkg-name "-" pkg-version "/README")))) + (unless (equal pkg-version version-string) + (error "Inconsistent versions!")) + (unless (equal pkg-name name-str) + (error "Inconsistent names!")) + ;; Kind of a hack. + (if (string-match ": Not found in archive" readme) + (setq readme nil)) + ;; Turn string version numbers into list form. + (if (eq (car requires) 'quote) + (setq requires (car (cdr requires)))) + (setq requires + (mapcar + (lambda (elt) + (list (car elt) + (package-version-split (car (cdr elt))))) + requires)) + (vector pkg-name requires docstring version-string readme)))) + +(defun package-install-buffer-internal (pkg-info type) + (save-excursion + (save-restriction + (let* ((file-name (aref pkg-info 0)) + (requires (aref pkg-info 1)) + (desc (if (string= (aref pkg-info 2) "") + "No description available." + (aref pkg-info 2))) + (pkg-version (aref pkg-info 3))) + ;; Download and install the dependencies. + (let ((transaction (package-compute-transaction nil requires))) + (package-download-transaction transaction)) + ;; Install the package itself. + (cond + ((eq type 'single) + (package-unpack-single file-name pkg-version desc requires)) + ((eq type 'tar) + (package-unpack (intern file-name) pkg-version)) + (t + (error "Unknown type: %s" (symbol-name type)))) + ;; Try to activate it. + (package-initialize))))) + +;;;###autoload +(defun package-install-from-buffer () + "Install a package from the current buffer. +The package is assumed to be a single .el file which +follows the elisp comment guidelines; see +info node `(elisp)Library Headers'." + (interactive) + (package-install-buffer-internal (package-buffer-info) 'single)) + +;;;###autoload +(defun package-install-file (file) + "Install a package from a file. +The file can either be a tar file or an Emacs Lisp file." + (interactive "fPackage file name: ") + (with-temp-buffer + (insert-file-contents-literally file) + (cond + ((string-match "\\.el$" file) (package-install-from-buffer)) + ((string-match "\\.tar$" file) + (package-install-buffer-internal (package-tar-file-info file) 'tar)) + (t (error "Unrecognized extension `%s'" (file-name-extension file)))))) + +(defun package-delete (name version) + (require 'dired) ; for dired-delete-file + (dired-delete-file (expand-file-name (concat name "-" version) + package-user-dir) + ;; FIXME: query user? + 'always)) + +(defun package--download-one-archive (file) + "Download a single archive file and cache it locally." + (let ((buffer (url-retrieve-synchronously + (concat package-archive-base file)))) + (with-current-buffer buffer + (package-handle-response) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (setq buffer-file-name (concat (file-name-as-directory package-user-dir) + file)) + (let ((version-control 'never)) + (save-buffer)) + (kill-buffer buffer)))) + +(defun package-refresh-contents () + "Download the ELPA archive description if needed. +Invoking this will ensure that Emacs knows about the latest versions +of all packages. This will let Emacs make them available for +download." + (interactive) + (unless (file-exists-p package-user-dir) + (make-directory package-user-dir t)) + (package--download-one-archive "archive-contents") + (package--download-one-archive "builtin-packages") + (package-read-archive-contents)) + +;;;###autoload +(defun package-initialize () + "Load Emacs Lisp packages, and activate them. +The variable `package-load-list' controls which packages to load." + (interactive) + (setq package-obsolete-alist nil) + (package-load-all-descriptors) + (package-read-archive-contents) + ;; Try to activate all our packages. + (mapc (lambda (elt) + (package-activate (car elt) (package-desc-vers (cdr elt)))) + package-alist)) + + + +;;;; Package menu mode. + +(defvar package-menu-mode-map nil + "Local keymap for `package-menu-mode' buffers.") + +(unless package-menu-mode-map + (setq package-menu-mode-map (make-keymap)) + (suppress-keymap package-menu-mode-map) + (define-key package-menu-mode-map "q" 'quit-window) + (define-key package-menu-mode-map "n" 'next-line) + (define-key package-menu-mode-map "p" 'previous-line) + (define-key package-menu-mode-map "u" 'package-menu-mark-unmark) + (define-key package-menu-mode-map "\177" 'package-menu-backup-unmark) + (define-key package-menu-mode-map "d" 'package-menu-mark-delete) + (define-key package-menu-mode-map "i" 'package-menu-mark-install) + (define-key package-menu-mode-map "g" 'package-menu-revert) + (define-key package-menu-mode-map "r" 'package-menu-refresh) + (define-key package-menu-mode-map "~" + 'package-menu-mark-obsolete-for-deletion) + (define-key package-menu-mode-map "x" 'package-menu-execute) + (define-key package-menu-mode-map "h" 'package-menu-quick-help) + (define-key package-menu-mode-map "?" 'package-menu-view-commentary)) + +(defvar package-menu-sort-button-map + (let ((map (make-sparse-keymap))) + (define-key map [header-line mouse-1] 'package-menu-sort-by-column) + (define-key map [follow-link] 'mouse-face) + map) + "Local keymap for package menu sort buttons.") + +(put 'package-menu-mode 'mode-class 'special) + +(defun package-menu-mode () + "Major mode for browsing a list of packages. +Letters do not insert themselves; instead, they are commands. +\\ +\\{package-menu-mode-map}" + (kill-all-local-variables) + (use-local-map package-menu-mode-map) + (setq major-mode 'package-menu-mode) + (setq mode-name "Package Menu") + (setq truncate-lines t) + (setq buffer-read-only t) + ;; Support Emacs 21. + (if (fboundp 'run-mode-hooks) + (run-mode-hooks 'package-menu-mode-hook) + (run-hooks 'package-menu-mode-hook))) + +(defun package-menu-refresh () + "Download the ELPA archive. +This fetches the file describing the current contents of +the Emacs Lisp Package Archive, and then refreshes the +package menu. This lets you see what new packages are +available for download." + (interactive) + (package-refresh-contents) + (package-list-packages-internal)) + +(defun package-menu-revert () + "Update the list of packages." + (interactive) + (package-list-packages-internal)) + +(defun package-menu-mark-internal (what) + (unless (eobp) + (let ((buffer-read-only nil)) + (beginning-of-line) + (delete-char 1) + (insert what) + (forward-line)))) + +;; fixme numeric argument +(defun package-menu-mark-delete (num) + "Mark a package for deletion and move to the next line." + (interactive "p") + (package-menu-mark-internal "D")) + +(defun package-menu-mark-install (num) + "Mark a package for installation and move to the next line." + (interactive "p") + (package-menu-mark-internal "I")) + +(defun package-menu-mark-unmark (num) + "Clear any marks on a package and move to the next line." + (interactive "p") + (package-menu-mark-internal " ")) + +(defun package-menu-backup-unmark () + "Back up one line and clear any marks on that package." + (interactive) + (forward-line -1) + (package-menu-mark-internal " ") + (forward-line -1)) + +(defun package-menu-mark-obsolete-for-deletion () + "Mark all obsolete packages for deletion." + (interactive) + (save-excursion + (goto-char (point-min)) + (forward-line 2) + (while (not (eobp)) + (if (looking-at ".*\\s obsolete\\s ") + (package-menu-mark-internal "D") + (forward-line 1))))) + +(defun package-menu-quick-help () + "Show short key binding help for package-menu-mode." + (interactive) + (message "n-ext, i-nstall, d-elete, u-nmark, x-ecute, r-efresh, h-elp")) + +(defun package-menu-view-commentary () + "Display information about this package. +For single-file packages, shows the commentary section from the header. +For larger packages, shows the README file." + (interactive) + (let* (start-point ok + (pkg-name (package-menu-get-package)) + (buffer (url-retrieve-synchronously (concat package-archive-base + pkg-name + "-readme.txt")))) + (with-current-buffer buffer + ;; FIXME: it would be nice to work with any URL type. + (setq start-point url-http-end-of-headers) + (setq ok (eq (url-http-parse-response) 200))) + (let ((new-buffer (get-buffer-create "*Package Info*"))) + (with-current-buffer new-buffer + (let ((buffer-read-only nil)) + (erase-buffer) + (insert "Package information for " pkg-name "\n\n") + (if ok + (insert-buffer-substring buffer start-point) + (insert "This package does not have a README file or commentary comment.\n")) + (goto-char (point-min)) + (view-mode))) + (display-buffer new-buffer t)))) + +;; Return the name of the package on the current line. +(defun package-menu-get-package () + (save-excursion + (beginning-of-line) + (if (looking-at ". \\([^ \t]*\\)") + (match-string 1)))) + +;; Return the version of the package on the current line. +(defun package-menu-get-version () + (save-excursion + (beginning-of-line) + (if (looking-at ". [^ \t]*[ \t]*\\([0-9.]*\\)") + (match-string 1)))) + +(defun package-menu-get-status () + (save-excursion + (if (looking-at ". [^ \t]*[ \t]*[^ \t]*[ \t]*\\([^ \t]*\\)") + (match-string 1) + ""))) + +(defun package-menu-execute () + "Perform all the marked actions. +Packages marked for installation will be downloaded and +installed. Packages marked for deletion will be removed. +Note that after installing packages you will want to restart +Emacs." + (interactive) + (goto-char (point-min)) + (forward-line 2) + (while (not (eobp)) + (let ((cmd (char-after)) + (pkg-name (package-menu-get-package)) + (pkg-vers (package-menu-get-version)) + (pkg-status (package-menu-get-status))) + (cond + ((eq cmd ?D) + (when (and (string= pkg-status "installed") + (string= pkg-name "package")) + ;; FIXME: actually, we could be tricky and remove all info. + ;; But that is drastic and the user can do that instead. + (error "Can't delete most recent version of `package'")) + ;; Ask for confirmation here? Maybe if package status is ""? + ;; Or if any lisp from package is actually loaded? + (message "Deleting %s-%s..." pkg-name pkg-vers) + (package-delete pkg-name pkg-vers) + (message "Deleting %s-%s... done" pkg-name pkg-vers)) + ((eq cmd ?I) + (package-install (intern pkg-name))))) + (forward-line)) + (package-menu-revert)) + +(defun package-print-package (package version key desc) + (let ((face + (cond ((eq package 'emacs) 'font-lock-builtin-face) + ((string= key "available") 'default) + ((string= key "held") 'font-lock-constant-face) + ((string= key "disabled") 'font-lock-warning-face) + ((string= key "installed") 'font-lock-comment-face) + (t ; obsolete, but also the default. + 'font-lock-warning-face)))) + (insert (propertize " " 'font-lock-face face)) + (insert (propertize (symbol-name package) 'font-lock-face face)) + (indent-to 20 1) + (insert (propertize (package-version-join version) 'font-lock-face face)) + (indent-to 30 1) + (insert (propertize key 'font-lock-face face)) + ;; FIXME: this 'when' is bogus... + (when desc + (indent-to 41 1) + (insert (propertize desc 'font-lock-face face))) + (insert "\n"))) + +(defun package-list-maybe-add (package version status description result) + (unless (assoc (cons package version) result) + (setq result (cons (list (cons package version) status description) + result))) + result) + +;; This decides how we should sort; nil means by package name. +(defvar package-menu-sort-key nil) + +(defun package-list-packages-internal () + (package-initialize) ; FIXME: do this here? + (with-current-buffer (get-buffer-create "*Packages*") + (setq buffer-read-only nil) + (erase-buffer) + (let ((info-list) + name desc hold) + ;; List installed packages + (dolist (elt package-alist) + (setq name (car elt) + desc (cdr elt) + hold (assq name package-load-list)) + (setq info-list + (package-list-maybe-add name (package-desc-vers desc) + ;; FIXME: it turns out to be + ;; tricky to see if this package + ;; is presently activated. + (if (stringp (cadr hold)) + "held" + "installed") + (package-desc-doc desc) + info-list))) + ;; List available packages + (dolist (elt package-archive-contents) + (setq name (car elt) + desc (cdr elt) + hold (assq name package-load-list)) + (unless (and hold (stringp (cadr hold)) + (package-installed-p + name (package-version-split (cadr hold)))) + (setq info-list + (package-list-maybe-add name + (package-desc-vers desc) + (if (and hold (null (cadr hold))) + "disabled" + "available") + (package-desc-doc (cdr elt)) + info-list)))) + ;; List obsolete packages + (mapc (lambda (elt) + (mapc (lambda (inner-elt) + (setq info-list + (package-list-maybe-add (car elt) + (package-desc-vers + (cdr inner-elt)) + "obsolete" + (package-desc-doc + (cdr inner-elt)) + info-list))) + (cdr elt))) + package-obsolete-alist) + (let ((selector (cond + ((string= package-menu-sort-key "Version") + ;; FIXME this doesn't work. + #'(lambda (e) (cdr (car e)))) + ((string= package-menu-sort-key "Status") + #'(lambda (e) (car (cdr e)))) + ((string= package-menu-sort-key "Description") + #'(lambda (e) (car (cdr (cdr e))))) + (t ; "Package" is default. + #'(lambda (e) (symbol-name (car (car e)))))))) + (setq info-list + (sort info-list + (lambda (left right) + (let ((vleft (funcall selector left)) + (vright (funcall selector right))) + (string< vleft vright)))))) + (mapc (lambda (elt) + (package-print-package (car (car elt)) + (cdr (car elt)) + (car (cdr elt)) + (car (cdr (cdr elt))))) + info-list)) + (goto-char (point-min)) + (current-buffer))) + +(defun package-menu-sort-by-column (&optional e) + "Sort the package menu by the last column clicked on." + (interactive (list last-input-event)) + (if e (mouse-select-window e)) + (let* ((pos (event-start e)) + (obj (posn-object pos)) + (col (if obj + (get-text-property (cdr obj) 'column-name (car obj)) + (get-text-property (posn-point pos) 'column-name)))) + (setq package-menu-sort-key col)) + (package-list-packages-internal)) + +(defun package--list-packages () + "Display a list of packages. +Helper function that does all the work for the user-facing functions." + (with-current-buffer (package-list-packages-internal) + (package-menu-mode) + ;; Set up the header line. + (setq header-line-format + (mapconcat + (lambda (pair) + (let ((column (car pair)) + (name (cdr pair))) + (concat + ;; Insert a space that aligns the button properly. + (propertize " " 'display (list 'space :align-to column) + 'face 'fixed-pitch) + ;; Set up the column button. + (if (string= name "Version") + name + (propertize name + 'column-name name + 'help-echo "mouse-1: sort by column" + 'mouse-face 'highlight + 'keymap package-menu-sort-button-map))))) + ;; We take a trick from buff-menu and have a dummy leading + ;; space to align the header line with the beginning of the + ;; text. This doesn't really work properly on Emacs 21, + ;; but it is close enough. + '((0 . "") + (2 . "Package") + (20 . "Version") + (30 . "Status") + (41 . "Description")) + "")) + + ;; It's okay to use pop-to-buffer here. The package menu buffer + ;; has keybindings, and the user just typed 'M-x + ;; package-list-packages', suggesting that they might want to use + ;; them. + (pop-to-buffer (current-buffer)))) + +;;;###autoload +(defun package-list-packages () + "Display a list of packages. +Fetches the updated list of packages before displaying. +The list is displayed in a buffer named `*Packages*'." + (interactive) + (package-refresh-contents) + (package--list-packages)) + +(defun package-list-packages-no-fetch () + "Display a list of packages. +Does not fetch the updated list of packages before displaying. +The list is displayed in a buffer named `*Packages*'." + (interactive) + (package--list-packages)) + +;; Make it appear on the menu. +(define-key-after menu-bar-options-menu [package] + '(menu-item "Manage Packages" package-list-packages + :help "Install or uninstall additional Emacs packages")) + +(provide 'package) + +;;; package.el ends here diff --git a/lisp/startup.el b/lisp/startup.el index 87f1a00bd54..71857076d4f 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1166,6 +1166,9 @@ the `--debug-init' option to view a complete error backtrace." (eq face-ignored-fonts old-face-ignored-fonts)) (clear-face-cache))) + ;; Load ELPA packages. + (and user-init-file package-enable-at-startup (package-initialize)) + (setq after-init-time (current-time)) (run-hooks 'after-init-hook) From 69582fcd16d902bddecf0bda2a781e1a23404d46 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 17 Jun 2010 12:45:25 +0200 Subject: [PATCH 31/36] menu-bar.el (menu-bar-options-menu): Fix typo in menu entry. --- lisp/ChangeLog | 4 ++++ lisp/menu-bar.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eb6c15841f7..9308fbcc773 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-17 Juanma Barranquero + + * menu-bar.el (menu-bar-options-menu): Fix typo in menu entry. + 2010-06-17 Chong Yidong * emacs-lisp/package.el (package-archive-base): Point to diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d831744f311..2d5b6d51aa6 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1055,7 +1055,7 @@ mail status in mode line")) (define-key menu-bar-options-menu [cua-emulation-mode] (menu-bar-make-mm-toggle cua-mode "Shift movement mark region (CUA)" - "Use shifted movement keys to set and extend the region." + "Use shifted movement keys to set and extend the region" (:visible (and (boundp 'cua-enable-cua-keys) (not cua-enable-cua-keys))))) From 54ea2a0d41668006195fb9a0891ec9d5421b2e37 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 17 Jun 2010 13:02:42 +0200 Subject: [PATCH 32/36] emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/package.el | 36 +++++++++++++++++------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9308fbcc773..374ee905f12 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-06-17 Juanma Barranquero + * emacs-lisp/package.el (package-menu-mode-map): + Move initialization into declaration. + * menu-bar.el (menu-bar-options-menu): Fix typo in menu entry. 2010-06-17 Chong Yidong diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8632fcd5647..8a9bcbe8f0b 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1040,27 +1040,25 @@ The variable `package-load-list' controls which packages to load." ;;;; Package menu mode. -(defvar package-menu-mode-map nil +(defvar package-menu-mode-map + (let ((map (make-keymap))) + (suppress-keymap map) + (define-key map "q" 'quit-window) + (define-key map "n" 'next-line) + (define-key map "p" 'previous-line) + (define-key map "u" 'package-menu-mark-unmark) + (define-key map "\177" 'package-menu-backup-unmark) + (define-key map "d" 'package-menu-mark-delete) + (define-key map "i" 'package-menu-mark-install) + (define-key map "g" 'package-menu-revert) + (define-key map "r" 'package-menu-refresh) + (define-key map "~" 'package-menu-mark-obsolete-for-deletion) + (define-key map "x" 'package-menu-execute) + (define-key map "h" 'package-menu-quick-help) + (define-key map "?" 'package-menu-view-commentary) + map) "Local keymap for `package-menu-mode' buffers.") -(unless package-menu-mode-map - (setq package-menu-mode-map (make-keymap)) - (suppress-keymap package-menu-mode-map) - (define-key package-menu-mode-map "q" 'quit-window) - (define-key package-menu-mode-map "n" 'next-line) - (define-key package-menu-mode-map "p" 'previous-line) - (define-key package-menu-mode-map "u" 'package-menu-mark-unmark) - (define-key package-menu-mode-map "\177" 'package-menu-backup-unmark) - (define-key package-menu-mode-map "d" 'package-menu-mark-delete) - (define-key package-menu-mode-map "i" 'package-menu-mark-install) - (define-key package-menu-mode-map "g" 'package-menu-revert) - (define-key package-menu-mode-map "r" 'package-menu-refresh) - (define-key package-menu-mode-map "~" - 'package-menu-mark-obsolete-for-deletion) - (define-key package-menu-mode-map "x" 'package-menu-execute) - (define-key package-menu-mode-map "h" 'package-menu-quick-help) - (define-key package-menu-mode-map "?" 'package-menu-view-commentary)) - (defvar package-menu-sort-button-map (let ((map (make-sparse-keymap))) (define-key map [header-line mouse-1] 'package-menu-sort-by-column) From 26508c03ce7b09ee8a164a450e23811ada41edad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Thu, 17 Jun 2010 16:44:34 +0200 Subject: [PATCH 33/36] ispell.el (ispell-aspell-find-dictionary): Fix regexp for full xx_YY search. This is needed for languages like Portuguese where there are aspell dicts for pt_BR and pt_PT, not for plain pt. If we strip country part `ispell-aspell-find-dictionary' does not find dicts for portuguese. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/ispell.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 374ee905f12..0779035b47e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-17 Agustín Martín + + * ispell.el (ispell-aspell-find-dictionary): Fix regexp for + languages like Portuguese with pt_{BR,PT} and no plain pt. + 2010-06-17 Juanma Barranquero * emacs-lisp/package.el (package-menu-mode-map): diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 1a657b0fdf9..4d0cc842351 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -982,8 +982,8 @@ Assumes that value contains no whitespace." ;; This returns nil if the data file does not exist. ;; Can someone please explain the return value format when the ;; file does exist -- rms? - (let* ((lang ;; Strip out region, variant, etc. - (and (string-match "^[[:alpha:]]+" dict-name) + (let* ((lang ;; Strip out variant, etc. + (and (string-match "^[[:alpha:]_]+" dict-name) (match-string 0 dict-name))) (data-file (concat (or ispell-aspell-data-dir From 64eba874f5977eb99d9f1bdaa26010cc5fd9e689 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 17 Jun 2010 09:41:13 -0700 Subject: [PATCH 34/36] * lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/package.el | 48 +++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0779035b47e..054f97b1255 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-06-17 Dan Nicolaescu + + * emacs-lisp/package.el (package-menu-mode-map): Add a menu. + 2010-06-17 Agustín Martín * ispell.el (ispell-aspell-find-dictionary): Fix regexp for diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8a9bcbe8f0b..54a2ba610ca 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1041,7 +1041,8 @@ The variable `package-load-list' controls which packages to load." ;;;; Package menu mode. (defvar package-menu-mode-map - (let ((map (make-keymap))) + (let ((map (make-keymap)) + (menu-map (make-sparse-keymap "Package"))) (suppress-keymap map) (define-key map "q" 'quit-window) (define-key map "n" 'next-line) @@ -1056,6 +1057,51 @@ The variable `package-load-list' controls which packages to load." (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) (define-key map "?" 'package-menu-view-commentary) + (define-key map [menu-bar package-menu] (cons "Package" menu-map)) + (define-key menu-map [mq] + '(menu-item "Quit" quit-window + :help "Quit package selection")) + (define-key menu-map [s1] '("--")) + (define-key menu-map [mn] + '(menu-item "Next" next-line + :help "Next Line")) + (define-key menu-map [mp] + '(menu-item "Previous" previous-line + :help "Previous Line")) + (define-key menu-map [s2] '("--")) + (define-key menu-map [mu] + '(menu-item "Unmark" package-menu-mark-unmark + :help "Clear any marks on a package and move to the next line")) + (define-key menu-map [munm] + '(menu-item "Unmark backwards" package-menu-backup-unmark + :help "Back up one line and clear any marks on that package")) + (define-key menu-map [md] + '(menu-item "Mark for deletion" package-menu-mark-delete + :help "Mark a package for deletion and move to the next line")) + (define-key menu-map [mi] + '(menu-item "Mark for install" package-menu-mark-install + :help "Mark a package for installation and move to the next line")) + (define-key menu-map [s3] '("--")) + (define-key menu-map [mg] + '(menu-item "Update package list" package-menu-revert + :help "Update the list of packages")) + (define-key menu-map [mr] + '(menu-item "Refresh package list" package-menu-refresh + :help "Download the ELPA archive")) + (define-key menu-map [s4] '("--")) + (define-key menu-map [mt] + '(menu-item "Mark obsolete packages" package-menu-mark-obsolete-for-deletion + :help "Mark all obsolete packages for deletion")) + (define-key menu-map [mx] + '(menu-item "Execute actions" package-menu-execute + :help "Perform all the marked actions")) + (define-key menu-map [s5] '("--")) + (define-key menu-map [mh] + '(menu-item "Help" package-menu-quick-help + :help "Show short key binding help for package-menu-mode")) + (define-key menu-map [mc] + '(menu-item "View Commentary" package-menu-view-commentary + :help "Display information about this package")) map) "Local keymap for `package-menu-mode' buffers.") From dbd6da78650014d997dceeecaa4392fc79f6ca8b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 17 Jun 2010 23:56:17 +0300 Subject: [PATCH 35/36] Fix revert-buffer functionality of Help mode and Info. * lisp/help-mode.el (help-mode): Set buffer-local variable revert-buffer-function to help-mode-revert-buffer. (help-mode-revert-buffer): New function. * lisp/info.el (Info-revert-find-node): Check for major-mode Info-mode before popping to "*info*" (like in other Info functions). Keep buffer-name in old-buffer-name. Keep Info-history-forward in old-history-forward. Pop to old-buffer-name or "*info*" to recreate the killed buffer. Set Info-history-forward from old-history-forward. (Info-breadcrumbs-depth): Add :group and :version. --- lisp/ChangeLog | 14 ++++++++++++++ lisp/help-mode.el | 14 ++++++++++++++ lisp/info.el | 11 +++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 054f97b1255..fffbc555e97 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2010-06-17 Juri Linkov + + * help-mode.el (help-mode): Set buffer-local variable + revert-buffer-function to help-mode-revert-buffer. + (help-mode-revert-buffer): New function. + + * info.el (Info-revert-find-node): Check for major-mode Info-mode + before popping to "*info*" (like in other Info functions). + Keep buffer-name in old-buffer-name. Keep Info-history-forward in + old-history-forward. Pop to old-buffer-name or "*info*" to + recreate the killed buffer. Set Info-history-forward from + old-history-forward. + (Info-breadcrumbs-depth): Add :group and :version. + 2010-06-17 Dan Nicolaescu * emacs-lisp/package.el (package-menu-mode-map): Add a menu. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index f115e425325..c478bf6d16c 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -272,6 +272,9 @@ Commands: (with-current-buffer buffer (bury-buffer)))) + (set (make-local-variable 'revert-buffer-function) + 'help-mode-revert-buffer) + (run-mode-hooks 'help-mode-hook)) ;;;###autoload @@ -783,6 +786,17 @@ Show all docs for that symbol as either a variable, function or face." (fboundp sym) (facep sym)) (help-do-xref pos #'help-xref-interned (list sym))))) +(defun help-mode-revert-buffer (ignore-auto noconfirm) + (when (or noconfirm (yes-or-no-p "Revert help buffer? ")) + (let ((pos (point)) + (item help-xref-stack-item) + ;; Pretend there is no current item to add to the history. + (help-xref-stack-item nil) + ;; Use the current buffer. + (help-xref-following t)) + (apply (car item) (cdr item)) + (goto-char pos)))) + (defun help-insert-string (string) "Insert STRING to the help buffer and install xref info for it. This function can be used to restore the old contents of the help buffer diff --git a/lisp/info.el b/lisp/info.el index e76a8da146e..9a30f63fff0 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -238,7 +238,9 @@ This only has an effect if `Info-hide-note-references' is non-nil." (defcustom Info-breadcrumbs-depth 4 "Depth of breadcrumbs to display. 0 means do not display breadcrumbs." - :type 'integer) + :version "23.1" + :type 'integer + :group 'info) (defcustom Info-search-whitespace-regexp "\\s-+" "If non-nil, regular expression to match a sequence of whitespace chars. @@ -800,17 +802,22 @@ otherwise, that defaults to `Top'." "Go to an Info node FILENAME and NODENAME, re-reading disk contents. When *info* is already displaying FILENAME and NODENAME, the window position is preserved, if possible." - (pop-to-buffer "*info*") + (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) (let ((old-filename Info-current-file) (old-nodename Info-current-node) + (old-buffer-name (buffer-name)) (pcolumn (current-column)) (pline (count-lines (point-min) (line-beginning-position))) (wline (count-lines (point-min) (window-start))) + (old-history-forward Info-history-forward) (old-history Info-history) (new-history (and Info-current-file (list Info-current-file Info-current-node (point))))) (kill-buffer (current-buffer)) + (pop-to-buffer (or old-buffer-name "*info*")) + (Info-mode) (Info-find-node filename nodename) + (setq Info-history-forward old-history-forward) (setq Info-history old-history) (if (and (equal old-filename Info-current-file) (equal old-nodename Info-current-node)) From b1a03ef6bfba4296dddc3df1e8f9d54aba3e45e3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 18 Jun 2010 10:05:43 -0400 Subject: [PATCH 36/36] * lisp/emacs-lisp/edebug.el (edebug-read-list): Phase out old-style backquotes. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/edebug.el | 34 ++++++++-------------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fffbc555e97..730cf65c8d5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-18 Stefan Monnier + + * emacs-lisp/edebug.el (edebug-read-list): + Phase out old-style backquotes. + 2010-06-17 Juri Linkov * help-mode.el (help-mode): Set buffer-local variable diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 8bf20b0ccef..43fb5762647 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -885,17 +885,12 @@ already is one.)" (edebug-storing-offsets (1- (point)) 'quote) (edebug-read-storing-offsets stream))) -(defvar edebug-read-backquote-level 0 - "If non-zero, we're in a new-style backquote. -It should never be negative. This controls how we read comma constructs.") - (defun edebug-read-backquote (stream) ;; Turn `thing into (\` thing) (forward-char 1) (list (edebug-storing-offsets (1- (point)) '\`) - (let ((edebug-read-backquote-level (1+ edebug-read-backquote-level))) - (edebug-read-storing-offsets stream)))) + (edebug-read-storing-offsets stream))) (defun edebug-read-comma (stream) ;; Turn ,thing into (\, thing). Handle ,@ and ,. also. @@ -910,12 +905,9 @@ It should never be negative. This controls how we read comma constructs.") (forward-char 1))) ;; Generate the same structure of offsets we would have ;; if the resulting list appeared verbatim in the input text. - (if (zerop edebug-read-backquote-level) - (edebug-storing-offsets opoint symbol) - (list - (edebug-storing-offsets opoint symbol) - (let ((edebug-read-backquote-level (1- edebug-read-backquote-level))) - (edebug-read-storing-offsets stream))))))) + (list + (edebug-storing-offsets opoint symbol) + (edebug-read-storing-offsets stream))))) (defun edebug-read-function (stream) ;; Turn #'thing into (function thing) @@ -937,17 +929,7 @@ It should never be negative. This controls how we read comma constructs.") (prog1 (let ((elements)) (while (not (memq (edebug-next-token-class) '(rparen dot))) - (if (and (eq (edebug-next-token-class) 'backquote) - (null elements) - (zerop edebug-read-backquote-level)) - (progn - ;; Old style backquote. - (forward-char 1) ; Skip backquote. - ;; Call edebug-storing-offsets here so that we - ;; produce the same offsets we would have had - ;; if the backquote were an ordinary symbol. - (push (edebug-storing-offsets (1- (point)) '\`) elements)) - (push (edebug-read-storing-offsets stream) elements))) + (push (edebug-read-storing-offsets stream) elements)) (setq elements (nreverse elements)) (if (eq 'dot (edebug-next-token-class)) (let (dotted-form) @@ -4455,7 +4437,7 @@ With prefix argument, make it a temporary breakpoint." (add-hook 'cl-load-hook (function (lambda () (require 'cl-specs))))) -;;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu +;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu (if (featurep 'cl-read) (add-hook 'edebug-setup-hook (function (lambda () (require 'edebug-cl-read)))) @@ -4466,8 +4448,8 @@ With prefix argument, make it a temporary breakpoint." ;;; Finalize Loading -;;; Finally, hook edebug into the rest of Emacs. -;;; There are probably some other things that could go here. +;; Finally, hook edebug into the rest of Emacs. +;; There are probably some other things that could go here. ;; Install edebug read and eval functions. (edebug-install-read-eval-functions)